History

switch usec timestamps to uint64_t

Stephen Birarda committed 13 years ago

Commit ca8f2591 parent 9ba3bfc20 files · +58 −57Browse files

Showing the changes to interface/src/VoxelSystem.cpp (1 of 20 files). Show all

Unified · Split

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