|
@@ -247,7 +247,7 @@ function buildMesh( geometry ) {
|
|
|
|
|
|
function buildMeshVertexCount( geometry ) {
|
|
|
|
|
|
- const count = geometry.index !== null ? geometry.index.array.length : geometry.attributes.position.count;
|
|
|
+ const count = geometry.index !== null ? geometry.index.count : geometry.attributes.position.count;
|
|
|
|
|
|
return Array( count / 3 ).fill( 3 ).join( ', ' );
|
|
|
|
|
@@ -255,18 +255,26 @@ function buildMeshVertexCount( geometry ) {
|
|
|
|
|
|
function buildMeshVertexIndices( geometry ) {
|
|
|
|
|
|
- if ( geometry.index !== null ) {
|
|
|
+ const index = geometry.index;
|
|
|
+ const array = [];
|
|
|
|
|
|
- return geometry.index.array.join( ', ' );
|
|
|
+ if ( index !== null ) {
|
|
|
|
|
|
- }
|
|
|
+ for ( let i = 0; i < index.count; i ++ ) {
|
|
|
|
|
|
- const array = [];
|
|
|
- const length = geometry.attributes.position.count;
|
|
|
+ array.push( index.getX( i ) );
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ const length = geometry.attributes.position.count;
|
|
|
+
|
|
|
+ for ( let i = 0; i < length; i ++ ) {
|
|
|
|
|
|
- for ( let i = 0; i < length; i ++ ) {
|
|
|
+ array.push( i );
|
|
|
|
|
|
- array.push( i );
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -284,11 +292,14 @@ function buildVector3Array( attribute, count ) {
|
|
|
}
|
|
|
|
|
|
const array = [];
|
|
|
- const data = attribute.array;
|
|
|
|
|
|
- for ( let i = 0; i < data.length; i += 3 ) {
|
|
|
+ for ( let i = 0; i < attribute.count; i ++ ) {
|
|
|
+
|
|
|
+ const x = attribute.getX( i );
|
|
|
+ const y = attribute.getY( i );
|
|
|
+ const z = attribute.getZ( i );
|
|
|
|
|
|
- array.push( `(${ data[ i + 0 ].toPrecision( PRECISION ) }, ${ data[ i + 1 ].toPrecision( PRECISION ) }, ${ data[ i + 2 ].toPrecision( PRECISION ) })` );
|
|
|
+ array.push( `(${ x.toPrecision( PRECISION ) }, ${ y.toPrecision( PRECISION ) }, ${ z.toPrecision( PRECISION ) })` );
|
|
|
|
|
|
}
|
|
|
|
|
@@ -306,11 +317,13 @@ function buildVector2Array( attribute, count ) {
|
|
|
}
|
|
|
|
|
|
const array = [];
|
|
|
- const data = attribute.array;
|
|
|
|
|
|
- for ( let i = 0; i < data.length; i += 2 ) {
|
|
|
+ for ( let i = 0; i < attribute.count; i ++ ) {
|
|
|
+
|
|
|
+ const x = attribute.getX( i );
|
|
|
+ const y = attribute.getY( i );
|
|
|
|
|
|
- array.push( `(${ data[ i + 0 ].toPrecision( PRECISION ) }, ${ 1 - data[ i + 1 ].toPrecision( PRECISION ) })` );
|
|
|
+ array.push( `(${ x.toPrecision( PRECISION ) }, ${ 1 - y.toPrecision( PRECISION ) })` );
|
|
|
|
|
|
}
|
|
|
|