Showing the changes to interface/src/VoxelSystem.cpp (1 of 22 files). Show all
Unified · Split
| @@ -166,15 +166,15 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 165 unmodified lines | |||
| 166 | 166 | ||
| 167 | void VoxelSystem::setupNewVoxelsForDrawing() { | 167 | void VoxelSystem::setupNewVoxelsForDrawing() { |
| 168 | PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated | 168 | PerformanceWarning warn(_renderWarningsOn, "setupNewVoxelsForDrawing()"); // would like to include _voxelsInArrays, _voxelsUpdated |
| 169 | double start = usecTimestampNow(); | 169 | long long start = usecTimestampNow(); |
| 170 | double sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000.0; | 170 | long long sinceLastTime = (start - _setupNewVoxelsForDrawingLastFinished) / 1000; |
| 171 | 171 | ||
| 172 | bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging | 172 | bool iAmDebugging = false; // if you're debugging set this to true, so you won't get skipped for slow debugging |
| 173 | if (!iAmDebugging && sinceLastTime <= std::max(_setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) { | 173 | if (!iAmDebugging && sinceLastTime <= std::max(_setupNewVoxelsForDrawingLastElapsed, SIXTY_FPS_IN_MILLISECONDS)) { |
| 174 | return; // bail early, it hasn't been long enough since the last time we ran | 174 | return; // bail early, it hasn't been long enough since the last time we ran |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | double sinceLastViewCulling = (start - _lastViewCulling) / 1000.0; | 177 | long long sinceLastViewCulling = (start - _lastViewCulling) / 1000; |
| 178 | // If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view | 178 | // If the view frustum is no longer changing, but has changed, since last time, then remove nodes that are out of view |
| 179 | if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) | 179 | if ((sinceLastViewCulling >= std::max(_lastViewCullingElapsed, VIEW_CULLING_RATE_IN_MILLISECONDS)) |
| 180 | && !isViewChanging() && hasViewChanged()) { | 180 | && !isViewChanging() && hasViewChanged()) { |
| @@ -190,8 +190,8 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 9 unmodified lines | |||
| 190 | // VBO reubuilding. Possibly we should do this only if our actual VBO usage crosses some lower boundary. | 190 | // VBO reubuilding. Possibly we should do this only if our actual VBO usage crosses some lower boundary. |
| 191 | cleanupRemovedVoxels(); | 191 | cleanupRemovedVoxels(); |
| 192 | 192 | ||
| 193 | double endViewCulling = usecTimestampNow(); | 193 | long long endViewCulling = usecTimestampNow(); |
| 194 | _lastViewCullingElapsed = (endViewCulling - start) / 1000.0; | 194 | _lastViewCullingElapsed = (endViewCulling - start) / 1000; |
| 195 | } | 195 | } |
| 196 | 196 | ||
| 197 | bool didWriteFullVBO = _writeRenderFullVBO; | 197 | bool didWriteFullVBO = _writeRenderFullVBO; |
| @@ -227,8 +227,8 @@ void VoxelSystem::setupNewVoxelsForDrawing() { · 29 unmodified lines | |||
| 227 | 227 | ||
| 228 | pthread_mutex_unlock(&_bufferWriteLock); | 228 | pthread_mutex_unlock(&_bufferWriteLock); |
| 229 | 229 | ||
| 230 | double end = usecTimestampNow(); | 230 | long long end = usecTimestampNow(); |
| 231 | double elapsedmsec = (end - start) / 1000.0; | 231 | long long elapsedmsec = (end - start) / 1000; |
| 232 | _setupNewVoxelsForDrawingLastFinished = end; | 232 | _setupNewVoxelsForDrawingLastFinished = end; |
| 233 | _setupNewVoxelsForDrawingLastElapsed = elapsedmsec; | 233 | _setupNewVoxelsForDrawingLastElapsed = elapsedmsec; |
| 234 | } | 234 | } |