diff options
| author | Jonathan "Geenz" Goodman <geenz@lindenlab.com> | 2025-12-03 11:50:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-12-03 11:50:32 -0500 |
| commit | bf347d15804c27348c84a55ab763f89b718e8aac (patch) | |
| tree | a112d8ef3e65581fb1fae03a093a75637d134756 /indra/llprimitive/llgltfmaterial.cpp | |
| parent | aec7bf19ebffd9d6b60c68e31de723eabd6aa98a (diff) | |
| parent | ad6008a5880dff8691f5fce56b7fbfc5ea8b1626 (diff) | |
Merge pull request #4853 from secondlife/release/2025.08
Release/2025.08
Diffstat (limited to 'indra/llprimitive/llgltfmaterial.cpp')
| -rw-r--r-- | indra/llprimitive/llgltfmaterial.cpp | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/indra/llprimitive/llgltfmaterial.cpp b/indra/llprimitive/llgltfmaterial.cpp index cc4921416f..930222e3db 100644 --- a/indra/llprimitive/llgltfmaterial.cpp +++ b/indra/llprimitive/llgltfmaterial.cpp @@ -923,3 +923,34 @@ void LLGLTFMaterial::updateTextureTracking() // setTEGLTFMaterialOverride is responsible for tracking // for material overrides editor will set it } + +void LLGLTFMaterial::convertTextureTransformToPBR( + F32 tex_scale_s, + F32 tex_scale_t, + F32 tex_offset_s, + F32 tex_offset_t, + F32 tex_rotation, + LLVector2& pbr_scale, + LLVector2& pbr_offset, + F32& pbr_rotation) +{ + pbr_scale.set(tex_scale_s, tex_scale_t); + pbr_rotation = -(tex_rotation) / 2.f; + const F32 adjusted_offset_s = tex_offset_s; + const F32 adjusted_offset_t = -tex_offset_t; + F32 center_adjust_s = 0.5f * (1.0f - tex_scale_s); + F32 center_adjust_t = 0.5f * (1.0f - tex_scale_t); + + if (pbr_rotation != 0.0f) + { + const F32 c = cosf(pbr_rotation); + const F32 s = sinf(pbr_rotation); + const F32 tmp_s = center_adjust_s * c - center_adjust_t * s; + const F32 tmp_t = center_adjust_s * s + center_adjust_t * c; + center_adjust_s = tmp_s; + center_adjust_t = tmp_t; + } + + pbr_offset.set(adjusted_offset_s + center_adjust_s, + adjusted_offset_t + center_adjust_t); +} |
