diff options
| -rw-r--r-- | indra/llprimitive/llgltfmaterial.h | 2 | ||||
| -rw-r--r-- | indra/llprimitive/llprimitive.cpp | 2 | ||||
| -rw-r--r-- | indra/llprimitive/llprimitive.h | 2 | ||||
| -rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | indra/newview/llmaterialeditor.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/lltooldraganddrop.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.cpp | 29 | ||||
| -rw-r--r-- | indra/newview/llviewerobject.h | 1 | ||||
| -rw-r--r-- | indra/newview/llvovolume.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llvovolume.h | 2 | 
10 files changed, 40 insertions, 6 deletions
diff --git a/indra/llprimitive/llgltfmaterial.h b/indra/llprimitive/llgltfmaterial.h index d6f59cd1a3..a8d5fb8e85 100644 --- a/indra/llprimitive/llgltfmaterial.h +++ b/indra/llprimitive/llgltfmaterial.h @@ -53,6 +53,8 @@ public:      F32 mMetallicFactor = 0.f;      F32 mRoughnessFactor = 0.f; +    F32 mAlphaCutoff = 0.f; +      bool mDoubleSided = false;      AlphaMode mAlphaMode = ALPHA_MODE_OPAQUE; diff --git a/indra/llprimitive/llprimitive.cpp b/indra/llprimitive/llprimitive.cpp index 6df7111a47..3f0059b759 100644 --- a/indra/llprimitive/llprimitive.cpp +++ b/indra/llprimitive/llprimitive.cpp @@ -2430,7 +2430,7 @@ void LLRenderMaterialParams::setMaterial(U8 te, const LLUUID& id)      mEntries.push_back({ te, id });  } -LLUUID LLRenderMaterialParams::getMaterial(U8 te) const +const LLUUID& LLRenderMaterialParams::getMaterial(U8 te) const  {      for (int i = 0; i < mEntries.size(); ++i)      { diff --git a/indra/llprimitive/llprimitive.h b/indra/llprimitive/llprimitive.h index 1c290185b0..d2adfa4a3d 100644 --- a/indra/llprimitive/llprimitive.h +++ b/indra/llprimitive/llprimitive.h @@ -387,7 +387,7 @@ public:      bool fromLLSD(LLSD& sd);      void setMaterial(U8 te_idx, const LLUUID& id); -    LLUUID getMaterial(U8 te_idx) const; +    const LLUUID& getMaterial(U8 te_idx) const;      bool isEmpty() { return mEntries.empty(); }  }; diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index d4bd1c8b57..b67bc91277 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -344,6 +344,7 @@ set(viewer_SOURCE_FILES      llgesturemgr.cpp      llgiveinventory.cpp      llglsandbox.cpp +    llgltfmateriallist.cpp      llgroupactions.cpp      llgroupiconctrl.cpp      llgrouplist.cpp @@ -986,6 +987,7 @@ set(viewer_HEADER_FILES      llgesturelistener.h      llgesturemgr.h      llgiveinventory.h +    llgltfmateriallist.h      llgroupactions.h      llgroupiconctrl.h      llgrouplist.h diff --git a/indra/newview/llmaterialeditor.cpp b/indra/newview/llmaterialeditor.cpp index 2455ad2926..9fb9f723cd 100644 --- a/indra/newview/llmaterialeditor.cpp +++ b/indra/newview/llmaterialeditor.cpp @@ -43,7 +43,6 @@  #include "llviewerregion.h"  #include "llvovolume.h"  #include "roles_constants.h" -#include "tinygltf/tiny_gltf.h"  #include "llviewerobjectlist.h"  #include "llfloaterreg.h"  #include "llfilesystem.h" @@ -52,6 +51,7 @@  #include "llviewertexturelist.h"  #include "llfloaterperms.h" +#include "tinygltf/tiny_gltf.h"  #include <strstream>  ///---------------------------------------------------------------------------- diff --git a/indra/newview/lltooldraganddrop.cpp b/indra/newview/lltooldraganddrop.cpp index a4b34bb5b6..55e8a3b98b 100644 --- a/indra/newview/lltooldraganddrop.cpp +++ b/indra/newview/lltooldraganddrop.cpp @@ -1083,8 +1083,6 @@ void LLToolDragAndDrop::dropMaterialOneFace(LLViewerObject* hit_obj,      {          return;      } -     -    LLTextureEntry* tep = hit_obj ? (hit_obj->getTE(hit_face)) : NULL;      hit_obj->setRenderMaterialID(hit_face, asset_id); diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp index 232e51896e..753fb014c9 100644 --- a/indra/newview/llviewerobject.cpp +++ b/indra/newview/llviewerobject.cpp @@ -107,6 +107,7 @@  #include "llcleanup.h"  #include "llcallstack.h"  #include "llmeshrepository.h" +#include "llgltfmateriallist.h"  #include "llgl.h"  //#define DEBUG_UPDATE_TYPE @@ -4906,6 +4907,18 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)      };      LLGLTFMaterial* mat = getTE(te)->getGLTFMaterial(); +    LLUUID mat_id = getRenderMaterialID(te); +    if (mat == nullptr && mat_id.notNull()) +    { +        mat = gGLTFMaterialList.getMaterial(mat_id); +        getTE(te)->setGLTFMaterial(mat); +    } +    else if (mat_id.isNull() && mat != nullptr) +    { +        mat = nullptr; +        getTE(te)->setGLTFMaterial(nullptr); +    } +      if (mat != nullptr)      {          mGLTFAlbedoMaps[te] = fetch_texture(mat->mAlbedoId); @@ -4913,6 +4926,14 @@ void LLViewerObject::updateTEMaterialTextures(U8 te)          mGLTFMetallicRoughnessMaps[te] = fetch_texture(mat->mMetallicRoughnessId);          mGLTFEmissiveMaps[te] = fetch_texture(mat->mEmissiveId);      } +    else +    { +        mGLTFAlbedoMaps[te] = nullptr; +        mGLTFNormalMaps[te] = nullptr; +        mGLTFMetallicRoughnessMaps[te] = nullptr; +        mGLTFEmissiveMaps[te] = nullptr; +    } +  }  void LLViewerObject::refreshBakeTexture() @@ -7028,8 +7049,16 @@ void LLViewerObject::setRenderMaterialID(U8 te, const LLUUID& id)  {      if (id.notNull())      { +        getTE(te)->setGLTFMaterial(gGLTFMaterialList.getMaterial(id));          setHasRenderMaterialParams(true);      } +    else +    { +        getTE(te)->setGLTFMaterial(nullptr); +    } + +    faceMappingChanged(); +    gPipeline.markTextured(mDrawable);      LLRenderMaterialParams* param_block = (LLRenderMaterialParams*)getParameterEntry(LLNetworkData::PARAMS_RENDER_MATERIAL);      if (param_block) diff --git a/indra/newview/llviewerobject.h b/indra/newview/llviewerobject.h index 1392caa855..109c96dc9c 100644 --- a/indra/newview/llviewerobject.h +++ b/indra/newview/llviewerobject.h @@ -207,6 +207,7 @@ public:  	// Graphical stuff for objects - maybe broken out into render class later?  	virtual void updateTextures(); +    virtual void faceMappingChanged() {}  	virtual void boostTexturePriority(BOOL boost_children = TRUE);	// When you just want to boost priority of this object  	virtual LLDrawable* createDrawable(LLPipeline *pipeline); diff --git a/indra/newview/llvovolume.cpp b/indra/newview/llvovolume.cpp index 685b24d5d6..4fa9f05c09 100644 --- a/indra/newview/llvovolume.cpp +++ b/indra/newview/llvovolume.cpp @@ -5861,6 +5861,8 @@ void LLVolumeGeometryManager::rebuildGeom(LLSpatialGroup* group)  					continue;  				} +                // HACK -- brute force this check every time a drawable gets rebuilt +                vobj->updateTEMaterialTextures(i);  #if 0  #if LL_RELEASE_WITH_DEBUG_INFO                  const LLUUID pbr_id( "49c88210-7238-2a6b-70ac-92d4f35963cf" ); diff --git a/indra/newview/llvovolume.h b/indra/newview/llvovolume.h index 79049851b4..db586fd741 100644 --- a/indra/newview/llvovolume.h +++ b/indra/newview/llvovolume.h @@ -172,7 +172,7 @@ public:  				void	markForUpdate(BOOL priority) override;  				void	markForUnload()							{ LLViewerObject::markForUnload(TRUE); mVolumeChanged = TRUE; } -				void    faceMappingChanged()                    { mFaceMappingChanged=TRUE; }; +				void    faceMappingChanged() override           { mFaceMappingChanged=TRUE; }  	/*virtual*/ void	onShift(const LLVector4a &shift_vector) override; // Called when the drawable shifts  | 
