Browse Source

BufferAttribute.onUpload() clean up.

Mr.doob 8 years ago
parent
commit
91802d6870

+ 1 - 8
docs/api/core/BufferAttribute.html

@@ -18,7 +18,7 @@
 		<h3>[name]( [page:TypedArray array], [page:Integer itemSize], [page:Boolean normalized] )</h3>
 		<div>
 		Instantiates this attribute with data from the associated buffer.
-		itemSize gives the number of values of the array that should be associated with a particular vertex. normalized indicates how the underlying data in the buffer maps to the values in the GLSL shader code. 
+		itemSize gives the number of values of the array that should be associated with a particular vertex. normalized indicates how the underlying data in the buffer maps to the values in the GLSL shader code.
 		</div>
 
 		<h2>Properties</h2>
@@ -57,7 +57,6 @@
 		<h3>[property:Function onUploadCallback]</h3>
 		<div>
 		A callback function that is executed after the Renderer has transfered the attribute array data to the GPU.
-		The callback is executed with a single parameter "name", the name of the buffer attribute, and "this" set to the BufferAttribute object.
 		</div>
 
 		<h2>Methods</h2>
@@ -113,12 +112,6 @@
 		Copies this attribute.
 		</div>
 
-		<h3>[method:null disposeArray]() </h3>
-		<div>
-		Discards the typed array containing the attribute data. This can be executed after the data has been transfered to the GPU to allow the memory to be reclaimed.
-		For use where the attribute will not be changed after the discard method is called.
-		</div>
-
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 2 - 9
src/core/BufferAttribute.js

@@ -26,8 +26,9 @@ function BufferAttribute( array, itemSize, normalized ) {
 	this.dynamic = false;
 	this.updateRange = { offset: 0, count: - 1 };
 
+	this.onUpload = null;
+
 	this.version = 0;
-	this.onUploadCallback = null;
 
 }
 
@@ -324,14 +325,6 @@ BufferAttribute.prototype = {
 
 		return new this.constructor().copy( this );
 
-	},
-
-	disposeArray: function () {
-
-		var oldArray = this.array;
-
-		this.array = new oldArray.constructor( 1 ); // create dummy minimal length TypedArray
-
 	}
 
 };

+ 6 - 6
src/renderers/webgl/WebGLObjects.js

@@ -34,7 +34,7 @@ function WebGLObjects( gl, properties, info ) {
 
 		for ( var name in attributes ) {
 
-			updateAttribute( attributes[ name ], gl.ARRAY_BUFFER, name );
+			updateAttribute( attributes[ name ], gl.ARRAY_BUFFER );
 
 		}
 
@@ -58,7 +58,7 @@ function WebGLObjects( gl, properties, info ) {
 
 	}
 
-	function updateAttribute( attribute, bufferType, name ) {
+	function updateAttribute( attribute, bufferType ) {
 
 		var data = ( attribute.isInterleavedBufferAttribute ) ? attribute.data : attribute;
 
@@ -66,7 +66,7 @@ function WebGLObjects( gl, properties, info ) {
 
 		if ( attributeProperties.__webglBuffer === undefined ) {
 
-			createBuffer( attributeProperties, data, bufferType, name );
+			createBuffer( attributeProperties, data, bufferType );
 
 		} else if ( attributeProperties.version !== data.version ) {
 
@@ -76,7 +76,7 @@ function WebGLObjects( gl, properties, info ) {
 
 	}
 
-	function createBuffer( attributeProperties, data, bufferType, name ) {
+	function createBuffer( attributeProperties, data, bufferType ) {
 
 		attributeProperties.__webglBuffer = gl.createBuffer();
 		gl.bindBuffer( bufferType, attributeProperties.__webglBuffer );
@@ -126,9 +126,9 @@ function WebGLObjects( gl, properties, info ) {
 		attributeProperties.type = type;
 		attributeProperties.version = data.version;
 
-		if ( data.onUploadCallback ) {
+		if ( data.onUpload !== null ) {
 
-			data.onUploadCallback( name );
+			data.onUpload();
 
 		}