Merge branch 'master' of https://github.com/worklist/hifi into recursive_voxel_delete

This commit is contained in:
ZappoMan 2013-06-07 09:24:33 -07:00
commit 20312e9f99
5 changed files with 61 additions and 2 deletions

View file

@ -1475,6 +1475,8 @@ void Application::initMenu() {
"Render Mode", this, SLOT(cycleFrustumRenderMode()), Qt::SHIFT | Qt::Key_R);
updateFrustumRenderModeAction();
debugMenu->addAction("Run Timing Tests", this, SLOT(runTests()));
debugMenu->addAction("Show Render Pipeline Warnings", this, SLOT(setRenderWarnings(bool)))->setCheckable(true);
debugMenu->addAction("Kill Local Voxels", this, SLOT(doKillLocalVoxels()));
debugMenu->addAction("Randomize Voxel TRUE Colors", this, SLOT(doRandomizeVoxelColors()), Qt::CTRL | Qt::Key_R);
@ -1521,6 +1523,10 @@ void Application::updateFrustumRenderModeAction() {
}
}
void Application::runTests() {
runTimingTests();
}
void Application::initDisplay() {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

View file

@ -123,6 +123,7 @@ private slots:
void cutVoxels();
void copyVoxels();
void pasteVoxels();
void runTests();
private:
static bool sendVoxelsOperation(VoxelNode* node, void* extraData);

View file

@ -317,9 +317,9 @@ glm::quat Avatar::getWorldAlignedOrientation () const {
void Avatar::updateFromMouse(int mouseX, int mouseY, int screenWidth, int screenHeight) {
// Update head yaw and pitch based on mouse input
const float MOUSE_MOVE_RADIUS = 0.15f;
const float MOUSE_MOVE_RADIUS = 0.3f;
const float MOUSE_ROTATE_SPEED = 4.0f;
const float MOUSE_PITCH_SPEED = 1.5f;
const float MOUSE_PITCH_SPEED = 2.0f;
const int TITLE_BAR_HEIGHT = 46;
float mouseLocationX = (float)mouseX / (float)screenWidth - 0.5f;
float mouseLocationY = (float)mouseY / (float)screenHeight - 0.5f;

View file

@ -9,6 +9,8 @@
#include "InterfaceConfig.h"
#include <iostream>
#include <cstring>
#include <time.h>
#include <math.h>
#include <glm/glm.hpp>
#include <glm/gtc/noise.hpp>
@ -21,6 +23,7 @@
#include "world.h"
#include "Util.h"
#include "VoxelConstants.h"
using namespace std;
@ -448,6 +451,53 @@ bool closeEnoughForGovernmentWork(float a, float b) {
return (distance < 0.00001f);
}
// Do some basic timing tests and report the results
void runTimingTests() {
// How long does it take to make a call to get the time?
const int numTests = 1000000;
int iResults[numTests];
float fTest = 1.0;
float fResults[numTests];
timeval startTime, endTime;
float elapsedMsecs;
gettimeofday(&startTime, NULL);
for (int i = 1; i < numTests; i++) {
gettimeofday(&endTime, NULL);
}
elapsedMsecs = diffclock(&startTime, &endTime);
printLog("gettimeofday() usecs: %f\n", 1000.0f * elapsedMsecs / (float) numTests);
// Random number generation
gettimeofday(&startTime, NULL);
for (int i = 1; i < numTests; i++) {
iResults[i] = rand();
}
gettimeofday(&endTime, NULL);
elapsedMsecs = diffclock(&startTime, &endTime);
printLog("rand() stored in array usecs: %f\n", 1000.0f * elapsedMsecs / (float) numTests);
// Random number generation using randFloat()
gettimeofday(&startTime, NULL);
for (int i = 1; i < numTests; i++) {
fResults[i] = randFloat();
}
gettimeofday(&endTime, NULL);
elapsedMsecs = diffclock(&startTime, &endTime);
printLog("randFloat() stored in array usecs: %f\n", 1000.0f * elapsedMsecs / (float) numTests);
// PowF function
fTest = 1145323.2342f;
gettimeofday(&startTime, NULL);
for (int i = 1; i < numTests; i++) {
fTest = powf(fTest, 0.5f);
}
gettimeofday(&endTime, NULL);
elapsedMsecs = diffclock(&startTime, &endTime);
printLog("powf(f, 0.5) usecs: %f\n", 1000.0f * elapsedMsecs / (float) numTests);
}

View file

@ -64,4 +64,6 @@ void renderOrientationDirections( glm::vec3 position, const glm::quat& orientati
void renderSphereOutline(glm::vec3 position, float radius, int numSides, glm::vec3 cameraPosition);
void renderCircle(glm::vec3 position, float radius, glm::vec3 surfaceNormal, int numSides );
void runTimingTests();
#endif