bool StdClientProcessList::advanceTime( SimTime timeDelta ) { PROFILE_SCOPE( StdClientProcessList_AdvanceTime ); if ( doBacklogged( timeDelta ) ) return false; bool ret = Parent::advanceTime( timeDelta ); ProcessObject *obj = NULL; AssertFatal( mLastDelta >= 0.0f && mLastDelta <= 1.0f, "mLastDelta is not zero to one."); obj = mHead.mProcessLink.next; while ( obj != &mHead ) { if ( obj->isTicking() ) obj->interpolateTick( mLastDelta ); obj = obj->mProcessLink.next; } for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]); if (!comp->isClientObject() || !comp->isActive()) continue; UpdateInterface::all[i]->interpolateTick(mLastDelta); } // Inform objects of total elapsed delta so they can advance // client side animations. F32 dt = F32(timeDelta) / 1000; // Update camera FX. gCamFXMgr.update( dt ); obj = mHead.mProcessLink.next; while ( obj != &mHead ) { obj->advanceTime( dt ); obj = obj->mProcessLink.next; } for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast<Component*>(UpdateInterface::all[i]); if (comp) { if (!comp->isClientObject() || !comp->isActive()) continue; } UpdateInterface::all[i]->advanceTime(dt); } return ret; }
static void ProgressCallback(Object *object, const EventObject &event, void *clientdata) { ProcessObject *process = dynamic_cast<ProcessObject *>(object); Reporter *reporter = reinterpret_cast<Reporter *>(clientdata); if (process && reporter) { float progress = process->GetProgress(); reporter->report(int(progress * 100.f)); } }
bool HifiClientProcessList::advanceTime( SimTime timeDelta ) { PROFILE_SCOPE( AdvanceClientTime ); if ( mSkipAdvanceObjectsMs && timeDelta > mSkipAdvanceObjectsMs ) { timeDelta -= mSkipAdvanceObjectsMs; advanceTime( mSkipAdvanceObjectsMs ); AssertFatal( !mSkipAdvanceObjectsMs, "mSkipAdvanceObjectsMs must always be positive." ); } if ( doBacklogged( timeDelta ) ) return false; // remember interpolation value because we might need to set it back F32 oldLastDelta = mLastDelta; bool ret = Parent::advanceTime( timeDelta ); if ( !mSkipAdvanceObjectsMs ) { AssertFatal( mLastDelta >= 0.0f && mLastDelta <= 1.0f, "mLastDelta must always be zero to one." ); for ( ProcessObject *pobj = mHead.mProcessLink.next; pobj != &mHead; pobj = pobj->mProcessLink.next ) { if ( pobj->isTicking() ) pobj->interpolateTick( mLastDelta ); } // Inform objects of total elapsed delta so they can advance // client side animations. F32 dt = F32( timeDelta ) / 1000; for ( ProcessObject *pobj = mHead.mProcessLink.next; pobj != &mHead; pobj = pobj->mProcessLink.next) { pobj->advanceTime( dt ); } } else { mSkipAdvanceObjectsMs -= timeDelta; mLastDelta = oldLastDelta; } return ret; }
void ProcessList::advanceObjects() { PROFILE_START(ProcessList_AdvanceObjects); // A little link list shuffling is done here to avoid problems // with objects being deleted from within the process method. ProcessObject list; list.plLinkBefore(mHead.mProcessLink.next); mHead.plUnlink(); for (ProcessObject * pobj = list.mProcessLink.next; pobj != &list; pobj = list.mProcessLink.next) { pobj->plUnlink(); pobj->plLinkBefore(&mHead); onTickObject(pobj); } mTotalTicks++; PROFILE_END(); }
bool StdClientProcessList::advanceTime( SimTime timeDelta ) { PROFILE_SCOPE( StdClientProcessList_AdvanceTime ); if ( doBacklogged( timeDelta ) ) return false; bool ret = Parent::advanceTime( timeDelta ); ProcessObject *obj = NULL; AssertFatal( mLastDelta >= 0.0f && mLastDelta <= 1.0f, "mLastDelta is not zero to one."); obj = mHead.mProcessLink.next; while ( obj != &mHead ) { if ( obj->isTicking() ) obj->interpolateMove( mLastDelta ); obj = obj->mProcessLink.next; } // Inform objects of total elapsed delta so they can advance // client side animations. F32 dt = F32(timeDelta) / 1000; // Update camera FX. //gCamFXMgr.update( dt ); obj = mHead.mProcessLink.next; while ( obj != &mHead ) { obj->advanceMove( dt ); obj = obj->mProcessLink.next; } return ret; }
void ProcessList::orderList() { // ProcessObject tags are initialized to 0, so current tag should never be 0. if (++mCurrentTag == 0) mCurrentTag++; // Install a temporary head node ProcessObject list; list.plLinkBefore(mHead.mProcessLink.next); mHead.plUnlink(); // start out by (bubble) sorting list by GUID for (ProcessObject * cur = list.mProcessLink.next; cur != &list; cur = cur->mProcessLink.next) { if (cur->mOrderGUID == 0) // special case -- can be no lower, so accept as lowest (this is also // a common value since it is what non ordered objects have) continue; for (ProcessObject * walk = cur->mProcessLink.next; walk != &list; walk = walk->mProcessLink.next) { if (walk->mOrderGUID < cur->mOrderGUID) { // swap walk and cur -- need to be careful because walk might be just after cur // so insert after item before cur and before item after walk ProcessObject * before = cur->mProcessLink.prev; ProcessObject * after = walk->mProcessLink.next; cur->plUnlink(); walk->plUnlink(); cur->plLinkBefore(after); walk->plLinkAfter(before); ProcessObject * swap = walk; walk = cur; cur = swap; } } } // Reverse topological sort into the original head node while (list.mProcessLink.next != &list) { ProcessObject * ptr = list.mProcessLink.next; ProcessObject * afterObject = ptr->getAfterObject(); ptr->mProcessTag = mCurrentTag; ptr->plUnlink(); if (afterObject) { // Build chain "stack" of dependent objects and patch // it to the end of the current list. while (afterObject && afterObject->mProcessTag != mCurrentTag) { afterObject->mProcessTag = mCurrentTag; afterObject->plUnlink(); afterObject->plLinkBefore(ptr); ptr = afterObject; afterObject = ptr->getAfterObject(); } ptr->plJoin(&mHead); } else ptr->plLinkBefore(&mHead); } mDirty = false; }