Browse Source

Rename updateCounter to version. Add api doc.

dubejf 10 years ago
parent
commit
90d5c79855

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

@@ -43,10 +43,14 @@
 		Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
 		Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
 		</div>
 		</div>
 
 
+		<h3>[property:Integer version]</h3>
+		<div>
+		A version number, incremented every time the needsUpdate property is set to true.
+		</div>
 
 
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
-		
+
 		<h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
 		<h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
 		<div>
 		<div>
 		Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
 		Copies itemSize values in the array from the vertex at index2 to the vertex at index1.

+ 2 - 2
src/core/BufferAttribute.js

@@ -9,7 +9,7 @@ THREE.BufferAttribute = function ( array, itemSize ) {
 	this.array = array;
 	this.array = array;
 	this.itemSize = itemSize;
 	this.itemSize = itemSize;
 
 
-	this.updateCounter = 0;
+	this.version = 0;
 
 
 };
 };
 
 
@@ -32,7 +32,7 @@ THREE.BufferAttribute.prototype = {
 
 
 	set needsUpdate( value ) {
 	set needsUpdate( value ) {
 
 
-		if ( value === true ) this.updateCounter ++;
+		if ( value === true ) this.version ++;
 
 
 	},
 	},
 
 

+ 2 - 2
src/core/InterleavedBuffer.js

@@ -9,7 +9,7 @@ THREE.InterleavedBuffer = function ( array, stride, dynamic ) {
 	this.array = array;
 	this.array = array;
 	this.stride = stride;
 	this.stride = stride;
 
 
-	this.updateCounter = 0;
+	this.version = 0;
 
 
 	this.dynamic = dynamic || false;
 	this.dynamic = dynamic || false;
 	this.updateRange = { offset: 0, count: -1 };
 	this.updateRange = { offset: 0, count: -1 };
@@ -34,7 +34,7 @@ THREE.InterleavedBuffer.prototype = {
 
 
 	set needsUpdate( value ) {
 	set needsUpdate( value ) {
 
 
-		if ( value === true ) this.updateCounter ++;
+		if ( value === true ) this.version ++;
 
 
 	},
 	},
 
 

+ 3 - 5
src/renderers/webgl/WebGLObjects.js

@@ -185,7 +185,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
 
 
 			createBuffer( attributeProperties, data, bufferType );
 			createBuffer( attributeProperties, data, bufferType );
 
 
-		} else if ( attributeProperties.updateCounter !== data.updateCounter ) {
+		} else if ( attributeProperties.version !== data.version ) {
 
 
 			updateBuffer( attributeProperties, data, bufferType );
 			updateBuffer( attributeProperties, data, bufferType );
 
 
@@ -210,8 +210,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
 
 
 		gl.bufferData( bufferType, data.array, usage );
 		gl.bufferData( bufferType, data.array, usage );
 
 
-		attributeProperties.updateCounter = data.updateCounter;
-		data.needsUpdate = false;
+		attributeProperties.version = data.version;
 
 
 	}
 	}
 
 
@@ -236,8 +235,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) {
 
 
 		}
 		}
 
 
-		attributeProperties.updateCounter = data.updateCounter;
-		data.needsUpdate = false;
+		attributeProperties.version = data.version;
 
 
 	}
 	}