summaryrefslogtreecommitdiff
path: root/indra/newview/llface.cpp
diff options
context:
space:
mode:
authorcosmic-linden <111533034+cosmic-linden@users.noreply.github.com>2023-03-03 11:04:32 -0800
committerGitHub <noreply@github.com>2023-03-03 11:04:32 -0800
commitf92dddcf1fbf5e7c8e71afa783f2712d08b652cd (patch)
tree121eca245c727f4e0bb9ed33cf730b31932f0109 /indra/newview/llface.cpp
parent9464065503f62ac2603b8cb0089540aaa494d36c (diff)
parentdc7ad02aa577bb572e8bf9d7f39a55de5cd2adef (diff)
Merge pull request #100 from secondlife/SL-19294
SL-19294: Fix Blinn-Phong texture transforms affecting PBR materials
Diffstat (limited to 'indra/newview/llface.cpp')
-rw-r--r--indra/newview/llface.cpp95
1 files changed, 55 insertions, 40 deletions
diff --git a/indra/newview/llface.cpp b/indra/newview/llface.cpp
index a74950dad2..d05e367c12 100644
--- a/indra/newview/llface.cpp
+++ b/indra/newview/llface.cpp
@@ -1524,7 +1524,8 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
|| mVertexBuffer->hasDataType(LLVertexBuffer::TYPE_TEXCOORD2);
}
- bool do_tex_mat = tex_mode && mTextureMatrix;
+ // For GLTF materials: Transforms will be applied later
+ bool do_tex_mat = tex_mode && mTextureMatrix && !gltf_mat;
if (!do_bump)
{ //not bump mapped, might be able to do a cheap update
@@ -1614,7 +1615,7 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
*tex_coords0++ = tc;
}
}
- else
+ else if (do_xform)
{
for (S32 i = 0; i < num_vertices; i++)
{
@@ -1630,6 +1631,20 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
*tex_coords0++ = tc;
}
}
+ else
+ {
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+ LLVector4a& norm = vf.mNormals[i];
+ LLVector4a& center = *(vf.mCenter);
+ LLVector4a vec = vf.mPositions[i];
+ vec.mul(scalea);
+ planarProjection(tc, norm, center, vec);
+
+ *tex_coords0++ = tc;
+ }
+ }
}
}
else
@@ -1694,44 +1709,44 @@ BOOL LLFace::getGeometryVolume(const LLVolume& volume,
}
- for (S32 i = 0; i < num_vertices; i++)
- {
- LLVector2 tc(vf.mTexCoords[i]);
-
- LLVector4a& norm = vf.mNormals[i];
-
- LLVector4a& center = *(vf.mCenter);
-
- if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
- {
- LLVector4a vec = vf.mPositions[i];
-
- vec.mul(scalea);
-
- if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
- {
- planarProjection(tc, norm, center, vec);
- }
- }
-
- if (tex_mode && mTextureMatrix)
- {
- LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
- tmp = tmp * *mTextureMatrix;
- tc.mV[0] = tmp.mV[0];
- tc.mV[1] = tmp.mV[1];
- }
- else
- {
- xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
- }
-
- *dst++ = tc;
- if (do_bump)
- {
- bump_tc.push_back(tc);
- }
- }
+ for (S32 i = 0; i < num_vertices; i++)
+ {
+ LLVector2 tc(vf.mTexCoords[i]);
+
+ LLVector4a& norm = vf.mNormals[i];
+
+ LLVector4a& center = *(vf.mCenter);
+
+ if (texgen != LLTextureEntry::TEX_GEN_DEFAULT)
+ {
+ LLVector4a vec = vf.mPositions[i];
+
+ vec.mul(scalea);
+
+ if (texgen == LLTextureEntry::TEX_GEN_PLANAR)
+ {
+ planarProjection(tc, norm, center, vec);
+ }
+ }
+
+ if (tex_mode && mTextureMatrix)
+ {
+ LLVector3 tmp(tc.mV[0], tc.mV[1], 0.f);
+ tmp = tmp * *mTextureMatrix;
+ tc.mV[0] = tmp.mV[0];
+ tc.mV[1] = tmp.mV[1];
+ }
+ else if (do_xform)
+ {
+ xform(tc, cos_ang, sin_ang, os, ot, ms, mt);
+ }
+
+ *dst++ = tc;
+ if (do_bump)
+ {
+ bump_tc.push_back(tc);
+ }
+ }
}
if ((!mat && !gltf_mat) && do_bump)