From 90d5c79855d263ecf3a0308419016da6d866dd66 Mon Sep 17 00:00:00 2001 From: dubejf Date: Sun, 12 Jul 2015 21:56:06 -0400 Subject: [PATCH] Rename updateCounter to version. Add api doc. --- docs/api/core/BufferAttribute.html | 6 +++++- src/core/BufferAttribute.js | 4 ++-- src/core/InterleavedBuffer.js | 4 ++-- src/renderers/webgl/WebGLObjects.js | 8 +++----- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/docs/api/core/BufferAttribute.html b/docs/api/core/BufferAttribute.html index bfd2189312..97c076a9dd 100644 --- a/docs/api/core/BufferAttribute.html +++ b/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. +

[property:Integer version]

+
+ A version number, incremented every time the needsUpdate property is set to true. +

Methods

- +

[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] )

Copies itemSize values in the array from the vertex at index2 to the vertex at index1. diff --git a/src/core/BufferAttribute.js b/src/core/BufferAttribute.js index f0ae441738..0f00a6738b 100644 --- a/src/core/BufferAttribute.js +++ b/src/core/BufferAttribute.js @@ -9,7 +9,7 @@ THREE.BufferAttribute = function ( array, itemSize ) { this.array = array; this.itemSize = itemSize; - this.updateCounter = 0; + this.version = 0; }; @@ -32,7 +32,7 @@ THREE.BufferAttribute.prototype = { set needsUpdate( value ) { - if ( value === true ) this.updateCounter ++; + if ( value === true ) this.version ++; }, diff --git a/src/core/InterleavedBuffer.js b/src/core/InterleavedBuffer.js index 64a27b301d..a79a1206a6 100644 --- a/src/core/InterleavedBuffer.js +++ b/src/core/InterleavedBuffer.js @@ -9,7 +9,7 @@ THREE.InterleavedBuffer = function ( array, stride, dynamic ) { this.array = array; this.stride = stride; - this.updateCounter = 0; + this.version = 0; this.dynamic = dynamic || false; this.updateRange = { offset: 0, count: -1 }; @@ -34,7 +34,7 @@ THREE.InterleavedBuffer.prototype = { set needsUpdate( value ) { - if ( value === true ) this.updateCounter ++; + if ( value === true ) this.version ++; }, diff --git a/src/renderers/webgl/WebGLObjects.js b/src/renderers/webgl/WebGLObjects.js index ce4f1c4893..24e21a62c5 100644 --- a/src/renderers/webgl/WebGLObjects.js +++ b/src/renderers/webgl/WebGLObjects.js @@ -185,7 +185,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) { createBuffer( attributeProperties, data, bufferType ); - } else if ( attributeProperties.updateCounter !== data.updateCounter ) { + } else if ( attributeProperties.version !== data.version ) { updateBuffer( attributeProperties, data, bufferType ); @@ -210,8 +210,7 @@ THREE.WebGLObjects = function ( gl, properties, info ) { 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; } -- GitLab