Drtvwr 596 11/8/2023 (#501)

* SL-20570 Fix for lossy (and square) normal maps when importing GLTF materials.

* SL-20582 Fix for overriding to alpha mode blend not working.  Incidental decruft of dead code (thanks, Rye!)
meow-7.2.2
RunitaiLinden 2023-11-13 13:12:48 -06:00 committed by GitHub
parent afa45530f7
commit 843866d193
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 51 deletions

View File

@ -723,6 +723,7 @@ void LLGLTFMaterial::applyOverrideLLSD(const LLSD& data)
if (am.isInteger())
{
mAlphaMode = (AlphaMode) am.asInteger();
mOverrideAlphaMode = true;
}
const LLSD& ac = data["ac"];

View File

@ -2376,42 +2376,6 @@ void LLRenderMaterialParams::copy(const LLNetworkData& data)
mEntries = param.mEntries;
}
LLSD LLRenderMaterialParams::asLLSD() const
{
LLSD ret;
for (int i = 0; i < mEntries.size(); ++i)
{
ret[i]["te_idx"] = mEntries[i].te_idx;
ret[i]["id"] = mEntries[i].id;
}
return ret;
}
bool LLRenderMaterialParams::fromLLSD(LLSD& sd)
{
if (sd.isArray())
{
mEntries.resize(sd.size());
for (int i = 0; i < sd.size(); ++i)
{
if (sd[i].has("te_idx") && sd.has("id"))
{
mEntries[i].te_idx = sd[i]["te_idx"].asInteger();
mEntries[i].id = sd[i]["id"].asUUID();
}
else
{
return false;
}
}
return true;
}
return false;
}
void LLRenderMaterialParams::setMaterial(U8 te, const LLUUID& id)
{

View File

@ -382,10 +382,7 @@ public:
BOOL unpack(LLDataPacker& dp) override;
bool operator==(const LLNetworkData& data) const override;
void copy(const LLNetworkData& data) override;
LLSD asLLSD() const;
operator LLSD() const { return asLLSD(); }
bool fromLLSD(LLSD& sd);
void setMaterial(U8 te_idx, const LLUUID& id);
const LLUUID& getMaterial(U8 te_idx) const;

View File

@ -1840,17 +1840,9 @@ static void pack_textures(
if (normal_img)
{
normal_j2c = LLViewerTextureList::convertToUploadFile(normal_img);
LLPointer<LLImageJ2C> test;
test = LLViewerTextureList::convertToUploadFile(normal_img, 1024, true);
S32 lossy_bytes = normal_j2c->getDataSize();
S32 lossless_bytes = test->getDataSize();
LL_DEBUGS("MaterialEditor") << llformat("Lossless vs Lossy: (%d/%d) = %.2f", lossless_bytes, lossy_bytes, (F32)lossless_bytes / lossy_bytes) << LL_ENDL;
normal_j2c = test;
// create a losslessly compressed version of the normal map
normal_j2c = LLViewerTextureList::convertToUploadFile(normal_img, 1024, false, true);
LL_DEBUGS("MaterialEditor") << "Normal: " << normal_j2c->getDataSize() << LL_ENDL;
}
if (mr_img)