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

Made Geometry2/IndexedGeometry2 more user friendly.

Starting to consider implementing geometry.bufferGeometry...
上级 aa4b3959
......@@ -8,13 +8,13 @@ THREE.Geometry2 = function ( size ) {
if ( size !== undefined ) {
var vertices = new Float32Array( size * 3 * 3 );
var normals = new Float32Array( size * 3 * 3 );
var uvs = new Float32Array( size * 3 * 2 );
this.vertices = new Float32Array( size * 3 * 3 );
this.normals = new Float32Array( size * 3 * 3 );
this.uvs = new Float32Array( size * 3 * 2 );
this.attributes[ 'position' ] = { array: vertices, itemSize: 3 };
this.attributes[ 'normal' ] = { array: normals, itemSize: 3 };
this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 };
this.attributes[ 'position' ] = { array: this.vertices, itemSize: 3 };
this.attributes[ 'normal' ] = { array: this.normals, itemSize: 3 };
this.attributes[ 'uv' ] = { array: this.uvs, itemSize: 2 };
}
......@@ -24,6 +24,10 @@ THREE.Geometry2.prototype = Object.create( THREE.BufferGeometry.prototype );
THREE.Geometry2.prototype.setArrays = function ( vertices, normals, uvs ) {
this.vertices = vertices;
this.normals = normals;
this.uvs = uvs;
this.attributes[ 'position' ] = { array: vertices, itemSize: 3 };
this.attributes[ 'normal' ] = { array: normals, itemSize: 3 };
this.attributes[ 'uv' ] = { array: uvs, itemSize: 2 };
......
......@@ -12,6 +12,11 @@ THREE.IndexedGeometry2.prototype = Object.create( THREE.BufferGeometry.prototype
THREE.IndexedGeometry2.prototype.setArrays = function ( indices, vertices, normals, uvs ) {
this.indices = indices;
this.vertices = vertices;
this.normals = normals;
this.uvs = uvs;
this.attributes[ 'index' ] = { array: indices, itemSize: 1 };
this.attributes[ 'position' ] = { array: vertices, itemSize: 3 };
this.attributes[ 'normal' ] = { array: normals, itemSize: 3 };
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册