diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-19 16:52:44 +0300 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2019-06-19 16:52:44 +0300 |
commit | acf592419bde744d171ceb3d0b978fe18dc32198 (patch) | |
tree | 98a23db4220fdd7d5c3608c496c689355bbd5ab7 /indra | |
parent | 6f95100f7e33e6cd6e5bc462b1577c3a45fd964c (diff) |
DRTVWR-493 LLFollowCamMgr to singleton
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llagentcamera.cpp | 6 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llfollowcam.cpp | 72 | ||||
-rw-r--r-- | indra/newview/llfollowcam.h | 54 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermessage.cpp | 30 | ||||
-rw-r--r-- | indra/newview/llviewerobject.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llvoavatar.cpp | 4 | ||||
-rw-r--r-- | indra/newview/llvoavatarself.cpp | 4 |
9 files changed, 76 insertions, 100 deletions
diff --git a/indra/newview/llagentcamera.cpp b/indra/newview/llagentcamera.cpp index 92a3026096..f377cf2cb4 100644 --- a/indra/newview/llagentcamera.cpp +++ b/indra/newview/llagentcamera.cpp @@ -1140,7 +1140,7 @@ void LLAgentCamera::updateCamera() mCameraUpVector = mCameraUpVector * gAgentAvatarp->getRenderRotation(); } - if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getActiveFollowCamParams()) + if (cameraThirdPerson() && (mFocusOnAvatar || mAllowChangeToFollow) && LLFollowCamMgr::getInstance()->getActiveFollowCamParams()) { mAllowChangeToFollow = FALSE; mFocusOnAvatar = TRUE; @@ -1240,7 +1240,7 @@ void LLAgentCamera::updateCamera() // *TODO: use combined rotation of frameagent and sit object LLQuaternion avatarRotationForFollowCam = gAgentAvatarp->isSitting() ? gAgentAvatarp->getRenderRotation() : gAgent.getFrameAgent().getQuaternion(); - LLFollowCamParams* current_cam = LLFollowCamMgr::getActiveFollowCamParams(); + LLFollowCamParams* current_cam = LLFollowCamMgr::getInstance()->getActiveFollowCamParams(); if (current_cam) { mFollowCam.copyParams(*current_cam); @@ -2100,7 +2100,7 @@ void LLAgentCamera::changeCameraToDefault() return; } - if (LLFollowCamMgr::getActiveFollowCamParams()) + if (LLFollowCamMgr::getInstance()->getActiveFollowCamParams()) { changeCameraToFollow(); } diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp index 56e8cc8ff4..81d0523512 100644 --- a/indra/newview/llappviewer.cpp +++ b/indra/newview/llappviewer.cpp @@ -1894,8 +1894,6 @@ bool LLAppViewer::cleanup() //end_messaging_system(); - SUBSYSTEM_CLEANUP(LLFollowCamMgr); - //SUBSYSTEM_CLEANUP(LLVolumeMgr); LLPrimitive::cleanupVolumeManager(); SUBSYSTEM_CLEANUP(LLWorldMapView); SUBSYSTEM_CLEANUP(LLFolderViewItem); diff --git a/indra/newview/llfollowcam.cpp b/indra/newview/llfollowcam.cpp index 612afc0d18..c2ea3b07c1 100644 --- a/indra/newview/llfollowcam.cpp +++ b/indra/newview/llfollowcam.cpp @@ -30,12 +30,6 @@ #include "llagent.h" //------------------------------------------------------- -// class statics -//------------------------------------------------------- -std::map<LLUUID, LLFollowCamParams*> LLFollowCamMgr::sParamMap; -std::vector<LLFollowCamParams*> LLFollowCamMgr::sParamStack; - -//------------------------------------------------------- // constants //------------------------------------------------------- const F32 FOLLOW_CAM_ZOOM_FACTOR = 0.1f; @@ -668,18 +662,20 @@ LLFollowCam::~LLFollowCam() //------------------------------------------------------- // LLFollowCamMgr //------------------------------------------------------- -//static -void LLFollowCamMgr::cleanupClass() +LLFollowCamMgr::LLFollowCamMgr() { - for (param_map_t::iterator iter = sParamMap.begin(); iter != sParamMap.end(); ++iter) - { - LLFollowCamParams* params = iter->second; - delete params; - } - sParamMap.clear(); } -//static +LLFollowCamMgr::~LLFollowCamMgr() +{ + for (param_map_t::iterator iter = mParamMap.begin(); iter != mParamMap.end(); ++iter) + { + LLFollowCamParams* params = iter->second; + delete params; + } + mParamMap.clear(); +} + void LLFollowCamMgr::setPositionLag( const LLUUID& source, F32 lag) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -689,7 +685,6 @@ void LLFollowCamMgr::setPositionLag( const LLUUID& source, F32 lag) } } -//static void LLFollowCamMgr::setFocusLag( const LLUUID& source, F32 lag) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -699,7 +694,6 @@ void LLFollowCamMgr::setFocusLag( const LLUUID& source, F32 lag) } } -//static void LLFollowCamMgr::setFocusThreshold( const LLUUID& source, F32 threshold) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -710,7 +704,6 @@ void LLFollowCamMgr::setFocusThreshold( const LLUUID& source, F32 threshold) } -//static void LLFollowCamMgr::setPositionThreshold( const LLUUID& source, F32 threshold) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -720,7 +713,6 @@ void LLFollowCamMgr::setPositionThreshold( const LLUUID& source, F32 threshold) } } -//static void LLFollowCamMgr::setDistance( const LLUUID& source, F32 distance) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -730,7 +722,6 @@ void LLFollowCamMgr::setDistance( const LLUUID& source, F32 distance) } } -//static void LLFollowCamMgr::setPitch( const LLUUID& source, F32 pitch) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -740,7 +731,6 @@ void LLFollowCamMgr::setPitch( const LLUUID& source, F32 pitch) } } -//static void LLFollowCamMgr::setFocusOffset( const LLUUID& source, const LLVector3& offset) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -750,7 +740,6 @@ void LLFollowCamMgr::setFocusOffset( const LLUUID& source, const LLVector3& offs } } -//static void LLFollowCamMgr::setBehindnessAngle( const LLUUID& source, F32 angle) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -760,7 +749,6 @@ void LLFollowCamMgr::setBehindnessAngle( const LLUUID& source, F32 angle) } } -//static void LLFollowCamMgr::setBehindnessLag( const LLUUID& source, F32 force) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -770,7 +758,6 @@ void LLFollowCamMgr::setBehindnessLag( const LLUUID& source, F32 force) } } -//static void LLFollowCamMgr::setPosition( const LLUUID& source, const LLVector3 position) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -780,7 +767,6 @@ void LLFollowCamMgr::setPosition( const LLUUID& source, const LLVector3 position } } -//static void LLFollowCamMgr::setFocus( const LLUUID& source, const LLVector3 focus) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -790,7 +776,6 @@ void LLFollowCamMgr::setFocus( const LLUUID& source, const LLVector3 focus) } } -//static void LLFollowCamMgr::setPositionLocked( const LLUUID& source, bool locked) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -800,7 +785,6 @@ void LLFollowCamMgr::setPositionLocked( const LLUUID& source, bool locked) } } -//static void LLFollowCamMgr::setFocusLocked( const LLUUID& source, bool locked ) { LLFollowCamParams* paramsp = getParamsForID(source); @@ -810,16 +794,15 @@ void LLFollowCamMgr::setFocusLocked( const LLUUID& source, bool locked ) } } -//static LLFollowCamParams* LLFollowCamMgr::getParamsForID(const LLUUID& source) { LLFollowCamParams* params = NULL; - param_map_t::iterator found_it = sParamMap.find(source); - if (found_it == sParamMap.end()) // didn't find it? + param_map_t::iterator found_it = mParamMap.find(source); + if (found_it == mParamMap.end()) // didn't find it? { params = new LLFollowCamParams(); - sParamMap[source] = params; + mParamMap[source] = params; } else { @@ -829,56 +812,51 @@ LLFollowCamParams* LLFollowCamMgr::getParamsForID(const LLUUID& source) return params; } -//static LLFollowCamParams* LLFollowCamMgr::getActiveFollowCamParams() { - if (sParamStack.empty()) + if (mParamStack.empty()) { return NULL; } - return sParamStack.back(); + return mParamStack.back(); } -//static void LLFollowCamMgr::setCameraActive( const LLUUID& source, bool active ) { LLFollowCamParams* params = getParamsForID(source); - param_stack_t::iterator found_it = std::find(sParamStack.begin(), sParamStack.end(), params); - if (found_it != sParamStack.end()) + param_stack_t::iterator found_it = std::find(mParamStack.begin(), mParamStack.end(), params); + if (found_it != mParamStack.end()) { - sParamStack.erase(found_it); + mParamStack.erase(found_it); } // put on top of stack if(active) { - sParamStack.push_back(params); + mParamStack.push_back(params); } } -//static void LLFollowCamMgr::removeFollowCamParams(const LLUUID& source) { setCameraActive(source, FALSE); LLFollowCamParams* params = getParamsForID(source); - sParamMap.erase(source); + mParamMap.erase(source); delete params; } -//static bool LLFollowCamMgr::isScriptedCameraSource(const LLUUID& source) { - param_map_t::iterator found_it = sParamMap.find(source); - return (found_it != sParamMap.end()); + param_map_t::iterator found_it = mParamMap.find(source); + return (found_it != mParamMap.end()); } -//static void LLFollowCamMgr::dump() { S32 param_count = 0; LL_INFOS() << "Scripted camera active stack" << LL_ENDL; - for (param_stack_t::iterator param_it = sParamStack.begin(); - param_it != sParamStack.end(); + for (param_stack_t::iterator param_it = mParamStack.begin(); + param_it != mParamStack.end(); ++param_it) { LL_INFOS() << param_count++ << diff --git a/indra/newview/llfollowcam.h b/indra/newview/llfollowcam.h index f4b7b2723a..7995848160 100644 --- a/indra/newview/llfollowcam.h +++ b/indra/newview/llfollowcam.h @@ -193,40 +193,40 @@ protected: };// end of FollowCam class -class LLFollowCamMgr +class LLFollowCamMgr : public LLSingleton<LLFollowCamMgr> { -public: - static void cleanupClass ( ); - - static void setPositionLag ( const LLUUID& source, F32 lag); - static void setFocusLag ( const LLUUID& source, F32 lag); - static void setFocusThreshold ( const LLUUID& source, F32 threshold); - static void setPositionThreshold ( const LLUUID& source, F32 threshold); - static void setDistance ( const LLUUID& source, F32 distance); - static void setPitch ( const LLUUID& source, F32 pitch); - static void setFocusOffset ( const LLUUID& source, const LLVector3& offset); - static void setBehindnessAngle ( const LLUUID& source, F32 angle); - static void setBehindnessLag ( const LLUUID& source, F32 lag); - static void setPosition ( const LLUUID& source, const LLVector3 position); - static void setFocus ( const LLUUID& source, const LLVector3 focus); - static void setPositionLocked ( const LLUUID& source, bool locked); - static void setFocusLocked ( const LLUUID& source, bool locked ); - - static void setCameraActive ( const LLUUID& source, bool active ); - - static LLFollowCamParams* getActiveFollowCamParams(); - static LLFollowCamParams* getParamsForID(const LLUUID& source); - static void removeFollowCamParams(const LLUUID& source); - static bool isScriptedCameraSource(const LLUUID& source); - static void dump(); + LLSINGLETON(LLFollowCamMgr); + ~LLFollowCamMgr(); +public: + void setPositionLag ( const LLUUID& source, F32 lag); + void setFocusLag ( const LLUUID& source, F32 lag); + void setFocusThreshold ( const LLUUID& source, F32 threshold); + void setPositionThreshold ( const LLUUID& source, F32 threshold); + void setDistance ( const LLUUID& source, F32 distance); + void setPitch ( const LLUUID& source, F32 pitch); + void setFocusOffset ( const LLUUID& source, const LLVector3& offset); + void setBehindnessAngle ( const LLUUID& source, F32 angle); + void setBehindnessLag ( const LLUUID& source, F32 lag); + void setPosition ( const LLUUID& source, const LLVector3 position); + void setFocus ( const LLUUID& source, const LLVector3 focus); + void setPositionLocked ( const LLUUID& source, bool locked); + void setFocusLocked ( const LLUUID& source, bool locked ); + + void setCameraActive ( const LLUUID& source, bool active ); + + LLFollowCamParams* getActiveFollowCamParams(); + LLFollowCamParams* getParamsForID(const LLUUID& source); + void removeFollowCamParams(const LLUUID& source); + bool isScriptedCameraSource(const LLUUID& source); + void dump(); protected: typedef std::map<LLUUID, LLFollowCamParams*> param_map_t; - static param_map_t sParamMap; + param_map_t mParamMap; typedef std::vector<LLFollowCamParams*> param_stack_t; - static param_stack_t sParamStack; + param_stack_t mParamStack; }; #endif //LL_FOLLOWCAM_H diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ba68ce4cf4..8f90225359 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -6275,7 +6275,7 @@ void dump_inventory(void*) void handle_dump_followcam(void*) { - LLFollowCamMgr::dump(); + LLFollowCamMgr::getInstance()->dump(); } void handle_viewer_enable_message_log(void*) diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index e50c8ee9f0..f42c4c3c51 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -4271,7 +4271,7 @@ void process_clear_follow_cam_properties(LLMessageSystem *mesgsys, void **user_d mesgsys->getUUIDFast(_PREHASH_ObjectData, _PREHASH_ObjectID, source_id); - LLFollowCamMgr::removeFollowCamParams(source_id); + LLFollowCamMgr::getInstance()->removeFollowCamParams(source_id); } void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_data) @@ -4303,7 +4303,7 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat switch(type) { case FOLLOWCAM_PITCH: - LLFollowCamMgr::setPitch(source_id, value); + LLFollowCamMgr::getInstance()->setPitch(source_id, value); break; case FOLLOWCAM_FOCUS_OFFSET_X: focus_offset.mV[VX] = value; @@ -4318,29 +4318,29 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat settingFocusOffset = true; break; case FOLLOWCAM_POSITION_LAG: - LLFollowCamMgr::setPositionLag(source_id, value); + LLFollowCamMgr::getInstance()->setPositionLag(source_id, value); break; case FOLLOWCAM_FOCUS_LAG: - LLFollowCamMgr::setFocusLag(source_id, value); + LLFollowCamMgr::getInstance()->setFocusLag(source_id, value); break; case FOLLOWCAM_DISTANCE: - LLFollowCamMgr::setDistance(source_id, value); + LLFollowCamMgr::getInstance()->setDistance(source_id, value); break; case FOLLOWCAM_BEHINDNESS_ANGLE: - LLFollowCamMgr::setBehindnessAngle(source_id, value); + LLFollowCamMgr::getInstance()->setBehindnessAngle(source_id, value); break; case FOLLOWCAM_BEHINDNESS_LAG: - LLFollowCamMgr::setBehindnessLag(source_id, value); + LLFollowCamMgr::getInstance()->setBehindnessLag(source_id, value); break; case FOLLOWCAM_POSITION_THRESHOLD: - LLFollowCamMgr::setPositionThreshold(source_id, value); + LLFollowCamMgr::getInstance()->setPositionThreshold(source_id, value); break; case FOLLOWCAM_FOCUS_THRESHOLD: - LLFollowCamMgr::setFocusThreshold(source_id, value); + LLFollowCamMgr::getInstance()->setFocusThreshold(source_id, value); break; case FOLLOWCAM_ACTIVE: //if 1, set using followcam,. - LLFollowCamMgr::setCameraActive(source_id, value != 0.f); + LLFollowCamMgr::getInstance()->setCameraActive(source_id, value != 0.f); break; case FOLLOWCAM_POSITION_X: settingPosition = true; @@ -4367,10 +4367,10 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat focus.mV[ 2 ] = value; break; case FOLLOWCAM_POSITION_LOCKED: - LLFollowCamMgr::setPositionLocked(source_id, value != 0.f); + LLFollowCamMgr::getInstance()->setPositionLocked(source_id, value != 0.f); break; case FOLLOWCAM_FOCUS_LOCKED: - LLFollowCamMgr::setFocusLocked(source_id, value != 0.f); + LLFollowCamMgr::getInstance()->setFocusLocked(source_id, value != 0.f); break; default: @@ -4380,15 +4380,15 @@ void process_set_follow_cam_properties(LLMessageSystem *mesgsys, void **user_dat if ( settingPosition ) { - LLFollowCamMgr::setPosition(source_id, position); + LLFollowCamMgr::getInstance()->setPosition(source_id, position); } if ( settingFocus ) { - LLFollowCamMgr::setFocus(source_id, focus); + LLFollowCamMgr::getInstance()->setFocus(source_id, focus); } if ( settingFocusOffset ) { - LLFollowCamMgr::setFocusOffset(source_id, focus_offset); + LLFollowCamMgr::getInstance()->setFocusOffset(source_id, focus_offset); } } //end Ventrella diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index ec1095813b..ef7dd9cb08 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -482,7 +482,7 @@ void LLViewerObject::markDead() if (flagCameraSource()) { - LLFollowCamMgr::removeFollowCamParams(mID); + LLFollowCamMgr::getInstance()->removeFollowCamParams(mID); } sNumZombieObjects++; diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 20fa327790..3feea2abc0 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -7329,7 +7329,7 @@ void LLVOAvatar::getOffObject() if (sit_object) { stopMotionFromSource(sit_object->getID()); - LLFollowCamMgr::setCameraActive(sit_object->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(sit_object->getID(), FALSE); LLViewerObject::const_child_list_t& child_list = sit_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -7338,7 +7338,7 @@ void LLVOAvatar::getOffObject() LLViewerObject* child_objectp = *iter; stopMotionFromSource(child_objectp->getID()); - LLFollowCamMgr::setCameraActive(child_objectp->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE); } } diff --git a/indra/newview/llvoavatarself.cpp b/indra/newview/llvoavatarself.cpp index dcaade55a6..63ace4fe52 100644 --- a/indra/newview/llvoavatarself.cpp +++ b/indra/newview/llvoavatarself.cpp @@ -1208,7 +1208,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // the simulator should automatically handle permission revocation stopMotionFromSource(attachment_id); - LLFollowCamMgr::setCameraActive(viewer_object->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(viewer_object->getID(), FALSE); LLViewerObject::const_child_list_t& child_list = viewer_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); @@ -1220,7 +1220,7 @@ BOOL LLVOAvatarSelf::detachObject(LLViewerObject *viewer_object) // permissions revocation stopMotionFromSource(child_objectp->getID()); - LLFollowCamMgr::setCameraActive(child_objectp->getID(), FALSE); + LLFollowCamMgr::getInstance()->setCameraActive(child_objectp->getID(), FALSE); } // Make sure the inventory is in sync with the avatar. |