Skip to content

Commit f5635a1

Browse files
committed
GLTFExporter: Fix normal computation with interleaved data.
1 parent 23d4ad8 commit f5635a1

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

examples/js/exporters/GLTFExporter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ THREE.GLTFExporter.prototype = {
244244
for ( var i = 0, il = normal.count; i < il; i ++ ) {
245245

246246
// 0.0005 is from glTF-validator
247-
if ( Math.abs( v.fromArray( normal.array, i * 3 ).length() - 1.0 ) > 0.0005 ) return false;
247+
if ( Math.abs( v.fromBufferAttribute( normal, i ).length() - 1.0 ) > 0.0005 ) return false;
248248

249249
}
250250

@@ -273,7 +273,7 @@ THREE.GLTFExporter.prototype = {
273273

274274
for ( var i = 0, il = attribute.count; i < il; i ++ ) {
275275

276-
v.fromArray( attribute.array, i * 3 );
276+
v.fromBufferAttribute( attribute, i );
277277

278278
if ( v.x === 0 && v.y === 0 && v.z === 0 ) {
279279

@@ -286,7 +286,7 @@ THREE.GLTFExporter.prototype = {
286286

287287
}
288288

289-
v.toArray( attribute.array, i * 3 );
289+
attribute.setXYZ( i, v.x, v.y, v.z );
290290

291291
}
292292

examples/jsm/exporters/GLTFExporter.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ GLTFExporter.prototype = {
267267
for ( var i = 0, il = normal.count; i < il; i ++ ) {
268268

269269
// 0.0005 is from glTF-validator
270-
if ( Math.abs( v.fromArray( normal.array, i * 3 ).length() - 1.0 ) > 0.0005 ) return false;
270+
if ( Math.abs( v.fromBufferAttribute( normal, i ).length() - 1.0 ) > 0.0005 ) return false;
271271

272272
}
273273

@@ -296,7 +296,7 @@ GLTFExporter.prototype = {
296296

297297
for ( var i = 0, il = attribute.count; i < il; i ++ ) {
298298

299-
v.fromArray( attribute.array, i * 3 );
299+
v.fromBufferAttribute( attribute, i );
300300

301301
if ( v.x === 0 && v.y === 0 && v.z === 0 ) {
302302

@@ -309,7 +309,7 @@ GLTFExporter.prototype = {
309309

310310
}
311311

312-
v.toArray( attribute.array, i * 3 );
312+
attribute.setXYZ( i, v.x, v.y, v.z );
313313

314314
}
315315

0 commit comments

Comments
 (0)