SL-12069 Backed out changeset: 544a91982eba (#13)
Originally a fix for MAINT-4773/SL-5842 (transparent alpha being white). Reverting due to a critical flaw of the fix replacing material (sometimes server side included). And ignoring user and script input in some cases that makes scripts misbehave. Viewer should Not modify existing content of own volition.master
parent
adbd264d35
commit
78feca373e
|
|
@ -342,34 +342,6 @@ void LLFace::dirtyTexture()
|
|||
gPipeline.markTextured(drawablep);
|
||||
}
|
||||
|
||||
void LLFace::notifyAboutCreatingTexture(LLViewerTexture *texture)
|
||||
{
|
||||
LLDrawable* drawablep = getDrawable();
|
||||
if(mVObjp.notNull() && mVObjp->getVolume())
|
||||
{
|
||||
LLVOVolume *vobj = drawablep->getVOVolume();
|
||||
if(vobj && vobj->notifyAboutCreatingTexture(texture))
|
||||
{
|
||||
gPipeline.markTextured(drawablep);
|
||||
gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFace::notifyAboutMissingAsset(LLViewerTexture *texture)
|
||||
{
|
||||
LLDrawable* drawablep = getDrawable();
|
||||
if(mVObjp.notNull() && mVObjp->getVolume())
|
||||
{
|
||||
LLVOVolume *vobj = drawablep->getVOVolume();
|
||||
if(vobj && vobj->notifyAboutMissingAsset(texture))
|
||||
{
|
||||
gPipeline.markTextured(drawablep);
|
||||
gPipeline.markRebuild(drawablep, LLDrawable::REBUILD_VOLUME);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
|
||||
{
|
||||
llassert(ch < LLRender::NUM_TEXTURE_CHANNELS);
|
||||
|
|
|
|||
|
|
@ -228,9 +228,6 @@ public:
|
|||
LLVertexBuffer* getVertexBuffer() const { return mVertexBuffer; }
|
||||
S32 getRiggedIndex(U32 type) const;
|
||||
|
||||
void notifyAboutCreatingTexture(LLViewerTexture *texture);
|
||||
void notifyAboutMissingAsset(LLViewerTexture *texture);
|
||||
|
||||
// used to preserve draw order of faces that are batched together.
|
||||
// Allows content creators to manipulate linked sets and face ordering
|
||||
// for consistent alpha sorting results, particularly for rigged attachments
|
||||
|
|
|
|||
|
|
@ -659,8 +659,6 @@ S8 LLViewerTexture::getType() const
|
|||
|
||||
void LLViewerTexture::cleanup()
|
||||
{
|
||||
notifyAboutMissingAsset();
|
||||
|
||||
if (LLAppViewer::getTextureFetch())
|
||||
{
|
||||
LLAppViewer::getTextureFetch()->updateRequestPriority(mID, 0.f);
|
||||
|
|
@ -673,30 +671,6 @@ void LLViewerTexture::cleanup()
|
|||
mVolumeList[LLRender::SCULPT_TEX].clear();
|
||||
}
|
||||
|
||||
void LLViewerTexture::notifyAboutCreatingTexture()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
|
||||
for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
|
||||
{
|
||||
for(U32 f = 0; f < mNumFaces[ch]; f++)
|
||||
{
|
||||
mFaceList[ch][f]->notifyAboutCreatingTexture(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerTexture::notifyAboutMissingAsset()
|
||||
{
|
||||
LL_PROFILE_ZONE_SCOPED_CATEGORY_TEXTURE;
|
||||
for(U32 ch = 0; ch < LLRender::NUM_TEXTURE_CHANNELS; ++ch)
|
||||
{
|
||||
for(U32 f = 0; f < mNumFaces[ch]; f++)
|
||||
{
|
||||
mFaceList[ch][f]->notifyAboutMissingAsset(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// virtual
|
||||
void LLViewerTexture::dump()
|
||||
{
|
||||
|
|
@ -1579,8 +1553,6 @@ void LLViewerFetchedTexture::postCreateTexture()
|
|||
mGLTexturep->checkActiveThread();
|
||||
#endif
|
||||
|
||||
notifyAboutCreatingTexture();
|
||||
|
||||
setActive();
|
||||
|
||||
if (!needsToSaveRawImage())
|
||||
|
|
@ -2221,8 +2193,6 @@ void LLViewerFetchedTexture::setIsMissingAsset(BOOL is_missing)
|
|||
}
|
||||
if (is_missing)
|
||||
{
|
||||
notifyAboutMissingAsset();
|
||||
|
||||
if (mUrl.empty())
|
||||
{
|
||||
LL_WARNS() << mID << ": Marking image as missing" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -177,10 +177,7 @@ protected:
|
|||
void cleanup() ;
|
||||
void init(bool firstinit) ;
|
||||
void reorganizeFaceList() ;
|
||||
void reorganizeVolumeList() ;
|
||||
|
||||
void notifyAboutMissingAsset();
|
||||
void notifyAboutCreatingTexture();
|
||||
void reorganizeVolumeList();
|
||||
|
||||
private:
|
||||
friend class LLBumpImageList;
|
||||
|
|
|
|||
|
|
@ -2367,243 +2367,11 @@ 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<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
|
||||
|
||||
typedef std::map<U8, LLMaterialPtr> 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(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())
|
||||
{
|
||||
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<mmap_UUID_MAP_t::iterator, mmap_UUID_MAP_t::iterator> range = mWaitingTextureInfo.equal_range(texture->getID());
|
||||
if(range.first == range.second) return false;
|
||||
|
||||
typedef std::map<U8, LLMaterialPtr> 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);
|
||||
if (cur_material.isNull())
|
||||
continue;
|
||||
|
||||
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;
|
||||
case LLRender::NUM_TEXTURE_CHANNELS:
|
||||
//nothing to do, make compiler happy
|
||||
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()->setLocalMaterial(getRegion()->getRegionID(), 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<LLMaterialPtr&>(pMaterialParams);
|
||||
S32 res = LLViewerObject::setTEMaterialParams(te, pMaterialParams);
|
||||
|
||||
if(pMaterialParams)
|
||||
{ //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
|
||||
LLTextureEntry* tex_entry = getTE(te);
|
||||
bool bIsBakedImageId = false;
|
||||
if (tex_entry && LLAvatarAppearanceDefines::LLAvatarAppearanceDictionary::isBakedImageId(tex_entry->getID()))
|
||||
{
|
||||
bIsBakedImageId = true;
|
||||
}
|
||||
if (GL_RGBA != img_diffuse->getPrimaryFormat() && !bIsBakedImageId)
|
||||
{
|
||||
bSetDiffuseNone = true;
|
||||
}
|
||||
} break;
|
||||
}
|
||||
} //else
|
||||
|
||||
|
||||
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())
|
||||
{
|
||||
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(new_material) {
|
||||
pMaterial = new_material;
|
||||
LLMaterialMgr::getInstance()->setLocalMaterial(getRegion()->getRegionID(), pMaterial);
|
||||
}
|
||||
}
|
||||
|
||||
S32 res = LLViewerObject::setTEMaterialParams(te, pMaterial);
|
||||
|
||||
LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterial) ? pMaterial->asLLSD() : LLSD("null")) << " res " << res
|
||||
LL_DEBUGS("MaterialTEs") << "te " << (S32)te << " material " << ((pMaterialParams) ? pMaterialParams->asLLSD() : LLSD("null")) << " res " << res
|
||||
<< ( LLSelectMgr::getInstance()->getSelection()->contains(const_cast<LLVOVolume*>(this), te) ? " selected" : " not selected" )
|
||||
<< LL_ENDL;
|
||||
setChanged(ALL_CHANGED);
|
||||
|
|
|
|||
|
|
@ -476,26 +476,6 @@ protected:
|
|||
static S32 sNumLODChanges;
|
||||
|
||||
friend class LLVolumeImplFlexible;
|
||||
|
||||
public:
|
||||
bool notifyAboutCreatingTexture(LLViewerTexture *texture);
|
||||
bool notifyAboutMissingAsset(LLViewerTexture *texture);
|
||||
|
||||
private:
|
||||
struct material_info
|
||||
{
|
||||
LLRender::eTexIndex map;
|
||||
U8 te;
|
||||
|
||||
material_info(LLRender::eTexIndex map_, U8 te_)
|
||||
: map(map_)
|
||||
, te(te_)
|
||||
{}
|
||||
};
|
||||
|
||||
typedef std::multimap<LLUUID, material_info> mmap_UUID_MAP_t;
|
||||
mmap_UUID_MAP_t mWaitingTextureInfo;
|
||||
|
||||
};
|
||||
|
||||
#endif // LL_LLVOVOLUME_H
|
||||
|
|
|
|||
Loading…
Reference in New Issue