mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-18 08:20:11 +02:00
Simple frequencey decoupling. Still same thread.
This commit is contained in:
parent
5d65937120
commit
9ed418f7b6
2 changed files with 20 additions and 6 deletions
|
@ -2289,6 +2289,7 @@ QVector<EntityItemID> Application::pasteEntities(float x, float y, float z) {
|
|||
void Application::initDisplay() {
|
||||
}
|
||||
|
||||
static QTimer* avatarTimer = NULL;
|
||||
void Application::init() {
|
||||
// Make sure Login state is up to date
|
||||
DependencyManager::get<DialogsManager>()->toggleLoginDialog();
|
||||
|
@ -2351,6 +2352,11 @@ void Application::init() {
|
|||
// Make sure any new sounds are loaded as soon as know about them.
|
||||
connect(tree, &EntityTree::newCollisionSoundURL, DependencyManager::get<SoundCache>().data(), &SoundCache::getSound);
|
||||
connect(_myAvatar, &MyAvatar::newCollisionSoundURL, DependencyManager::get<SoundCache>().data(), &SoundCache::getSound);
|
||||
|
||||
const qint64 AVATAR_UPDATE_INTERVAL_MSECS = 1000 / 55;
|
||||
avatarTimer = new QTimer(this);
|
||||
connect(avatarTimer, &QTimer::timeout, this, &Application::avatarUpdate);
|
||||
avatarTimer->start(AVATAR_UPDATE_INTERVAL_MSECS);
|
||||
}
|
||||
|
||||
void Application::closeMirrorView() {
|
||||
|
@ -2415,6 +2421,16 @@ void Application::updateMouseRay() {
|
|||
}
|
||||
}
|
||||
|
||||
void Application::avatarUpdate() {
|
||||
PerformanceTimer perfTimer("myAvatar");
|
||||
qint64 now = usecTimestampNow();
|
||||
float deltaTime = (now - _lastAvatarUpdate) / (1000.0f * 1000.0f);
|
||||
_lastAvatarUpdate = now;
|
||||
updateMyAvatarLookAtPosition();
|
||||
// Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
||||
DependencyManager::get<AvatarManager>()->updateMyAvatar(deltaTime);
|
||||
}
|
||||
|
||||
// Called during Application::update immediately before AvatarManager::updateMyAvatar, updating my data that is then sent to everyone.
|
||||
// (Maybe this code should be moved there?)
|
||||
// The principal result is to call updateLookAtTargetAvatar() and then setLookAtPosition().
|
||||
|
@ -2787,12 +2803,7 @@ void Application::update(float deltaTime) {
|
|||
_overlays.update(deltaTime);
|
||||
}
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("myAvatar");
|
||||
updateMyAvatarLookAtPosition();
|
||||
// Sample hardware, update view frustum if needed, and send avatar data to mixer/nodes
|
||||
DependencyManager::get<AvatarManager>()->updateMyAvatar(deltaTime);
|
||||
}
|
||||
avatarUpdate();
|
||||
|
||||
{
|
||||
PerformanceTimer perfTimer("emitSimulating");
|
||||
|
|
|
@ -681,6 +681,9 @@ private:
|
|||
|
||||
EntityItemID _keyboardFocusedItem;
|
||||
quint64 _lastAcceptedKeyPress = 0;
|
||||
|
||||
void avatarUpdate();
|
||||
quint64 _lastAvatarUpdate = 0;
|
||||
};
|
||||
|
||||
#endif // hifi_Application_h
|
||||
|
|
Loading…
Reference in a new issue