|
@@ -159,7 +159,7 @@ STLLoader.prototype = {
|
|
|
( reader.getUint8( index + 5 ) == 0x3D /*'='*/ ) ) {
|
|
|
|
|
|
hasColors = true;
|
|
|
- colors = new Float32Array(faces * 3 * 3);
|
|
|
+ colors = new Float32Array( faces * 3 * 3 );
|
|
|
|
|
|
defaultR = reader.getUint8( index + 6 ) / 255;
|
|
|
defaultG = reader.getUint8( index + 7 ) / 255;
|
|
@@ -173,10 +173,10 @@ STLLoader.prototype = {
|
|
|
var dataOffset = 84;
|
|
|
var faceLength = 12 * 4 + 2;
|
|
|
|
|
|
- var geometry = new THREE.BufferGeometry();
|
|
|
+ var geometry = new BufferGeometry();
|
|
|
|
|
|
- var vertices = new Float32Array(faces * 3 * 3);
|
|
|
- var normals = new Float32Array(faces * 3 * 3);
|
|
|
+ var vertices = new Float32Array( faces * 3 * 3 );
|
|
|
+ var normals = new Float32Array( faces * 3 * 3 );
|
|
|
|
|
|
for ( var face = 0; face < faces; face ++ ) {
|
|
|
|
|
@@ -210,21 +210,21 @@ STLLoader.prototype = {
|
|
|
for ( var i = 1; i <= 3; i ++ ) {
|
|
|
|
|
|
var vertexstart = start + i * 12;
|
|
|
- var componentIdx = (face * 3 * 3) + ((i - 1) * 3);
|
|
|
+ var componentIdx = ( face * 3 * 3 ) + ( ( i - 1 ) * 3 );
|
|
|
|
|
|
- vertices[componentIdx] = reader.getFloat32( vertexstart, true );
|
|
|
- vertices[componentIdx + 1] = reader.getFloat32( vertexstart + 4, true );
|
|
|
- vertices[componentIdx + 2] = reader.getFloat32( vertexstart + 8, true );
|
|
|
+ vertices[ componentIdx ] = reader.getFloat32( vertexstart, true );
|
|
|
+ vertices[ componentIdx + 1 ] = reader.getFloat32( vertexstart + 4, true );
|
|
|
+ vertices[ componentIdx + 2 ] = reader.getFloat32( vertexstart + 8, true );
|
|
|
|
|
|
- normals[componentIdx] = normalX;
|
|
|
- normals[componentIdx + 1] = normalY;
|
|
|
- normals[componentIdx + 2] = normalZ;
|
|
|
+ normals[ componentIdx ] = normalX;
|
|
|
+ normals[ componentIdx + 1 ] = normalY;
|
|
|
+ normals[ componentIdx + 2 ] = normalZ;
|
|
|
|
|
|
if ( hasColors ) {
|
|
|
|
|
|
- colors[componentIdx] = r;
|
|
|
- colors[componentIdx + 1] = g;
|
|
|
- colors[componentIdx + 2] = b;
|
|
|
+ colors[ componentIdx ] = r;
|
|
|
+ colors[ componentIdx + 1 ] = g;
|
|
|
+ colors[ componentIdx + 2 ] = b;
|
|
|
|
|
|
}
|
|
|
|
|
@@ -232,12 +232,12 @@ STLLoader.prototype = {
|
|
|
|
|
|
}
|
|
|
|
|
|
- geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
|
|
|
- geometry.addAttribute( 'normal', new THREE.BufferAttribute( normals, 3 ) );
|
|
|
+ geometry.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
|
|
|
+ geometry.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
|
|
|
|
|
|
if ( hasColors ) {
|
|
|
|
|
|
- geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
|
|
|
+ geometry.addAttribute( 'color', new BufferAttribute( colors, 3 ) );
|
|
|
geometry.hasColors = true;
|
|
|
geometry.alpha = alpha;
|
|
|
|