diff --git a/interface/src/VoxelSystem.cpp b/interface/src/VoxelSystem.cpp index dbaf0760df..4dad137385 100644 --- a/interface/src/VoxelSystem.cpp +++ b/interface/src/VoxelSystem.cpp @@ -170,16 +170,16 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { void VoxelSystem::setupNewVoxelsForDrawing() { PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated uint64_t start = usecTimestampNow(); - int sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; + uint64_t sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging - if (!iAmDebugging && sinceLastTime <= std::max(_setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) { + if (!iAmDebugging && sinceLastTime <= std::max((float) _setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) { return; // bail early, it hasn't been long enough since the last time we ran } int sinceLastViewCulling = (start - _lastViewCulling) / 1000; // If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view - if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) + if ((sinceLastViewCulling >= std::max((float) _lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) && !isViewChanging() && hasViewChanged()) { _lastViewCulling = start; diff --git a/interface/src/VoxelSystem.h b/interface/src/VoxelSystem.h index 470ec79aa2..411ae2f81f 100644 --- a/interface/src/VoxelSystem.h +++ b/interface/src/VoxelSystem.h @@ -160,10 +160,10 @@ private: bool _writeRenderFullVBO; bool _readRenderFullVBO; - double _setupNewVoxelsForDrawingLastElapsed; - double _setupNewVoxelsForDrawingLastFinished; - double _lastViewCulling; - double _lastViewCullingElapsed; + int _setupNewVoxelsForDrawingLastElapsed; + uint64_t _setupNewVoxelsForDrawingLastFinished; + uint64_t _lastViewCulling; + int _lastViewCullingElapsed; GLuint _vboVerticesID; GLuint _vboNormalsID; diff --git a/libraries/voxels/src/VoxelConstants.h b/libraries/voxels/src/VoxelConstants.h index d0ae6f538a..30a0427292 100644 --- a/libraries/voxels/src/VoxelConstants.h +++ b/libraries/voxels/src/VoxelConstants.h @@ -34,7 +34,7 @@ const int COLOR_VALUES_PER_VOXEL = NUMBER_OF_COLORS * VERTICES_PER_VOXEL; typedef unsigned long int glBufferIndex; const glBufferIndex GLBUFFER_INDEX_UNKNOWN = ULONG_MAX; -const double SIXTY_FPS_IN_MILLISECONDS = 1000.0/60; -const double VIEW_CULLING_RATE_IN_MILLISECONDS = 1000.0; // once a second is fine +const float SIXTY_FPS_IN_MILLISECONDS = 1000.0f / 60.0f; +const float VIEW_CULLING_RATE_IN_MILLISECONDS = 1000.0f; // once a second is fine #endif