From 5aaa83fe52d97ce627941604fa144d407f331012 Mon Sep 17 00:00:00 2001 From: anidivr Date: Wed, 20 Mar 2024 15:34:26 -0700 Subject: [PATCH] Update mesh.js #6193 update code example to fix uv and include setting normals --- src/scene/mesh.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scene/mesh.js b/src/scene/mesh.js index bbd87687e0e..7de14cd0bf4 100644 --- a/src/scene/mesh.js +++ b/src/scene/mesh.js @@ -124,16 +124,17 @@ class GeometryVertexStream { * 0, 1, 0 // pos 3 * ]); * const uvs = new Float32Array([ - * 0, 0, // uv 0 - * 1, 0, // uv 1 - * 1, 1, // uv 2 * 0, 1 // uv 3 + * 1, 1, // uv 2 + * 1, 0, // uv 1 + * 0, 0, // uv 0 * ]); * const indices = [ * 0, 1, 2, // triangle 0 * 0, 2, 3 // triangle 1 * ]; * mesh.setPositions(positions); + * mesh.setNormals(pc.calculateNormals(positions, indices)); * mesh.setUvs(0, uvs); * mesh.setIndices(indices); * mesh.update();