diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index b5ad6857725d0ae0e86e227a5811f210e1f1f83e..43d60d4035930fa16c8c300beff7a80f1c577a89 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -107,6 +107,7 @@ class LLNetworkData PARAMS_RESERVED = 0x50, // Used on server-side PARAMS_MESH = 0x60, PARAMS_EXTENDED_MESH = 0x70, + PARAMS_MAX = PARAMS_EXTENDED_MESH }; public: diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index 287ae0140359d63d00d2e2ab3f8651f37d696bae..88a4e748c8900e547850342f5eac0435ccb12b44 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -544,7 +544,7 @@ void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel) if (object->isSculpted() && object->getVolume() && object->getVolume()->getParams().getSculptID() == old_id) { - LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams* old_params = (LLSculptParams*)object->getSculptParams(); LLSculptParams new_params(*old_params); new_params.setSculptTexture(new_id, (*old_params).getSculptType()); object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE); diff --git a/indra/newview/llpanelobject.cpp b/indra/newview/llpanelobject.cpp index 615c85586ffe88226d8ce5bcdb5a478d08fb9569..736164facad118dcc70d657697f8842db7b0e8f8 100644 --- a/indra/newview/llpanelobject.cpp +++ b/indra/newview/llpanelobject.cpp @@ -628,7 +628,7 @@ void LLPanelObject::getState( ) } - if (objectp->getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + if (objectp->getSculptParams()) { selected_item = MI_SCULPT; //LLFirstUse::useSculptedPrim(); @@ -1077,7 +1077,7 @@ void LLPanelObject::getState( ) // sculpt texture if (selected_item == MI_SCULPT) { - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getSculptParams(); if (sculpt_params) // if we have a legal sculpt param block for this object: @@ -1244,13 +1244,13 @@ void LLPanelObject::onCommitParametric( LLUICtrl* ctrl, void* userdata ) if (selected_type == MI_SCULPT) { self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, TRUE, TRUE); - LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getSculptParams(); if (sculpt_params) volume_params.setSculptID(sculpt_params->getSculptTexture(), sculpt_params->getSculptType()); } else { - LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)self->mObject->getSculptParams(); if (sculpt_params) self->mObject->setParameterEntryInUse(LLNetworkData::PARAMS_SCULPT, FALSE, TRUE); } diff --git a/indra/newview/llpanelvolume.cpp b/indra/newview/llpanelvolume.cpp index 05d9346f89a13d03011ca4325d9407439d7dec4c..625ef8993e80a0a5c322275f5cac0b3a65c89e37 100644 --- a/indra/newview/llpanelvolume.cpp +++ b/indra/newview/llpanelvolume.cpp @@ -440,7 +440,7 @@ void LLPanelVolume::getState( ) getChildView("FlexForceY")->setEnabled(true); getChildView("FlexForceZ")->setEnabled(true); - LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getFlexibleObjectData(); getChild<LLUICtrl>("FlexNumSections")->setValue((F32)attributes->getSimulateLOD()); getChild<LLUICtrl>("FlexGravity")->setValue(attributes->getGravity()); @@ -531,7 +531,7 @@ void LLPanelVolume::getState( ) mComboPhysicsShapeType->add(getString("None"), LLSD(1)); BOOL isMesh = FALSE; - LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)objectp->getSculptParams(); if (sculpt_params) { U8 sculpt_type = sculpt_params->getSculptType(); @@ -943,7 +943,7 @@ void LLPanelVolume::onCommitFlexible( LLUICtrl* ctrl, void* userdata ) return; } - LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + LLFlexibleObjectData *attributes = (LLFlexibleObjectData *)objectp->getFlexibleObjectData(); if (attributes) { LLFlexibleObjectData new_attributes; diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 88185d915d0f257a1ca35771d10a01245a342e42..8f7f3622d08fd986dcbdc90ccc9b7e4bf946c057 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -308,6 +308,7 @@ LLViewerObject::LLViewerObject(const LLUUID &id, const LLPCode pcode, LLViewerRe mAttachmentItemID(LLUUID::null), mLastUpdateType(OUT_UNKNOWN), mLastUpdateCached(FALSE), + mExtraParameterList(LLNetworkData::PARAMS_MAX >> 4), mCachedMuteListUpdateTime(0), mCachedOwnerInMuteList(false) { @@ -350,14 +351,6 @@ LLViewerObject::~LLViewerObject() } // Delete memory associated with extra parameters. - for (auto iter = mExtraParameterList.begin(), end_it = mExtraParameterList.end(); iter != end_it; ++iter) - { - if(iter->second != NULL) - { - delete iter->second->data; - delete iter->second; - } - } mExtraParameterList.clear(); for_each(mNameValuePairs.begin(), mNameValuePairs.end(), DeletePairedPointer()) ; @@ -1547,9 +1540,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, unpackParticleSource(block_num, owner_id); // Mark all extra parameters not used - for (auto iter = mExtraParameterList.begin(), end_it = mExtraParameterList.end(); iter != end_it; ++iter) + for (auto& entry : mExtraParameterList) { - iter->second->in_use = FALSE; + if (entry.in_use) *entry.in_use = false; } // Unpack extra parameters @@ -1576,12 +1569,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, delete[] buffer; } - for (auto iter = mExtraParameterList.begin(), end_it = mExtraParameterList.end(); iter != end_it; ++iter) + for (size_t i = 0; i < mExtraParameterList.size(); ++i) { - if (!iter->second->in_use) + auto& entry = mExtraParameterList[i]; + if (entry.in_use && !*entry.in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged((i + 1) << 4, entry.data, FALSE, false); } } @@ -1944,10 +1938,9 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, } // Mark all extra parameters not used - std::map<U16, ExtraParameter*>::iterator iter; - for (auto iter = mExtraParameterList.begin(), end_it = mExtraParameterList.end(); iter != end_it; ++iter) + for (auto& entry : mExtraParameterList) { - iter->second->in_use = FALSE; + if (entry.in_use) *entry.in_use = false; } // Unpack extra params @@ -1965,12 +1958,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys, unpackParameterEntry(param_type, &dp2); } - for (auto iter = mExtraParameterList.begin(), end_it = mExtraParameterList.end(); iter != end_it; ++iter) + for (size_t i = 0; i < mExtraParameterList.size(); ++i) { - if (!iter->second->in_use) + auto& entry = mExtraParameterList[i]; + if (entry.in_use && !*entry.in_use) { // Send an update message in case it was formerly in use - parameterChanged(iter->first, iter->second->data, FALSE, false); + parameterChanged((i + 1) << 4, entry.data, FALSE, false); } } @@ -4088,7 +4082,7 @@ void LLViewerObject::boostTexturePriority(BOOL boost_children /* = TRUE */) if (isSculpted() && !isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); LLViewerTextureManager::getFetchedTexture(sculpt_id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE)->setBoostLevel(LLGLTexture::BOOST_SELECTED); } @@ -6037,7 +6031,7 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) if (param) { param->data->unpack(*dp); - param->in_use = TRUE; + *param->in_use = TRUE; parameterChanged(param_type, param->data, TRUE, false); return true; } @@ -6049,96 +6043,65 @@ bool LLViewerObject::unpackParameterEntry(U16 param_type, LLDataPacker *dp) LLViewerObject::ExtraParameter* LLViewerObject::createNewParameterEntry(U16 param_type) { - LLNetworkData* new_block = NULL; + LLNetworkData* new_block = nullptr; + bool* in_use = NULL; switch (param_type) { case LLNetworkData::PARAMS_FLEXIBLE: { - new_block = new LLFlexibleObjectData(); + mFlexibleObjectData = std::make_unique<LLFlexibleObjectData>(); + new_block = mFlexibleObjectData.get(); + in_use = &mFlexibleObjectDataInUse; break; } case LLNetworkData::PARAMS_LIGHT: { - new_block = new LLLightParams(); + mLightParams = std::make_unique<LLLightParams>(); + new_block = mLightParams.get(); + in_use = &mLightParamsInUse; break; } case LLNetworkData::PARAMS_SCULPT: { - new_block = new LLSculptParams(); + mSculptParams = std::make_unique<LLSculptParams>(); + new_block = mSculptParams.get(); + in_use = &mSculptParamsInUse; break; } case LLNetworkData::PARAMS_LIGHT_IMAGE: { - new_block = new LLLightImageParams(); + mLightImageParams = std::make_unique<LLLightImageParams>(); + new_block = mLightImageParams.get(); + in_use = &mLightImageParamsInUse; break; } case LLNetworkData::PARAMS_EXTENDED_MESH: { - new_block = new LLExtendedMeshParams(); + mExtendedMeshParams = std::make_unique<LLExtendedMeshParams>(); + new_block = mExtendedMeshParams.get(); + in_use = &mExtendedMeshParamsInUse; break; } default: { - LL_INFOS() << "Unknown param type." << LL_ENDL; + LL_INFOS() << "Unknown param type. (" << llformat("0x%2x", param_type) << ")" << LL_ENDL; break; } }; + ExtraParameter& entry = mExtraParameterList[U32(param_type >> 4) - 1]; if (new_block) { - ExtraParameter* new_entry = new ExtraParameter; - new_entry->data = new_block; - new_entry->in_use = false; // not in use yet - mExtraParameterList.insert_or_assign(param_type, new_entry); - return new_entry; - } - return NULL; -} - -LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntry(U16 param_type) const -{ - auto itor = mExtraParameterList.find(param_type); - if (itor != mExtraParameterList.end()) - { - return itor->second; - } - return NULL; -} - -LLViewerObject::ExtraParameter* LLViewerObject::getExtraParameterEntryCreate(U16 param_type) -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (!param) - { - param = createNewParameterEntry(param_type); - } - return param; -} - -LLNetworkData* LLViewerObject::getParameterEntry(U16 param_type) const -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) - { - return param->data; + entry.in_use = in_use; + *entry.in_use = false; // not in use yet + entry.data = new_block; + return &entry; } else { - return NULL; - } -} - -BOOL LLViewerObject::getParameterEntryInUse(U16 param_type) const -{ - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) - { - return param->in_use; - } - else - { - return FALSE; + entry.is_invalid = true; } + return nullptr; } bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin) @@ -6146,11 +6109,11 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ ExtraParameter* param = getExtraParameterEntryCreate(param_type); if (param) { - if (param->in_use && new_value == *(param->data)) + if (*(param->in_use) && new_value == *(param->data)) { return false; } - param->in_use = true; + *param->in_use = true; param->data->copy(new_value); parameterChanged(param_type, param->data, TRUE, local_origin); return true; @@ -6166,22 +6129,28 @@ bool LLViewerObject::setParameterEntry(U16 param_type, const LLNetworkData& new_ // Should always return true. bool LLViewerObject::setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin) { - ExtraParameter* param = getExtraParameterEntryCreate(param_type); - if (param && param->in_use != in_use) + if (param_type <= LLNetworkData::PARAMS_MAX) { - param->in_use = in_use; - parameterChanged(param_type, param->data, in_use, local_origin); - return true; + ExtraParameter* param = (in_use ? getExtraParameterEntryCreate(param_type) : &getExtraParameterEntry(param_type)); + if (param && param->data && *param->in_use != (bool)in_use) + { + *param->in_use = in_use; + parameterChanged(param_type, param->data, in_use, local_origin); + return true; + } } return false; } void LLViewerObject::parameterChanged(U16 param_type, bool local_origin) { - ExtraParameter* param = getExtraParameterEntry(param_type); - if (param) + if (param_type <= LLNetworkData::PARAMS_MAX) { - parameterChanged(param_type, param->data, param->in_use, local_origin); + const ExtraParameter& param = getExtraParameterEntry(param_type); + if (param.data) + { + parameterChanged(param_type, param.data, *param.in_use, local_origin); + } } } @@ -6649,9 +6618,9 @@ void LLViewerObject::setPhysicsShapeType(U8 type) mPhysicsShapeUnknown = false; if (type != mPhysicsShapeType) { - mPhysicsShapeType = type; - mCostStale = true; -} + mPhysicsShapeType = type; + mCostStale = true; + } } void LLViewerObject::setPhysicsGravity(F32 gravity) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 87c3acb5b9e35d62f1a5e4310f3f31651474893d..071d0d23eca09205f8ed6fd453156ad0c4d8475d 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -117,13 +117,24 @@ class LLViewerObject protected: virtual ~LLViewerObject(); // use unref() - // TomY: Provide for a list of extra parameter structures, mapped by structure name +private: struct ExtraParameter { - BOOL in_use; - LLNetworkData *data; + bool is_invalid = false; + bool* in_use = nullptr; + LLNetworkData* data = nullptr; }; - absl::flat_hash_map<U16, ExtraParameter*> mExtraParameterList; + std::vector<ExtraParameter> mExtraParameterList; + bool mFlexibleObjectDataInUse = false; + bool mLightParamsInUse = false; + bool mSculptParamsInUse = false; + bool mLightImageParamsInUse = false; + bool mExtendedMeshParamsInUse = false; + std::unique_ptr<LLFlexibleObjectData> mFlexibleObjectData; + std::unique_ptr<LLLightParams> mLightParams; + std::unique_ptr<LLSculptParams> mSculptParams; + std::unique_ptr<LLLightImageParams> mLightImageParams; + std::unique_ptr<LLExtendedMeshParams> mExtendedMeshParams; public: typedef std::list<LLPointer<LLViewerObject> > child_list_t; @@ -587,10 +598,15 @@ class LLViewerObject virtual void dirtySpatialGroup(BOOL priority = FALSE) const; virtual void dirtyMesh(); - virtual LLNetworkData* getParameterEntry(U16 param_type) const; - virtual bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); - virtual BOOL getParameterEntryInUse(U16 param_type) const; - virtual bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); + const LLFlexibleObjectData* getFlexibleObjectData() const { return mFlexibleObjectDataInUse ? mFlexibleObjectData.get() : nullptr; } + const LLLightParams* getLightParams() const { return mLightParamsInUse ? mLightParams.get() : nullptr; } + const LLSculptParams* getSculptParams() const { return mSculptParamsInUse ? mSculptParams.get() : nullptr; } + const LLLightImageParams* getLightImageParams() const { return mLightImageParamsInUse ? mLightImageParams.get() : nullptr; } + const LLExtendedMeshParams* getExtendedMeshParams() const { return mExtendedMeshParamsInUse ? mExtendedMeshParams.get() : nullptr; } + + bool setParameterEntry(U16 param_type, const LLNetworkData& new_value, bool local_origin); + bool setParameterEntryInUse(U16 param_type, BOOL in_use, bool local_origin); + // Called when a parameter is changed virtual void parameterChanged(U16 param_type, bool local_origin); virtual void parameterChanged(U16 param_type, LLNetworkData* data, BOOL in_use, bool local_origin); @@ -621,9 +637,32 @@ class LLViewerObject private: ExtraParameter* createNewParameterEntry(U16 param_type); - ExtraParameter* getExtraParameterEntry(U16 param_type) const; - ExtraParameter* getExtraParameterEntryCreate(U16 param_type); - bool unpackParameterEntry(U16 param_type, LLDataPacker *dp); + const ExtraParameter& getExtraParameterEntry(U16 param_type) const + { + return mExtraParameterList[U32(param_type >> 4) - 1]; + } + ExtraParameter& getExtraParameterEntry(U16 param_type) + { + return mExtraParameterList[U32(param_type >> 4) - 1]; + } + ExtraParameter* getExtraParameterEntryCreate(U16 param_type) + { + if (param_type <= LLNetworkData::PARAMS_MAX) + { + ExtraParameter& param = getExtraParameterEntry(param_type); + if (!param.is_invalid) + { + if (!param.data) + { + ExtraParameter* new_entry = createNewParameterEntry(param_type); + return new_entry; + } + return ¶m; + } + } + return nullptr; + } + bool unpackParameterEntry(U16 param_type, LLDataPacker* dp); // This function checks to see if the given media URL has changed its version // and the update wasn't due to this agent's last action. diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f78c35fb4f75753d6c257e18f265a876ad7e133d..b20b9fca3cdc8a529e6e345c2ed824a99a2f3779 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -350,7 +350,7 @@ U32 LLVOVolume::processUpdateMessage(LLMessageSystem *mesgsys, U8 sculpt_type = 0; if (isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)getSculptParams(); sculpt_id = sculpt_params->getSculptTexture(); sculpt_type = sculpt_params->getSculptType(); @@ -866,7 +866,7 @@ void LLVOVolume::updateTextureVirtualSize(bool forced) if (getLightTextureID().notNull()) { - LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + LLLightImageParams* params = (LLLightImageParams*) getLightImageParams(); LLUUID id = params->getLightTexture(); mLightTexture = LLViewerTextureManager::getFetchedTexture(id, FTT_DEFAULT, TRUE, LLGLTexture::BOOST_ALM); if (mLightTexture.notNull()) @@ -1012,7 +1012,7 @@ BOOL LLVOVolume::setVolume(const LLVolumeParams ¶ms_in, const S32 detail, bo setParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE, TRUE, false); if (!mVolumeImpl) { - LLFlexibleObjectData* data = (LLFlexibleObjectData*)getParameterEntry(LLNetworkData::PARAMS_FLEXIBLE); + LLFlexibleObjectData* data = (LLFlexibleObjectData*)getFlexibleObjectData(); mVolumeImpl = new LLVolumeImplFlexible(this, data); } } @@ -1106,7 +1106,7 @@ void LLVOVolume::updateSculptTexture() if (isSculpted() && !isMesh()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + LLSculptParams *sculpt_params = (LLSculptParams *)getSculptParams(); LLUUID id = sculpt_params->getSculptTexture(); if (id.notNull()) { @@ -3168,7 +3168,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) { old_texturep->removeVolume(LLRender::LIGHT_TEX, this); } - LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + LLLightImageParams* param_block = (LLLightImageParams*)getLightImageParams(); if (param_block && param_block->getLightTexture() != id) { param_block->setLightTexture(id); @@ -3198,7 +3198,7 @@ void LLVOVolume::setLightTextureID(LLUUID id) void LLVOVolume::setSpotLightParams(LLVector3 params) { - LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); + LLLightImageParams* param_block = (LLLightImageParams*)getLightImageParams(); if (param_block && param_block->getParams() != params) { param_block->setParams(params); @@ -3240,7 +3240,7 @@ void LLVOVolume::setLightSRGBColor(const LLColor3& color) void LLVOVolume::setLightLinearColor(const LLColor3& color) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getLinearColor() != color) @@ -3255,7 +3255,7 @@ void LLVOVolume::setLightLinearColor(const LLColor3& color) void LLVOVolume::setLightIntensity(F32 intensity) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getLinearColor().mV[3] != intensity) @@ -3268,7 +3268,7 @@ void LLVOVolume::setLightIntensity(F32 intensity) void LLVOVolume::setLightRadius(F32 radius) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getRadius() != radius) @@ -3281,7 +3281,7 @@ void LLVOVolume::setLightRadius(F32 radius) void LLVOVolume::setLightFalloff(F32 falloff) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getFalloff() != falloff) @@ -3294,7 +3294,7 @@ void LLVOVolume::setLightFalloff(F32 falloff) void LLVOVolume::setLightCutoff(F32 cutoff) { - LLLightParams *param_block = (LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + LLLightParams *param_block = (LLLightParams *)getLightParams(); if (param_block) { if (param_block->getCutoff() != cutoff) @@ -3309,7 +3309,7 @@ void LLVOVolume::setLightCutoff(F32 cutoff) BOOL LLVOVolume::getIsLight() const { - return getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT); + return getLightParams() != nullptr; } LLColor3 LLVOVolume::getLightSRGBBaseColor() const @@ -3319,7 +3319,7 @@ LLColor3 LLVOVolume::getLightSRGBBaseColor() const LLColor3 LLVOVolume::getLightLinearBaseColor() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return LLColor3(param_block->getLinearColor()); @@ -3332,7 +3332,7 @@ LLColor3 LLVOVolume::getLightLinearBaseColor() const LLColor3 LLVOVolume::getLightLinearColor() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return LLColor3(param_block->getLinearColor()) * param_block->getLinearColor().mV[3]; @@ -3352,30 +3352,24 @@ LLColor3 LLVOVolume::getLightSRGBColor() const LLUUID LLVOVolume::getLightTextureID() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams *param_block = getLightImageParams(); + if (param_block) { - const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (param_block) - { - return param_block->getLightTexture(); - } + return param_block->getLightTexture(); } - + return LLUUID::null; } LLVector3 LLVOVolume::getSpotLightParams() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams *param_block = getLightImageParams(); + if (param_block) { - const LLLightImageParams *param_block = (const LLLightImageParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (param_block) - { - return param_block->getParams(); - } + return param_block->getParams(); } - + return LLVector3(); } @@ -3410,8 +3404,8 @@ void LLVOVolume::updateSpotLightPriority() bool LLVOVolume::isLightSpotlight() const { - LLLightImageParams* params = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); - if (params && getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + const LLLightImageParams* params = getLightImageParams(); + if (params) { return params->isLightSpotlight(); } @@ -3440,7 +3434,7 @@ LLViewerTexture* LLVOVolume::getLightTexture() F32 LLVOVolume::getLightIntensity() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getLinearColor().mV[3]; @@ -3453,7 +3447,7 @@ F32 LLVOVolume::getLightIntensity() const F32 LLVOVolume::getLightRadius() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getRadius(); @@ -3466,7 +3460,7 @@ F32 LLVOVolume::getLightRadius() const F32 LLVOVolume::getLightFalloff(const F32 fudge_factor) const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getFalloff() * fudge_factor; @@ -3479,7 +3473,7 @@ F32 LLVOVolume::getLightFalloff(const F32 fudge_factor) const F32 LLVOVolume::getLightCutoff() const { - const LLLightParams *param_block = (const LLLightParams *)getParameterEntry(LLNetworkData::PARAMS_LIGHT); + const LLLightParams *param_block = getLightParams(); if (param_block) { return param_block->getCutoff(); @@ -3502,7 +3496,7 @@ U32 LLVOVolume::getVolumeInterfaceID() const BOOL LLVOVolume::isFlexible() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_FLEXIBLE)) + if (getFlexibleObjectData()) { LLVolume* volume = getVolume(); if (volume && volume->getParams().getPathParams().getCurveType() != LL_PCODE_PATH_FLEXIBLE) @@ -3521,7 +3515,7 @@ BOOL LLVOVolume::isFlexible() const BOOL LLVOVolume::isSculpted() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_SCULPT)) + if (getSculptParams()) { return TRUE; } @@ -3533,7 +3527,7 @@ BOOL LLVOVolume::isMesh() const { if (isSculpted()) { - LLSculptParams *sculpt_params = (LLSculptParams *)getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = getSculptParams(); U8 sculpt_type = sculpt_params->getSculptType(); if ((sculpt_type & LL_SCULPT_TYPE_MASK) == LL_SCULPT_TYPE_MESH) @@ -3548,7 +3542,7 @@ BOOL LLVOVolume::isMesh() const BOOL LLVOVolume::hasLightTexture() const { - if (getParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE)) + if (getLightImageParams()) { return TRUE; } @@ -3640,8 +3634,7 @@ BOOL LLVOVolume::isRiggedMesh() const //---------------------------------------------------------------------------- U32 LLVOVolume::getExtendedMeshFlags() const { - const LLExtendedMeshParams *param_block = - (const LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + const LLExtendedMeshParams *param_block = getExtendedMeshParams(); if (param_block) { return param_block->getFlags(); @@ -3686,8 +3679,7 @@ void LLVOVolume::setExtendedMeshFlags(U32 flags) { bool in_use = true; setParameterEntryInUse(LLNetworkData::PARAMS_EXTENDED_MESH, in_use, true); - LLExtendedMeshParams *param_block = - (LLExtendedMeshParams *)getParameterEntry(LLNetworkData::PARAMS_EXTENDED_MESH); + LLExtendedMeshParams *param_block = (LLExtendedMeshParams *)getExtendedMeshParams(); if (param_block) { param_block->setFlags(flags); @@ -4028,7 +4020,7 @@ U32 LLVOVolume::getRenderCost(texture_cost_t &textures) const } else { - const LLSculptParams *sculpt_params = (LLSculptParams *) getParameterEntry(LLNetworkData::PARAMS_SCULPT); + const LLSculptParams *sculpt_params = (LLSculptParams *) getSculptParams(); LLUUID sculpt_id = sculpt_params->getSculptTexture(); if (textures.find(sculpt_id) == textures.end()) {