diff options
author | Steven Bennetts <steve@lindenlab.com> | 2008-06-27 21:02:01 +0000 |
---|---|---|
committer | Steven Bennetts <steve@lindenlab.com> | 2008-06-27 21:02:01 +0000 |
commit | 926ea0b39afd04cab469ca17b28f95ebf969e669 (patch) | |
tree | 40d5653e19160f72e7a0b80fadb9bdb93ef3575c | |
parent | 41877d457ab9542dca22b99f3eddb1bfcfe7c1d6 (diff) |
QAR-669 1.20 Viewer RC11
QAR-648 1.20 Viewer RC10
merge Branch_1-20-Viewer-2 -r 88724:90511 -> release
75 files changed, 1028 insertions, 1101 deletions
diff --git a/doc/contributions.txt b/doc/contributions.txt index 99a0e7ad9e..4201d6149d 100644 --- a/doc/contributions.txt +++ b/doc/contributions.txt @@ -53,6 +53,7 @@ Alissa Sabre VWR-7153 VWR-7168 VWR-7087 + VWR-7086 Angus Boyd VWR-592 Argent Stonecutter @@ -146,6 +147,7 @@ Ginko Bayliss VWR-4 Grazer Kline VWR-1092 + VWR-2113 Gudmund Shepherd VWR-1594 Hamncheese Omlet @@ -363,6 +365,8 @@ Tharax Ferraris Thraxis Epsilon SVC-371 VWR-383 +Wilton Lundquist + VWR-7682 Whoops Babii VWR-631 VWR-1640 diff --git a/indra/llcharacter/llcharacter.cpp b/indra/llcharacter/llcharacter.cpp index 033ac16274..1d5947c9ef 100644 --- a/indra/llcharacter/llcharacter.cpp +++ b/indra/llcharacter/llcharacter.cpp @@ -103,11 +103,11 @@ LLJoint *LLCharacter::getJoint( const std::string &name ) } //----------------------------------------------------------------------------- -// addMotion() +// registerMotion() //----------------------------------------------------------------------------- -BOOL LLCharacter::addMotion( const LLUUID& id, LLMotionConstructor create ) +BOOL LLCharacter::registerMotion( const LLUUID& id, LLMotionConstructor create ) { - return mMotionController.addMotion(id, create); + return mMotionController.registerMotion(id, create); } //----------------------------------------------------------------------------- @@ -119,7 +119,16 @@ void LLCharacter::removeMotion( const LLUUID& id ) } //----------------------------------------------------------------------------- -// getMotion() +// findMotion() +//----------------------------------------------------------------------------- +LLMotion* LLCharacter::findMotion( const LLUUID &id ) +{ + return mMotionController.findMotion( id ); +} + +//----------------------------------------------------------------------------- +// createMotion() +// NOTE: Always assign the result to a LLPointer! //----------------------------------------------------------------------------- LLMotion* LLCharacter::createMotion( const LLUUID &id ) { @@ -168,26 +177,24 @@ void LLCharacter::requestStopMotion( LLMotion* motion) //----------------------------------------------------------------------------- -// updateMotion() +// updateMotions() //----------------------------------------------------------------------------- -void LLCharacter::updateMotion(BOOL force_update) +void LLCharacter::updateMotions(e_update_t update_type) { - // unpause if we're forcing an update or - // number of outstanding pause requests has dropped - // to the initial one - if (mMotionController.isPaused() && - (force_update || mPauseRequest->getNumRefs() == 1)) + LLFastTimer t(LLFastTimer::FTM_UPDATE_ANIMATION); + if (update_type == HIDDEN_UPDATE) { - mMotionController.unpause(); + mMotionController.updateMotionsMinimal(); } - - mMotionController.updateMotion(); - - // pause once again, after forced update, if there are outstanding - // pause requests - if (force_update && mPauseRequest->getNumRefs() > 1) + else { - mMotionController.pause(); + // unpause if the number of outstanding pause requests has dropped to the initial one + if (mMotionController.isPaused() && mPauseRequest->getNumRefs() == 1) + { + mMotionController.unpauseAllMotions(); + } + bool force_update = (update_type == FORCE_UPDATE); + mMotionController.updateMotions(force_update); } } @@ -499,7 +506,7 @@ void LLCharacter::updateVisualParams() LLAnimPauseRequest LLCharacter::requestPause() { - mMotionController.pause(); + mMotionController.pauseAllMotions(); return mPauseRequest; } diff --git a/indra/llcharacter/llcharacter.h b/indra/llcharacter/llcharacter.h index 2c0451d46c..4fd135721b 100644 --- a/indra/llcharacter/llcharacter.h +++ b/indra/llcharacter/llcharacter.h @@ -137,13 +137,16 @@ public: //------------------------------------------------------------------------- // registers a motion with the character // returns true if successfull - BOOL addMotion( const LLUUID& id, LLMotionConstructor create ); + BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); void removeMotion( const LLUUID& id ); - // returns an instance of a registered motion + // returns an instance of a registered motion, creating one if necessary LLMotion* createMotion( const LLUUID &id ); + // returns an existing instance of a registered motion + LLMotion* findMotion( const LLUUID &id ); + // start a motion // returns true if successful, false if an error occurred virtual BOOL startMotion( const LLUUID& id, F32 start_offset = 0.f); @@ -161,12 +164,16 @@ public: virtual void requestStopMotion( LLMotion* motion ); // periodic update function, steps the motion controller - void updateMotion(BOOL force_update = FALSE); + enum e_update_t { NORMAL_UPDATE, HIDDEN_UPDATE, FORCE_UPDATE }; + void updateMotions(e_update_t update_type); LLAnimPauseRequest requestPause(); BOOL areAnimationsPaused() { return mMotionController.isPaused(); } void setAnimTimeFactor(F32 factor) { mMotionController.setTimeFactor(factor); } void setTimeStep(F32 time_step) { mMotionController.setTimeStep(time_step); } + + LLMotionController& getMotionController() { return mMotionController; } + // Releases all motion instances which should result in // no cached references to character joint data. This is // useful if a character wants to rebuild it's skeleton. diff --git a/indra/llcharacter/llkeyframemotion.cpp b/indra/llcharacter/llkeyframemotion.cpp index d9e8407d44..710cd44a6f 100644 --- a/indra/llcharacter/llkeyframemotion.cpp +++ b/indra/llcharacter/llkeyframemotion.cpp @@ -1986,9 +1986,8 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, LLCharacter* character = *char_iter; - // create an instance of this motion (it may or may not already exist) - LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->createMotion(asset_uuid); - + // look for an existing instance of this motion + LLKeyframeMotion* motionp = (LLKeyframeMotion*) character->findMotion(asset_uuid); if (motionp) { if (0 == status) @@ -2017,7 +2016,7 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, motionp->mAssetStatus = ASSET_FETCH_FAILED; } - delete []buffer; + delete[] buffer; } else { @@ -2027,8 +2026,7 @@ void LLKeyframeMotion::onLoadComplete(LLVFS *vfs, } else { - // motionp is NULL - llwarns << "Failed to createMotion() for asset UUID " << asset_uuid << llendl; + llwarns << "No existing motion for asset data. UUID: " << asset_uuid << llendl; } } diff --git a/indra/llcharacter/llkeyframemotionparam.cpp b/indra/llcharacter/llkeyframemotionparam.cpp index 513b7688ce..ea88e18367 100644 --- a/indra/llcharacter/llkeyframemotionparam.cpp +++ b/indra/llcharacter/llkeyframemotionparam.cpp @@ -76,7 +76,7 @@ LLKeyframeMotionParam::~LLKeyframeMotionParam() for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; - delete paramMotion.first; // note - deletes the structure; ParameterizedMotion pair remains intact + delete paramMotion.mMotion; } motionList.clear(); } @@ -102,32 +102,32 @@ LLMotion::LLMotionInitStatus LLKeyframeMotionParam::onInitialize(LLCharacter *ch for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; + LLMotion* motion = paramMotion.mMotion; + motion->onInitialize(character); - paramMotion.first->onInitialize(character); - - if (paramMotion.first->getDuration() > mEaseInDuration) + if (motion->getDuration() > mEaseInDuration) { - mEaseInDuration = paramMotion.first->getEaseInDuration(); + mEaseInDuration = motion->getEaseInDuration(); } - if (paramMotion.first->getEaseOutDuration() > mEaseOutDuration) + if (motion->getEaseOutDuration() > mEaseOutDuration) { - mEaseOutDuration = paramMotion.first->getEaseOutDuration(); + mEaseOutDuration = motion->getEaseOutDuration(); } - if (paramMotion.first->getDuration() > mDuration) + if (motion->getDuration() > mDuration) { - mDuration = paramMotion.first->getDuration(); + mDuration = motion->getDuration(); } - if (paramMotion.first->getPriority() > mPriority) + if (motion->getPriority() > mPriority) { - mPriority = paramMotion.first->getPriority(); + mPriority = motion->getPriority(); } - LLPose *pose = paramMotion.first->getPose(); + LLPose *pose = motion->getPose(); - mPoseBlender.addMotion(paramMotion.first); + mPoseBlender.addMotion(motion); for (LLJointState *jsp = pose->getFirstJointState(); jsp; jsp = pose->getNextJointState()) { LLPose *blendedPose = mPoseBlender.getBlendedPose(); @@ -151,7 +151,7 @@ BOOL LLKeyframeMotionParam::onActivate() for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; - paramMotion.first->activate(); + paramMotion.mMotion->activate(mActivationTimestamp); } } return TRUE; @@ -173,8 +173,8 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; -// llinfos << "Weight for pose " << paramMotion.first->getName() << " is " << paramMotion.first->getPose()->getWeight() << llendl; - paramMotion.first->getPose()->setWeight(0.f); +// llinfos << "Weight for pose " << paramMotion.mMotion->getName() << " is " << paramMotion.mMotion->getPose()->getWeight() << llendl; + paramMotion.mMotion->getPose()->setWeight(0.f); } } @@ -190,6 +190,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) continue; } + // DANGER! Do not modify mParameterizedMotions while using these pointers! const ParameterizedMotion* firstMotion = NULL; const ParameterizedMotion* secondMotion = NULL; @@ -197,9 +198,9 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; - paramMotion.first->onUpdate(time, joint_mask); + paramMotion.mMotion->onUpdate(time, joint_mask); - F32 distToParam = paramMotion.second - *paramValue; + F32 distToParam = paramMotion.mParam - *paramValue; if ( distToParam <= 0.f) { @@ -227,12 +228,12 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) LLPose *secondPose; if (firstMotion) - firstPose = firstMotion->first->getPose(); + firstPose = firstMotion->mMotion->getPose(); else firstPose = NULL; if (secondMotion) - secondPose = secondMotion->first->getPose(); + secondPose = secondMotion->mMotion->getPose(); else secondPose = NULL; @@ -243,7 +244,7 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) { firstPose->setWeight(weightFactor); } - else if (firstMotion->second == secondMotion->second) + else if (firstMotion->mParam == secondMotion->mParam) { firstPose->setWeight(0.5f * weightFactor); secondPose->setWeight(0.5f * weightFactor); @@ -251,8 +252,8 @@ BOOL LLKeyframeMotionParam::onUpdate(F32 time, U8* joint_mask) else { F32 first_weight = 1.f - - ((llclamp(*paramValue - firstMotion->second, 0.f, (secondMotion->second - firstMotion->second))) / - (secondMotion->second - firstMotion->second)); + ((llclamp(*paramValue - firstMotion->mParam, 0.f, (secondMotion->mParam - firstMotion->mParam))) / + (secondMotion->mParam - firstMotion->mParam)); first_weight = llclamp(first_weight, 0.f, 1.f); F32 second_weight = 1.f - first_weight; @@ -290,7 +291,7 @@ void LLKeyframeMotionParam::onDeactivate() for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; - paramMotion.first->onDeactivate(); + paramMotion.mMotion->onDeactivate(); } } } @@ -328,9 +329,9 @@ void LLKeyframeMotionParam::setDefaultKeyframeMotion(char *name) for (motion_list_t::iterator iter2 = motionList.begin(); iter2 != motionList.end(); ++iter2) { const ParameterizedMotion& paramMotion = *iter2; - if (paramMotion.first->getName() == name) + if (paramMotion.mMotion->getName() == name) { - mDefaultKeyframeMotion = paramMotion.first; + mDefaultKeyframeMotion = paramMotion.mMotion; } } } diff --git a/indra/llcharacter/llkeyframemotionparam.h b/indra/llcharacter/llkeyframemotionparam.h index 305207eb09..c8104d2b38 100644 --- a/indra/llcharacter/llkeyframemotionparam.h +++ b/indra/llcharacter/llkeyframemotionparam.h @@ -126,7 +126,12 @@ protected: //------------------------------------------------------------------------- // new functions defined by this subclass //------------------------------------------------------------------------- - typedef std::pair<LLMotion*, F32> ParameterizedMotion; + struct ParameterizedMotion + { + ParameterizedMotion(LLMotion* motion, F32 param) : mMotion(motion), mParam(param) {} + LLMotion* mMotion; + F32 mParam; + }; // add a motion and associated parameter triplet BOOL addKeyframeMotion(char *name, const LLUUID &id, char *param, F32 value); @@ -134,8 +139,6 @@ protected: // set default motion for LOD and retrieving blend constants void setDefaultKeyframeMotion(char *); - static BOOL sortFunc(ParameterizedMotion *new_motion, ParameterizedMotion *tested_motion); - BOOL loadMotions(); protected: @@ -147,10 +150,10 @@ protected: { bool operator() (const ParameterizedMotion& a, const ParameterizedMotion& b) const { - if (a.second != b.second) - return (a.second < b.second); + if (a.mParam != b.mParam) + return (a.mParam < b.mParam); else - return a.first < b.first; + return a.mMotion < b.mMotion; } }; diff --git a/indra/llcharacter/llmotion.cpp b/indra/llcharacter/llmotion.cpp index 9123ebfcbd..369e516482 100644 --- a/indra/llcharacter/llmotion.cpp +++ b/indra/llcharacter/llmotion.cpp @@ -127,6 +127,13 @@ void LLMotion::setDeactivateCallback( void (*cb)(void *), void* userdata ) mDeactivateCallbackUserData = userdata; } +//virtual +void LLMotion::setStopTime(F32 time) +{ + mStopTimestamp = time; + mStopped = TRUE; +} + BOOL LLMotion::isBlending() { return mPose.getWeight() < 1.f; @@ -135,8 +142,9 @@ BOOL LLMotion::isBlending() //----------------------------------------------------------------------------- // activate() //----------------------------------------------------------------------------- -void LLMotion::activate() +void LLMotion::activate(F32 time) { + mActivationTimestamp = time; mStopped = FALSE; mActive = TRUE; onActivate(); @@ -150,7 +158,12 @@ void LLMotion::deactivate() mActive = FALSE; mPose.setWeight(0.f); - if (mDeactivateCallback) (*mDeactivateCallback)(mDeactivateCallbackUserData); + if (mDeactivateCallback) + { + (*mDeactivateCallback)(mDeactivateCallbackUserData); + mDeactivateCallback = NULL; // only call callback once + mDeactivateCallbackUserData = NULL; + } onDeactivate(); } diff --git a/indra/llcharacter/llmotion.h b/indra/llcharacter/llmotion.h index 7669920339..50090e65e4 100644 --- a/indra/llcharacter/llmotion.h +++ b/indra/llcharacter/llmotion.h @@ -48,6 +48,8 @@ class LLCharacter; //----------------------------------------------------------------------------- class LLMotion { + friend class LLMotionController; + public: enum LLMotionBlendType { @@ -73,10 +75,6 @@ public: // functions to support MotionController and MotionRegistry //------------------------------------------------------------------------- - // static constructor - // all subclasses must implement such a function and register it - static LLMotion *create(const LLUUID &id) { return NULL; } - // get the name of this instance const std::string &getName() const { return mName; } @@ -96,7 +94,7 @@ public: F32 getStopTime() const { return mStopTimestamp; } - virtual void setStopTime(F32 time) { mStopTimestamp = time; mStopped = TRUE; } + virtual void setStopTime(F32 time); BOOL isStopped() const { return mStopped; } @@ -104,12 +102,18 @@ public: BOOL isBlending(); - void activate(); - + // Activation functions. + // It is OK for other classes to activate a motion, + // but only the controller can deactivate it. + // Thus, if mActive == TRUE, the motion *may* be on the controllers active list, + // but if mActive == FALSE, the motion is gauranteed not to be on the active list. +protected: + // Used by LLMotionController only void deactivate(); - BOOL isActive() { return mActive; } - +public: + void activate(F32 time); + public: //------------------------------------------------------------------------- // animation callbacks to be implemented by subclasses @@ -170,14 +174,13 @@ protected: BOOL mStopped; // motion has been stopped; BOOL mActive; // motion is on active list (can be stopped or not stopped) -public: //------------------------------------------------------------------------- // these are set implicitly by the motion controller and // may be referenced (read only) in the above handlers. //------------------------------------------------------------------------- std::string mName; // instance name assigned by motion controller LLUUID mID; - + F32 mActivationTimestamp; // time when motion was activated F32 mStopTimestamp; // time when motion was told to stop F32 mSendStopTimestamp; // time when simulator should be told to stop this motion diff --git a/indra/llcharacter/llmotioncontroller.cpp b/indra/llcharacter/llmotioncontroller.cpp index 5bcae5e635..3cb4da4e3a 100644 --- a/indra/llcharacter/llmotioncontroller.cpp +++ b/indra/llcharacter/llmotioncontroller.cpp @@ -34,6 +34,8 @@ //----------------------------------------------------------------------------- #include "linden_common.h" +#include "llmemtype.h" + #include "llmotioncontroller.h" #include "llkeyframemotion.h" #include "llmath.h" @@ -50,32 +52,6 @@ const U32 MAX_MOTION_INSTANCES = 32; LLMotionRegistry LLMotionController::sRegistry; //----------------------------------------------------------------------------- -// LLMotionTableEntry() -//----------------------------------------------------------------------------- -LLMotionTableEntry::LLMotionTableEntry() -{ - mConstructor = NULL; - mID.setNull(); -} - -LLMotionTableEntry::LLMotionTableEntry(LLMotionConstructor constructor, const LLUUID& id) - : mConstructor(constructor), mID(id) -{ - -} - -//----------------------------------------------------------------------------- -// create() -//----------------------------------------------------------------------------- -LLMotion* LLMotionTableEntry::create(const LLUUID &id) -{ - LLMotion* motionp = mConstructor(id); - - return motionp; -} - - -//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // LLMotionRegistry class //----------------------------------------------------------------------------- @@ -85,7 +61,7 @@ LLMotion* LLMotionTableEntry::create(const LLUUID &id) // LLMotionRegistry() // Class Constructor //----------------------------------------------------------------------------- -LLMotionRegistry::LLMotionRegistry() : mMotionTable(LLMotionTableEntry::uuidEq, LLMotionTableEntry()) +LLMotionRegistry::LLMotionRegistry() { } @@ -97,19 +73,19 @@ LLMotionRegistry::LLMotionRegistry() : mMotionTable(LLMotionTableEntry::uuidEq, //----------------------------------------------------------------------------- LLMotionRegistry::~LLMotionRegistry() { - mMotionTable.removeAll(); + mMotionTable.clear(); } //----------------------------------------------------------------------------- // addMotion() //----------------------------------------------------------------------------- -BOOL LLMotionRegistry::addMotion( const LLUUID& id, LLMotionConstructor constructor ) +BOOL LLMotionRegistry::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { -// llinfos << "Registering motion: " << name << llendl; - if (!mMotionTable.check(id)) + // llinfos << "Registering motion: " << name << llendl; + if (!is_in_map(mMotionTable, id)) { - mMotionTable.set(id, LLMotionTableEntry(constructor, id)); + mMotionTable[id] = constructor; return TRUE; } @@ -121,7 +97,7 @@ BOOL LLMotionRegistry::addMotion( const LLUUID& id, LLMotionConstructor construc //----------------------------------------------------------------------------- void LLMotionRegistry::markBad( const LLUUID& id ) { - mMotionTable.set(id, LLMotionTableEntry()); + mMotionTable[id] = LLMotionConstructor(NULL); } //----------------------------------------------------------------------------- @@ -129,17 +105,17 @@ void LLMotionRegistry::markBad( const LLUUID& id ) //----------------------------------------------------------------------------- LLMotion *LLMotionRegistry::createMotion( const LLUUID &id ) { - LLMotionTableEntry motion_entry = mMotionTable.get(id); + LLMotionConstructor constructor = get_if_there(mMotionTable, id, LLMotionConstructor(NULL)); LLMotion* motion = NULL; - if ( motion_entry.getID().isNull() ) + if ( constructor == NULL ) { // *FIX: need to replace with a better default scheme. RN motion = LLKeyframeMotion::create(id); } else { - motion = motion_entry.create(id); + motion = constructor(id); } return motion; @@ -158,8 +134,8 @@ LLMotion *LLMotionRegistry::createMotion( const LLUUID &id ) LLMotionController::LLMotionController() : mTimeFactor(1.f), mCharacter(NULL), - mTime(0.f), - mTimeOffset(0.f), + mAnimTime(0.f), + mPrevTimerElapsed(0.f), mLastTime(0.0f), mHasRunOnce(FALSE), mPaused(FALSE), @@ -180,6 +156,15 @@ LLMotionController::~LLMotionController() deleteAllMotions(); } +void LLMotionController::incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions) +{ + num_motions += mAllMotions.size(); + num_loading_motions += mLoadingMotions.size(); + num_loaded_motions += mLoadedMotions.size(); + num_active_motions += mActiveMotions.size(); + num_deprecated_motions += mDeprecatedMotions.size(); +} + //----------------------------------------------------------------------------- // deleteAllMotions() //----------------------------------------------------------------------------- @@ -194,24 +179,38 @@ void LLMotionController::deleteAllMotions() } //----------------------------------------------------------------------------- -// addLoadedMotion() +// purgeExcessMotion() //----------------------------------------------------------------------------- -void LLMotionController::addLoadedMotion(LLMotion* motionp) +void LLMotionController::purgeExcessMotions() { - std::set<LLUUID> motions_to_kill; + if (mLoadedMotions.size() > MAX_MOTION_INSTANCES) + { + // clean up deprecated motions + for (motion_set_t::iterator deprecated_motion_it = mDeprecatedMotions.begin(); + deprecated_motion_it != mDeprecatedMotions.end(); ) + { + motion_set_t::iterator cur_iter = deprecated_motion_it++; + LLMotion* cur_motionp = *cur_iter; + if (!isMotionActive(cur_motionp)) + { + // Motion is deprecated so we know it's not cannonical, + // we can safely remove the instance + removeMotionInstance(cur_motionp); // modifies mDeprecatedMotions + mDeprecatedMotions.erase(cur_iter); + } + } + } - // gather all inactive, loaded motions + std::set<LLUUID> motions_to_kill; if (mLoadedMotions.size() > MAX_MOTION_INSTANCES) { // too many motions active this frame, kill all blenders mPoseBlender.clearBlenders(); - - for (motion_list_t::iterator loaded_motion_it = mLoadedMotions.begin(); - loaded_motion_it != mLoadedMotions.end(); - ++loaded_motion_it) + for (motion_set_t::iterator loaded_motion_it = mLoadedMotions.begin(); + loaded_motion_it != mLoadedMotions.end(); + ++loaded_motion_it) { LLMotion* cur_motionp = *loaded_motion_it; - // motion isn't playing, delete it if (!isMotionActive(cur_motionp)) { @@ -219,7 +218,7 @@ void LLMotionController::addLoadedMotion(LLMotion* motionp) } } } - + // clean up all inactive, loaded motions for (std::set<LLUUID>::iterator motion_it = motions_to_kill.begin(); motion_it != motions_to_kill.end(); @@ -235,8 +234,28 @@ void LLMotionController::addLoadedMotion(LLMotion* motionp) } } - // add new motion to loaded list - mLoadedMotions.push_back(motionp); + if (mLoadedMotions.size() > 2*MAX_MOTION_INSTANCES) + { + LL_WARNS_ONCE("Animation") << "> " << 2*MAX_MOTION_INSTANCES << " Loaded Motions" << llendl; + } +} + +//----------------------------------------------------------------------------- +// deactivateStoppedMotions() +//----------------------------------------------------------------------------- +void LLMotionController::deactivateStoppedMotions() +{ + // Since we're hidden, deactivate any stopped motions. + for (motion_list_t::iterator iter = mActiveMotions.begin(); + iter != mActiveMotions.end(); ) + { + motion_list_t::iterator curiter = iter++; + LLMotion* motionp = *curiter; + if (motionp->isStopped()) + { + deactivateMotionInstance(motionp); + } + } } //----------------------------------------------------------------------------- @@ -253,9 +272,10 @@ void LLMotionController::setTimeStep(F32 step) iter != mActiveMotions.end(); ++iter) { LLMotion* motionp = *iter; - motionp->mActivationTimestamp = (F32)llfloor(motionp->mActivationTimestamp / step) * step; + F32 activation_time = motionp->mActivationTimestamp; + motionp->mActivationTimestamp = (F32)(llfloor(activation_time / step)) * step; BOOL stopped = motionp->isStopped(); - motionp->setStopTime((F32)llfloor(motionp->getStopTime() / step) * step); + motionp->setStopTime((F32)(llfloor(motionp->getStopTime() / step)) * step); motionp->setStopped(stopped); motionp->mSendStopTimestamp = (F32)llfloor(motionp->mSendStopTimestamp / step) * step; } @@ -267,7 +287,6 @@ void LLMotionController::setTimeStep(F32 step) //----------------------------------------------------------------------------- void LLMotionController::setTimeFactor(F32 time_factor) { - mTimeOffset += mTimer.getElapsedTimeAndResetF32() * mTimeFactor; mTimeFactor = time_factor; } @@ -281,11 +300,11 @@ void LLMotionController::setCharacter(LLCharacter *character) //----------------------------------------------------------------------------- -// addMotion() +// registerMotion() //----------------------------------------------------------------------------- -BOOL LLMotionController::addMotion( const LLUUID& id, LLMotionConstructor constructor ) +BOOL LLMotionController::registerMotion( const LLUUID& id, LLMotionConstructor constructor ) { - return sRegistry.addMotion(id, constructor); + return sRegistry.registerMotion(id, constructor); } //----------------------------------------------------------------------------- @@ -294,10 +313,8 @@ BOOL LLMotionController::addMotion( const LLUUID& id, LLMotionConstructor constr void LLMotionController::removeMotion( const LLUUID& id) { LLMotion* motionp = findMotion(id); - - removeMotionInstance(motionp); - mAllMotions.erase(id); + removeMotionInstance(motionp); } // removes instance of a motion from all runtime structures, but does @@ -307,10 +324,11 @@ void LLMotionController::removeMotionInstance(LLMotion* motionp) { if (motionp) { - stopMotionInstance(motionp, TRUE); - + llassert(findMotion(motionp->getID()) != motionp); + if (motionp->isActive()) + motionp->deactivate(); mLoadingMotions.erase(motionp); - mLoadedMotions.remove(motionp); + mLoadedMotions.erase(motionp); mActiveMotions.remove(motionp); delete motionp; } @@ -321,6 +339,7 @@ void LLMotionController::removeMotionInstance(LLMotion* motionp) //----------------------------------------------------------------------------- LLMotion* LLMotionController::createMotion( const LLUUID &id ) { + LLMemType mt(LLMemType::MTYPE_ANIMATION); // do we have an instance of this motion for this character? LLMotion *motion = findMotion(id); @@ -354,8 +373,8 @@ LLMotion* LLMotionController::createMotion( const LLUUID &id ) mLoadingMotions.insert(motion); break; case LLMotion::STATUS_SUCCESS: - // add motion to our list - addLoadedMotion(motion); + // add motion to our list + mLoadedMotions.insert(motion); break; default: llerrs << "Invalid initialization status" << llendl; @@ -378,6 +397,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) // motion that is stopping will be allowed to stop but // replaced by a new instance of that motion if (motion + && !mPaused && motion->canDeprecate() && motion->getFadeWeight() > 0.01f // not LOD-ed out && (motion->isBlending() || motion->getStopTime() != 0.f)) @@ -404,7 +424,7 @@ BOOL LLMotionController::startMotion(const LLUUID &id, F32 start_offset) } // llinfos << "Starting motion " << name << llendl; - return activateMotionInstance(motion, mTime - start_offset); + return activateMotionInstance(motion, mAnimTime - start_offset); } @@ -415,7 +435,6 @@ BOOL LLMotionController::stopMotionLocally(const LLUUID &id, BOOL stop_immediate { // if already inactive, return false LLMotion *motion = findMotion(id); - return stopMotionInstance(motion, stop_immediate); } @@ -429,12 +448,7 @@ BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediat // If on active list, stop it if (isMotionActive(motion) && !motion->isStopped()) { - // when using timesteps, set stop time to last frame's time, otherwise grab current timer value - // *FIX: should investigate this inconsistency...hints of obscure bugs - - F32 stop_time = (mTimeStep != 0.f || mPaused) ? (mTime) : mTimeOffset + (mTimer.getElapsedTimeF32() * mTimeFactor); - motion->setStopTime(stop_time); - + motion->setStopTime(mAnimTime); if (stop_immediate) { deactivateMotionInstance(motion); @@ -450,7 +464,6 @@ BOOL LLMotionController::stopMotionInstance(LLMotion* motion, BOOL stop_immediat return FALSE; } - //----------------------------------------------------------------------------- // updateRegularMotions() //----------------------------------------------------------------------------- @@ -477,6 +490,59 @@ void LLMotionController::resetJointSignatures() } //----------------------------------------------------------------------------- +// updateIdleMotion() +// minimal updates for active motions +//----------------------------------------------------------------------------- +void LLMotionController::updateIdleMotion(LLMotion* motionp) +{ + if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration()) + { + deactivateMotionInstance(motionp); + } + else if (motionp->isStopped() && mAnimTime > motionp->getStopTime()) + { + // is this the first iteration in the ease out phase? + if (mLastTime <= motionp->getStopTime()) + { + // store residual weight for this motion + motionp->mResidualWeight = motionp->getPose()->getWeight(); + } + } + else if (mAnimTime > motionp->mSendStopTimestamp) + { + // notify character of timed stop event on first iteration past sendstoptimestamp + // this will only be called when an animation stops itself (runs out of time) + if (mLastTime <= motionp->mSendStopTimestamp) + { + mCharacter->requestStopMotion( motionp ); + stopMotionInstance(motionp, FALSE); + } + } + else if (mAnimTime >= motionp->mActivationTimestamp) + { + if (mLastTime < motionp->mActivationTimestamp) + { + motionp->mResidualWeight = motionp->getPose()->getWeight(); + } + } +} + +//----------------------------------------------------------------------------- +// updateIdleActiveMotions() +// Call this instead of updateMotionsByType for hidden avatars +//----------------------------------------------------------------------------- +void LLMotionController::updateIdleActiveMotions() +{ + for (motion_list_t::iterator iter = mActiveMotions.begin(); + iter != mActiveMotions.end(); ) + { + motion_list_t::iterator curiter = iter++; + LLMotion* motionp = *curiter; + updateIdleMotion(motionp); + } +} + +//----------------------------------------------------------------------------- // updateMotionsByType() //----------------------------------------------------------------------------- void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_type) @@ -531,36 +597,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (!update_motion) { - if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) - { - deactivateMotionInstance(motionp); - } - else if (motionp->isStopped() && mTime > motionp->getStopTime()) - { - // is this the first iteration in the ease out phase? - if (mLastTime <= motionp->getStopTime()) - { - // store residual weight for this motion - motionp->mResidualWeight = motionp->getPose()->getWeight(); - } - } - else if (mTime > motionp->mSendStopTimestamp) - { - // notify character of timed stop event on first iteration past sendstoptimestamp - // this will only be called when an animation stops itself (runs out of time) - if (mLastTime <= motionp->mSendStopTimestamp) - { - mCharacter->requestStopMotion( motionp ); - stopMotionInstance(motionp, FALSE); - } - } - else if (mTime >= motionp->mActivationTimestamp) - { - if (mLastTime < motionp->mActivationTimestamp) - { - motionp->mResidualWeight = motionp->getPose()->getWeight(); - } - } + updateIdleMotion(motionp); continue; } @@ -572,7 +609,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty motionp->fadeOut(); //should we notify the simulator that this motion should be stopped (check even if skipped by LOD logic) - if (mTime > motionp->mSendStopTimestamp) + if (mAnimTime > motionp->mSendStopTimestamp) { // notify character of timed stop event on first iteration past sendstoptimestamp // this will only be called when an animation stops itself (runs out of time) @@ -585,7 +622,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty if (motionp->getFadeWeight() < 0.01f) { - if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) + if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { posep->setWeight(0.f); deactivateMotionInstance(motionp); @@ -601,7 +638,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty //********************** // MOTION INACTIVE //********************** - if (motionp->isStopped() && mTime > motionp->getStopTime() + motionp->getEaseOutDuration()) + if (motionp->isStopped() && mAnimTime > motionp->getStopTime() + motionp->getEaseOutDuration()) { // this motion has gone on too long, deactivate it // did we have a chance to stop it? @@ -623,7 +660,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty //********************** // MOTION EASE OUT //********************** - else if (motionp->isStopped() && mTime > motionp->getStopTime()) + else if (motionp->isStopped() && mAnimTime > motionp->getStopTime()) { // is this the first iteration in the ease out phase? if (mLastTime <= motionp->getStopTime()) @@ -638,22 +675,22 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } else { - posep->setWeight(motionp->getFadeWeight() * motionp->mResidualWeight * cubic_step(1.f - ((mTime - motionp->getStopTime()) / motionp->getEaseOutDuration()))); + posep->setWeight(motionp->getFadeWeight() * motionp->mResidualWeight * cubic_step(1.f - ((mAnimTime - motionp->getStopTime()) / motionp->getEaseOutDuration()))); } // perform motion update - update_result = motionp->onUpdate(mTime - motionp->mActivationTimestamp, last_joint_signature); + update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } //********************** // MOTION ACTIVE //********************** - else if (mTime > motionp->mActivationTimestamp + motionp->getEaseInDuration()) + else if (mAnimTime > motionp->mActivationTimestamp + motionp->getEaseInDuration()) { posep->setWeight(motionp->getFadeWeight()); //should we notify the simulator that this motion should be stopped? - if (mTime > motionp->mSendStopTimestamp) + if (mAnimTime > motionp->mSendStopTimestamp) { // notify character of timed stop event on first iteration past sendstoptimestamp // this will only be called when an animation stops itself (runs out of time) @@ -665,13 +702,13 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } // perform motion update - update_result = motionp->onUpdate(mTime - motionp->mActivationTimestamp, last_joint_signature); + update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } //********************** // MOTION EASE IN //********************** - else if (mTime >= motionp->mActivationTimestamp) + else if (mAnimTime >= motionp->mActivationTimestamp) { if (mLastTime < motionp->mActivationTimestamp) { @@ -684,10 +721,10 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty else { // perform motion update - posep->setWeight(motionp->getFadeWeight() * motionp->mResidualWeight + (1.f - motionp->mResidualWeight) * cubic_step((mTime - motionp->mActivationTimestamp) / motionp->getEaseInDuration())); + posep->setWeight(motionp->getFadeWeight() * motionp->mResidualWeight + (1.f - motionp->mResidualWeight) * cubic_step((mAnimTime - motionp->mActivationTimestamp) / motionp->getEaseInDuration())); } // perform motion update - update_result = motionp->onUpdate(mTime - motionp->mActivationTimestamp, last_joint_signature); + update_result = motionp->onUpdate(mAnimTime - motionp->mActivationTimestamp, last_joint_signature); } else { @@ -698,7 +735,7 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty // allow motions to deactivate themselves if (!update_result) { - if (!motionp->isStopped() || motionp->getStopTime() > mTime) + if (!motionp->isStopped() || motionp->getStopTime() > mAnimTime) { // animation has stopped itself due to internal logic // propagate this to the network @@ -714,18 +751,68 @@ void LLMotionController::updateMotionsByType(LLMotion::LLMotionBlendType anim_ty } } +//----------------------------------------------------------------------------- +// updateLoadingMotions() +//----------------------------------------------------------------------------- +void LLMotionController::updateLoadingMotions() +{ + // query pending motions for completion + for (motion_set_t::iterator iter = mLoadingMotions.begin(); + iter != mLoadingMotions.end(); ) + { + motion_set_t::iterator curiter = iter++; + LLMotion* motionp = *curiter; + if( !motionp) + { + continue; // maybe shouldn't happen but i've seen it -MG + } + LLMotion::LLMotionInitStatus status = motionp->onInitialize(mCharacter); + if (status == LLMotion::STATUS_SUCCESS) + { + mLoadingMotions.erase(curiter); + // add motion to our loaded motion list + mLoadedMotions.insert(motionp); + // this motion should be playing + if (!motionp->isStopped()) + { + activateMotionInstance(motionp, mAnimTime); + } + } + else if (status == LLMotion::STATUS_FAILURE) + { + llinfos << "Motion " << motionp->getID() << " init failed." << llendl; + sRegistry.markBad(motionp->getID()); + mLoadingMotions.erase(curiter); + mAllMotions.erase(motionp->getID()); + delete motionp; + } + } +} + +//----------------------------------------------------------------------------- +// call updateMotion() or updateMotionsMinimal() every frame +//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // updateMotion() //----------------------------------------------------------------------------- -void LLMotionController::updateMotion() +void LLMotionController::updateMotions(bool force_update) { BOOL use_quantum = (mTimeStep != 0.f); + // Always update mPrevTimerElapsed + F32 cur_time = mTimer.getElapsedTimeF32(); + F32 delta_time = cur_time - mPrevTimerElapsed; + mPrevTimerElapsed = cur_time; + mLastTime = mAnimTime; + + // Always cap the number of loaded motions + purgeExcessMotions(); + // Update timing info for this time step. if (!mPaused) { - F32 update_time = mTimeOffset + (mTimer.getElapsedTimeF32() * mTimeFactor); + F32 update_time = mAnimTime + delta_time * mTimeFactor; if (use_quantum) { F32 time_interval = fmodf(update_time, mTimeStep); @@ -741,7 +828,8 @@ void LLMotionController::updateMotion() mPoseBlender.interpolate(interp - mLastInterp); mLastInterp = interp; } - + + updateLoadingMotions(); return; } @@ -750,53 +838,24 @@ void LLMotionController::updateMotion() clearBlenders(); mTimeStepCount = quantum_count; - mLastTime = mTime; - mTime = (F32)quantum_count * mTimeStep; + mAnimTime = (F32)quantum_count * mTimeStep; mLastInterp = 0.f; } else { - mLastTime = mTime; - mTime = update_time; + mAnimTime = update_time; } } - // query pending motions for completion - for (motion_set_t::iterator iter = mLoadingMotions.begin(); - iter != mLoadingMotions.end(); ) - { - motion_set_t::iterator curiter = iter++; - LLMotion* motionp = *curiter; - if( !motionp) - { - continue; // maybe shouldn't happen but i've seen it -MG - } - LLMotion::LLMotionInitStatus status = motionp->onInitialize(mCharacter); - if (status == LLMotion::STATUS_SUCCESS) - { - mLoadingMotions.erase(curiter); - // add motion to our loaded motion list - addLoadedMotion(motionp); - // this motion should be playing - if (!motionp->isStopped()) - { - activateMotionInstance(motionp, mTime); - } - } - else if (status == LLMotion::STATUS_FAILURE) - { - llinfos << "Motion " << motionp->getID() << " init failed." << llendl; - sRegistry.markBad(motionp->getID()); - mLoadingMotions.erase(curiter); - - mAllMotions.erase(motionp->getID()); - delete motionp; - } - } + updateLoadingMotions(); resetJointSignatures(); - if (!mPaused) + if (mPaused && !force_update) + { + updateIdleActiveMotions(); + } + else { // update additive motions updateAdditiveMotions(); @@ -819,6 +878,23 @@ void LLMotionController::updateMotion() // llinfos << "Motion controller time " << motionTimer.getElapsedTimeF32() << llendl; } +//----------------------------------------------------------------------------- +// updateMotionsMinimal() +// minimal update (e.g. while hidden) +//----------------------------------------------------------------------------- +void LLMotionController::updateMotionsMinimal() +{ + // Always update mPrevTimerElapsed + mPrevTimerElapsed = mTimer.getElapsedTimeF32(); + + purgeExcessMotions(); + updateLoadingMotions(); + resetJointSignatures(); + + deactivateStoppedMotions(); + + mHasRunOnce = TRUE; +} //----------------------------------------------------------------------------- // activateMotionInstance() @@ -841,7 +917,6 @@ BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) } motion->mResidualWeight = motion->getPose()->getWeight(); - motion->mActivationTimestamp = time; // set stop time based on given duration and ease out time if (motion->getDuration() != 0.f && !motion->getLoop()) @@ -862,13 +937,26 @@ BOOL LLMotionController::activateMotionInstance(LLMotion *motion, F32 time) { motion->mSendStopTimestamp = F32_MAX; } - - mActiveMotions.remove(motion); // in case it is already in the active list + + if (motion->isActive()) + { + mActiveMotions.remove(motion); + } mActiveMotions.push_front(motion); - motion->activate(); + motion->activate(time); motion->onUpdate(0.f, mJointSignature[1]); + if (mAnimTime >= motion->mSendStopTimestamp) + { + motion->setStopTime(motion->mSendStopTimestamp); + if (motion->mResidualWeight == 0.0f) + { + // bit of a hack; if newly activating a motion while easing out, weight should = 1 + motion->mResidualWeight = 1.f; + } + } + return TRUE; } @@ -925,9 +1013,17 @@ bool LLMotionController::isMotionLoading(LLMotion* motion) //----------------------------------------------------------------------------- // findMotion() //----------------------------------------------------------------------------- -LLMotion *LLMotionController::findMotion(const LLUUID& id) +LLMotion* LLMotionController::findMotion(const LLUUID& id) { - return get_if_there<LLUUID, LLMotion*>(mAllMotions, id, NULL); + motion_map_t::iterator iter = mAllMotions.find(id); + if(iter == mAllMotions.end()) + { + return NULL; + } + else + { + return iter->second; + } } //----------------------------------------------------------------------------- @@ -935,16 +1031,12 @@ LLMotion *LLMotionController::findMotion(const LLUUID& id) //----------------------------------------------------------------------------- void LLMotionController::deactivateAllMotions() { - //They must all die, precious. - for (std::map<LLUUID, LLMotion*>::iterator iter = mAllMotions.begin(); + for (motion_map_t::iterator iter = mAllMotions.begin(); iter != mAllMotions.end(); iter++) { LLMotion* motionp = iter->second; - if (motionp) motionp->deactivate(); + deactivateMotionInstance(motionp); } - - // delete all motion instances - deleteAllMotions(); } @@ -960,11 +1052,12 @@ void LLMotionController::flushAllMotions() { motion_list_t::iterator curiter = iter++; LLMotion* motionp = *curiter; - F32 dtime = mTime - motionp->mActivationTimestamp; + F32 dtime = mAnimTime - motionp->mActivationTimestamp; active_motions.push_back(std::make_pair(motionp->getID(),dtime)); - motionp->deactivate(); + motionp->deactivate(); // don't call deactivateMotionInstance() because we are going to reactivate it } - + mActiveMotions.clear(); + // delete all motion instances deleteAllMotions(); @@ -983,12 +1076,11 @@ void LLMotionController::flushAllMotions() //----------------------------------------------------------------------------- // pause() //----------------------------------------------------------------------------- -void LLMotionController::pause() +void LLMotionController::pauseAllMotions() { if (!mPaused) { //llinfos << "Pausing animations..." << llendl; - mPauseTime = mTimer.getElapsedTimeF32(); mPaused = TRUE; } @@ -997,13 +1089,11 @@ void LLMotionController::pause() //----------------------------------------------------------------------------- // unpause() //----------------------------------------------------------------------------- -void LLMotionController::unpause() +void LLMotionController::unpauseAllMotions() { if (mPaused) { //llinfos << "Unpausing animations..." << llendl; - mTimer.reset(); - mTimer.setAge(mPauseTime); mPaused = FALSE; } } diff --git a/indra/llcharacter/llmotioncontroller.h b/indra/llcharacter/llmotioncontroller.h index c6749c5c36..4da6d8ac57 100644 --- a/indra/llcharacter/llmotioncontroller.h +++ b/indra/llcharacter/llmotioncontroller.h @@ -57,30 +57,6 @@ class LLCharacter; //----------------------------------------------------------------------------- typedef LLMotion*(*LLMotionConstructor)(const LLUUID &id); -class LLMotionTableEntry -{ -public: - LLMotionTableEntry(); - LLMotionTableEntry(LLMotionConstructor constructor, const LLUUID& id); - ~LLMotionTableEntry(){}; - - LLMotion* create(const LLUUID& id); - static BOOL uuidEq(const LLUUID &uuid, const LLMotionTableEntry &id_pair) - { - if (uuid == id_pair.mID) - { - return TRUE; - } - return FALSE; - } - - const LLUUID& getID() { return mID; } - -protected: - LLMotionConstructor mConstructor; - LLUUID mID; -}; - class LLMotionRegistry { public: @@ -92,7 +68,7 @@ public: // adds motion classes to the registry // returns true if successfull - BOOL addMotion( const LLUUID& id, LLMotionConstructor create); + BOOL registerMotion( const LLUUID& id, LLMotionConstructor create); // creates a new instance of a named motion // returns NULL motion is not registered @@ -103,7 +79,8 @@ public: protected: - LLUUIDHashMap<LLMotionTableEntry, 32> mMotionTable; + typedef std::map<LLUUID, LLMotionConstructor> motion_map_t; + motion_map_t mMotionTable; }; //----------------------------------------------------------------------------- @@ -130,7 +107,7 @@ public: // registers a motion with the controller // (actually just forwards call to motion registry) // returns true if successfull - BOOL addMotion( const LLUUID& id, LLMotionConstructor create ); + BOOL registerMotion( const LLUUID& id, LLMotionConstructor create ); // creates a motion from the registry LLMotion *createMotion( const LLUUID &id ); @@ -151,11 +128,17 @@ public: // returns true if successful BOOL stopMotionLocally( const LLUUID &id, BOOL stop_immediate ); + // Move motions from loading to loaded + void updateLoadingMotions(); + // update motions // invokes the update handlers for each active motion // activates sequenced motions // deactivates terminated motions` - void updateMotion(); + void updateMotions(bool force_update = false); + + // minimal update (e.g. while hidden) + void updateMotionsMinimal(); void clearBlenders() { mPoseBlender.clearBlenders(); } @@ -167,8 +150,8 @@ public: void deactivateAllMotions(); // pause and continue all motions - void pause(); - void unpause(); + void pauseAllMotions(); + void unpauseAllMotions(); BOOL isPaused() { return mPaused; } void setTimeStep(F32 step); @@ -178,6 +161,8 @@ public: motion_list_t& getActiveMotions() { return mActiveMotions; } + void incMotionCounts(S32& num_motions, S32& num_loading_motions, S32& num_loaded_motions, S32& num_active_motions, S32& num_deprecated_motions); + //protected: bool isMotionActive( LLMotion *motion ); bool isMotionLoading( LLMotion *motion ); @@ -187,7 +172,6 @@ protected: // internal operations act on motion instances directly // as there can be duplicate motions per id during blending overlap void deleteAllMotions(); - void addLoadedMotion(LLMotion *motion); BOOL activateMotionInstance(LLMotion *motion, F32 time); BOOL deactivateMotionInstance(LLMotion *motion); void deprecateMotionInstance(LLMotion* motion); @@ -197,6 +181,10 @@ protected: void updateAdditiveMotions(); void resetJointSignatures(); void updateMotionsByType(LLMotion::LLMotionBlendType motion_type); + void updateIdleMotion(LLMotion* motionp); + void updateIdleActiveMotions(); + void purgeExcessMotions(); + void deactivateStoppedMotions(); protected: F32 mTimeFactor; @@ -210,20 +198,20 @@ protected: // Animations are instantiated and immediately put in the mAllMotions map for their entire lifetime. // If the animations depend on any asset data, the appropriate data is fetched from the data server, // and the animation is put on the mLoadingMotions list. -// Once an animations is loaded, it will be initialized and put on the mLoadedMotions deque. +// Once an animations is loaded, it will be initialized and put on the mLoadedMotions list. // Any animation that is currently playing also sits in the mActiveMotions list. typedef std::map<LLUUID, LLMotion*> motion_map_t; motion_map_t mAllMotions; motion_set_t mLoadingMotions; - motion_list_t mLoadedMotions; + motion_set_t mLoadedMotions; motion_list_t mActiveMotions; motion_set_t mDeprecatedMotions; LLFrameTimer mTimer; - F32 mTime; - F32 mTimeOffset; + F32 mPrevTimerElapsed; + F32 mAnimTime; F32 mLastTime; BOOL mHasRunOnce; BOOL mPaused; diff --git a/indra/llcommon/llmemory.cpp b/indra/llcommon/llmemory.cpp index 4ca6a12435..56879f4e73 100644 --- a/indra/llcommon/llmemory.cpp +++ b/indra/llcommon/llmemory.cpp @@ -36,12 +36,8 @@ # include <psapi.h> #elif defined(LL_DARWIN) # include <sys/types.h> -# include <sys/sysctl.h> # include <mach/task.h> -# include <mach/vm_map.h> # include <mach/mach_init.h> -# include <mach/vm_region.h> -# include <mach/mach_port.h> #elif defined(LL_LINUX) # include <unistd.h> #endif @@ -314,13 +310,18 @@ U64 getCurrentRSS() #elif defined(LL_DARWIN) -// This can cause bad stalls! Replace with fast version - -// static U32 getPageSize() -// { -// int ctl[2] = { CTL_HW, HW_PAGESIZE }; -// int page_size; -// size_t size = sizeof(page_size); +/* + The API used here is not capable of dealing with 64-bit memory sizes, but is available before 10.4. + + Once we start requiring 10.4, we can use the updated API, which looks like this: + + task_basic_info_64_data_t basicInfo; + mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_64_COUNT; + if (task_info(mach_task_self(), TASK_BASIC_INFO_64, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) + + Of course, this doesn't gain us anything unless we start building the viewer as a 64-bit executable, since that's the only way + for our memory allocation to exceed 2^32. +*/ // if (sysctl(ctl, 2, &page_size, &size, NULL, 0) == -1) // { @@ -333,58 +334,25 @@ U64 getCurrentRSS() U64 getCurrentRSS() { - // Stalls!!! - -// task_t task = mach_task_self(); -// vm_address_t addr = VM_MIN_ADDRESS; -// vm_size_t size = 0; -// U64 residentPages = 0; + U64 residentSize = 0; -// while (true) -// { -// mach_msg_type_number_t bcount = VM_REGION_BASIC_INFO_COUNT; -// vm_region_basic_info binfo; -// mach_port_t bobj; -// kern_return_t ret; - -// addr += size; - -// ret = vm_region(task, &addr, &size, VM_REGION_BASIC_INFO, -// (vm_region_info_t) &binfo, &bcount, &bobj); - -// if (ret != KERN_SUCCESS) -// { -// break; -// } - -// if (bobj != MACH_PORT_NULL) -// { -// mach_port_deallocate(task, bobj); -// } - -// mach_msg_type_number_t ecount = VM_REGION_EXTENDED_INFO_COUNT; -// vm_region_extended_info einfo; -// mach_port_t eobj; - -// ret = vm_region(task, &addr, &size, VM_REGION_EXTENDED_INFO, -// (vm_region_info_t) &einfo, &ecount, &eobj); - -// if (ret != KERN_SUCCESS) -// { -// llwarns << "vm_region failed" << llendl; -// return 0; -// } - -// if (eobj != MACH_PORT_NULL) -// { -// mach_port_deallocate(task, eobj); -// } + task_basic_info_data_t basicInfo; + mach_msg_type_number_t basicInfoCount = TASK_BASIC_INFO_COUNT; + if (task_info(mach_task_self(), TASK_BASIC_INFO, (task_info_t)&basicInfo, &basicInfoCount) == KERN_SUCCESS) + { + residentSize = basicInfo.resident_size; -// residentPages += einfo.pages_resident; -// } + // If we ever wanted it, the process virtual size is also available as: + // virtualSize = basicInfo.virtual_size; + +// llinfos << "resident size is " << residentSize << llendl; + } + else + { + llwarns << "task_info failed" << llendl; + } -// return residentPages * getPageSize(); - return 0; + return residentSize; } #elif defined(LL_LINUX) diff --git a/indra/llcommon/llversionviewer.h b/indra/llcommon/llversionviewer.h index 2cdb55eb19..bed6c1dda5 100644 --- a/indra/llcommon/llversionviewer.h +++ b/indra/llcommon/llversionviewer.h @@ -34,7 +34,7 @@ const S32 LL_VERSION_MAJOR = 1; const S32 LL_VERSION_MINOR = 20; -const S32 LL_VERSION_PATCH = 9; +const S32 LL_VERSION_PATCH = 11; const S32 LL_VERSION_BUILD = 0; const char * const LL_CHANNEL = "Second Life Release"; diff --git a/indra/llcommon/llworkerthread.cpp b/indra/llcommon/llworkerthread.cpp index d828ed9468..f3be5a2690 100644 --- a/indra/llcommon/llworkerthread.cpp +++ b/indra/llcommon/llworkerthread.cpp @@ -36,6 +36,7 @@ #include "llframecallbackmanager.h" #endif +BOOL LLWorkerClass::sDeleteLock = FALSE ; //============================================================================ // Run on MAIN thread @@ -94,6 +95,7 @@ S32 LLWorkerThread::update(U32 max_time_ms) { (*iter)->abortWork(false); } + LLWorkerClass::sDeleteLock = TRUE ; for (std::vector<LLWorkerClass*>::iterator iter = delete_list.begin(); iter != delete_list.end(); ++iter) { @@ -107,6 +109,7 @@ S32 LLWorkerThread::update(U32 max_time_ms) } delete *iter; } + LLWorkerClass::sDeleteLock = FALSE ; // delete and aborted entries mean there's still work to do res += delete_list.size() + abort_list.size(); return res; diff --git a/indra/llcommon/llworkerthread.h b/indra/llcommon/llworkerthread.h index be06bc2a58..793155308b 100644 --- a/indra/llcommon/llworkerthread.h +++ b/indra/llcommon/llworkerthread.h @@ -118,6 +118,9 @@ class LLWorkerClass { friend class LLWorkerThread; friend class LLWorkerThread::WorkRequest; + +public: + static BOOL sDeleteLock ; public: typedef LLWorkerThread::handle_t handle_t; enum FLAGS @@ -178,6 +181,7 @@ private: void setFlags(U32 flags) { mWorkFlags = mWorkFlags | flags; } void clearFlags(U32 flags) { mWorkFlags = mWorkFlags & ~flags; } U32 getFlags() { return mWorkFlags; } +public: bool getFlags(U32 flags) { return mWorkFlags & flags ? true : false; } private: diff --git a/indra/llcrashlogger/llcrashlogger.cpp b/indra/llcrashlogger/llcrashlogger.cpp index 32dea6c707..076149bcf4 100755 --- a/indra/llcrashlogger/llcrashlogger.cpp +++ b/indra/llcrashlogger/llcrashlogger.cpp @@ -96,6 +96,33 @@ LLCrashLogger::~LLCrashLogger() } +// TRIM_SIZE must remain larger than LINE_SEARCH_SIZE. +const int TRIM_SIZE = 128000; +const int LINE_SEARCH_DIST = 500; +const std::string SKIP_TEXT = "\n ...Skipping... \n"; +void trimSLLog(std::string& sllog) +{ + if(sllog.length() > TRIM_SIZE * 2) + { + std::string::iterator head = sllog.begin() + TRIM_SIZE; + std::string::iterator tail = sllog.begin() + sllog.length() - TRIM_SIZE; + std::string::iterator new_head = std::find(head, head - LINE_SEARCH_DIST, '\n'); + if(new_head != head - LINE_SEARCH_DIST) + { + head = new_head; + } + + std::string::iterator new_tail = std::find(tail, tail + LINE_SEARCH_DIST, '\n'); + if(new_tail != tail + LINE_SEARCH_DIST) + { + tail = new_tail; + } + + sllog.erase(head, tail); + sllog.insert(head, SKIP_TEXT.begin(), SKIP_TEXT.end()); + } +} + void LLCrashLogger::gatherFiles() { @@ -129,7 +156,15 @@ void LLCrashLogger::gatherFiles() LLSDSerialize::fromXML(mDebugLog, debug_log_file); mFileMap["SecondLifeLog"] = mDebugLog["SLLog"].asString(); mFileMap["SettingsXml"] = mDebugLog["SettingsFilename"].asString(); - LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); + if(mDebugLog.has("CAFilename")) + { + LLCurl::setCAFile(mDebugLog["CAFilename"].asString()); + } + else + { + LLCurl::setCAFile(gDirUtilp->getCAFile()); + } + llinfos << "Using log file from debug log " << mFileMap["SecondLifeLog"] << llendl; llinfos << "Using settings file from debug log " << mFileMap["SettingsXml"] << llendl; } @@ -150,6 +185,17 @@ void LLCrashLogger::gatherFiles() mCrashHost += mDebugLog["CurrentSimHost"].asString(); mCrashHost += ":12043/crash/report"; } + else if(mDebugLog.has("GridName")) + { + // This is a 'little' hacky, but its the best simple solution. + std::string grid_host = mDebugLog["GridName"].asString(); + LLStringUtil::toLower(grid_host); + + mCrashHost = "https://login."; + mCrashHost += grid_host; + mCrashHost += ".lindenlab.com:12043/crash/report"; + } + // Use login servers as the alternate, since they are already load balanced and have a known name mAltCrashHost = "https://login.agni.lindenlab.com:12043/crash/report"; @@ -169,7 +215,14 @@ void LLCrashLogger::gatherFiles() } std::stringstream s; s << f.rdbuf(); - mCrashInfo[(*itr).first] = s.str(); + + std::string crash_info = s.str(); + if(itr->first == "SecondLifeLog") + { + trimSLLog(crash_info); + } + + mCrashInfo[(*itr).first] = crash_info; } } diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp index 66b84c9a08..1c8fb4234f 100644 --- a/indra/llimage/llimage.cpp +++ b/indra/llimage/llimage.cpp @@ -842,8 +842,8 @@ void LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data ) U8* temp_buffer = new U8[ temp_data_size ]; if (!temp_buffer) { - llerrs << "Out of memory in LLImageRaw::scale( S32 new_width, S32 new_height, BOOL scale_image_data )" << llendl; - return; + llerrs << "Out of memory in LLImageRaw::scale: old (w, h, c) = (" << old_width << ", " << old_height << ", " << (S32)getComponents() << + ") ; new (w, h, c) = (" << new_width << ", " << new_height << ", " << (S32)getComponents() << ")" << llendl; } memcpy(temp_buffer, getData(), temp_data_size); /* Flawfinder: ignore */ diff --git a/indra/llrender/llimagegl.cpp b/indra/llrender/llimagegl.cpp index f020730d4a..1c9b4d9693 100644 --- a/indra/llrender/llimagegl.cpp +++ b/indra/llrender/llimagegl.cpp @@ -61,8 +61,6 @@ S32 LLImageGL::sCount = 0; BOOL LLImageGL::sGlobalUseAnisotropic = FALSE; F32 LLImageGL::sLastFrameTime = 0.f; -BOOL LLImageGL::sRefCheck = TRUE ; - std::set<LLImageGL*> LLImageGL::sImageList; //---------------------------------------------------------------------------- @@ -279,9 +277,7 @@ LLImageGL::LLImageGL(const LLImageRaw* imageraw, BOOL usemipmaps) sImageList.insert(this); sCount++; - sRefCheck = FALSE ; createGLTexture(0, imageraw); - sRefCheck = TRUE ; } LLImageGL::~LLImageGL() @@ -426,9 +422,7 @@ void LLImageGL::dump() //---------------------------------------------------------------------------- BOOL LLImageGL::bindTextureInternal(const S32 stage) const -{ - llassert_always(!sRefCheck || (getNumRefs() > 0 && getNumRefs() < 100000)) ; - +{ if (gGLManager.mIsDisabled) { llwarns << "Trying to bind a texture while GL is disabled!" << llendl; diff --git a/indra/llrender/llimagegl.h b/indra/llrender/llimagegl.h index c5fe9b7299..8aeecb3627 100644 --- a/indra/llrender/llimagegl.h +++ b/indra/llrender/llimagegl.h @@ -207,9 +207,6 @@ public: #else BOOL getMissed() const { return FALSE; }; #endif - -private://paranoia error check - static BOOL sRefCheck ; }; #endif // LL_LLIMAGEGL_H diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp index 681c5ce5da..0bc5bc60de 100644 --- a/indra/llui/llscrolllistctrl.cpp +++ b/indra/llui/llscrolllistctrl.cpp @@ -1107,11 +1107,15 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) BOOL success = FALSE; S32 index = 0; - for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); iter++) + for (item_list::iterator iter = mItemList.begin(); iter != mItemList.end(); ) { LLScrollListItem *itemp = *iter; - - llassert_always(itemp) ; + if(!itemp) + { + iter = mItemList.erase(iter); + continue ; + } + if( index >= first_index && index <= last_index ) { if( itemp->getEnabled() ) @@ -1125,6 +1129,7 @@ BOOL LLScrollListCtrl::selectItemRange( S32 first_index, S32 last_index ) deselectItem(itemp); } index++; + iter++ ; } if (mCommitOnSelectionChange) diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp index ccff4f3161..4a81ddd1fd 100644 --- a/indra/llwindow/llwindowwin32.cpp +++ b/indra/llwindow/llwindowwin32.cpp @@ -1343,9 +1343,6 @@ BOOL LLWindowWin32::switchContext(BOOL fullscreen, const LLCoordScreen &size, BO SetWindowLong(mWindowHandle, GWL_USERDATA, (U32)this); show(); - //make sure multi sampling is disabled by default - glDisable(GL_MULTISAMPLE_ARB); - //register joystick timer callback SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer @@ -1368,7 +1365,9 @@ void LLWindowWin32::moveWindow( const LLCoordScreen& position, const LLCoordScre // if the window was already maximized, MoveWindow seems to still set the maximized flag even if // the window is smaller than maximized. // So we're going to do a restore first (which is a ShowWindow call) (SL-44655). - ShowWindow(mWindowHandle, SW_RESTORE); + + // THIS CAUSES DEV-15484 and DEV-15949 + //ShowWindow(mWindowHandle, SW_RESTORE); // NOW we can call MoveWindow MoveWindow(mWindowHandle, position.mX, position.mY, size.mX, size.mY, TRUE); } diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 5f649d1f8d..14f8acb551 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -603,9 +603,10 @@ extern "C" { int yyerror(const char *fmt, ...); } "CLICK_ACTION_OPEN_MEDIA" { count(); yylval.ival = CLICK_ACTION_OPEN_MEDIA; return(INTEGER_CONSTANT); } "TEXTURE_BLANK" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "5748decc-f629-461c-9a36-a35a221fe21f"); return(STRING_CONSTANT); } -"TEXTURE_DEFAULT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"); return(STRING_CONSTANT); } -"TEXTURE_PLYWOOD" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); } -"TEXTURE_TRANSPARENT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "59facb66-4a72-40a2-815c-7d9b42c56f60"); return(STRING_CONSTANT); } +"TEXTURE_DEFAULT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); } +"TEXTURE_MEDIA" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"); return(STRING_CONSTANT); } +"TEXTURE_PLYWOOD" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); } +"TEXTURE_TRANSPARENT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); return(STRING_CONSTANT); } {L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); } diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index eb04b430d7..e185d96c98 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -5797,17 +5797,6 @@ <key>Value</key> <integer>1</integer> </map> - <key>RenderDynamicReflections</key> - <map> - <key>Comment</key> - <string>Generate a dynamic cube map for reflections (objects reflect their environment, experimental).</string> - <key>Persist</key> - <integer>1</integer> - <key>Type</key> - <string>Boolean</string> - <key>Value</key> - <integer>0</integer> - </map> <key>RenderFSAASamples</key> <map> <key>Comment</key> @@ -9961,11 +9950,11 @@ <key>Comment</key> <string>Controls whether the thread watchdog timer is activated.</string> <key>Persist</key> - <integer>1</integer> + <integer>0</integer> <key>Type</key> <string>Boolean</string> <key>Value</key> - <integer>1</integer> + <integer>0</integer> </map> <key>WaterEditPresets</key> <map> diff --git a/indra/newview/gpu_table.txt b/indra/newview/gpu_table.txt index f0b0f0c514..f038e0f64d 100644 --- a/indra/newview/gpu_table.txt +++ b/indra/newview/gpu_table.txt @@ -186,6 +186,7 @@ NVIDIA GeForce Go 6700 .*NVIDIA.*GeForce Go 67.* 1 1 NVIDIA GeForce Go 6800 .*NVIDIA.*GeForce Go 68.* 1 1 NVIDIA GeForce Go 7200 .*NVIDIA.*GeForce Go 72.* 1 1 NVIDIA GeForce Go 7300 .*NVIDIA.*GeForce Go 73.* 1 1 +NVIDIA GeForce Go 7300 LE .*NVIDIA.*GeForce Go 73.*LE.* 0 1 NVIDIA GeForce Go 7400 .*NVIDIA.*GeForce Go 74.* 1 1 NVIDIA GeForce Go 7600 .*NVIDIA.*GeForce Go 76.* 2 1 NVIDIA GeForce Go 7700 .*NVIDIA.*GeForce Go 77.* 2 1 @@ -194,6 +195,7 @@ NVIDIA GeForce Go 7900 .*NVIDIA.*GeForce Go 79.* 2 1 NVIDIA GeForce Go 6 .*GeForce Go 6.* 1 1 NVIDIA GeForce PCX .*GeForce PCX.* 0 1 NVIDIA Generic .*NVIDIA.*Unknown.* 0 0 +NVIDIA NV34 .*NVIDIA.*NV34.* 0 1 NVIDIA NV43 .*NVIDIA.*NV43.* 1 1 NVIDIA MCP78 .*NVIDIA.*MCP78.* 1 1 NVIDIA Quadro2 .*Quadro2.* 0 1 diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index 9d2ea7a1b7..e926e97f76 100644 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -94,6 +94,7 @@ #include "llsky.h" #include "llrendersphere.h" #include "llstatusbar.h" +#include "llstartup.h" #include "llimview.h" #include "lltool.h" #include "lltoolfocus.h" @@ -6432,7 +6433,6 @@ BOOL LLAgent::isWearingItem( const LLUUID& item_id ) return (getWearableFromWearableItem( item_id ) != NULL); } - // static void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void** user_data ) { @@ -6471,8 +6471,12 @@ void LLAgent::processAgentInitialWearablesUpdate( LLMessageSystem* mesgsys, void //avatar->createStandardWearables(); // no, deal with it by noting that we need to choose a - // gender. - gAgent.setGenderChosen(FALSE); + // gender, but only if an initial outfit load isn't happening. + // This whole check (num_wearables < 4) can probably be deleted. JC + if (gInitialOutfit.empty()) + { + gAgent.setGenderChosen(FALSE); + } return; } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 0c7a5e23ae..c040dae469 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -402,13 +402,13 @@ bool handleCrashSubmitBehaviorChanged(const LLSD& newvalue) const S32 NEVER_SUBMIT_REPORT = 2; if(cb == NEVER_SUBMIT_REPORT) { -// LLWatchdog::getInstance()->cleanup(); // SJB: cleaning up a running watchdog is unsafe +// LLWatchdog::getInstance()->cleanup(); // SJB: cleaning up a running watchdog thread is unsafe LLAppViewer::instance()->destroyMainloopTimeout(); } else if(gSavedSettings.getBOOL("WatchdogEnabled") == TRUE) { -// LLWatchdog::getInstance()->init(); -// LLAppViewer::instance()->initMainloopTimeout("Mainloop Resume"); + // Don't re-enable the watchdog when we change the setting; this may get called before it's started +// LLWatchdog::getInstance()->init(); } return true; } @@ -530,7 +530,7 @@ void LLAppViewer::initGridChoice() std::string custom_server = gSavedSettings.getString("CustomServer"); LLViewerLogin::getInstance()->setGridChoice(custom_server); } - else if(server != 0) + else if(server != (S32)GRID_INFO_NONE) { LLViewerLogin::getInstance()->setGridChoice((EGridInfo)server); } @@ -1139,12 +1139,12 @@ bool LLAppViewer::cleanup() llinfos << "Cleaning Up" << llendflush; - LLKeyframeDataCache::clear(); - // Must clean up texture references before viewer window is destroyed. LLHUDObject::cleanupHUDObjects(); llinfos << "HUD Objects cleaned up" << llendflush; + LLKeyframeDataCache::clear(); + // End TransferManager before deleting systems it depends on (Audio, VFS, AssetStorage) #if 0 // this seems to get us stuck in an infinite loop... gTransferManager.cleanup(); @@ -1321,7 +1321,7 @@ bool LLAppViewer::cleanup() removeMarkerFile(); // Any crashes from here on we'll just have to ignore - closeDebug(); + writeDebugInfo(); // Let threads finish LLTimer idleTimer; @@ -1579,6 +1579,7 @@ bool LLAppViewer::initConfiguration() // on these platform to help debug. #ifndef LL_RELEASE_FOR_DOWNLOAD gSavedSettings.setBOOL("WatchdogEnabled", FALSE); + gSavedSettings.setBOOL("QAMode", TRUE ); #endif #ifndef LL_WINDOWS @@ -1630,15 +1631,6 @@ bool LLAppViewer::initConfiguration() // Do this *before* loading the settings file LLAlertDialog::parseAlerts("alerts.xml", &gSavedSettings, TRUE); -#if LL_DYNAMIC_FONT_DISCOVERY - // Linux does *dynamic* font discovery which is preferable to - // whatever got written-out into the config file last time. This - // does remove the ability of the user to hand-define the fallbacks - // though, so from a config-management point of view this is hacky. - gSavedSettings.setString("FontSansSerifFallback", - LLWindow::getFontListSans()); -#endif - // - read command line settings. LLControlGroupCLP clp; std::string cmd_line_config = gDirUtilp->getExpandedFilename(LL_PATH_APP_SETTINGS, @@ -1683,6 +1675,15 @@ bool LLAppViewer::initConfiguration() // - load overrides from user_settings loadSettingsFromDirectory(LL_PATH_USER_SETTINGS); +#if LL_DYNAMIC_FONT_DISCOVERY + // Linux does *dynamic* font discovery which is preferable to + // whatever got written-out into the config file last time. This + // does remove the ability of the user to hand-define the fallbacks + // though, so from a config-management point of view this is hacky. + gSavedSettings.setString("FontSansSerifFallback", + LLWindow::getFontListSans()); +#endif + // - apply command line settings clp.notify(); @@ -2133,7 +2134,7 @@ bool LLAppViewer::initWindow() return true; } -void LLAppViewer::closeDebug() +void LLAppViewer::writeDebugInfo() { std::string debug_filename = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"debug_info.log"); llinfos << "Opening debug file " << debug_filename << llendl; @@ -2212,6 +2213,8 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["ClientInfo"]["PatchVersion"] = LL_VERSION_PATCH; gDebugInfo["ClientInfo"]["BuildVersion"] = LL_VERSION_BUILD; + gDebugInfo["CAFilename"] = gDirUtilp->getCAFile(); + gDebugInfo["CPUInfo"]["CPUString"] = gSysCPU.getCPUString(); gDebugInfo["CPUInfo"]["CPUFamily"] = gSysCPU.getFamily(); gDebugInfo["CPUInfo"]["CPUMhz"] = gSysCPU.getMhz(); @@ -2222,7 +2225,11 @@ void LLAppViewer::writeSystemInfo() gDebugInfo["RAMInfo"]["Physical"] = (LLSD::Integer)(gSysMemory.getPhysicalMemoryKB()); gDebugInfo["RAMInfo"]["Allocated"] = (LLSD::Integer)(gMemoryAllocated>>10); // MB -> KB gDebugInfo["OSInfo"] = getOSInfo().getOSStringSimple(); - + + // The user is not logged on yet, but record the current grid choice login url + // which may have been the intended grid. This can b + gDebugInfo["GridName"] = LLViewerLogin::getInstance()->getGridLabel(); + // *FIX:Mani - move this ddown in llappviewerwin32 #ifdef LL_WINDOWS DWORD thread_id = GetCurrentThreadId(); @@ -2246,6 +2253,8 @@ void LLAppViewer::writeSystemInfo() LL_INFOS("SystemInfo") << "Memory info:\n" << gSysMemory << LL_ENDL; LL_INFOS("SystemInfo") << "OS: " << getOSInfo().getOSStringSimple() << LL_ENDL; LL_INFOS("SystemInfo") << "OS info: " << getOSInfo() << LL_ENDL; + + writeDebugInfo(); // Save out debug_info.log early, in case of crash. } void LLAppViewer::handleSyncViewerCrash() @@ -2259,9 +2268,6 @@ void LLAppViewer::handleViewerCrash() { llinfos << "Handle viewer crash entry." << llendl; - // Make sure the watchdog gets turned off... -// LLWatchdog::getInstance()->cleanup(); // SJB: This causes the Watchdog to hang for an extra 20-40s?! - LLAppViewer* pApp = LLAppViewer::instance(); if (pApp->beingDebugged()) { @@ -2277,6 +2283,9 @@ void LLAppViewer::handleViewerCrash() } pApp->mReportedCrash = TRUE; + // Make sure the watchdog gets turned off... +// pApp->destroyMainloopTimeout(); // SJB: Bah. This causes the crash handler to hang, not sure why. + //We already do this in writeSystemInfo(), but we do it again here to make /sure/ we have a version //to check against no matter what gDebugInfo["ClientInfo"]["Name"] = gSavedSettings.getString("VersionChannelName"); @@ -2365,7 +2374,7 @@ void LLAppViewer::handleViewerCrash() LLWorld::getInstance()->getInfo(gDebugInfo); // Close the debug file - pApp->closeDebug(); + pApp->writeDebugInfo(); LLError::logToFile(""); diff --git a/indra/newview/llappviewer.h b/indra/newview/llappviewer.h index 228f6e4baf..4bafca25a4 100644 --- a/indra/newview/llappviewer.h +++ b/indra/newview/llappviewer.h @@ -70,7 +70,7 @@ public: bool quitRequested() { return mQuitRequested; } bool logoutRequestSent() { return mLogoutRequestSent; } - void closeDebug(); + void writeDebugInfo(); const LLOSInfo& getOSInfo() const { return mSysOSInfo; } diff --git a/indra/newview/lldrawable.cpp b/indra/newview/lldrawable.cpp index a03adfa338..6f5dc1d3e7 100644 --- a/indra/newview/lldrawable.cpp +++ b/indra/newview/lldrawable.cpp @@ -122,7 +122,11 @@ void LLDrawable::destroy() sNumZombieDrawables--; } - LLFace::sDeleteLock = mFaces.size() ; + if (LLSpatialGroup::sNoDelete) + { + llerrs << "Illegal deletion of LLDrawable!" << llendl; + } + std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); mFaces.clear(); @@ -185,7 +189,6 @@ void LLDrawable::cleanupReferences() { LLFastTimer t(LLFastTimer::FTM_PIPELINE); - LLFace::sDeleteLock = mFaces.size() ; std::for_each(mFaces.begin(), mFaces.end(), DeletePointer()); mFaces.clear(); @@ -279,7 +282,6 @@ void LLDrawable::setNumFaces(const S32 newFaces, LLFacePool *poolp, LLViewerImag } else if (newFaces < (S32)mFaces.size()) { - LLFace::sDeleteLock = (S32)mFaces.size() - newFaces ; std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer()); mFaces.erase(mFaces.begin() + newFaces, mFaces.end()); } @@ -303,7 +305,6 @@ void LLDrawable::setNumFacesFast(const S32 newFaces, LLFacePool *poolp, LLViewer } else if (newFaces < (S32)mFaces.size()) { - LLFace::sDeleteLock = (S32)mFaces.size() - newFaces ; std::for_each(mFaces.begin() + newFaces, mFaces.end(), DeletePointer()); mFaces.erase(mFaces.begin() + newFaces, mFaces.end()); } @@ -338,12 +339,8 @@ void LLDrawable::deleteFaces(S32 offset, S32 count) face_list_t::iterator face_begin = mFaces.begin() + offset; face_list_t::iterator face_end = face_begin + count; - S32 end = (S32)mFaces.size() ; - LLFace::sDeleteLock = count ; std::for_each(face_begin, face_end, DeletePointer()); mFaces.erase(face_begin, face_end); - - llassert_always(mFaces.size() == end - count) ; } void LLDrawable::update() @@ -521,7 +518,7 @@ F32 LLDrawable::updateXform(BOOL undamped) } if ((mCurrentScale != target_scale) || - (!isRoot() && (dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED*camdist2))) + (!isRoot() && (dist_squared >= MIN_INTERPOLATE_DISTANCE_SQUARED) || !mVObjp->getAngularVelocity().isExactlyZero())) { //child prim moving or scale change requires immediate rebuild gPipeline.markRebuild(this, LLDrawable::REBUILD_POSITION, TRUE); } diff --git a/indra/newview/lldrawpoolalpha.cpp b/indra/newview/lldrawpoolalpha.cpp index 5cc4e37c97..fe2c2041ae 100644 --- a/indra/newview/lldrawpoolalpha.cpp +++ b/indra/newview/lldrawpoolalpha.cpp @@ -230,7 +230,6 @@ void LLDrawPoolAlpha::renderGroupAlpha(LLSpatialGroup* group, U32 type, U32 mask if (texture && params.mTexture.notNull()) { - llassert_always(gGL.getTexUnit(0)) ; gGL.getTexUnit(0)->activate(); params.mTexture->bind(); params.mTexture->addTextureStats(params.mVSize); diff --git a/indra/newview/lldrawpoolavatar.cpp b/indra/newview/lldrawpoolavatar.cpp index f1d88aa54a..04a7cfd8a0 100644 --- a/indra/newview/lldrawpoolavatar.cpp +++ b/indra/newview/lldrawpoolavatar.cpp @@ -452,7 +452,7 @@ void LLDrawPoolAvatar::renderAvatars(LLVOAvatar* single_avatar, S32 pass) return; } - if (single_avatar && avatarp->mSpecialRenderMode >= 2) // 2=image preview, 3=morph view + if (single_avatar && avatarp->mSpecialRenderMode >= 1) // 1=anim preview, 2=image preview, 3=morph view { gPipeline.enableLightsAvatarEdit(LLColor4(.5f, .5f, .5f, 1.f)); } diff --git a/indra/newview/lldrawpoolbump.cpp b/indra/newview/lldrawpoolbump.cpp index 1784fccf1f..56dc61c1a3 100644 --- a/indra/newview/lldrawpoolbump.cpp +++ b/indra/newview/lldrawpoolbump.cpp @@ -556,30 +556,7 @@ void LLDrawPoolBump::renderGroup(LLSpatialGroup* group, U32 type, U32 mask, BOOL for (LLSpatialGroup::drawmap_elem_t::iterator k = draw_info.begin(); k != draw_info.end(); ++k) { LLDrawInfo& params = **k; - if (LLPipeline::sDynamicReflections) - { - if (params.mReflectionMap.notNull()) - { - params.mReflectionMap->bind(); - } - else - { - if (params.mModelMatrix) - { - sCubeMap = gPipeline.findReflectionMap(params.mModelMatrix->getTranslation()); - } - - if (sCubeMap) - { - sCubeMap->bind(); - } - else if (gSky.mVOSkyp->getCubeMap()) - { - gSky.mVOSkyp->getCubeMap()->bind(); - } - } - } - + applyModelMatrix(params); params.mVertexBuffer->setBuffer(mask); @@ -607,10 +584,6 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) if( tex ) { bump = gBumpImageList.getBrightnessDarknessImage( tex, bump_code ); - //------------------------------------------ - //error check to make sure bump is valid - llassert_always(!bump || bump->getNumRefs() == 1) ; - //------------------------------------------ } break; @@ -625,11 +598,6 @@ BOOL LLDrawPoolBump::bindBumpMap(LLDrawInfo& params) if (bump) { - //------------------------------------------ - //error check to make sure bump is valid - llassert_always(bump->getNumRefs() > 0 && bump->getNumRefs() < 100000) ; - //------------------------------------------ - bump->bind(1); bump->bind(0); return TRUE; @@ -1121,22 +1089,6 @@ void LLDrawPoolBump::pushBatch(LLDrawInfo& params, U32 mask, BOOL texture) { LLImageGL::unbindTexture(0); } - - if (LLPipeline::sDynamicReflections) - { - LLCubeMap* cube_map = params.mReflectionMap; - - if (!cube_map && params.mModelMatrix) - { - cube_map = gPipeline.findReflectionMap(params.mModelMatrix->getTranslation()); - } - - if (cube_map) - { - cube_map->enableTexture(cube_channel); - cube_map->bind(); - } - } } params.mVertexBuffer->setBuffer(mask); diff --git a/indra/newview/lldriverparam.cpp b/indra/newview/lldriverparam.cpp index b3daad9fb3..e88381d9e9 100644 --- a/indra/newview/lldriverparam.cpp +++ b/indra/newview/lldriverparam.cpp @@ -34,6 +34,7 @@ #include "lldriverparam.h" #include "llfasttimer.h" +#include "llvoavatar.h" //----------------------------------------------------------------------------- // LLDriverParamInfo diff --git a/indra/newview/lldriverparam.h b/indra/newview/lldriverparam.h index 46b8609038..8170873849 100644 --- a/indra/newview/lldriverparam.h +++ b/indra/newview/lldriverparam.h @@ -32,9 +32,10 @@ #ifndef LL_LLDRIVERPARAM_H #define LL_LLDRIVERPARAM_H -#include "llvoavatar.h" #include "llviewervisualparam.h" +class LLVOAvatar; + //----------------------------------------------------------------------------- struct LLDrivenEntryInfo diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp index 8474762d9b..b2f5caa57d 100644 --- a/indra/newview/llface.cpp +++ b/indra/newview/llface.cpp @@ -57,7 +57,6 @@ extern BOOL gPickFaces; BOOL LLFace::sSafeRenderSelect = TRUE; // FALSE -S32 LLFace::sDeleteLock = 0 ; #define DOTVEC(a,b) (a.mV[0]*b.mV[0] + a.mV[1]*b.mV[1] + a.mV[2]*b.mV[2]) @@ -178,9 +177,6 @@ void LLFace::init(LLDrawable* drawablep, LLViewerObject* objp) void LLFace::destroy() { - llassert_always(sDeleteLock >= 1); - --sDeleteLock; - mDrawablep = NULL; mVObjp = NULL; diff --git a/indra/newview/llface.h b/indra/newview/llface.h index 34c81c3fdd..0391cda66f 100644 --- a/indra/newview/llface.h +++ b/indra/newview/llface.h @@ -296,9 +296,6 @@ public: lhs->getTexture() < rhs->getTexture(); } }; - -public://paranoia check only - static S32 sDeleteLock ; }; #endif // LL_LLFACE_H diff --git a/indra/newview/llfloateranimpreview.cpp b/indra/newview/llfloateranimpreview.cpp index 6d4ff5a1a7..417ac0e868 100644 --- a/indra/newview/llfloateranimpreview.cpp +++ b/indra/newview/llfloateranimpreview.cpp @@ -76,13 +76,14 @@ const F32 PREVIEW_CAMERA_DISTANCE = 4.f; const F32 MIN_CAMERA_ZOOM = 0.5f; const F32 MAX_CAMERA_ZOOM = 10.f; +const F32 BASE_ANIM_TIME_OFFSET = 5.f; + //----------------------------------------------------------------------------- // LLFloaterAnimPreview() //----------------------------------------------------------------------------- LLFloaterAnimPreview::LLFloaterAnimPreview(const std::string& filename) : LLFloaterNameDesc(filename) { - mLastSliderValue = 0.f; mLastMouseX = 0; mLastMouseY = 0; @@ -414,20 +415,32 @@ void LLFloaterAnimPreview::resetMotion() LLVOAvatar* avatarp = mAnimPreview->getDummyAvatar(); BOOL paused = avatarp->areAnimationsPaused(); - mPauseRequest = NULL; + // *TODO: Fix awful casting hack + LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(mMotionID); + + // Set emotion + std::string emote = childGetValue("emote_combo").asString(); + motionp->setEmote(mIDList[emote]); - LLUUID anim_id = mIDList[childGetValue("preview_base_anim").asString()]; - avatarp->stopMotion(anim_id, TRUE); - avatarp->stopMotion(mMotionID, TRUE); - avatarp->startMotion(anim_id, 5.f); - avatarp->startMotion(mMotionID); - childSetValue("playback_slider", 0.0); - mLastSliderValue = 0.0f; + LLUUID base_id = mIDList[childGetValue("preview_base_anim").asString()]; + avatarp->deactivateAllMotions(); + avatarp->startMotion(base_id, BASE_ANIM_TIME_OFFSET); + avatarp->startMotion(mMotionID, 0.0f); + childSetValue("playback_slider", 0.0f); + + // Set pose + std::string handpose = childGetValue("hand_pose_combo").asString(); + avatarp->startMotion( ANIM_AGENT_HAND_MOTION, 0.0f ); + motionp->setHandPose(LLHandMotion::getHandPose(handpose)); if (paused) { mPauseRequest = avatarp->requestPause(); } + else + { + mPauseRequest = NULL; + } } //----------------------------------------------------------------------------- @@ -538,7 +551,8 @@ void LLFloaterAnimPreview::onMouseCaptureLost() void LLFloaterAnimPreview::onBtnPlay(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { @@ -569,22 +583,14 @@ void LLFloaterAnimPreview::onBtnPlay(void* user_data) void LLFloaterAnimPreview::onBtnStop(void* user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; if (previewp->mMotionID.notNull() && previewp->mAnimPreview) { LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - - // is the motion looping and have we passed the loop in point? - if (previewp->childGetValue("loop_check").asBoolean() && - (F32)previewp->childGetValue("loop_in_point").asReal() <= (F32)previewp->childGetValue("playback_slider").asReal() * 100.f) - { - avatarp->stopMotion(previewp->mMotionID, FALSE); - } - else - { - avatarp->stopMotion(previewp->mMotionID, FALSE); - } + previewp->resetMotion(); + previewp->mPauseRequest = avatarp->requestPause(); } } @@ -594,43 +600,24 @@ void LLFloaterAnimPreview::onBtnStop(void* user_data) void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)user_data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; if (previewp->mAnimPreview) { LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); + F32 slider_value = (F32)previewp->childGetValue("playback_slider").asReal(); + LLUUID base_id = previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()]; LLMotion* motionp = avatarp->findMotion(previewp->mMotionID); - LLMotion* base_motionp = - avatarp->findMotion(previewp->mIDList[previewp->childGetValue("preview_base_anim").asString()]); - - if (motionp && base_motionp) - { - if (!avatarp->isMotionActive(previewp->mMotionID)) - { - previewp->resetMotion(); - } - - previewp->mPauseRequest = avatarp->requestPause(); - F32 original_activation_time = motionp->mActivationTimestamp; - motionp->mActivationTimestamp -= ((F32)previewp->childGetValue("playback_slider").asReal() - previewp->mLastSliderValue) * - motionp->getDuration(); - base_motionp->mActivationTimestamp -= ((F32)previewp->childGetValue("playback_slider").asReal() - previewp->mLastSliderValue) * - base_motionp->getDuration(); - - if (motionp->mSendStopTimestamp != F32_MIN) - { - motionp->mSendStopTimestamp = motionp->mSendStopTimestamp - original_activation_time + motionp->mActivationTimestamp; - } - - if (motionp->mStopTimestamp != F32_MIN) - { - motionp->mStopTimestamp = motionp->mStopTimestamp - original_activation_time + motionp->mActivationTimestamp; - } - previewp->refresh(); - } + F32 duration = motionp->getDuration();// + motionp->getEaseOutDuration(); + F32 delta_time = duration * slider_value; + avatarp->deactivateAllMotions(); + avatarp->startMotion(base_id, delta_time + BASE_ANIM_TIME_OFFSET); + avatarp->startMotion(previewp->mMotionID, delta_time); + previewp->mPauseRequest = avatarp->requestPause(); + previewp->refresh(); } - previewp->mLastSliderValue = (F32)previewp->childGetValue("playback_slider").asReal(); } //----------------------------------------------------------------------------- @@ -639,8 +626,8 @@ void LLFloaterAnimPreview::onSliderMove(LLUICtrl* ctrl, void*user_data) void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; if (previewp->mAnimPreview) { @@ -669,8 +656,9 @@ void LLFloaterAnimPreview::onCommitBaseAnim(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; + LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -688,7 +676,8 @@ void LLFloaterAnimPreview::onCommitLoop(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -708,7 +697,8 @@ void LLFloaterAnimPreview::onCommitLoopIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -728,7 +718,8 @@ void LLFloaterAnimPreview::onCommitLoopOut(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -747,13 +738,10 @@ void LLFloaterAnimPreview::onCommitName(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; - - LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); + if (!previewp->getEnabled()) + return; - motionp->setHandPose(LLHandMotion::getHandPose(previewp->childGetValue("hand_pose_combo").asString())); - previewp->resetMotion(); + previewp->resetMotion(); // sets hand pose } //----------------------------------------------------------------------------- @@ -762,13 +750,10 @@ void LLFloaterAnimPreview::onCommitHandPose(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; - LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); - LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); - - motionp->setEmote(previewp->mIDList[previewp->childGetValue("emote_combo").asString()]); - previewp->resetMotion(); + previewp->resetMotion(); // ssts emote } //----------------------------------------------------------------------------- @@ -777,7 +762,8 @@ void LLFloaterAnimPreview::onCommitEmote(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -791,7 +777,8 @@ void LLFloaterAnimPreview::onCommitPriority(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -806,7 +793,8 @@ void LLFloaterAnimPreview::onCommitEaseIn(LLUICtrl* ctrl, void* data) void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return; + if (!previewp->getEnabled()) + return; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -820,9 +808,9 @@ void LLFloaterAnimPreview::onCommitEaseOut(LLUICtrl* ctrl, void* data) //----------------------------------------------------------------------------- BOOL LLFloaterAnimPreview::validateEaseIn(LLUICtrl* spin, void* data) { - LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - - if (!previewp->getEnabled()) return FALSE; + LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; + if (!previewp->getEnabled()) + return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -843,7 +831,8 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - if (!previewp->getEnabled()) return FALSE; + if (!previewp->getEnabled()) + return FALSE; LLVOAvatar* avatarp = previewp->mAnimPreview->getDummyAvatar(); LLKeyframeMotion* motionp = (LLKeyframeMotion*)avatarp->findMotion(previewp->mMotionID); @@ -863,8 +852,8 @@ BOOL LLFloaterAnimPreview::validateEaseOut(LLUICtrl* spin, void* data) BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - - if (!previewp->getEnabled()) return FALSE; + if (!previewp->getEnabled()) + return FALSE; F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); @@ -892,8 +881,8 @@ BOOL LLFloaterAnimPreview::validateLoopIn(LLUICtrl* ctrl, void* data) BOOL LLFloaterAnimPreview::validateLoopOut(LLUICtrl* spin, void* data) { LLFloaterAnimPreview* previewp = (LLFloaterAnimPreview*)data; - - if (!previewp->getEnabled()) return FALSE; + if (!previewp->getEnabled()) + return FALSE; F32 loop_out_value = (F32)previewp->childGetValue("loop_out_point").asReal(); F32 loop_in_value = (F32)previewp->childGetValue("loop_in_point").asReal(); @@ -948,11 +937,8 @@ void LLFloaterAnimPreview::refresh() { if (motionp) { - F32 fraction_complete; - fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); - + F32 fraction_complete = motionp->getLastUpdateTime() / motionp->getDuration(); childSetValue("playback_slider", fraction_complete); - mLastSliderValue = fraction_complete; } mPlayButton->setImages(std::string("button_anim_pause.tga"), std::string("button_anim_pause_selected.tga")); @@ -965,7 +951,7 @@ void LLFloaterAnimPreview::refresh() mPlayButton->setImages(std::string("button_anim_play.tga"), std::string("button_anim_play_selected.tga")); - mStopButton->setEnabled(FALSE); + mStopButton->setEnabled(TRUE); // stop also resets, leave enabled. } childEnable("ok_btn"); mAnimPreview->requestUpdate(); @@ -1038,12 +1024,12 @@ LLPreviewAnimation::LLPreviewAnimation(S32 width, S32 height) : LLDynamicTexture mDummyAvatar = (LLVOAvatar*)gObjectList.createObjectViewer(LL_PCODE_LEGACY_AVATAR, gAgent.getRegion()); mDummyAvatar->createDrawable(&gPipeline); mDummyAvatar->mIsDummy = TRUE; - mDummyAvatar->mSpecialRenderMode = 2; + mDummyAvatar->mSpecialRenderMode = 1; mDummyAvatar->setPositionAgent(LLVector3::zero); mDummyAvatar->slamPosition(); mDummyAvatar->updateJointLODs(); mDummyAvatar->updateGeometry(mDummyAvatar->mDrawable); - mDummyAvatar->startMotion(ANIM_AGENT_STAND, 5.f); + mDummyAvatar->startMotion(ANIM_AGENT_STAND, BASE_ANIM_TIME_OFFSET); mDummyAvatar->mSkirtLOD.setVisible(FALSE, TRUE); gPipeline.markVisible(mDummyAvatar->mDrawable, *LLViewerCamera::getInstance()); @@ -1111,30 +1097,15 @@ BOOL LLPreviewAnimation::render() //avatarp->setAnimationData("LookAtPoint", (void *)&mCameraRelPos); - //RN: timestep must be zero, because paused animations will never initialize - // av skeleton otherwise - avatarp->setTimeStep(0.f); - if (avatarp->areAnimationsPaused()) - { - avatarp->updateMotion(TRUE); - } - else - { - avatarp->updateMotion(); - } + //SJB: Animation is updated in LLVOAvatar::updateCharacter - LLVertexBuffer::unbind(); - avatarp->updateLOD(); - - - avatarp->mRoot.updateWorldMatrixChildren(); - - stop_glerror(); - - LLGLDepthTest gls_depth(GL_TRUE); - if (avatarp->mDrawable.notNull()) { + avatarp->updateLOD(); + + LLVertexBuffer::unbind(); + LLGLDepthTest gls_depth(GL_TRUE); + LLDrawPoolAvatar *avatarPoolp = (LLDrawPoolAvatar *)avatarp->mDrawable->getFace(0)->getPool(); avatarp->dirtyMesh(); avatarPoolp->renderAvatars(avatarp); // renders only one avatar diff --git a/indra/newview/llfloateranimpreview.h b/indra/newview/llfloateranimpreview.h index 693e3f8fbf..d13dfdcdb8 100644 --- a/indra/newview/llfloateranimpreview.h +++ b/indra/newview/llfloateranimpreview.h @@ -118,7 +118,6 @@ protected: S32 mLastMouseY; LLButton* mPlayButton; LLButton* mStopButton; - F32 mLastSliderValue; LLRect mPreviewRect; LLRectf mPreviewImageRect; LLAssetID mMotionID; diff --git a/indra/newview/llfloatergroups.cpp b/indra/newview/llfloatergroups.cpp index a85b4ec0e9..ca3332e4ad 100644 --- a/indra/newview/llfloatergroups.cpp +++ b/indra/newview/llfloatergroups.cpp @@ -438,7 +438,8 @@ void init_group_list(LLScrollListCtrl* ctrl, const LLUUID& highlight_id, U64 pow { id = gAgent.mGroups.get(i).mID; LLGroupData* group_datap = &gAgent.mGroups.get(i); - if ((group_datap->mPowers & powers_mask) != 0) { + if ((powers_mask == GP_ALL_POWERS) || ((group_datap->mPowers & powers_mask) != 0)) + { std::string style = "NORMAL"; if(highlight_id == id) { diff --git a/indra/newview/llfloaterworldmap.cpp b/indra/newview/llfloaterworldmap.cpp index d38121047a..d26acaa892 100644 --- a/indra/newview/llfloaterworldmap.cpp +++ b/indra/newview/llfloaterworldmap.cpp @@ -871,8 +871,6 @@ void LLFloaterWorldMap::buildLandmarkIDLists() { list->selectItemRange(1, -1); list->operateOnSelection(LLCtrlListInterface::OP_DELETE); - - llassert_always(list->getItemCount() == 1) ; } mLandmarkItemIDList.reset(); diff --git a/indra/newview/llhudeffectlookat.cpp b/indra/newview/llhudeffectlookat.cpp index ea7413ea3f..7a1df7e3b2 100644 --- a/indra/newview/llhudeffectlookat.cpp +++ b/indra/newview/llhudeffectlookat.cpp @@ -503,8 +503,8 @@ void LLHUDEffectLookAt::render() LLVector3 target = mTargetPos + ((LLVOAvatar*)(LLViewerObject*)mSourceObject)->mHeadp->getWorldPosition(); glMatrixMode(GL_MODELVIEW); - glPushMatrix(); - glTranslatef(target.mV[VX], target.mV[VY], target.mV[VZ]); + gGL.pushMatrix(); + gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); gGL.begin(LLVertexBuffer::LINES); { @@ -519,7 +519,7 @@ void LLHUDEffectLookAt::render() gGL.vertex3f(0.f, 0.f, -1.f); gGL.vertex3f(0.f, 0.f, 1.f); } gGL.end(); - glPopMatrix(); + gGL.popMatrix(); } } diff --git a/indra/newview/llhudeffectpointat.cpp b/indra/newview/llhudeffectpointat.cpp index 93344db622..310b0331c9 100644 --- a/indra/newview/llhudeffectpointat.cpp +++ b/indra/newview/llhudeffectpointat.cpp @@ -331,8 +331,8 @@ void LLHUDEffectPointAt::render() LLGLSNoTexture gls_no_texture; LLVector3 target = mTargetPos + mSourceObject->getRenderPosition(); - glPushMatrix(); - glTranslatef(target.mV[VX], target.mV[VY], target.mV[VZ]); + gGL.pushMatrix(); + gGL.translatef(target.mV[VX], target.mV[VY], target.mV[VZ]); glScalef(0.3f, 0.3f, 0.3f); gGL.begin(LLVertexBuffer::LINES); { @@ -346,7 +346,7 @@ void LLHUDEffectPointAt::render() gGL.vertex3f(0.f, 0.f, -1.f); gGL.vertex3f(0.f, 0.f, 1.f); } gGL.end(); - glPopMatrix(); + gGL.popMatrix(); } } diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 8a8321f9a0..754935edc6 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -1215,6 +1215,12 @@ LLFloaterIMPanel::~LLFloaterIMPanel() delete mVoiceChannel; mVoiceChannel = NULL; + + //delete focus lost callback + if(mInputEditor) + { + mInputEditor->setFocusLostCallback( NULL ); + } } BOOL LLFloaterIMPanel::postBuild() diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 8aa51ad048..d3671239bb 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -76,6 +76,7 @@ #include "llviewerinventory.h" #include "llviewerobjectlist.h" #include "llviewerwindow.h" +#include "llvoavatar.h" #include "llwearable.h" #include "llwearablelist.h" #include "llviewermessage.h" diff --git a/indra/newview/llmemoryview.cpp b/indra/newview/llmemoryview.cpp index ccaed78727..75f05f6d0c 100644 --- a/indra/newview/llmemoryview.cpp +++ b/indra/newview/llmemoryview.cpp @@ -41,6 +41,7 @@ #include "llfontgl.h" #include "llmemtype.h" +#include "llcharacter.h" #include "llui.h" #include "llviewercontrol.h" #include "llstat.h" @@ -120,6 +121,7 @@ static const struct mtv_display_info mtv_display_table[] = { LLMemType::MTYPE_SPACE_PARTITION, "Space Partition", &LLColor4::blue2 }, { LLMemType::MTYPE_VERTEX_DATA, "Vertex Buffer", &LLColor4::blue3 }, { LLMemType::MTYPE_AVATAR, "Avatar", &LLColor4::purple1 }, + { LLMemType::MTYPE_ANIMATION, "Animation", &LLColor4::purple3 }, { LLMemType::MTYPE_REGIONS, "Regions", &LLColor4::blue1 }, { LLMemType::MTYPE_VOLUME, "Volume", &LLColor4::pink1 }, { LLMemType::MTYPE_PRIMITIVE, "Profile", &LLColor4::pink2 }, @@ -208,10 +210,25 @@ void LLMemoryView::draw() if (textw > labelwidth) labelwidth = textw; } + + S32 num_avatars = 0; + S32 num_motions = 0; + S32 num_loading_motions = 0; + S32 num_loaded_motions = 0; + S32 num_active_motions = 0; + S32 num_deprecated_motions = 0; + for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin(); + iter != LLCharacter::sInstances.end(); ++iter) + { + num_avatars++; + (*iter)->getMotionController().incMotionCounts(num_motions, num_loading_motions, num_loaded_motions, num_active_motions, num_deprecated_motions); + } + x = xleft; - tdesc = llformat("Total Bytes: %d MB Overhead: %d KB", - LLMemType::sTotalMem >> 20, LLMemType::sOverheadMem >> 10); - LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); + tdesc = llformat("Total Bytes: %d MB Overhead: %d KB Avs %d Motions:%d Loading:%d Loaded:%d Active:%d Dep:%d", + LLMemType::sTotalMem >> 20, LLMemType::sOverheadMem >> 10, + num_avatars, num_motions, num_loading_motions, num_loaded_motions, num_active_motions, num_deprecated_motions); + LLFontGL::sMonospace->renderUTF8(tdesc, 0, x, y, LLColor4::white, LLFontGL::LEFT, LLFontGL::TOP); } // Bars diff --git a/indra/newview/llmutelist.cpp b/indra/newview/llmutelist.cpp index e2b5c821ae..5311a594fb 100644 --- a/indra/newview/llmutelist.cpp +++ b/indra/newview/llmutelist.cpp @@ -72,9 +72,6 @@ #include "llviewerobjectlist.h" -std::map<LLUUID, F32> LLMuteList::sUserVolumeSettings; - - // "emptymutelist" class LLDispatchEmptyMuteList : public LLDispatchHandler { @@ -182,10 +179,19 @@ LLMuteList* LLMuteList::getInstance() // LLMuteList() //----------------------------------------------------------------------------- LLMuteList::LLMuteList() : - mIsLoaded(FALSE) + mIsLoaded(FALSE), + mUserVolumesLoaded(FALSE) { gGenericDispatcher.addHandler("emptymutelist", &sDispatchEmptyMuteList); +} +void LLMuteList::loadUserVolumes() +{ + // call once, after LLDir::setLindenUserDir() has been called + if (mUserVolumesLoaded) + return; + mUserVolumesLoaded = TRUE; + // load per-resident voice volume information // conceptually, this is part of the mute list information, although it is only stored locally std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); @@ -201,7 +207,7 @@ LLMuteList::LLMuteList() : for (LLSD::map_const_iterator iter = settings_llsd.beginMap(); iter != settings_llsd.endMap(); ++iter) { - sUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal())); + mUserVolumeSettings.insert(std::make_pair(LLUUID(iter->first), (F32)iter->second.asReal())); } } @@ -213,7 +219,7 @@ LLMuteList::~LLMuteList() std::string filename = gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "volume_settings.xml"); LLSD settings_llsd; - for(user_volume_map_t::iterator iter = sUserVolumeSettings.begin(); iter != sUserVolumeSettings.end(); ++iter) + for(user_volume_map_t::iterator iter = mUserVolumeSettings.begin(); iter != mUserVolumeSettings.end(); ++iter) { settings_llsd[iter->first.asString()] = iter->second; } @@ -668,6 +674,8 @@ BOOL LLMuteList::isMuted(const LLUUID& id, const std::string& name, U32 flags) c //----------------------------------------------------------------------------- void LLMuteList::requestFromServer(const LLUUID& agent_id) { + loadUserVolumes(); + std::string agent_id_string; std::string filename; agent_id.toString(agent_id_string); @@ -705,15 +713,15 @@ void LLMuteList::cache(const LLUUID& agent_id) void LLMuteList::setSavedResidentVolume(const LLUUID& id, F32 volume) { // store new value in volume settings file - sUserVolumeSettings[id] = volume; + mUserVolumeSettings[id] = volume; } F32 LLMuteList::getSavedResidentVolume(const LLUUID& id) { const F32 DEFAULT_VOLUME = 0.5f; - - user_volume_map_t::iterator found_it = sUserVolumeSettings.find(id); - if (found_it != sUserVolumeSettings.end()) + + user_volume_map_t::iterator found_it = mUserVolumeSettings.find(id); + if (found_it != mUserVolumeSettings.end()) { return found_it->second; } diff --git a/indra/newview/llmutelist.h b/indra/newview/llmutelist.h index cc6f5c9762..c1b887b877 100644 --- a/indra/newview/llmutelist.h +++ b/indra/newview/llmutelist.h @@ -131,6 +131,8 @@ public: F32 getSavedResidentVolume(const LLUUID& id); private: + void loadUserVolumes(); + BOOL loadFromFile(const std::string& filename); BOOL saveToFile(const std::string& filename); @@ -171,11 +173,12 @@ private: observer_set_t mObservers; BOOL mIsLoaded; + BOOL mUserVolumesLoaded; friend class LLDispatchEmptyMuteList; typedef std::map<LLUUID, F32> user_volume_map_t; - static user_volume_map_t sUserVolumeSettings; + user_volume_map_t mUserVolumeSettings; }; class LLMuteListObserver diff --git a/indra/newview/llpanellogin.cpp b/indra/newview/llpanellogin.cpp index c252c54ad7..a8dc35f99c 100644 --- a/indra/newview/llpanellogin.cpp +++ b/indra/newview/llpanellogin.cpp @@ -777,9 +777,8 @@ void LLPanelLogin::getFields(std::string &firstname, std::string &lastname, std: remember = sInstance->childGetValue("remember_check"); } - -// static. Return TRUE if user made a choice from the popup -BOOL LLPanelLogin::getServer(std::string &server, S32 &domain_name) +// static +BOOL LLPanelLogin::isGridComboDirty() { BOOL user_picked = FALSE; if (!sInstance) @@ -789,25 +788,8 @@ BOOL LLPanelLogin::getServer(std::string &server, S32 &domain_name) else { LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); - LLSD combo_val = combo->getValue(); - if (LLSD::TypeInteger == combo_val.type()) - { - domain_name = combo->getValue().asInteger(); - - if ((S32)GRID_INFO_OTHER == domain_name) - { - server = LLViewerLogin::getInstance()->getGridLabel(); - } - } - else - { - // no valid selection, return other - domain_name = (S32)GRID_INFO_OTHER; - server = combo_val.asString(); - } user_picked = combo->isDirty(); } - return user_picked; } @@ -941,19 +923,13 @@ void LLPanelLogin::loadLoginPage() curl_free(curl_version); // Grid - std::string grid; - S32 grid_index; - getServer( grid, grid_index ); + char* curl_grid = curl_escape(LLViewerLogin::getInstance()->getGridLabel().c_str(), 0); + oStr << "&grid=" << curl_grid; + curl_free(curl_grid); gViewerWindow->setMenuBackgroundColor(false, !LLViewerLogin::getInstance()->isInProductionGrid()); gLoginMenuBarView->setBackgroundColor(gMenuBarView->getBackgroundColor()); - if (!grid.empty()) - { - char* curl_grid = curl_escape(grid.c_str(), 0); - oStr << "&grid=" << curl_grid; - curl_free(curl_grid); - } #if USE_VIEWER_AUTH LLURLSimString::sInstance.parse(); @@ -1167,9 +1143,29 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) { // The user twiddled with the grid choice ui. // apply the selection to the grid setting. - std::string grid; + std::string grid_label; S32 grid_index; - getServer( grid, grid_index ); + + LLComboBox* combo = sInstance->getChild<LLComboBox>("server_combo"); + LLSD combo_val = combo->getValue(); + + if (LLSD::TypeInteger == combo_val.type()) + { + grid_index = combo->getValue().asInteger(); + + if ((S32)GRID_INFO_OTHER == grid_index) + { + // This happens if the user specifies a custom grid + // via command line. + grid_label = combo->getSimple(); + } + } + else + { + // no valid selection, return other + grid_index = (S32)GRID_INFO_OTHER; + grid_label = combo_val.asString(); + } // This new seelction will override preset uris // from the command line. @@ -1178,11 +1174,10 @@ void LLPanelLogin::onSelectServer(LLUICtrl*, void*) if(grid_index != GRID_INFO_OTHER) { vl->setGridChoice((EGridInfo)grid_index); - grid = vl->getGridLabel(); } else { - vl->setGridChoice(grid); + vl->setGridChoice(grid_label); } // grid changed so show new splash screen (possibly) diff --git a/indra/newview/llpanellogin.h b/indra/newview/llpanellogin.h index 69bf54ecc4..2429ac0f1b 100644 --- a/indra/newview/llpanellogin.h +++ b/indra/newview/llpanellogin.h @@ -92,8 +92,8 @@ public: static void getFields(std::string& firstname, std::string& lastname, std::string& password, BOOL& remember); - static BOOL getServer(std::string& server, S32& domain_name); - static void getLocation(std::string& location); + static BOOL isGridComboDirty(); + static void getLocation(std::string &location); static void close(); diff --git a/indra/newview/llpreviewanim.cpp b/indra/newview/llpreviewanim.cpp index 868278472f..4e3d102b0e 100644 --- a/indra/newview/llpreviewanim.cpp +++ b/indra/newview/llpreviewanim.cpp @@ -194,6 +194,7 @@ void LLPreviewAnim::onClose(bool app_quitting) if (motion) { + // *TODO: minor memory leak here, user data is never deleted (Use real callbacks) motion->setDeactivateCallback(NULL, (void *)NULL); } } diff --git a/indra/newview/llselectmgr.cpp b/indra/newview/llselectmgr.cpp index 7554778301..8ebaeb6758 100644 --- a/indra/newview/llselectmgr.cpp +++ b/indra/newview/llselectmgr.cpp @@ -4855,18 +4855,9 @@ void LLSelectMgr::renderSilhouettes(BOOL for_hud) for (S32 pass = 0; pass < 2; pass++) { - LLObjectSelection::iterator end_ = mSelectedObjects->end(); - S32 num_nodes = mSelectedObjects->getNumNodes() ; - LLObjectSelection::iterator prev_iter = mSelectedObjects->end(); for (LLObjectSelection::iterator iter = mSelectedObjects->begin(); iter != mSelectedObjects->end(); iter++) { - llassert_always(end_ == mSelectedObjects->end()) ;//mSelectedObjects should not grow - llassert_always(prev_iter != iter) ; //iter should move - llassert_always(num_nodes > 0) ; //iter should not circle inside mSelectedObjects. - num_nodes-- ; - prev_iter = iter ; - LLSelectNode* node = *iter; LLViewerObject* objectp = node->getObject(); if (!objectp) diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp index b6ef833709..a62b1ac56a 100644 --- a/indra/newview/llspatialpartition.cpp +++ b/indra/newview/llspatialpartition.cpp @@ -1158,7 +1158,6 @@ void LLSpatialGroup::destroyGL() mVertexBuffer = NULL; mBufferMap.clear(); - mReflectionMap = NULL; clearDrawMap(); if (mOcclusionQuery) @@ -1350,7 +1349,6 @@ LLSpatialPartition::LLSpatialPartition(U32 data_mask, U32 buffer_usage) mDepthMask = FALSE; mSlopRatio = 0.25f; mRenderByGroup = TRUE; - mImageEnabled = FALSE; mInfiniteFarClip = FALSE; LLGLNamePool::registerPool(&sQueryPool); @@ -1564,12 +1562,7 @@ public: virtual void preprocess(LLSpatialGroup* group) { - if (LLPipeline::sDynamicReflections && - group->mOctreeNode->getSize().mdV[0] == 16.0 && - group->mDistance < 64.f) - { - group->mSpatialPartition->markReimage(group); - } + } virtual void processGroup(LLSpatialGroup* group) @@ -1837,76 +1830,6 @@ BOOL earlyFail(LLCamera* camera, LLSpatialGroup* group) return TRUE; } -void LLSpatialPartition::markReimage(LLSpatialGroup* group) -{ - if (mImageEnabled && group->isState(LLSpatialGroup::IMAGE_DIRTY)) - { - if (!group->isState(LLSpatialGroup::IN_IMAGE_QUEUE)) - { - group->setState(LLSpatialGroup::IN_IMAGE_QUEUE); - mImageQueue.push(group); - } - } -} - -void LLSpatialPartition::processImagery(LLCamera* camera) -{ - if (!mImageEnabled) - { - return; - } - - U32 process_count = 1; - - S32 pull_count = (S32) mImageQueue.size(); - - while (process_count > 0 && pull_count > 0 && !mImageQueue.empty()) - { - pull_count--; - LLPointer<LLSpatialGroup> group = mImageQueue.front(); - mImageQueue.pop(); - - if (group->isDead()) - { - continue; - } - - if (group->isState(LLSpatialGroup::GEOM_DIRTY)) - { //put it back - mImageQueue.push(group); - continue; - } - - group->clearState(LLSpatialGroup::IN_IMAGE_QUEUE); - if (LLPipeline::sDynamicReflections) - { - process_count--; - LLVector3 origin = group->mBounds[0]; - /*LLVector3 at = camera->getOrigin()-origin; - at.normVec(); - origin += at* (at * group->mBounds[1]);*/ - - LLCamera cube_cam; - cube_cam.setOrigin(origin); - cube_cam.setFar(64.f); - - LLPointer<LLCubeMap> cube_map = group->mReflectionMap; - group->mReflectionMap = NULL; - if (cube_map.isNull()) - { - cube_map = new LLCubeMap(); - cube_map->initGL(); - } - - gPipeline.generateReflectionMap(gPipeline.mCubeBuffer, cube_cam); - gPipeline.blurReflectionMap(gPipeline.mCubeBuffer, cube_map); - group->mReflectionMap = cube_map; - group->setState(LLSpatialGroup::GEOM_DIRTY); - } - - group->clearState(LLSpatialGroup::IMAGE_DIRTY); - } -} void pushVerts(LLDrawInfo* params, U32 mask) { diff --git a/indra/newview/llspatialpartition.h b/indra/newview/llspatialpartition.h index 6ea22c2f66..7e872915b9 100644 --- a/indra/newview/llspatialpartition.h +++ b/indra/newview/llspatialpartition.h @@ -66,7 +66,6 @@ public: LLPointer<LLVertexBuffer> mVertexBuffer; LLPointer<LLViewerImage> mTexture; - LLPointer<LLCubeMap> mReflectionMap; LLColor4U mGlowColor; S32 mDebugColor; const LLMatrix4* mTextureMatrix; @@ -262,7 +261,6 @@ public: LLPointer<LLVertexBuffer> mVertexBuffer; F32* mOcclusionVerts; GLuint mOcclusionQuery; - LLPointer<LLCubeMap> mReflectionMap; U32 mBufferUsage; draw_map_t mDrawMap; @@ -314,8 +312,6 @@ public: virtual void rebuildGeom(LLSpatialGroup* group); S32 cull(LLCamera &camera, std::vector<LLDrawable *>* results = NULL, BOOL for_select = FALSE); // Cull on arbitrary frustum - void markReimage(LLSpatialGroup* group); - void processImagery(LLCamera* camera); BOOL isVisible(const LLVector3& v); @@ -326,23 +322,12 @@ public: void restoreGL(); void resetVertexBuffers(); -protected: - - typedef std::set<LLPointer<LLSpatialGroup> > spatial_group_set_t; - spatial_group_set_t mSpatialGroups; - - typedef std::queue<LLPointer<LLSpatialGroup> > spatial_group_queue_t; - - //things that need an image update - spatial_group_queue_t mImageQueue; - public: LLSpatialGroup::OctreeNode* mOctree; BOOL mOcclusionEnabled; // if TRUE, occlusion culling is performed BOOL mInfiniteFarClip; // if TRUE, frustum culling ignores far clip plane U32 mBufferUsage; BOOL mRenderByGroup; - BOOL mImageEnabled; U32 mLODSeed; U32 mLODPeriod; //number of frames between LOD updates for a given spatial group (staggered by mLODSeed) U32 mVertexDataMask; diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 7fe55d6efd..ada8ab5fdc 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -816,26 +816,11 @@ BOOL idle_startup() if (show_connect_box) { - // TODO only set loginuri based on server choice if ! USE_VIEWER_AUTH - std::string server_label; - S32 domain_name_index; - BOOL user_picked_server = LLPanelLogin::getServer( server_label, domain_name_index ); - if((EGridInfo)domain_name_index == GRID_INFO_OTHER) + if ( LLPanelLogin::isGridComboDirty() ) { - // Since the grid chosen was an 'other', set the choice by string. - LLViewerLogin::getInstance()->setGridChoice(server_label); - } - else - { - // Set the choice according to index. - LLViewerLogin::getInstance()->setGridChoice((EGridInfo)domain_name_index); - } - - if ( user_picked_server ) - { // User picked a grid from the popup, so clear the - // stored uris and they will be re-generated from the GridChoice + // User picked a grid from the popup, so clear the + // stored uris and they will be reacquired from the grid choice. sAuthUris.clear(); - LLViewerLogin::getInstance()->resetURIs(); } std::string location; @@ -2224,6 +2209,18 @@ BOOL idle_startup() { do_normal_idle = TRUE; + // Avoid generic Ruth avatar in Orientation Island by starting + // our outfit load as soon as possible. This will be replaced + // with a more definitive patch from featurettes-4 later. JC + if (gAgent.isFirstLogin() + && !gInitialOutfit.empty() // registration set up an outfit + && gAgent.getAvatarObject() // can't wear clothes until have obj + && !gAgent.isGenderChosen() ) // nothing already loaded + { + llinfos << "Wearing initial outfit " << gInitialOutfit << llendl; + callback_choose_gender(-1, NULL); + } + F32 timeout_frac = timeout.getElapsedTimeF32()/PRECACHING_DELAY; // wait precache-delay and for agent's avatar or a lot longer. if(((timeout_frac > 1.f) && gAgent.getAvatarObject()) @@ -2234,7 +2231,7 @@ BOOL idle_startup() else { update_texture_fetch(); - set_startup_status(0.60f + 0.40f * timeout_frac, + set_startup_status(0.60f + 0.20f * timeout_frac, "Loading world...", gAgent.mMOTD); } @@ -2264,7 +2261,7 @@ BOOL idle_startup() else { update_texture_fetch(); - set_startup_status(0.f + 0.25f * wearables_time / MAX_WEARABLES_TIME, + set_startup_status(0.80f + 0.20f * wearables_time / MAX_WEARABLES_TIME, LLTrans::getString("LoginDownloadingClothing"), gAgent.mMOTD); } diff --git a/indra/newview/llstartup.h b/indra/newview/llstartup.h index b5de15d983..38319c8d8a 100644 --- a/indra/newview/llstartup.h +++ b/indra/newview/llstartup.h @@ -73,6 +73,8 @@ enum EStartupState{ // exported symbols extern BOOL gAgentMovementCompleted; extern LLPointer<LLImageGL> gStartImageGL; +extern std::string gInitialOutfit; +extern std::string gInitialOutfitGender; // "male" or "female" class LLStartUp { diff --git a/indra/newview/lltexlayer.h b/indra/newview/lltexlayer.h index 59a0660a94..befb262a4c 100644 --- a/indra/newview/lltexlayer.h +++ b/indra/newview/lltexlayer.h @@ -40,7 +40,6 @@ #include "lluuid.h" #include "llviewerimage.h" #include "llviewervisualparam.h" -#include "llvoavatar.h" #include "llwearable.h" #include "v4color.h" #include "llfloater.h" diff --git a/indra/newview/lltexturefetch.cpp b/indra/newview/lltexturefetch.cpp index f32e4dd531..9a043b8d15 100644 --- a/indra/newview/lltexturefetch.cpp +++ b/indra/newview/lltexturefetch.cpp @@ -48,7 +48,6 @@ #include "llviewerregion.h" ////////////////////////////////////////////////////////////////////////////// - //static class LLTextureFetchWorker : public LLWorkerClass { @@ -435,6 +434,7 @@ LLTextureFetchWorker::LLTextureFetchWorker(LLTextureFetch* fetcher, LLTextureFetchWorker::~LLTextureFetchWorker() { + llassert_always(LLWorkerClass::sDeleteLock) ; // llinfos << "Destroy: " << mID // << " Decoded=" << mDecodedDiscard // << " Requested=" << mRequestedDiscard @@ -1052,9 +1052,11 @@ bool LLTextureFetchWorker::processSimulatorPackets() { if (mLastPacket >= mFirstPacket) { + llassert_always(mFormattedImage) ; S32 buffer_size = mFormattedImage->getDataSize(); for (S32 i = mFirstPacket; i<=mLastPacket; i++) { + llassert_always(mPackets[i]) ; buffer_size += mPackets[i]->mSize; } bool have_all_data = mLastPacket >= mTotalPackets-1; @@ -1436,13 +1438,16 @@ void LLTextureFetch::removeFromNetworkQueue(LLTextureFetchWorker* worker) // call lockQueue() first! void LLTextureFetch::removeRequest(LLTextureFetchWorker* worker, bool cancel) { - mRequestMap.erase(worker->mID); + size_t erased_1 = mRequestMap.erase(worker->mID); + llassert_always(erased_1 > 0) ; size_t erased = mNetworkQueue.erase(worker->mID); if (cancel && erased > 0) { mCancelQueue[worker->mHost].insert(worker->mID); } - worker->scheduleDelete(); + llassert_always(!(worker->getFlags(LLWorkerClass::WCF_DELETE_REQUESTED))) ; + + worker->scheduleDelete(); } // call lockQueue() first! diff --git a/indra/newview/lltoolpie.cpp b/indra/newview/lltoolpie.cpp index 5954a7f0ff..b6bcf9544d 100644 --- a/indra/newview/lltoolpie.cpp +++ b/indra/newview/lltoolpie.cpp @@ -309,7 +309,13 @@ BOOL LLToolPie::pickAndShowMenu(S32 x, S32 y, MASK mask, BOOL always_show) } else if (mHitObjectID == gAgent.getID() ) { - llassert_always(gPieSelf) ; + if(!gPieSelf) + { + //either at very early startup stage or at late quitting stage, + //this event is ignored. + return TRUE ; + } + gPieSelf->show(x, y, mPieMouseButtonDown); } else if (object) diff --git a/indra/newview/llviewercontrol.cpp b/indra/newview/llviewercontrol.cpp index eec1fff942..422546c811 100644 --- a/indra/newview/llviewercontrol.cpp +++ b/indra/newview/llviewercontrol.cpp @@ -447,7 +447,6 @@ void settings_setup_listeners() gSavedSettings.getControl("RenderTerrainDetail")->getSignal()->connect(boost::bind(&handleTerrainDetailChanged, _1)); gSavedSettings.getControl("RenderAvatarVP")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("VertexShaderEnable")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); - gSavedSettings.getControl("RenderDynamicReflections")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleReleaseGLBufferChanged, _1)); gSavedSettings.getControl("RenderGlow")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); gSavedSettings.getControl("EnableRippleWater")->getSignal()->connect(boost::bind(&handleSetShaderChanged, _1)); diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index b7b85105cc..d4249ce135 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -613,7 +613,6 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot) if (!for_snapshot) { LLAppViewer::instance()->pingMainloopTimeout("Display:Imagery"); - gPipeline.processImagery(*LLViewerCamera::getInstance()); gPipeline.generateWaterReflection(*LLViewerCamera::getInstance()); } @@ -823,6 +822,7 @@ void render_hud_attachments() //cull, sort, and render hud objects static LLCullResult result; + LLSpatialGroup::sNoDelete = TRUE; gPipeline.updateCull(hud_cam, result); gPipeline.toggleRenderType(LLPipeline::RENDER_TYPE_BUMP); @@ -834,6 +834,8 @@ void render_hud_attachments() gPipeline.renderGeom(hud_cam); + LLSpatialGroup::sNoDelete = FALSE; + render_hud_elements(); //restore type mask gPipeline.setRenderTypeMask(mask); diff --git a/indra/newview/llviewerjoint.cpp b/indra/newview/llviewerjoint.cpp index 176bf9273a..71d98b73de 100644 --- a/indra/newview/llviewerjoint.cpp +++ b/indra/newview/llviewerjoint.cpp @@ -118,123 +118,124 @@ void LLViewerJoint::setValid( BOOL valid, BOOL recursive ) //-------------------------------------------------------------------- // renderSkeleton() +// DEBUG (UNUSED) //-------------------------------------------------------------------- -void LLViewerJoint::renderSkeleton(BOOL recursive) -{ - F32 nc = 0.57735f; - - //---------------------------------------------------------------- - // push matrix stack - //---------------------------------------------------------------- - glPushMatrix(); - - //---------------------------------------------------------------- - // render the bone to my parent - //---------------------------------------------------------------- - if (mComponents & SC_BONE) - { - drawBone(); - } - - //---------------------------------------------------------------- - // offset to joint position and - // rotate to our orientation - //---------------------------------------------------------------- - glLoadIdentity(); - glMultMatrixf( &getWorldMatrix().mMatrix[0][0] ); - - //---------------------------------------------------------------- - // render joint axes - //---------------------------------------------------------------- - if (mComponents & SC_AXES) - { - gGL.begin(LLVertexBuffer::LINES); - gGL.color3f( 1.0f, 0.0f, 0.0f ); - gGL.vertex3f( 0.0f, 0.0f, 0.0f ); - gGL.vertex3f( 0.1f, 0.0f, 0.0f ); - - gGL.color3f( 0.0f, 1.0f, 0.0f ); - gGL.vertex3f( 0.0f, 0.0f, 0.0f ); - gGL.vertex3f( 0.0f, 0.1f, 0.0f ); - - gGL.color3f( 0.0f, 0.0f, 1.0f ); - gGL.vertex3f( 0.0f, 0.0f, 0.0f ); - gGL.vertex3f( 0.0f, 0.0f, 0.1f ); - gGL.end(); - } - - //---------------------------------------------------------------- - // render the joint graphic - //---------------------------------------------------------------- - if (mComponents & SC_JOINT) - { - gGL.color3f( 1.0f, 1.0f, 0.0f ); - - gGL.begin(LLVertexBuffer::TRIANGLES); - - // joint top half - glNormal3f(nc, nc, nc); - gGL.vertex3f(0.0f, 0.0f, 0.05f); - gGL.vertex3f(0.05f, 0.0f, 0.0f); - gGL.vertex3f(0.0f, 0.05f, 0.0f); - - glNormal3f(-nc, nc, nc); - gGL.vertex3f(0.0f, 0.0f, 0.05f); - gGL.vertex3f(0.0f, 0.05f, 0.0f); - gGL.vertex3f(-0.05f, 0.0f, 0.0f); +// void LLViewerJoint::renderSkeleton(BOOL recursive) +// { +// F32 nc = 0.57735f; + +// //---------------------------------------------------------------- +// // push matrix stack +// //---------------------------------------------------------------- +// glPushMatrix(); + +// //---------------------------------------------------------------- +// // render the bone to my parent +// //---------------------------------------------------------------- +// if (mComponents & SC_BONE) +// { +// drawBone(); +// } + +// //---------------------------------------------------------------- +// // offset to joint position and +// // rotate to our orientation +// //---------------------------------------------------------------- +// glLoadIdentity(); +// glMultMatrixf( &getWorldMatrix().mMatrix[0][0] ); + +// //---------------------------------------------------------------- +// // render joint axes +// //---------------------------------------------------------------- +// if (mComponents & SC_AXES) +// { +// gGL.begin(LLVertexBuffer::LINES); +// gGL.color3f( 1.0f, 0.0f, 0.0f ); +// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); +// gGL.vertex3f( 0.1f, 0.0f, 0.0f ); + +// gGL.color3f( 0.0f, 1.0f, 0.0f ); +// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); +// gGL.vertex3f( 0.0f, 0.1f, 0.0f ); + +// gGL.color3f( 0.0f, 0.0f, 1.0f ); +// gGL.vertex3f( 0.0f, 0.0f, 0.0f ); +// gGL.vertex3f( 0.0f, 0.0f, 0.1f ); +// gGL.end(); +// } + +// //---------------------------------------------------------------- +// // render the joint graphic +// //---------------------------------------------------------------- +// if (mComponents & SC_JOINT) +// { +// gGL.color3f( 1.0f, 1.0f, 0.0f ); + +// gGL.begin(LLVertexBuffer::TRIANGLES); + +// // joint top half +// glNormal3f(nc, nc, nc); +// gGL.vertex3f(0.0f, 0.0f, 0.05f); +// gGL.vertex3f(0.05f, 0.0f, 0.0f); +// gGL.vertex3f(0.0f, 0.05f, 0.0f); + +// glNormal3f(-nc, nc, nc); +// gGL.vertex3f(0.0f, 0.0f, 0.05f); +// gGL.vertex3f(0.0f, 0.05f, 0.0f); +// gGL.vertex3f(-0.05f, 0.0f, 0.0f); - glNormal3f(-nc, -nc, nc); - gGL.vertex3f(0.0f, 0.0f, 0.05f); - gGL.vertex3f(-0.05f, 0.0f, 0.0f); - gGL.vertex3f(0.0f, -0.05f, 0.0f); - - glNormal3f(nc, -nc, nc); - gGL.vertex3f(0.0f, 0.0f, 0.05f); - gGL.vertex3f(0.0f, -0.05f, 0.0f); - gGL.vertex3f(0.05f, 0.0f, 0.0f); +// glNormal3f(-nc, -nc, nc); +// gGL.vertex3f(0.0f, 0.0f, 0.05f); +// gGL.vertex3f(-0.05f, 0.0f, 0.0f); +// gGL.vertex3f(0.0f, -0.05f, 0.0f); + +// glNormal3f(nc, -nc, nc); +// gGL.vertex3f(0.0f, 0.0f, 0.05f); +// gGL.vertex3f(0.0f, -0.05f, 0.0f); +// gGL.vertex3f(0.05f, 0.0f, 0.0f); - // joint bottom half - glNormal3f(nc, nc, -nc); - gGL.vertex3f(0.0f, 0.0f, -0.05f); - gGL.vertex3f(0.0f, 0.05f, 0.0f); - gGL.vertex3f(0.05f, 0.0f, 0.0f); - - glNormal3f(-nc, nc, -nc); - gGL.vertex3f(0.0f, 0.0f, -0.05f); - gGL.vertex3f(-0.05f, 0.0f, 0.0f); - gGL.vertex3f(0.0f, 0.05f, 0.0f); +// // joint bottom half +// glNormal3f(nc, nc, -nc); +// gGL.vertex3f(0.0f, 0.0f, -0.05f); +// gGL.vertex3f(0.0f, 0.05f, 0.0f); +// gGL.vertex3f(0.05f, 0.0f, 0.0f); + +// glNormal3f(-nc, nc, -nc); +// gGL.vertex3f(0.0f, 0.0f, -0.05f); +// gGL.vertex3f(-0.05f, 0.0f, 0.0f); +// gGL.vertex3f(0.0f, 0.05f, 0.0f); - glNormal3f(-nc, -nc, -nc); - gGL.vertex3f(0.0f, 0.0f, -0.05f); - gGL.vertex3f(0.0f, -0.05f, 0.0f); - gGL.vertex3f(-0.05f, 0.0f, 0.0f); - - glNormal3f(nc, -nc, -nc); - gGL.vertex3f(0.0f, 0.0f, -0.05f); - gGL.vertex3f(0.05f, 0.0f, 0.0f); - gGL.vertex3f(0.0f, -0.05f, 0.0f); +// glNormal3f(-nc, -nc, -nc); +// gGL.vertex3f(0.0f, 0.0f, -0.05f); +// gGL.vertex3f(0.0f, -0.05f, 0.0f); +// gGL.vertex3f(-0.05f, 0.0f, 0.0f); + +// glNormal3f(nc, -nc, -nc); +// gGL.vertex3f(0.0f, 0.0f, -0.05f); +// gGL.vertex3f(0.05f, 0.0f, 0.0f); +// gGL.vertex3f(0.0f, -0.05f, 0.0f); - gGL.end(); - } - - //---------------------------------------------------------------- - // render children - //---------------------------------------------------------------- - if (recursive) - { - for (child_list_t::iterator iter = mChildren.begin(); - iter != mChildren.end(); ++iter) - { - LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->renderSkeleton(); - } - } - - //---------------------------------------------------------------- - // pop matrix stack - //---------------------------------------------------------------- - glPopMatrix(); -} +// gGL.end(); +// } + +// //---------------------------------------------------------------- +// // render children +// //---------------------------------------------------------------- +// if (recursive) +// { +// for (child_list_t::iterator iter = mChildren.begin(); +// iter != mChildren.end(); ++iter) +// { +// LLViewerJoint* joint = (LLViewerJoint*)(*iter); +// joint->renderSkeleton(); +// } +// } + +// //---------------------------------------------------------------- +// // pop matrix stack +// //---------------------------------------------------------------- +// glPopMatrix(); +// } //-------------------------------------------------------------------- @@ -330,59 +331,60 @@ U32 LLViewerJoint::render( F32 pixelArea, BOOL first_pass ) //-------------------------------------------------------------------- // drawBone() +// DEBUG (UNUSED) //-------------------------------------------------------------------- -void LLViewerJoint::drawBone() -{ - if ( mParent == NULL ) - return; +// void LLViewerJoint::drawBone() +// { +// if ( mParent == NULL ) +// return; - F32 boneSize = 0.02f; +// F32 boneSize = 0.02f; - // rotate to point to child (bone direction) - glPushMatrix(); +// // rotate to point to child (bone direction) +// glPushMatrix(); - LLVector3 boneX = getPosition(); - F32 length = boneX.normVec(); +// LLVector3 boneX = getPosition(); +// F32 length = boneX.normVec(); - LLVector3 boneZ(1.0f, 0.0f, 1.0f); +// LLVector3 boneZ(1.0f, 0.0f, 1.0f); - LLVector3 boneY = boneZ % boneX; - boneY.normVec(); +// LLVector3 boneY = boneZ % boneX; +// boneY.normVec(); - boneZ = boneX % boneY; +// boneZ = boneX % boneY; - LLMatrix4 rotateMat; - rotateMat.setFwdRow( boneX ); - rotateMat.setLeftRow( boneY ); - rotateMat.setUpRow( boneZ ); - glMultMatrixf( &rotateMat.mMatrix[0][0] ); +// LLMatrix4 rotateMat; +// rotateMat.setFwdRow( boneX ); +// rotateMat.setLeftRow( boneY ); +// rotateMat.setUpRow( boneZ ); +// glMultMatrixf( &rotateMat.mMatrix[0][0] ); - // render the bone - gGL.color3f( 0.5f, 0.5f, 0.0f ); +// // render the bone +// gGL.color3f( 0.5f, 0.5f, 0.0f ); - gGL.begin(LLVertexBuffer::TRIANGLES); +// gGL.begin(LLVertexBuffer::TRIANGLES); - gGL.vertex3f( length, 0.0f, 0.0f); - gGL.vertex3f( 0.0f, boneSize, 0.0f); - gGL.vertex3f( 0.0f, 0.0f, boneSize); +// gGL.vertex3f( length, 0.0f, 0.0f); +// gGL.vertex3f( 0.0f, boneSize, 0.0f); +// gGL.vertex3f( 0.0f, 0.0f, boneSize); - gGL.vertex3f( length, 0.0f, 0.0f); - gGL.vertex3f( 0.0f, 0.0f, -boneSize); - gGL.vertex3f( 0.0f, boneSize, 0.0f); +// gGL.vertex3f( length, 0.0f, 0.0f); +// gGL.vertex3f( 0.0f, 0.0f, -boneSize); +// gGL.vertex3f( 0.0f, boneSize, 0.0f); - gGL.vertex3f( length, 0.0f, 0.0f); - gGL.vertex3f( 0.0f, -boneSize, 0.0f); - gGL.vertex3f( 0.0f, 0.0f, -boneSize); +// gGL.vertex3f( length, 0.0f, 0.0f); +// gGL.vertex3f( 0.0f, -boneSize, 0.0f); +// gGL.vertex3f( 0.0f, 0.0f, -boneSize); - gGL.vertex3f( length, 0.0f, 0.0f); - gGL.vertex3f( 0.0f, 0.0f, boneSize); - gGL.vertex3f( 0.0f, -boneSize, 0.0f); +// gGL.vertex3f( length, 0.0f, 0.0f); +// gGL.vertex3f( 0.0f, 0.0f, boneSize); +// gGL.vertex3f( 0.0f, -boneSize, 0.0f); - gGL.end(); +// gGL.end(); - // restore matrix - glPopMatrix(); -} +// // restore matrix +// glPopMatrix(); +// } //-------------------------------------------------------------------- // isTransparent() @@ -437,13 +439,13 @@ void LLViewerJoint::updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind) } } -void LLViewerJoint::updateGeometry() +void LLViewerJoint::updateJointGeometry() { for (child_list_t::iterator iter = mChildren.begin(); iter != mChildren.end(); ++iter) { LLViewerJoint* joint = (LLViewerJoint*)(*iter); - joint->updateGeometry(); + joint->updateJointGeometry(); } } diff --git a/indra/newview/llviewerjoint.h b/indra/newview/llviewerjoint.h index 605f40979b..07d1f4c235 100644 --- a/indra/newview/llviewerjoint.h +++ b/indra/newview/llviewerjoint.h @@ -60,7 +60,12 @@ public: // Primarily for debugging and character setup // Derived classes may add text/graphic output. // Draw skeleton graphic for debugging and character setup - virtual void renderSkeleton(BOOL recursive=TRUE); + void renderSkeleton(BOOL recursive=TRUE); // debug only (unused) + + // Draws a bone graphic to the parent joint. + // Derived classes may add text/graphic output. + // Called by renderSkeleton(). + void drawBone(); // debug only (unused) // Render character hierarchy. // Traverses the entire joint hierarchy, setting up @@ -68,11 +73,6 @@ public: // Derived classes may add text/graphic output. virtual U32 render( F32 pixelArea, BOOL first_pass = TRUE ); // Returns triangle count - // Draws a bone graphic to the parent joint. - // Derived classes may add text/graphic output. - // Called by renderSkeleton(). - virtual void drawBone(); - // Returns true if this object is transparent. // This is used to determine in which order to draw objects. virtual BOOL isTransparent(); @@ -127,7 +127,7 @@ public: virtual void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); virtual void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE); virtual BOOL updateLOD(F32 pixel_area, BOOL activate); - virtual void updateGeometry(); + virtual void updateJointGeometry(); virtual void dump(); void setVisible( BOOL visible, BOOL recursive ); diff --git a/indra/newview/llviewerjointattachment.cpp b/indra/newview/llviewerjointattachment.cpp index ce61c3a2cd..0a2e328015 100644 --- a/indra/newview/llviewerjointattachment.cpp +++ b/indra/newview/llviewerjointattachment.cpp @@ -56,7 +56,6 @@ extern LLPipeline gPipeline; // LLViewerJointAttachment() //----------------------------------------------------------------------------- LLViewerJointAttachment::LLViewerJointAttachment() : -mJoint(NULL), mAttachedObject(NULL), mVisibleInFirst(FALSE), mGroup(0), diff --git a/indra/newview/llviewerjointattachment.h b/indra/newview/llviewerjointattachment.h index aa41252ab9..81e72e18b3 100644 --- a/indra/newview/llviewerjointattachment.h +++ b/indra/newview/llviewerjointattachment.h @@ -68,7 +68,6 @@ public: // accessors // - void setJoint (LLJoint* joint) { mJoint = joint; } void setPieSlice(S32 pie_slice) { mPieSlice = pie_slice; } void setVisibleInFirstPerson(BOOL visibility) { mVisibleInFirst = visibility; } BOOL getVisibleInFirstPerson() { return mVisibleInFirst; } @@ -99,7 +98,6 @@ protected: void calcLOD(); protected: - LLJoint* mJoint; // Backlink only; don't make this an LLPointer. LLViewerObject* mAttachedObject; BOOL mVisibleInFirst; diff --git a/indra/newview/llviewerjointmesh.cpp b/indra/newview/llviewerjointmesh.cpp index 8772149a86..95166278d5 100644 --- a/indra/newview/llviewerjointmesh.cpp +++ b/indra/newview/llviewerjointmesh.cpp @@ -873,7 +873,7 @@ void LLViewerJointMesh::updateVectorize() } } -void LLViewerJointMesh::updateGeometry() +void LLViewerJointMesh::updateJointGeometry() { if (!(mValid && mMesh diff --git a/indra/newview/llviewerjointmesh.h b/indra/newview/llviewerjointmesh.h index 4cef1552ca..3de9076c3d 100644 --- a/indra/newview/llviewerjointmesh.h +++ b/indra/newview/llviewerjointmesh.h @@ -142,7 +142,7 @@ public: /*virtual*/ void updateFaceSizes(U32 &num_vertices, U32& num_indices, F32 pixel_area); /*virtual*/ void updateFaceData(LLFace *face, F32 pixel_area, BOOL damp_wind = FALSE); /*virtual*/ BOOL updateLOD(F32 pixel_area, BOOL activate); - /*virtual*/ void updateGeometry(); + /*virtual*/ void updateJointGeometry(); /*virtual*/ void dump(); void setIsTransparent(BOOL is_transparent) { mIsTransparent = is_transparent; } diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 946167b90e..347ddac797 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -1429,11 +1429,6 @@ void init_debug_rendering_menu(LLMenuGL* menu) item = new LLMenuItemCheckGL("Run Multiple Threads", menu_toggle_control, NULL, menu_check_control, (void*)"RunMultipleThreads"); menu->append(item); -#ifndef LL_RELEASE_FOR_DOWNLOAD - item = new LLMenuItemCheckGL("Dynamic Reflections", menu_toggle_control, NULL, menu_check_control, (void*)"RenderDynamicReflections"); - menu->append(item); -#endif - item = new LLMenuItemCheckGL("Cheesy Beacon", menu_toggle_control, NULL, menu_check_control, (void*)"CheesyBeacon"); menu->append(item); diff --git a/indra/newview/llviewernetwork.cpp b/indra/newview/llviewernetwork.cpp index d2d8f774a0..23bec37064 100644 --- a/indra/newview/llviewernetwork.cpp +++ b/indra/newview/llviewernetwork.cpp @@ -120,13 +120,8 @@ static LLGridData gGridInfo[GRID_INFO_COUNT] = "" } }; -#if LL_RELEASE_FOR_DOWNLOAD - // Default userserver for production builds is agni - const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI; -#else - // Default userserver for development builds is none - const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_NONE; -#endif +const EGridInfo DEFAULT_GRID_CHOICE = GRID_INFO_AGNI; + unsigned char gMACAddress[MAC_ADDRESS_BYTES]; /* Flawfinder: ignore */ @@ -142,7 +137,7 @@ void LLViewerLogin::setGridChoice(EGridInfo grid) llerrs << "Invalid grid index specified." << llendl; } - if(mGridChoice != grid) + if(mGridChoice != grid || gSavedSettings.getS32("ServerChoice") != grid) { mGridChoice = grid; if(GRID_INFO_LOCAL == mGridChoice) diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 1c0aaec29a..8cd295b8a8 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -685,7 +685,6 @@ void LLViewerObjectList::update(LLAgent &agent, LLWorld &world) idle_iter != idle_list.end(); idle_iter++) { objectp = *idle_iter; - llassert_always(objectp) ; if (!objectp->idleUpdate(agent, world, frame_time)) { // If Idle Update returns false, kill object! diff --git a/indra/newview/llviewerstats.cpp b/indra/newview/llviewerstats.cpp index b90f665abd..8588d99b21 100644 --- a/indra/newview/llviewerstats.cpp +++ b/indra/newview/llviewerstats.cpp @@ -52,6 +52,7 @@ #include "lldebugview.h" #include "llfasttimerview.h" #include "llviewerregion.h" +#include "llvoavatar.h" #include "llfloaterhtml.h" #include "llviewerwindow.h" // *TODO: remove, only used for width/height #include "llworld.h" diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 068f4c86e9..b37b66effa 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -4477,7 +4477,6 @@ BOOL LLViewerWindow::rawSnapshot(LLImageRaw *raw, S32 image_width, S32 image_hei else { display(do_rebuild, scale_factor, subimage_x+(subimage_y*llceil(scale_factor)), use_fbo); - render_ui_and_swap(); } S32 subimage_x_offset = llclamp(buffer_x_offset - (subimage_x * window_width), 0, window_width); diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 4b7ad71e80..cf2c094ded 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -886,52 +886,53 @@ LLVOAvatar::LLVOAvatar( if (LLCharacter::sInstances.size() == 1) { LLKeyframeMotion::setVFS(gStaticVFS); - addMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); - addMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); - addMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); - addMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); - addMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); - addMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); - addMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); - addMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); - addMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); - addMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_BUSY, LLNullMotion::create ); + registerMotion( ANIM_AGENT_CROUCH, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_CROUCHWALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_EXPRESS_AFRAID, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_ANGER, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_BORED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_CRY, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_DISDAIN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_EMBARRASSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_FROWN, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_KISS, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_LAUGH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_OPEN_MOUTH, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_REPULSED, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SAD, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SHRUG, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_SURPRISE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TONGUE_OUT, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_TOOTHSMILE, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WINK, LLEmote::create ); + registerMotion( ANIM_AGENT_EXPRESS_WORRY, LLEmote::create ); + registerMotion( ANIM_AGENT_RUN, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_STAND, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_1, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_2, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_3, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STAND_4, LLKeyframeStandMotion::create ); + registerMotion( ANIM_AGENT_STANDUP, LLKeyframeFallMotion::create ); + registerMotion( ANIM_AGENT_TURNLEFT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_TURNRIGHT, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_WALK, LLKeyframeWalkMotion::create ); // motions without a start/stop bit - addMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); - addMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); - addMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); - addMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); - addMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); - addMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); - addMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); - addMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); - addMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); - addMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); - addMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); - addMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); + registerMotion( ANIM_AGENT_BODY_NOISE, LLBodyNoiseMotion::create ); + registerMotion( ANIM_AGENT_BREATHE_ROT, LLBreatheMotionRot::create ); + registerMotion( ANIM_AGENT_EDITING, LLEditingMotion::create ); + registerMotion( ANIM_AGENT_EYE, LLEyeMotion::create ); + registerMotion( ANIM_AGENT_FEMALE_WALK, LLKeyframeWalkMotion::create ); + registerMotion( ANIM_AGENT_FLY_ADJUST, LLFlyAdjustMotion::create ); + registerMotion( ANIM_AGENT_HAND_MOTION, LLHandMotion::create ); + registerMotion( ANIM_AGENT_HEAD_ROT, LLHeadRotMotion::create ); + registerMotion( ANIM_AGENT_PELVIS_FIX, LLPelvisFixMotion::create ); + registerMotion( ANIM_AGENT_SIT_FEMALE, LLKeyframeMotion::create ); + registerMotion( ANIM_AGENT_TARGET, LLTargetingMotion::create ); + registerMotion( ANIM_AGENT_WALK_ADJUST, LLWalkAdjustMotion::create ); + } if (gNoRender) @@ -3362,7 +3363,7 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) // the rest should only be done occasionally for far away avatars //-------------------------------------------------------------------- - if (!mIsSelf && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) + if (!mIsSelf && !mIsDummy && sUseImpostors && !mNeedsAnimUpdate && !sFreezeCounter) { F32 impostor_area = 256.f*512.f*(8.125f - LLVOAvatar::sLODFactor*8.f); if (LLMuteList::getInstance()->isMuted(getID())) @@ -3383,22 +3384,13 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) if (!visible) { - if (!mMotionController.isPaused()) - { - mMotionController.pause(); - mMotionController.updateMotion(); - mMotionController.unpause(); - } - else - { - mMotionController.updateMotion(); - } + updateMotions(LLCharacter::HIDDEN_UPDATE); return FALSE; } } - + // change animation time quanta based on avatar render load - if (!mIsSelf) + if (!mIsSelf && !mIsDummy) { F32 time_quantum = clamp_rescale((F32)sInstances.size(), 10.f, 35.f, 0.f, 0.25f); F32 pixel_area_scale = clamp_rescale(mPixelArea, 100, 5000, 1.f, 0.f); @@ -3672,10 +3664,10 @@ BOOL LLVOAvatar::updateCharacter(LLAgent &agent) mSpeed = speed; // update animations - { - LLFastTimer t(LLFastTimer::FTM_UPDATE_ANIMATION); - updateMotion(); - } + if (mSpecialRenderMode == 1) // Animation Preview + updateMotions(LLCharacter::FORCE_UPDATE); + else + updateMotions(LLCharacter::NORMAL_UPDATE); // update head position updateHeadOffset(); @@ -3851,9 +3843,6 @@ void LLVOAvatar::updateVisibility() } else { - // calculate avatar distance wrt head - mDrawable->updateDistance(*LLViewerCamera::getInstance()); - if (!mDrawable->getSpatialGroup() || mDrawable->getSpatialGroup()->isVisible()) { visible = TRUE; @@ -3870,8 +3859,7 @@ void LLVOAvatar::updateVisibility() visible = FALSE; } } - else - if( !mFirstAppearanceMessageReceived ) + else if( !mFirstAppearanceMessageReceived ) { visible = FALSE; } @@ -4017,19 +4005,19 @@ U32 LLVOAvatar::renderSkinned(EAvatarRenderPass pass) if (mNeedsSkin) { //generate animated mesh - mLowerBodyLOD.updateGeometry(); - mUpperBodyLOD.updateGeometry(); + mLowerBodyLOD.updateJointGeometry(); + mUpperBodyLOD.updateJointGeometry(); if( isWearingWearableType( WT_SKIRT ) ) { - mSkirtLOD.updateGeometry(); + mSkirtLOD.updateJointGeometry(); } if (!mIsSelf || gAgent.needsRenderHead()) { - mEyeLashLOD.updateGeometry(); - mHeadLOD.updateGeometry(); - mHairLOD.updateGeometry(); + mEyeLashLOD.updateJointGeometry(); + mHeadLOD.updateJointGeometry(); + mHairLOD.updateJointGeometry(); } mNeedsSkin = FALSE; @@ -5789,6 +5777,7 @@ void LLVOAvatar::setPixelAreaAndAngle(LLAgent &agent) //----------------------------------------------------------------------------- BOOL LLVOAvatar::updateJointLODs() { + const F32 MAX_PIXEL_AREA = 100000000.f; F32 lod_factor = (sLODFactor * AVATAR_LOD_TWEAK_RANGE + (1.f - AVATAR_LOD_TWEAK_RANGE)); F32 avatar_num_min_factor = clamp_rescale(sLODFactor, 0.f, 1.f, 0.25f, 0.6f); F32 avatar_num_factor = clamp_rescale((F32)sNumVisibleAvatars, 8, 25, 1.f, avatar_num_min_factor); @@ -5799,7 +5788,7 @@ BOOL LLVOAvatar::updateJointLODs() { if(gAgent.cameraCustomizeAvatar() || gAgent.cameraMouselook()) { - mAdjustedPixelArea = 1000000; + mAdjustedPixelArea = MAX_PIXEL_AREA; } else { @@ -5808,7 +5797,7 @@ BOOL LLVOAvatar::updateJointLODs() } else if (mIsDummy) { - mAdjustedPixelArea = 1000000; + mAdjustedPixelArea = MAX_PIXEL_AREA; } else { @@ -6762,7 +6751,7 @@ void LLVOAvatar::dumpTotalLocalTextureByteCount() BOOL LLVOAvatar::isVisible() { - return mDrawable.notNull() && mDrawable->isVisible(); + return mDrawable.notNull() && (mDrawable->isVisible() || mIsDummy); } @@ -9724,7 +9713,8 @@ BOOL LLVOAvatar::updateLOD() mDrawable->clearState(LLDrawable::REBUILD_GEOMETRY); } - + updateVisibility(); + return res; } diff --git a/indra/newview/llvoavatar.h b/indra/newview/llvoavatar.h index b991ae305e..54fd7d370f 100644 --- a/indra/newview/llvoavatar.h +++ b/indra/newview/llvoavatar.h @@ -757,9 +757,9 @@ public: //-------------------------------------------------------------------- F32 mSpeed; - // + //-------------------------------------------------------------------- // Shadow stuff - // + //-------------------------------------------------------------------- LLDrawable* mShadow; BOOL mInAir; LLFrameTimer mTimeInAir; @@ -1013,7 +1013,7 @@ protected: LLHost getObjectHost() const; S32 getLocalDiscardLevel( S32 index); -//Ventrella + //----------------------------------------------------------------------------------------------- // the Voice Visualizer is responsible for detecting the user's voice signal, and when the // user speaks, it puts a voice symbol over the avatar's head, and triggering gesticulations @@ -1021,7 +1021,6 @@ protected: private: LLVoiceVisualizer * mVoiceVisualizer; int mCurrentGesticulationLevel; -//End Ventrella private: static S32 sFreezeCounter ; diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 85a1674d98..f864b75bec 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -31,8 +31,6 @@ #ifndef LL_VOICE_CLIENT_H #define LL_VOICE_CLIENT_H -// This would create a circular reference -- just do a forward definition of necessary class names. -//#include "llvoavatar.h" class LLVOAvatar; class LLVivoxProtocolParser; diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 16c6bcdd5f..b84f8d8e4b 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1952,7 +1952,6 @@ LLVolumePartition::LLVolumePartition() mPartitionType = LLViewerRegion::PARTITION_VOLUME; mSlopRatio = 0.25f; mBufferUsage = GL_DYNAMIC_DRAW_ARB; - mImageEnabled = TRUE; } LLVolumeBridge::LLVolumeBridge(LLDrawable* drawablep) @@ -2045,7 +2044,6 @@ void LLVolumeGeometryManager::registerFace(LLSpatialGroup* group, LLFace* facep, draw_info->mGroup = group; draw_info->mVSize = facep->getVirtualSize(); draw_vec.push_back(draw_info); - draw_info->mReflectionMap = group->mReflectionMap; draw_info->mTextureMatrix = tex_mat; draw_info->mModelMatrix = model_mat; draw_info->mGlowColor.setVec(0,0,0,glow); @@ -2163,20 +2161,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) LLFastTimer ftm2(LLFastTimer::FTM_REBUILD_VOLUME_VB); - //find reflection map - if (group->mSpatialPartition->mImageEnabled && LLPipeline::sDynamicReflections) - { - if (group->mReflectionMap.isNull()) - { - LLSpatialGroup* parent = group->getParent(); - while (parent && group->mReflectionMap.isNull()) - { - group->mReflectionMap = parent->mReflectionMap; - parent = parent->getParent(); - } - } - } - group->clearDrawMap(); mFaceList.clear(); diff --git a/indra/newview/pipeline.cpp b/indra/newview/pipeline.cpp index 539379c9a1..3679b57da8 100644 --- a/indra/newview/pipeline.cpp +++ b/indra/newview/pipeline.cpp @@ -217,7 +217,6 @@ BOOL LLPipeline::sDisableShaders = FALSE; BOOL LLPipeline::sRenderBump = TRUE; BOOL LLPipeline::sUseFarClip = TRUE; BOOL LLPipeline::sSkipUpdate = FALSE; -BOOL LLPipeline::sDynamicReflections = FALSE; BOOL LLPipeline::sWaterReflections = FALSE; BOOL LLPipeline::sRenderGlow = FALSE; BOOL LLPipeline::sReflectionRender = FALSE; @@ -474,15 +473,14 @@ void LLPipeline::createGLBuffers() { assertInitialized(); - if (LLPipeline::sDynamicReflections || - LLPipeline::sWaterReflections) + if (LLPipeline::sWaterReflections) { //water reflection texture U32 res = (U32) gSavedSettings.getS32("RenderWaterRefResolution"); mWaterRef.allocate(res,res,GL_RGBA,TRUE); mWaterDis.allocate(res,res,GL_RGBA,TRUE); - if (LLPipeline::sDynamicReflections) +#if 0 //cube map buffers (keep for future work) { //reflection map generation buffers if (mCubeFrameBuffer == 0) @@ -538,8 +536,10 @@ void LLPipeline::createGLBuffers() } } } +#endif } + stop_glerror(); if (LLPipeline::sRenderGlow) @@ -910,6 +910,15 @@ void LLPipeline::unlinkDrawable(LLDrawable *drawable) } mLights.erase(drawablep); + for (light_set_t::iterator iter = mNearbyLights.begin(); + iter != mNearbyLights.end(); iter++) + { + if (iter->drawable == drawablep) + { + mNearbyLights.erase(iter); + break; + } + } } U32 LLPipeline::addObject(LLViewerObject *vobj) @@ -1777,17 +1786,16 @@ void LLPipeline::stateSort(LLDrawable* drawablep, LLCamera& camera) LLSpatialGroup* group = drawablep->getSpatialGroup(); if (!group || group->changeLOD()) { - if (!drawablep->isActive() && drawablep->isVisible()) + if (drawablep->isVisible() && !sSkipUpdate) { - if (!sSkipUpdate) + if (!drawablep->isActive()) { drawablep->updateDistance(camera); } - } - else if (drawablep->isAvatar() && drawablep->isVisible()) - { - LLVOAvatar* vobj = (LLVOAvatar*) drawablep->getVObj().get(); - vobj->updateVisibility(); + else if (drawablep->isAvatar()) + { + drawablep->updateDistance(camera); // calls vobj->updateLOD() which calls LLVOAvatar::updateVisibility() + } } } @@ -3147,6 +3155,11 @@ void LLPipeline::calcNearbyLights(LLCamera& camera) { assertInitialized(); + if (LLPipeline::sReflectionRender) + { + return; + } + if (mLightingDetail >= 1) { // mNearbyLight (and all light_set_t's) are sorted such that @@ -4801,21 +4814,6 @@ void LLPipeline::renderBloom(BOOL for_snapshot) } -void LLPipeline::processImagery(LLCamera& camera) -{ - for (LLWorld::region_list_t::iterator iter = LLWorld::getInstance()->getRegionList().begin(); - iter != LLWorld::getInstance()->getRegionList().end(); ++iter) - { - LLViewerRegion* region = *iter; - LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_VOLUME); - if (part) - { - part->processImagery(&camera); - } - } -} - - inline float sgn(float a) { if (a > 0.0F) return (1.0F); @@ -5026,26 +5024,6 @@ void LLPipeline::generateWaterReflection(LLCamera& camera_in) } } -LLCubeMap* LLPipeline::findReflectionMap(const LLVector3& location) -{ - LLViewerRegion* region = LLWorld::getInstance()->getRegionFromPosAgent(location); - if (region) - { - LLSpatialPartition* part = region->getSpatialPartition(LLViewerRegion::PARTITION_VOLUME); - if (part) - { - LLSpatialGroup::OctreeNode* node = part->mOctree->getNodeAt(LLVector3d(location), 32.0); - if (node) - { - LLSpatialGroup* group = (LLSpatialGroup*) node->getListener(0); - return group->mReflectionMap; - } - } - } - - return NULL; -} - void LLPipeline::renderGroups(LLRenderPass* pass, U32 type, U32 mask, BOOL texture) { for (LLCullResult::sg_list_t::iterator i = sCull->beginVisibleGroups(); i != sCull->endVisibleGroups(); ++i) diff --git a/indra/newview/pipeline.h b/indra/newview/pipeline.h index a96fe0865d..e98be79120 100644 --- a/indra/newview/pipeline.h +++ b/indra/newview/pipeline.h @@ -96,8 +96,6 @@ public: void bindScreenToTexture(); void renderBloom(BOOL for_snapshot); - LLCubeMap* findReflectionMap(const LLVector3& location); - void init(); void cleanup(); BOOL isInit() { return mInitialized; }; @@ -183,7 +181,6 @@ public: void renderGeom(LLCamera& camera, BOOL forceVBOUpdate = FALSE); void renderGeomDeferred(); - void processImagery(LLCamera& camera); void generateWaterReflection(LLCamera& camera); void renderHighlights(); void renderDebug(); @@ -371,7 +368,6 @@ public: static BOOL sUseFBO; static BOOL sUseFarClip; static BOOL sSkipUpdate; //skip lod updates - static BOOL sDynamicReflections; static BOOL sWaterReflections; static BOOL sDynamicLOD; static BOOL sReflectionRender; |