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