Skip to content

Commit 189fb5a

Browse files
committed
apply UV2 Y-flip to Legacy and M3 renderers for OpenGL origin consistency
1 parent 0ac6816 commit 189fb5a

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/js/3D/renderers/M2LegacyRendererGL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,9 +354,9 @@ class M2LegacyRendererGL {
354354
vertex_view.setFloat32(offset + 32, m2.uv[uv_idx], true);
355355
vertex_view.setFloat32(offset + 36, m2.uv[uv_idx + 1], true);
356356

357-
// texcoord2
357+
// texcoord2 (y-flipped for opengl bottom-left origin)
358358
vertex_view.setFloat32(offset + 40, m2.uv2[uv_idx], true);
359-
vertex_view.setFloat32(offset + 44, m2.uv2[uv_idx + 1], true);
359+
vertex_view.setFloat32(offset + 44, 1 - m2.uv2[uv_idx + 1], true);
360360
}
361361

362362
// map triangle indices

src/js/3D/renderers/M2RendererGL.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ class M2RendererGL {
525525
vertex_view.setFloat32(offset + 32, m2.uv[uv_idx], true);
526526
vertex_view.setFloat32(offset + 36, m2.uv[uv_idx + 1], true);
527527

528-
// texcoord2
528+
// texcoord2 (y-flipped for opengl bottom-left origin)
529529
vertex_view.setFloat32(offset + 40, m2.uv2[uv_idx], true);
530530
vertex_view.setFloat32(offset + 44, 1 - m2.uv2[uv_idx + 1], true);
531531
}

src/js/3D/renderers/M3RendererGL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,9 @@ class M3RendererGL {
124124
vertex_view.setFloat32(offset + 32, m3.uv ? m3.uv[uv_idx] : 0, true);
125125
vertex_view.setFloat32(offset + 36, m3.uv ? m3.uv[uv_idx + 1] : 0, true);
126126

127-
// texcoord2
127+
// texcoord2 (y-flipped for opengl bottom-left origin)
128128
vertex_view.setFloat32(offset + 40, m3.uv2 ? m3.uv2[uv_idx] : 0, true);
129-
vertex_view.setFloat32(offset + 44, m3.uv2 ? m3.uv2[uv_idx + 1] : 0, true);
129+
vertex_view.setFloat32(offset + 44, m3.uv2 ? 1 - m3.uv2[uv_idx + 1] : 0, true);
130130
}
131131

132132
// create VAO

0 commit comments

Comments
 (0)