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 | 215 | int thisFrame = 0; |
| 216 | 216 | |
| 217 | 217 | NodeList* nodeList = NodeList::getInstance(); |
| 218 | + | |
| 219 | + qint64 lastUpdate = usecTimestampNow(); | |
| 218 | 220 | |
| 219 | 221 | while (!_isFinished) { |
| 220 | 222 | int usecToSleep = usecTimestamp(&startTime) + (thisFrame++ * VISUAL_DATA_CALLBACK_USECS) - usecTimestampNow(); |
| @@ -259,7 +261,10 @@ void ScriptEngine::run() { · 38 unmodified lines | ||
| 259 | 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 | 269 | if (_engine.hasUncaughtException()) { |
| 265 | 270 | int line = _engine.uncaughtExceptionLineNumber(); |