提交 e5f0ec13 编写于 作者: M Mr.doob

UTF8Loader: Updated some of the addAttribute calls.

Need to think what to do when the array is already created, like index in this case...
上级 57354d14
......@@ -34,9 +34,13 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
var geometry = new THREE.BufferGeometry();
var positionArray = new Float32Array( 3 * 3 * ntris );
var normalArray = new Float32Array( 3 * 3 * ntris );
var uvArray = new Float32Array( 2 * 3 * ntris );
var positions = new THREE.Float32Attribute( ntris * 3, 3 );
var normals = new THREE.Float32Attribute( ntris * 3, 3 );
var uvs = new THREE.Float32Attribute( ntris * 3, 2 );
var positionsArray = positions.array;
var normalsArray = normals.array;
var uvsArray = uvs.array;
var i, j, offset;
var x, y, z;
......@@ -56,9 +60,9 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
y = attribArray[ i + 1 ];
z = attribArray[ i + 2 ];
positionArray[ j++ ] = x;
positionArray[ j++ ] = y;
positionArray[ j++ ] = z;
positionsArray[ j++ ] = x;
positionsArray[ j++ ] = y;
positionsArray[ j++ ] = z;
}
......@@ -72,8 +76,8 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
u = attribArray[ i ];
v = attribArray[ i + 1 ];
uvArray[ j++ ] = u;
uvArray[ j++ ] = v;
uvsArray[ j++ ] = u;
uvsArray[ j++ ] = v;
}
......@@ -88,16 +92,16 @@ THREE.UTF8Loader.BufferGeometryCreator.prototype.create = function ( attribArray
y = attribArray[ i + 1 ];
z = attribArray[ i + 2 ];
normalArray[ j++ ] = x;
normalArray[ j++ ] = y;
normalArray[ j++ ] = z;
normalsArray[ j++ ] = x;
normalsArray[ j++ ] = y;
normalsArray[ j++ ] = z;
}
geometry.addAttribute( 'index', indexArray, 1 );
geometry.addAttribute( 'position', positionArray, 3 );
geometry.addAttribute( 'normal', normalArray, 3 );
geometry.addAttribute( 'uv', uvArray, 2 );
geometry.addAttribute( 'position', positions );
geometry.addAttribute( 'normal', normals );
geometry.addAttribute( 'uv', uvs );
geometry.offsets.push( { start: 0, count: indexArray.length, index: 0 } );
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册