From 2be54fbe6f7e19a1e924f1d62e4327da2406310d Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 8 Oct 2014 11:45:12 -0400 Subject: Switched to keying joint offsets by mesh id --- indra/newview/llvovolume.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 9d16ce5a7b..35893a0354 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -4637,8 +4637,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) const LLVector3& jointPos = pSkinData->mAlternateBindMatrix[i].getTranslation(); //Set the joint position - const std::string& attachment_name = drawablep->getVObj()->getAttachmentItemName(); - pJoint->addAttachmentPosOverride( jointPos, attachment_name ); + const LLUUID& mesh_id = pSkinData->mMeshID; + pJoint->addAttachmentPosOverride( jointPos, mesh_id, pAvatarVO->avString() ); //If joint is a pelvis then handle old/new pelvis to foot values if ( lookingForJoint == "mPelvis" ) -- cgit v1.2.3 From c686407731751ababecf01569fa02eb5ba62337d Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Thu, 13 Nov 2014 18:47:57 +0200 Subject: MAINT-4092 FIXED Prim faces with opaque diffuse maps, with material set to ALPHA_MODE_BLEND, do not render MAINT-4645 FIXED [viewer-lion] The build tool shows normal or specular map as 'none' when one exists --- indra/newview/llvovolume.cpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 35893a0354..f2199b5189 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2040,18 +2040,19 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { - S32 res = 0; - - if (pMaterialParams && getTEImage(te) && 3 == getTEImage(te)->getComponents() && pMaterialParams->getDiffuseAlphaMode()) - { - LLViewerObject::setTEMaterialID(te, LLMaterialID::null); - res = LLViewerObject::setTEMaterialParams(te, NULL); - } - else + if(pMaterialParams) { - res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LLViewerTexture* image = getTEImage(te); + LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB; + LLMaterialPtr current_material = getTEMaterialParams(te); + const_cast(pMaterialParams)->setDiffuseAlphaMode( + current_material.isNull() ? (GL_RGB == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + : current_material->getDiffuseAlphaMode() + ); } + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; -- cgit v1.2.3 From 16d0b87b3ce7b88069b08981791f470cf6703c64 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 21 Nov 2014 00:37:15 +0200 Subject: MAINT-4092 FIXED Prim faces with opaque diffuse maps, with material set to ALPHA MODE BLEND, do not render Pathset #3. Fix problem with not existing UUID's and if have a "conflict" when material can't have DIFFUSE_ALPHA_MODE_BLEND and DIFFUSE_ALPHA_MODE_NONE simultaneously. --- indra/newview/llvovolume.cpp | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index f2199b5189..6839bed761 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2040,20 +2040,32 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { + LLMaterialPtr pMaterial = const_cast(pMaterialParams); + if(pMaterialParams) { LLViewerTexture* image = getTEImage(te); LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB; LLMaterialPtr current_material = getTEMaterialParams(te); - const_cast(pMaterialParams)->setDiffuseAlphaMode( - current_material.isNull() ? (GL_RGB == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) - : current_material->getDiffuseAlphaMode() - ); + + U8 new_diffuse_alpha_mode = pMaterialParams->getDiffuseAlphaMode(); + + if(new_diffuse_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + { + new_diffuse_alpha_mode = (GL_RGB == image_format || 0 == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : new_diffuse_alpha_mode); + } + + if(pMaterialParams->getDiffuseAlphaMode() != new_diffuse_alpha_mode) { + //create new material + pMaterial = new LLMaterial(pMaterialParams->asLLSD()); + pMaterial->setDiffuseAlphaMode(new_diffuse_alpha_mode); + LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial); + } } - S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams); + S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial); - LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res + LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res << ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast(this), te) ? " selected" : " not selected" ) << LL_ENDL; setChanged(ALL_CHANGED); -- cgit v1.2.3 From 5c255726f4820ea5007ea939a49eba82f8bdbc0b Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 12 Dec 2014 20:14:09 +0200 Subject: MAINT-3488 FIXED Pose balls are sometimes invisible after standing up until zooming camera closer --- indra/newview/llvovolume.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 008ef792e0..b49543c158 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -1742,6 +1742,8 @@ BOOL LLVOVolume::updateGeometry(LLDrawable *drawable) } } } + + genBBoxes(FALSE); } // it has its own drawable (it's moved) or it has changed UVs or it has changed xforms from global<->local else @@ -4973,7 +4975,7 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) facep->clearVertexBuffer(); } } - + if (is_rigged) { if (!drawablep->isState(LLDrawable::RIGGED)) @@ -4989,7 +4991,6 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group) { drawablep->clearState(LLDrawable::RIGGED); } - } } @@ -5464,8 +5465,8 @@ void LLVolumeGeometryManager::genDrawInfo(LLSpatialGroup* group, U32 mask, LLFac flexi = flexi || facep->getViewerObject()->getVolume()->isUnique(); } - } } + } if (flexi && buffer_usage && buffer_usage != GL_STREAM_DRAW_ARB) -- cgit v1.2.3 From bb3517c24e77e7fdea915a8a57326e10e8261d7c Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Wed, 7 Jan 2015 02:04:03 +0200 Subject: MAINT-4773 FIXED Some transparent textures are rendered as white. This bug fix related also to MAINT-4092. In 4092 sometimes when we don't have information about the texture during the setup the materail (LLVOVolume::setTEMaterialParams()), we should substitute the material with disabled "diffuse alpha mode" (for detail in cases see MAINT-4092 JIRA ticket comment). This bug fix cover the case when after the loading texture we have all information about alpha mode, and in this case we should restore diffuse alpha mode if need. In short: now we always believe that information about the material is valid (LLVOVolume::setTEMaterialParams()). Of course before setup it we check information about texture (if it possible) , if texture is not exist in database or not 32 bit depth (for diffuse) we made changes. But in all other cases (if we can't receive information about texture) we remeber this case in mWaitingTextureInfo multimap. When information about texture will be available we get it in: LLVOVolume::notify AboutCreatingTexture() or Volume::notifyAboutMissingAsset() and again, we recheck it and if need change (substitute) the material parameters. I suppose that this solution is better than was before. If this patch will be accepted , I think that MAINT-4092 should be rechecked again. --- indra/newview/llvovolume.cpp | 220 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 209 insertions(+), 11 deletions(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b49543c158..b483ec283c 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2040,27 +2040,225 @@ S32 LLVOVolume::setTEMaterialID(const U8 te, const LLMaterialID& pMaterialID) return res; } +bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture) +{ //Ok, here we have confirmation about texture creation, check our wait-list + //and make changes, or return false + + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + + //here we just interesting in DIFFUSE_MAP only! + if(LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) + { //ok let's check the diffuse mode + switch(cur_material->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //uups... we have non 32 bit texture with LLMaterial::DIFFUSE_ALPHA_MODE_* => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + + } break; + } //switch + } //if + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + +bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) +{ //Ok, here if we wait information about texture and it's missing + //then depending from the texture map (diffuse, normal, or specular) + //make changes in material and confirm it. If not return false. + std::pair range = mWaitingTextureInfo.equal_range(texture->getID()); + if(range.first == range.second) return false; + + typedef std::map map_te_material; + map_te_material new_material; + + for(mmap_UUID_MAP_t::iterator range_it = range.first; range_it != range.second; ++range_it) + { + LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); + + switch(range_it->second.map) + { + case LLRender::DIFFUSE_MAP: + { + if(LLMaterial::DIFFUSE_ALPHA_MODE_NONE != cur_material->getDiffuseAlphaMode()) + { //missing texture + !LLMaterial::DIFFUSE_ALPHA_MODE_NONE => LLMaterial::DIFFUSE_ALPHA_MODE_NONE + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } break; + case LLRender::NORMAL_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setNormalID(LLUUID::null); + } break; + case LLRender::SPECULAR_MAP: + { //missing texture => reset material texture id + LLMaterialPtr mat = NULL; + map_te_material::iterator it = new_material.find(range_it->second.te); + if(new_material.end() == it) { + mat = new LLMaterial(cur_material->asLLSD()); + new_material.insert(map_te_material::value_type(range_it->second.te, mat)); + } else { + mat = it->second; + } + + mat->setSpecularID(LLUUID::null); + } break; + } //switch + } //for + + //setup new materials + for(map_te_material::const_iterator it = new_material.begin(), end = new_material.end(); it != end; ++it) + { + LLMaterialMgr::getInstance()->put(getID(), it->first, *it->second); + LLViewerObject::setTEMaterialParams(it->first, it->second); + } + + //clear wait-list + mWaitingTextureInfo.erase(range.first, range.second); + + return 0 != new_material.size(); +} + S32 LLVOVolume::setTEMaterialParams(const U8 te, const LLMaterialPtr pMaterialParams) { LLMaterialPtr pMaterial = const_cast(pMaterialParams); if(pMaterialParams) - { - LLViewerTexture* image = getTEImage(te); - LLGLenum image_format = image ? image->getPrimaryFormat() : GL_RGB; - LLMaterialPtr current_material = getTEMaterialParams(te); + { //check all of them according to material settings + + LLViewerTexture *img_diffuse = getTEImage(te); + LLViewerTexture *img_normal = getTENormalMap(te); + LLViewerTexture *img_specular = getTESpecularMap(te); + + llassert(NULL != img_diffuse); + + LLMaterialPtr new_material = NULL; + + //diffuse + if(NULL != img_diffuse) + { //guard + if(0 == img_diffuse->getPrimaryFormat() && !img_diffuse->isMissingAsset()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(img_diffuse->getID(), material_info(LLRender::DIFFUSE_MAP, te))); + } + else + { + bool bSetDiffuseNone = false; + if(img_diffuse->isMissingAsset()) + { + bSetDiffuseNone = true; + } + else + { + switch(pMaterialParams->getDiffuseAlphaMode()) + { + case LLMaterial::DIFFUSE_ALPHA_MODE_BLEND: + case LLMaterial::DIFFUSE_ALPHA_MODE_EMISSIVE: + case LLMaterial::DIFFUSE_ALPHA_MODE_MASK: + { //all of them modes available only for 32 bit textures + if(GL_RGBA != img_diffuse->getPrimaryFormat()) + { + bSetDiffuseNone = true; + } + } break; + } + } //else - U8 new_diffuse_alpha_mode = pMaterialParams->getDiffuseAlphaMode(); - if(new_diffuse_alpha_mode == LLMaterial::DIFFUSE_ALPHA_MODE_BLEND) + if(bSetDiffuseNone) + { //upps... we should substitute this material with LLMaterial::DIFFUSE_ALPHA_MODE_NONE + new_material = new LLMaterial(pMaterialParams->asLLSD()); + new_material->setDiffuseAlphaMode(LLMaterial::DIFFUSE_ALPHA_MODE_NONE); + } + } + } + + //normal + if(LLUUID::null != pMaterialParams->getNormalID()) { - new_diffuse_alpha_mode = (GL_RGB == image_format || 0 == image_format ? LLMaterial::DIFFUSE_ALPHA_MODE_NONE : new_diffuse_alpha_mode); + if(img_normal && img_normal->isMissingAsset() && img_normal->getID() == pMaterialParams->getNormalID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setNormalID(LLUUID::null); + } + else if(NULL == img_normal || 0 == img_normal->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getNormalID(), material_info(LLRender::NORMAL_MAP,te))); + } + + } + + + //specular + if(LLUUID::null != pMaterialParams->getSpecularID()) + { + if(img_specular && img_specular->isMissingAsset() && img_specular->getID() == pMaterialParams->getSpecularID()) + { + if(!new_material) { + new_material = new LLMaterial(pMaterialParams->asLLSD()); + } + new_material->setSpecularID(LLUUID::null); + } + else if(NULL == img_specular || 0 == img_specular->getPrimaryFormat()) + { //ok here we don't have information about texture, let's belief and leave material settings + //but we remember this case + mWaitingTextureInfo.insert(mmap_UUID_MAP_t::value_type(pMaterialParams->getSpecularID(), material_info(LLRender::SPECULAR_MAP, te))); + } } - if(pMaterialParams->getDiffuseAlphaMode() != new_diffuse_alpha_mode) { - //create new material - pMaterial = new LLMaterial(pMaterialParams->asLLSD()); - pMaterial->setDiffuseAlphaMode(new_diffuse_alpha_mode); + if(new_material) { + pMaterial = new_material; LLMaterialMgr::getInstance()->put(getID(),te,*pMaterial); } } -- cgit v1.2.3 From 2eecf882b1cdc63615f3ecd01860d0d5bbdd60b0 Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Fri, 23 Jan 2015 15:03:04 +0200 Subject: MAINT-4833 Fixed Warning treated as error --- indra/newview/llvovolume.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index b483ec283c..fd2e96744a 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2150,6 +2150,9 @@ bool LLVOVolume::notifyAboutMissingAsset(LLViewerTexture *texture) mat->setSpecularID(LLUUID::null); } break; + case LLRender::NUM_TEXTURE_CHANNELS: + //nothing to do, make compiler happy + break; } //switch } //for -- cgit v1.2.3 From 5eeea87ef4f44baa156c898ae393d5e7edb757de Mon Sep 17 00:00:00 2001 From: ruslantproductengine Date: Wed, 4 Mar 2015 19:40:29 +0200 Subject: MAINT-4943 FIXED Crash on location --- indra/newview/llvovolume.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llvovolume.cpp') diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index fd2e96744a..47d4e5565b 100755 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -2054,7 +2054,7 @@ bool LLVOVolume::notifyAboutCreatingTexture(LLViewerTexture *texture) LLMaterialPtr cur_material = getTEMaterialParams(range_it->second.te); //here we just interesting in DIFFUSE_MAP only! - if(LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) + if(NULL != cur_material.get() && LLRender::DIFFUSE_MAP == range_it->second.map && GL_RGBA != texture->getPrimaryFormat()) { //ok let's check the diffuse mode switch(cur_material->getDiffuseAlphaMode()) { -- cgit v1.2.3