Skip to content

Commit 9a2fc99

Browse files
committed
vertex indexing optimization for PR
1 parent b048c37 commit 9a2fc99

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

examples/js/modifiers/SimplifyModifier.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,17 +121,16 @@
121121

122122
const vertex = vertices[ i ].position;
123123
position.push( vertex.x, vertex.y, vertex.z );
124+
// cache final index to GREATLY speed up faces reconstruction
125+
vertices[ i ].index = i;
124126

125127
} //
126128

127129

128130
for ( let i = 0; i < faces.length; i ++ ) {
129131

130132
const face = faces[ i ];
131-
const a = vertices.indexOf( face.v1 );
132-
const b = vertices.indexOf( face.v2 );
133-
const c = vertices.indexOf( face.v3 );
134-
index.push( a, b, c );
133+
index.push( face.v1.index, face.v2.index, face.v3.index );
135134

136135
} //
137136

0 commit comments

Comments
 (0)