Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 39 files). Show all
Unified · Split
| @@ -215,6 +215,8 @@ void ScriptEngine::run() { · 214 unmodified lines | |||
| 215 | int thisFrame = 0; | 215 | int thisFrame = 0; |
| 216 | 216 | ||
| 217 | NodeList* nodeList = NodeList::getInstance(); | 217 | NodeList* nodeList = NodeList::getInstance(); |
| 218 | |||
| 219 | qint64 lastUpdate = usecTimestampNow(); | ||
| 218 | 220 | ||
| 219 | while (!_isFinished) { | 221 | while (!_isFinished) { |
| 220 | int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * VISUAL_DATA_CALLBACK_USECS) - usecTimestampNow(); | 222 | int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * VISUAL_DATA_CALLBACK_USECS) - usecTimestampNow(); |
| @@ -259,7 +261,10 @@ void ScriptEngine::run() { · 38 unmodified lines | |||
| 259 | nodeList->broadcastToNodes(avatarPacket, NodeSet() << NodeType::AvatarMixer); | 261 | nodeList->broadcastToNodes(avatarPacket, NodeSet() << NodeType::AvatarMixer); |
| 260 | } | 262 | } |
| 261 | 263 | ||
| 262 | emit willSendVisualDataCallback(); | 264 | qint64 now = usecTimestampNow(); |
| 265 | float deltaTime = (float)(now - lastUpdate)/(float)USECS_PER_SECOND; | ||
| 266 | emit update(deltaTime); | ||
| 267 | lastUpdate = now; | ||
| 263 | 268 | ||
| 264 | if (_engine.hasUncaughtException()) { | 269 | if (_engine.hasUncaughtException()) { |
| 265 | int line = _engine.uncaughtExceptionLineNumber(); | 270 | int line = _engine.uncaughtExceptionLineNumber(); |