Skip to content

Commit

Permalink
Update mesh.js
Browse files Browse the repository at this point in the history
#6193 update code example to fix uv and include setting normals
  • Loading branch information
IRobot1 authored Mar 20, 2024
1 parent 374a492 commit 5aaa83f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/scene/mesh.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 5aaa83f

Please sign in to comment.