Browse Source

Simplified BufferAttribute constructor logic.
Advanced devs are going to kill me for this... Sorry!

Mr.doob 11 years ago
parent
commit
780f9f8c55
1 changed files with 18 additions and 18 deletions
  1. 18 18
      src/core/BufferAttribute.js

+ 18 - 18
src/core/BufferAttribute.js

@@ -86,81 +86,81 @@ THREE.BufferAttribute.prototype = {
 
 //
 
-THREE.Int8Attribute = function ( size, itemSize ) {
+THREE.Int8Attribute = function ( data, itemSize ) {
 
-	this.array = new Int8Array( size * itemSize );
+	this.array = new Int8Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Int8Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Uint8Attribute = function ( size, itemSize ) {
+THREE.Uint8Attribute = function ( data, itemSize ) {
 
-	this.array = new Uint8Array( size * itemSize );
+	this.array = new Uint8Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Uint8Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Uint8ClampedAttribute = function ( size, itemSize ) {
+THREE.Uint8ClampedAttribute = function ( data, itemSize ) {
 
-	this.array = new Uint8ClampedArray( size * itemSize );
+	this.array = new Uint8ClampedArray( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Uint8ClampedAttribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Int16Attribute = function ( size, itemSize ) {
+THREE.Int16Attribute = function ( data, itemSize ) {
 
-	this.array = new Int16Array( size * itemSize );
+	this.array = new Int16Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Int16Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Uint16Attribute = function ( size, itemSize ) {
+THREE.Uint16Attribute = function ( data, itemSize ) {
 
-	this.array = new Uint16Array( size * itemSize );
+	this.array = new Uint16Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Uint16Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Int32Attribute = function ( size, itemSize ) {
+THREE.Int32Attribute = function ( data, itemSize ) {
 
-	this.array = new Int32Array( size * itemSize );
+	this.array = new Int32Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Int32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Uint32Attribute = function ( size, itemSize ) {
+THREE.Uint32Attribute = function ( data, itemSize ) {
 
-	this.array = new Uint32Array( size * itemSize );
+	this.array = new Uint32Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Uint32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Float32Attribute = function ( size, itemSize ) {
+THREE.Float32Attribute = function ( data, itemSize ) {
 
-	this.array = new Float32Array( size * itemSize );
+	this.array = new Float32Array( data );
 	this.itemSize = itemSize;
 
 };
 
 THREE.Float32Attribute.prototype = Object.create( THREE.BufferAttribute.prototype );
 
-THREE.Float64Attribute = function ( size, itemSize ) {
+THREE.Float64Attribute = function ( data, itemSize ) {
 
-	this.array = new Float64Array( size * itemSize );
+	this.array = new Float64Array( data );
 	this.itemSize = itemSize;
 
 };