SL-20396: Apply blinn-phong rotation to texture translation animations for GLTF materials, for more consistent behavior
parent
b553899087
commit
85470fc4d2
|
|
@ -666,7 +666,25 @@ void LLVOVolume::animateTextures()
|
|||
{
|
||||
if (!(result & LLViewerTextureAnim::ROTATE))
|
||||
{
|
||||
rot = 0.0f;
|
||||
if (result & LLViewerTextureAnim::TRANSLATE)
|
||||
{
|
||||
// The current LSL texture animation system is
|
||||
// based on Blinn-Phong texture transforms, which
|
||||
// is incompatible with the GLTF texture
|
||||
// transforms. As a compromise, apply Blinn-Phong
|
||||
// texture rotation on top of the GLTF texture
|
||||
// transforms during a translation animation. This
|
||||
// ensures that the animation loops for trivial
|
||||
// GLTF texture transforms, when it would for
|
||||
// similar Blinn-Phong animations. This is not
|
||||
// guaranteed to loop for nontrivial GLTF texture
|
||||
// transforms.
|
||||
te->getRotation(&rot);
|
||||
}
|
||||
else
|
||||
{
|
||||
rot = 0.0f;
|
||||
}
|
||||
}
|
||||
if (!(result & LLViewerTextureAnim::TRANSLATE))
|
||||
{
|
||||
|
|
@ -679,29 +697,20 @@ void LLVOVolume::animateTextures()
|
|||
scale_t = 1.0f;
|
||||
}
|
||||
|
||||
// For PBR materials, use Blinn-Phong rotation as hint for
|
||||
// translation direction. In a Blinn-Phong material, the
|
||||
// translation direction would be a byproduct the texture
|
||||
// transform.
|
||||
F32 rot_frame;
|
||||
te->getRotation(&rot_frame);
|
||||
|
||||
tex_mat.translate(LLVector3(-0.5f, -0.5f, 0.f));
|
||||
|
||||
LLQuaternion quat;
|
||||
quat.setQuat(rot, 0, 0, -1.f);
|
||||
tex_mat.rotate(quat);
|
||||
tex_mat.rotate(quat);
|
||||
|
||||
LLMatrix4 mat;
|
||||
LLVector3 scale(scale_s, scale_t, 1.f);
|
||||
LLVector3 scale(scale_s, scale_t, 1.f);
|
||||
mat.initAll(scale, LLQuaternion(), LLVector3());
|
||||
tex_mat *= mat;
|
||||
|
||||
LLVector3 off(off_s, off_t, 0.f);
|
||||
off.rotVec(rot_frame, 0, 0, 1.f);
|
||||
tex_mat.translate(off);
|
||||
|
||||
tex_mat.translate(LLVector3(0.5f, 0.5f, 0.f));
|
||||
LLVector3 trans;
|
||||
trans.set(LLVector3(off_s+0.5f, off_t+0.5f, 0.f));
|
||||
tex_mat.translate(trans);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue