diff options
author | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-02-27 15:49:15 +0200 |
---|---|---|
committer | andreykproductengine <andreykproductengine@lindenlab.com> | 2018-02-27 15:49:15 +0200 |
commit | d9064d3a4e83a44c518851643993b0b79ac33e13 (patch) | |
tree | 5e214b16e161dbd485229b7fafcbf8c66a005f67 /indra/newview | |
parent | 4c869a97c558c0fa5759b6cf2f560c26a89a09b2 (diff) |
MAINT-8317 Fixed Local Textures for Advanced Lighting Projectors do not keep the selected texture.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/lllocalbitmaps.cpp | 44 | ||||
-rw-r--r-- | indra/newview/lllocalbitmaps.h | 2 | ||||
-rw-r--r-- | indra/newview/llviewertexture.cpp | 56 | ||||
-rw-r--r-- | indra/newview/llviewertexture.h | 12 | ||||
-rw-r--r-- | indra/newview/llvovolume.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llvovolume.h | 6 |
6 files changed, 89 insertions, 54 deletions
diff --git a/indra/newview/lllocalbitmaps.cpp b/indra/newview/lllocalbitmaps.cpp index a55938f334..760325b652 100644 --- a/indra/newview/lllocalbitmaps.cpp +++ b/indra/newview/lllocalbitmaps.cpp @@ -358,8 +358,9 @@ void LLLocalBitmap::replaceIDs(LLUUID old_id, LLUUID new_id) updateUserPrims(old_id, new_id, LLRender::DIFFUSE_MAP); updateUserPrims(old_id, new_id, LLRender::NORMAL_MAP); updateUserPrims(old_id, new_id, LLRender::SPECULAR_MAP); - - updateUserSculpts(old_id, new_id); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something? + + updateUserVolumes(old_id, new_id, LLRender::LIGHT_TEX); + updateUserVolumes(old_id, new_id, LLRender::SCULPT_TEX); // isn't there supposed to be an IMG_DEFAULT_SCULPT or something? // default safeguard image for layers if( new_id == IMG_DEFAULT ) @@ -502,26 +503,39 @@ void LLLocalBitmap::updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel) } } } - } -void LLLocalBitmap::updateUserSculpts(LLUUID old_id, LLUUID new_id) +void LLLocalBitmap::updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel) { LLViewerFetchedTexture* old_texture = gTextureList.findImage(old_id, TEX_LIST_STANDARD); - for(U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(); volume_iter++) + for (U32 volume_iter = 0; volume_iter < old_texture->getNumVolumes(channel); volume_iter++) { - LLVOVolume* volume_to_object = (*old_texture->getVolumeList())[volume_iter]; - LLViewerObject* object = (LLViewerObject*)volume_to_object; - - if(object) + LLVOVolume* volobjp = (*old_texture->getVolumeList(channel))[volume_iter]; + switch (channel) { - if (object->isSculpted() && object->getVolume() && - object->getVolume()->getParams().getSculptID() == old_id) + case LLRender::LIGHT_TEX: + { + if (volobjp->getLightTextureID() == old_id) + { + volobjp->setLightTextureID(new_id); + } + break; + } + case LLRender::SCULPT_TEX: { - LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); - LLSculptParams new_params(*old_params); - new_params.setSculptTexture(new_id, (*old_params).getSculptType()); - object->setParameterEntry(LLNetworkData::PARAMS_SCULPT, new_params, TRUE); + LLViewerObject* object = (LLViewerObject*)volobjp; + + if (object) + { + if (object->isSculpted() && object->getVolume() && + object->getVolume()->getParams().getSculptID() == old_id) + { + LLSculptParams* old_params = (LLSculptParams*)object->getParameterEntry(LLNetworkData::PARAMS_SCULPT); + 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/lllocalbitmaps.h b/indra/newview/lllocalbitmaps.h index 59467922b4..ee4161fb45 100644 --- a/indra/newview/lllocalbitmaps.h +++ b/indra/newview/lllocalbitmaps.h @@ -64,7 +64,7 @@ class LLLocalBitmap void replaceIDs(LLUUID old_id, LLUUID new_id); std::vector<LLViewerObject*> prepUpdateObjects(LLUUID old_id, U32 channel); void updateUserPrims(LLUUID old_id, LLUUID new_id, U32 channel); - void updateUserSculpts(LLUUID old_id, LLUUID new_id); + void updateUserVolumes(LLUUID old_id, LLUUID new_id, U32 channel); void updateUserLayers(LLUUID old_id, LLUUID new_id, LLWearableType::EType type); LLAvatarAppearanceDefines::ETextureIndex getTexIndex(LLWearableType::EType type, LLAvatarAppearanceDefines::EBakedTextureIndex baked_texind); diff --git a/indra/newview/llviewertexture.cpp b/indra/newview/llviewertexture.cpp index e5a1bed48c..2ad6198abd 100644 --- a/indra/newview/llviewertexture.cpp +++ b/indra/newview/llviewertexture.cpp @@ -651,14 +651,16 @@ void LLViewerTexture::init(bool firstinit) mAdditionalDecodePriority = 0.f; mParcelMedia = NULL; - mNumVolumes = 0; + memset(&mNumVolumes, 0, sizeof(U32)* LLRender::NUM_VOLUME_TEXTURE_CHANNELS); mFaceList[LLRender::DIFFUSE_MAP].clear(); mFaceList[LLRender::NORMAL_MAP].clear(); mFaceList[LLRender::SPECULAR_MAP].clear(); mNumFaces[LLRender::DIFFUSE_MAP] = mNumFaces[LLRender::NORMAL_MAP] = mNumFaces[LLRender::SPECULAR_MAP] = 0; - mVolumeList.clear(); + + mVolumeList[LLRender::LIGHT_TEX].clear(); + mVolumeList[LLRender::SCULPT_TEX].clear(); } //virtual @@ -674,7 +676,8 @@ void LLViewerTexture::cleanup() mFaceList[LLRender::DIFFUSE_MAP].clear(); mFaceList[LLRender::NORMAL_MAP].clear(); mFaceList[LLRender::SPECULAR_MAP].clear(); - mVolumeList.clear(); + mVolumeList[LLRender::LIGHT_TEX].clear(); + mVolumeList[LLRender::SCULPT_TEX].clear(); } void LLViewerTexture::notifyAboutCreatingTexture() @@ -891,40 +894,40 @@ S32 LLViewerTexture::getNumFaces(U32 ch) const //virtual -void LLViewerTexture::addVolume(LLVOVolume* volumep) +void LLViewerTexture::addVolume(U32 ch, LLVOVolume* volumep) { - if( mNumVolumes >= mVolumeList.size()) + if (mNumVolumes[ch] >= mVolumeList[ch].size()) { - mVolumeList.resize(2 * mNumVolumes + 1); + mVolumeList[ch].resize(2 * mNumVolumes[ch] + 1); } - mVolumeList[mNumVolumes] = volumep; - volumep->setIndexInTex(mNumVolumes); - mNumVolumes++; + mVolumeList[ch][mNumVolumes[ch]] = volumep; + volumep->setIndexInTex(ch, mNumVolumes[ch]); + mNumVolumes[ch]++; mLastVolumeListUpdateTimer.reset(); } //virtual -void LLViewerTexture::removeVolume(LLVOVolume* volumep) +void LLViewerTexture::removeVolume(U32 ch, LLVOVolume* volumep) { - if(mNumVolumes > 1) + if (mNumVolumes[ch] > 1) { - S32 index = volumep->getIndexInTex(); - llassert(index < mVolumeList.size()); - llassert(index < mNumVolumes); - mVolumeList[index] = mVolumeList[--mNumVolumes]; - mVolumeList[index]->setIndexInTex(index); + S32 index = volumep->getIndexInTex(ch); + llassert(index < mVolumeList[ch].size()); + llassert(index < mNumVolumes[ch]); + mVolumeList[ch][index] = mVolumeList[ch][--mNumVolumes[ch]]; + mVolumeList[ch][index]->setIndexInTex(ch, index); } else { - mVolumeList.clear(); - mNumVolumes = 0; + mVolumeList[ch].clear(); + mNumVolumes[ch] = 0; } mLastVolumeListUpdateTimer.reset(); } -S32 LLViewerTexture::getNumVolumes() const +S32 LLViewerTexture::getNumVolumes(U32 ch) const { - return mNumVolumes; + return mNumVolumes[ch]; } void LLViewerTexture::reorganizeFaceList() @@ -955,9 +958,13 @@ void LLViewerTexture::reorganizeVolumeList() static const F32 MAX_WAIT_TIME = 20.f; // seconds static const U32 MAX_EXTRA_BUFFER_SIZE = 4; - if(mNumVolumes + MAX_EXTRA_BUFFER_SIZE > mVolumeList.size()) + + for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i) { - return; + if (mNumVolumes[i] + MAX_EXTRA_BUFFER_SIZE > mVolumeList[i].size()) + { + return; + } } if(mLastVolumeListUpdateTimer.getElapsedTimeF32() < MAX_WAIT_TIME) @@ -966,7 +973,10 @@ void LLViewerTexture::reorganizeVolumeList() } mLastVolumeListUpdateTimer.reset(); - mVolumeList.erase(mVolumeList.begin() + mNumVolumes, mVolumeList.end()); + for (U32 i = 0; i < LLRender::NUM_VOLUME_TEXTURE_CHANNELS; ++i) + { + mVolumeList[i].erase(mVolumeList[i].begin() + mNumVolumes[i], mVolumeList[i].end()); + } } //virtual diff --git a/indra/newview/llviewertexture.h b/indra/newview/llviewertexture.h index c9dea17f63..5d89f9f029 100644 --- a/indra/newview/llviewertexture.h +++ b/indra/newview/llviewertexture.h @@ -156,10 +156,10 @@ public: S32 getNumFaces(U32 ch) const; const ll_face_list_t* getFaceList(U32 channel) const {llassert(channel < LLRender::NUM_TEXTURE_CHANNELS); return &mFaceList[channel];} - virtual void addVolume(LLVOVolume* volumep); - virtual void removeVolume(LLVOVolume* volumep); - S32 getNumVolumes() const; - const ll_volume_list_t* getVolumeList() const { return &mVolumeList; } + virtual void addVolume(U32 channel, LLVOVolume* volumep); + virtual void removeVolume(U32 channel, LLVOVolume* volumep); + S32 getNumVolumes(U32 channel) const; + const ll_volume_list_t* getVolumeList(U32 channel) const { return &mVolumeList[channel]; } virtual void setCachedRawImage(S32 discard_level, LLImageRaw* imageraw) ; @@ -201,8 +201,8 @@ protected: U32 mNumFaces[LLRender::NUM_TEXTURE_CHANNELS]; LLFrameTimer mLastFaceListUpdateTimer ; - ll_volume_list_t mVolumeList; - U32 mNumVolumes; + ll_volume_list_t mVolumeList[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; + U32 mNumVolumes[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; LLFrameTimer mLastVolumeListUpdateTimer; //do not use LLPointer here. diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index d93cae992b..9958657246 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -222,7 +222,7 @@ LLVOVolume::LLVOVolume(const LLUUID &id, const LLPCode pcode, LLViewerRegion *re mMediaImplList.resize(getNumTEs()); mLastFetchedMediaVersion = -1; - mIndexInTex = 0; + memset(&mIndexInTex, 0, sizeof(S32) * LLRender::NUM_VOLUME_TEXTURE_CHANNELS); mMDCImplCount = 0; } @@ -264,7 +264,11 @@ void LLVOVolume::markDead() if (mSculptTexture.notNull()) { - mSculptTexture->removeVolume(this); + mSculptTexture->removeVolume(LLRender::SCULPT_TEX, this); + } + if (hasLightTexture()) + { + getLightTexture()->removeVolume(LLRender::LIGHT_TEX, this); } } @@ -1086,11 +1090,11 @@ void LLVOVolume::updateSculptTexture() { if (old_sculpt.notNull()) { - old_sculpt->removeVolume(this); + old_sculpt->removeVolume(LLRender::SCULPT_TEX, this); } if (mSculptTexture.notNull()) { - mSculptTexture->addVolume(this); + mSculptTexture->addVolume(LLRender::SCULPT_TEX, this); } } @@ -1203,9 +1207,9 @@ void LLVOVolume::sculpt() getVolume()->sculpt(sculpt_width, sculpt_height, sculpt_components, sculpt_data, discard_level, mSculptTexture->isMissingAsset()); //notify rebuild any other VOVolumes that reference this sculpty volume - for (S32 i = 0; i < mSculptTexture->getNumVolumes(); ++i) + for (S32 i = 0; i < mSculptTexture->getNumVolumes(LLRender::SCULPT_TEX); ++i) { - LLVOVolume* volume = (*(mSculptTexture->getVolumeList()))[i]; + LLVOVolume* volume = (*(mSculptTexture->getVolumeList(LLRender::SCULPT_TEX)))[i]; if (volume != this && volume->getVolume() == getVolume()) { gPipeline.markRebuild(volume->mDrawable, LLDrawable::REBUILD_GEOMETRY, FALSE); @@ -2839,23 +2843,30 @@ S32 LLVOVolume::getFaceIndexWithMediaImpl(const LLViewerMediaImpl* media_impl, S void LLVOVolume::setLightTextureID(LLUUID id) { + LLViewerTexture* old_texturep = getLightTexture(); // same as mLightTexture, but inits if nessesary if (id.notNull()) { if (!hasLightTexture()) { setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, TRUE, true); } + else + { + old_texturep->removeVolume(LLRender::LIGHT_TEX, this); + } LLLightImageParams* param_block = (LLLightImageParams*) getParameterEntry(LLNetworkData::PARAMS_LIGHT_IMAGE); if (param_block && param_block->getLightTexture() != id) { param_block->setLightTexture(id); parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true); } + getLightTexture()->addVolume(LLRender::LIGHT_TEX, this); // new texture } else { if (hasLightTexture()) { + old_texturep->removeVolume(LLRender::LIGHT_TEX, this); setParameterEntryInUse(LLNetworkData::PARAMS_LIGHT_IMAGE, FALSE, true); parameterChanged(LLNetworkData::PARAMS_LIGHT_IMAGE, true); mLightTexture = NULL; diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index a331908320..1a7e49d198 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -202,10 +202,10 @@ public: /*virtual*/ BOOL setMaterial(const U8 material); void setTexture(const S32 face); - S32 getIndexInTex() const {return mIndexInTex ;} + S32 getIndexInTex(U32 ch) const {return mIndexInTex[ch];} /*virtual*/ BOOL setVolume(const LLVolumeParams &volume_params, const S32 detail, bool unique_volume = false); void updateSculptTexture(); - void setIndexInTex(S32 index) { mIndexInTex = index ;} + void setIndexInTex(U32 ch, S32 index) { mIndexInTex[ch] = index ;} void sculpt(); static void rebuildMeshAssetCallback(LLVFS *vfs, const LLUUID& asset_uuid, @@ -370,7 +370,7 @@ private: LLPointer<LLViewerFetchedTexture> mLightTexture; media_list_t mMediaImplList; S32 mLastFetchedMediaVersion; // as fetched from the server, starts as -1 - S32 mIndexInTex; + S32 mIndexInTex[LLRender::NUM_VOLUME_TEXTURE_CHANNELS]; S32 mMDCImplCount; LLPointer<LLRiggedVolume> mRiggedVolume; |