From 02c2283e117a16ba8c94b1b660c22f9535f1695c Mon Sep 17 00:00:00 2001 From: Shyotl Date: Sat, 8 Oct 2011 02:53:03 -0500 Subject: [PATCH] Cleanup. Mostly harmless. A few gAgentAvatarps changed to isAgentAvatarValid(), which is the only 'change' in behavior. Everything else is insignifigant syntax touchup and shuffling of inlines from headers to cpp files. --- indra/newview/lldrawpoolterrain.h | 2 - indra/newview/lldrawpoolwater.cpp | 4 +- indra/newview/llmeshrepository.cpp | 10 ++-- indra/newview/llstartup.cpp | 7 +-- indra/newview/llviewerdisplay.cpp | 10 ++-- indra/newview/llviewerobject.cpp | 14 ++++- indra/newview/llviewerobject.h | 4 +- indra/newview/llviewerobjectlist.cpp | 19 +++--- indra/newview/llviewerwindow.cpp | 2 +- indra/newview/llvoavatar.cpp | 89 ++++++++++++++-------------- indra/newview/llwaterparammanager.h | 5 +- 11 files changed, 83 insertions(+), 83 deletions(-) diff --git a/indra/newview/lldrawpoolterrain.h b/indra/newview/lldrawpoolterrain.h index 8eb5c5737..ec9cb2023 100644 --- a/indra/newview/lldrawpoolterrain.h +++ b/indra/newview/lldrawpoolterrain.h @@ -35,8 +35,6 @@ #include "lldrawpool.h" -class LLViewerFetchedTexture; - class LLDrawPoolTerrain : public LLFacePool { LLPointer mTexturep; diff --git a/indra/newview/lldrawpoolwater.cpp b/indra/newview/lldrawpoolwater.cpp index 7dcc82218..8a1c120ef 100644 --- a/indra/newview/lldrawpoolwater.cpp +++ b/indra/newview/lldrawpoolwater.cpp @@ -114,7 +114,7 @@ void LLDrawPoolWater::prerender() // got rid of modulation by light color since it got a little too // green at sunset and sl-57047 (underwater turns black at 8:00) - sWaterFogColor = LLWaterParamManager::getInstance()->getFogColor(); + sWaterFogColor = LLWaterParamManager::instance().getFogColor(); sWaterFogColor.mV[3] = 0; } @@ -532,7 +532,7 @@ void LLDrawPoolWater::shade() //bind normal map S32 bumpTex = shader->enableTexture(LLViewerShaderMgr::BUMP_MAP); - LLWaterParamManager * param_mgr = LLWaterParamManager::getInstance(); + LLWaterParamManager * param_mgr = &LLWaterParamManager::instance(); // change mWaterNormp if needed if (mWaterNormp->getID() != param_mgr->getNormalMapID()) diff --git a/indra/newview/llmeshrepository.cpp b/indra/newview/llmeshrepository.cpp index bacde05f2..f58d0e6b2 100644 --- a/indra/newview/llmeshrepository.cpp +++ b/indra/newview/llmeshrepository.cpp @@ -453,9 +453,9 @@ LLMeshRepoThread::LLMeshRepoThread() : LLThread("mesh repo") { mWaiting = false; - mMutex = new LLMutex; - mHeaderMutex = new LLMutex; - mSignal = new LLCondition; + mMutex = new LLMutex(); + mHeaderMutex = new LLMutex(); + mSignal = new LLCondition(); } LLMeshRepoThread::~LLMeshRepoThread() @@ -1208,7 +1208,7 @@ LLMeshUploadThread::LLMeshUploadThread(LLMeshUploadThread::instance_list& data, mUploadTextures = upload_textures; mUploadSkin = upload_skin; mUploadJoints = upload_joints; - mMutex = new LLMutex(NULL); + mMutex = new LLMutex(); mCurlRequest = NULL; mPendingUploads = 0; mFinished = false; @@ -2061,7 +2061,7 @@ LLMeshRepository::LLMeshRepository() void LLMeshRepository::init() { - mMeshMutex = new LLMutex; + mMeshMutex = new LLMutex(); #if MESH_IMPORT LLConvexDecomposition::getInstance()->initSystem(); diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ac7ef2804..627fcb95f 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -2743,7 +2743,7 @@ bool idle_startup() if (gAgent.isFirstLogin() && !sInitialOutfit.empty() // registration set up an outfit && !sInitialOutfitGender.empty() // and a gender - && gAgentAvatarp // can't wear clothes without object + && isAgentAvatarValid() // can't wear clothes without object && !gAgent.isGenderChosen() ) // nothing already loading { // Start loading the wearables, textures, gestures @@ -2766,7 +2766,7 @@ bool idle_startup() } // wait precache-delay and for agent's avatar or a lot longer. - if(((timeout_frac > 1.f) && gAgentAvatarp) + if(((timeout_frac > 1.f) && isAgentAvatarValid()) || (timeout_frac > 3.f)) { LLStartUp::setStartupState( STATE_WEARABLES_WAIT ); @@ -2822,7 +2822,7 @@ bool idle_startup() if (gAgent.isFirstLogin()) { // wait for avatar to be completely loaded - if (gAgentAvatarp + if (isAgentAvatarValid() && gAgentAvatarp->isFullyLoaded()) { //llinfos << "avatar fully loaded" << llendl; @@ -2889,7 +2889,6 @@ bool idle_startup() // Start automatic replay if the flag is set. if (gSavedSettings.getBOOL("StatsAutoRun")) { - LLUUID id; LL_DEBUGS("AppInit") << "Starting automatic playback" << LL_ENDL; gAgentPilot.startPlayback(); } diff --git a/indra/newview/llviewerdisplay.cpp b/indra/newview/llviewerdisplay.cpp index 7fd6dfed0..d75f20228 100644 --- a/indra/newview/llviewerdisplay.cpp +++ b/indra/newview/llviewerdisplay.cpp @@ -364,7 +364,7 @@ void display(BOOL rebuild, F32 zoom_factor, int subfield, BOOL for_snapshot, boo const F32 TELEPORT_ARRIVAL_DELAY = 2.f; // Time to preload the world before raising the curtain after we've actually already arrived. S32 attach_count = 0; - if (gAgentAvatarp) + if (isAgentAvatarValid()) { attach_count = gAgentAvatarp->getAttachmentCount(); } @@ -1128,13 +1128,11 @@ LLRect get_whole_screen_region() bool get_hud_matrices(const LLRect& screen_region, glh::matrix4f &proj, glh::matrix4f &model) { - LLVOAvatar* my_avatarp = gAgentAvatarp; - if (my_avatarp && my_avatarp->hasHUDAttachment()) + if (isAgentAvatarValid() && gAgentAvatarp->hasHUDAttachment()) { F32 zoom_level = gAgentCamera.mHUDCurZoom; - LLBBox hud_bbox = my_avatarp->getHUDBBox(); - - // set up transform to keep HUD objects in front of camera + LLBBox hud_bbox = gAgentAvatarp->getHUDBBox(); + F32 hud_depth = llmax(1.f, hud_bbox.getExtentLocal().mV[VX] * 1.1f); proj = gl_ortho(-0.5f * LLViewerCamera::getInstance()->getAspect(), 0.5f * LLViewerCamera::getInstance()->getAspect(), -0.5f, 0.5f, 0.f, hud_depth); proj.element(2,2) = -0.01f; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 6b1710b48..276d95216 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -140,7 +140,6 @@ LLViewerObject *LLViewerObject::createObject(const LLUUID &id, const LLPCode pco { if (!gAgentAvatarp) { - lldebugs << "Marking avatar as self " << id << llendl; gAgentAvatarp = new LLVOAvatarSelf(id, pcode, regionp); gAgentAvatarp->initInstance(); } @@ -5682,6 +5681,17 @@ std::string LLViewerObject::getAttachmentPointName() return llformat("unsupported point %d", point); } // + +const LLUUID &LLViewerObject::getAttachmentItemID() const +{ + return mAttachmentItemID; +} + +void LLViewerObject::setAttachmentItemID(const LLUUID &id) +{ + mAttachmentItemID = id; +} + EObjectUpdateType LLViewerObject::getLastUpdateType() const { return mLastUpdateType; @@ -5725,7 +5735,7 @@ LLVOAvatar* LLViewerObject::getAvatar() const { LLViewerObject* vobj = (LLViewerObject*) getParent(); - while (vobj && !vobj->isAvatar()) + while (vobj && !vobj->asAvatar()) { vobj = (LLViewerObject*) vobj->getParent(); } diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 0da84ef08..5b97e75e0 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -763,8 +763,8 @@ public: S32 getAttachmentPoint(); std::string getAttachmentPointName(); // - const LLUUID &getAttachmentItemID() const { return mAttachmentItemID; } - void setAttachmentItemID(const LLUUID &id) { mAttachmentItemID = id; } + const LLUUID &getAttachmentItemID() const; + void setAttachmentItemID(const LLUUID &id); const LLUUID &extractAttachmentItemID(); // find&set the inventory item ID of the attached object EObjectUpdateType getLastUpdateType() const; void setLastUpdateType(EObjectUpdateType last_update_type); diff --git a/indra/newview/llviewerobjectlist.cpp b/indra/newview/llviewerobjectlist.cpp index 24860ab25..3ba6dba17 100644 --- a/indra/newview/llviewerobjectlist.cpp +++ b/indra/newview/llviewerobjectlist.cpp @@ -1746,22 +1746,21 @@ void LLViewerObjectList::generatePickList(LLCamera &camera) // add all hud objects to pick list if (isAgentAvatarValid()) { - LLVOAvatar* avatarp = gAgentAvatarp; - for (LLVOAvatar::attachment_map_t::iterator iter = avatarp->mAttachmentPoints.begin(); - iter != avatarp->mAttachmentPoints.end(); ) + for (LLVOAvatar::attachment_map_t::iterator iter = gAgentAvatarp->mAttachmentPoints.begin(); + iter != gAgentAvatarp->mAttachmentPoints.end(); ) { LLVOAvatar::attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachmentp = curiter->second; - if (attachmentp->getIsHUDAttachment()) + LLViewerJointAttachment* attachment = curiter->second; + if (attachment->getIsHUDAttachment()) { - for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachmentp->mAttachedObjects.begin(); - attachment_iter != attachmentp->mAttachedObjects.end(); + for (LLViewerJointAttachment::attachedobjs_vec_t::iterator attachment_iter = attachment->mAttachedObjects.begin(); + attachment_iter != attachment->mAttachedObjects.end(); ++attachment_iter) { - if (LLViewerObject* objectp = (*attachment_iter)) + if (LLViewerObject* attached_object = (*attachment_iter)) { - mSelectPickList.insert(objectp); - LLViewerObject::const_child_list_t& child_list = objectp->getChildren(); + mSelectPickList.insert(attached_object); + LLViewerObject::const_child_list_t& child_list = attached_object->getChildren(); for (LLViewerObject::child_list_t::const_iterator iter = child_list.begin(); iter != child_list.end(); iter++) { diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 2886789e3..90f87357e 100644 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -363,7 +363,7 @@ public: agent_center_text = llformat("AgentCenter %f %f %f", (F32)(tvector.mdV[VX]), (F32)(tvector.mdV[VY]), (F32)(tvector.mdV[VZ])); - if (gAgentAvatarp) + if (isAgentAvatarValid()) { tvector = gAgent.getPosGlobalFromAgent(gAgentAvatarp->mRoot.getWorldPosition()); agent_root_center_text = llformat("AgentRootCenter %f %f %f", diff --git a/indra/newview/llvoavatar.cpp b/indra/newview/llvoavatar.cpp index 514030756..d6ef26892 100644 --- a/indra/newview/llvoavatar.cpp +++ b/indra/newview/llvoavatar.cpp @@ -6165,7 +6165,8 @@ BOOL LLVOAvatar::loadSkeletonNode () mRoot.addChild( &mSkeleton[0] ); for (std::vector::iterator iter = mMeshLOD.begin(); - iter != mMeshLOD.end(); iter++) + iter != mMeshLOD.end(); + ++iter) { LLViewerJoint *joint = (LLViewerJoint *) *iter; joint->mUpdateXform = FALSE; @@ -6201,7 +6202,8 @@ BOOL LLVOAvatar::loadSkeletonNode () { LLVOAvatarXmlInfo::skeletal_distortion_info_list_t::iterator iter; for (iter = sAvatarXmlInfo->mSkeletalDistortionInfoList.begin(); - iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); iter++) + iter != sAvatarXmlInfo->mSkeletalDistortionInfoList.end(); + ++iter) { LLPolySkeletalDistortionInfo *info = *iter; LLPolySkeletalDistortion *param = new LLPolySkeletalDistortion(this); @@ -6221,7 +6223,8 @@ BOOL LLVOAvatar::loadSkeletonNode () { LLVOAvatarXmlInfo::attachment_info_list_t::iterator iter; for (iter = sAvatarXmlInfo->mAttachmentInfoList.begin(); - iter != sAvatarXmlInfo->mAttachmentInfoList.end(); iter++) + iter != sAvatarXmlInfo->mAttachmentInfoList.end(); + ++iter) { LLVOAvatarXmlInfo::LLVOAvatarAttachmentInfo *info = *iter; if (!isSelf() && info->mJointName == "mScreen") @@ -6301,8 +6304,8 @@ BOOL LLVOAvatar::loadSkeletonNode () BOOL LLVOAvatar::loadMeshNodes() { for (LLVOAvatarXmlInfo::mesh_info_list_t::const_iterator meshinfo_iter = sAvatarXmlInfo->mMeshInfoList.begin(); - meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); - meshinfo_iter++) + meshinfo_iter != sAvatarXmlInfo->mMeshInfoList.end(); + ++meshinfo_iter) { const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo *info = *meshinfo_iter; const std::string &type = info->mType; @@ -6318,7 +6321,7 @@ BOOL LLVOAvatar::loadMeshNodes() mesh = &mHairMesh0; */ for (LLVOAvatarDictionary::Meshes::const_iterator mesh_iter = LLVOAvatarDictionary::getInstance()->getMeshes().begin(); mesh_iter != LLVOAvatarDictionary::getInstance()->getMeshes().end(); - mesh_iter++) + ++mesh_iter) { const EMeshIndex mesh_index = mesh_iter->first; const LLVOAvatarDictionary::MeshEntry *mesh_dict = mesh_iter->second; @@ -6389,8 +6392,8 @@ BOOL LLVOAvatar::loadMeshNodes() mesh->setLOD( info->mMinPixelArea ); for (LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_list_t::const_iterator xmlinfo_iter = info->mPolyMorphTargetInfoList.begin(); - xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); - xmlinfo_iter++) + xmlinfo_iter != info->mPolyMorphTargetInfoList.end(); + ++xmlinfo_iter) { const LLVOAvatarXmlInfo::LLVOAvatarMeshInfo::morph_info_pair_t *info_pair = &(*xmlinfo_iter); LLPolyMorphTarget *param = new LLPolyMorphTarget(mesh->getMesh()); @@ -7046,12 +7049,12 @@ void LLVOAvatar::cleanupAttachedMesh( LLViewerObject* pVO ) //----------------------------------------------------------------------------- BOOL LLVOAvatar::detachObject(LLViewerObject *viewer_object) { - for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); - iter != mAttachmentPoints.end(); ) + for (attachment_map_t::iterator iter = mAttachmentPoints.begin(); + iter != mAttachmentPoints.end(); + ++iter) { - attachment_map_t::iterator curiter = iter++; - LLViewerJointAttachment* attachment = curiter->second; - // only one object per attachment point for now + LLViewerJointAttachment* attachment = iter->second; + if (attachment->isObjectAttached(viewer_object)) { // [RLVa:KB] - Checked: 2010-03-05 (RLVa-1.2.0a) | Added: RLVa-1.2.0a @@ -7606,20 +7609,18 @@ void LLVOAvatar::invalidateAll() updateMeshTextures(); } -void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL set_by_user ) +void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL upload_bake ) { if (global_color == mTexSkinColor) { -// llinfos << "invalidateComposite cause: onGlobalColorChanged( skin color )" << llendl; - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_UPPER].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_LOWER].mTexLayerSet, upload_bake ); } else if (global_color == mTexHairColor) { -// llinfos << "invalidateComposite cause: onGlobalColorChanged( hair color )" << llendl; - invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, set_by_user ); - invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_HEAD].mTexLayerSet, upload_bake ); + invalidateComposite( mBakedTextureDatas[BAKED_HAIR].mTexLayerSet, upload_bake ); // ! BACKWARDS COMPATIBILITY ! // Fix for dealing with avatars from viewers that don't bake hair. @@ -7631,11 +7632,11 @@ void LLVOAvatar::onGlobalColorChanged(const LLTexGlobalColor* global_color, BOOL mBakedTextureDatas[BAKED_HAIR].mMeshes[i]->setColor( color.mV[VX], color.mV[VY], color.mV[VZ], color.mV[VW] ); } } - } + } else if (global_color == mTexEyeColor) { // llinfos << "invalidateComposite cause: onGlobalColorChanged( eyecolor )" << llendl; - invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, set_by_user ); + invalidateComposite( mBakedTextureDatas[BAKED_EYES].mTexLayerSet, upload_bake ); } updateMeshTextures(); } @@ -8728,14 +8729,14 @@ BOOL LLVOAvatar::teToColorParams( ETextureIndex te, const char* param_name[3] ) return TRUE; } -void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL set_by_user ) +void LLVOAvatar::setClothesColor( ETextureIndex te, const LLColor4& new_color, BOOL upload_bake ) { const char* param_name[3]; if( teToColorParams( te, param_name ) ) { - setVisualParamWeight( param_name[0], new_color.mV[VX], set_by_user ); - setVisualParamWeight( param_name[1], new_color.mV[VY], set_by_user ); - setVisualParamWeight( param_name[2], new_color.mV[VZ], set_by_user ); + setVisualParamWeight( param_name[0], new_color.mV[VX], upload_bake ); + setVisualParamWeight( param_name[1], new_color.mV[VY], upload_bake ); + setVisualParamWeight( param_name[2], new_color.mV[VZ], upload_bake ); } } @@ -8752,8 +8753,11 @@ LLColor4 LLVOAvatar::getClothesColor( ETextureIndex te ) return color; } - - +// static +LLColor4 LLVOAvatar::getDummyColor() +{ + return DUMMY_COLOR; +} void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const { @@ -8765,31 +8769,31 @@ void LLVOAvatar::dumpAvatarTEs( const std::string& context ) const iter != LLVOAvatarDictionary::getInstance()->getTextures().end(); ++iter) { - const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; const LLViewerTexture* te_image = getTEImage(iter->first); if( !te_image ) { - llinfos << " " << text_dict->mName << ": null ptr" << llendl; + llinfos << " " << texture_dict->mName << ": null ptr" << llendl; } else if( te_image->getID().isNull() ) { - llinfos << " " << text_dict->mName << ": null UUID" << llendl; + llinfos << " " << texture_dict->mName << ": null UUID" << llendl; } else if( te_image->getID() == IMG_DEFAULT ) { - llinfos << " " << text_dict->mName << ": IMG_DEFAULT" << llendl; + llinfos << " " << texture_dict->mName << ": IMG_DEFAULT" << llendl; } else if (te_image->getID() == IMG_INVISIBLE) { - llinfos << " " << text_dict->mName << ": IMG_INVISIBLE" << llendl; + llinfos << " " << texture_dict->mName << ": IMG_INVISIBLE" << llendl; } else if( te_image->getID() == IMG_DEFAULT_AVATAR ) { - llinfos << " " << text_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; + llinfos << " " << texture_dict->mName << ": IMG_DEFAULT_AVATAR" << llendl; } else { - llinfos << " " << text_dict->mName << ": " << te_image->getID() << llendl; + llinfos << " " << texture_dict->mName << ": " << te_image->getID() << llendl; } } } @@ -8850,11 +8854,6 @@ void LLVOAvatar::setInvisible(BOOL newvalue) } } -LLColor4 LLVOAvatar::getDummyColor() -{ - return DUMMY_COLOR; -} - // Unlike most wearable functions, this works for both self and other. BOOL LLVOAvatar::isWearingWearableType( LLWearableType::EType type ) const { @@ -9528,7 +9527,7 @@ void LLVOAvatar::dumpArchetypeXML( void* ) const std::string& wearable_name = LLWearableType::getTypeName( (LLWearableType::EType) type ); apr_file_printf( file, "\n\t\t\n", wearable_name.c_str() ); - for( LLVisualParam* param = avatar->getFirstVisualParam(); param; param = avatar->getNextVisualParam() ) + for( LLVisualParam* param = gAgentAvatarp->getFirstVisualParam(); param; param = gAgentAvatarp->getNextVisualParam() ) { LLViewerVisualParam* viewer_param = (LLViewerVisualParam*)param; if( (viewer_param->getWearableType() == type) && @@ -10523,10 +10522,10 @@ const std::string LLVOAvatar::getBakedStatusForPrintout() const ++iter) { const ETextureIndex index = iter->first; - const LLVOAvatarDictionary::TextureEntry *text_dict = iter->second; - if (text_dict->mIsBakedTexture) + const LLVOAvatarDictionary::TextureEntry *texture_dict = iter->second; + if (texture_dict->mIsBakedTexture) { - line += text_dict->mName; + line += texture_dict->mName; if (isTextureDefined(index)) { line += "_baked"; diff --git a/indra/newview/llwaterparammanager.h b/indra/newview/llwaterparammanager.h index c1042d06a..d0f1be510 100644 --- a/indra/newview/llwaterparammanager.h +++ b/indra/newview/llwaterparammanager.h @@ -279,9 +279,6 @@ public: F32 getFogDensity(void); LLColor4 getFogColor(void); - // singleton pattern implementation - static LLWaterParamManager * instance(); - public: LLWaterParamSet mCurParams; @@ -323,7 +320,7 @@ private: // list of all the parameters, listed by name - std::map mParamList; + preset_map_t mParamList; std::vector mShaderList; };