فهرست منبع

Updated examples relying on DynamicBufferAttribute.

Mr.doob 10 سال پیش
والد
کامیت
9b9d5fe259

+ 2 - 2
examples/js/GPUParticleSystem.js

@@ -361,8 +361,8 @@ THREE.GPUParticleContainer = function(maxParticles, particleSystem) {
   }
 
   self.particleShaderGeo.addAttribute('position', new THREE.BufferAttribute(self.particleVertices, 3));
-  self.particleShaderGeo.addAttribute('particlePositionsStartTime', new THREE.DynamicBufferAttribute(self.particlePositionsStartTime, 4));
-  self.particleShaderGeo.addAttribute('particleVelColSizeLife', new THREE.DynamicBufferAttribute(self.particleVelColSizeLife, 4));
+  self.particleShaderGeo.addAttribute('particlePositionsStartTime', new THREE.BufferAttribute(self.particlePositionsStartTime, 4).setDynamic(true));
+  self.particleShaderGeo.addAttribute('particleVelColSizeLife', new THREE.BufferAttribute(self.particleVelColSizeLife, 4).setDynamic(true));
 
   self.posStart = self.particleShaderGeo.getAttribute('particlePositionsStartTime')
   self.velCol = self.particleShaderGeo.getAttribute('particleVelColSizeLife');

+ 3 - 3
examples/webgl_buffergeometry_drawcalls.html

@@ -148,7 +148,7 @@
 				}
 
 				particles.addDrawCall( 0, particleCount );
-				particles.addAttribute( 'position', new THREE.DynamicBufferAttribute( particlePositions, 3 ) );
+				particles.addAttribute( 'position', new THREE.BufferAttribute( particlePositions, 3 ).setDynamic( true ) );
 
 				// create the particle system
 				pointCloud = new THREE.PointCloud( particles, pMaterial );
@@ -156,8 +156,8 @@
 
 				var geometry = new THREE.BufferGeometry();
 
-				geometry.addAttribute( 'position', new THREE.DynamicBufferAttribute( positions, 3 ) );
-				geometry.addAttribute( 'color', new THREE.DynamicBufferAttribute( colors, 3 ) );
+				geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ).setDynamic( true ) );
+				geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ).setDynamic( true ) );
 
 				geometry.computeBoundingSphere();
 

+ 4 - 4
examples/webgl_buffergeometry_instancing.html

@@ -143,7 +143,7 @@
 
             geometry.addAttribute( 'position', vertices );
 
-            var offsets = new THREE.InstancedBufferAttribute( new Float32Array( instances * 3 ), 3, 1, false );
+            var offsets = new THREE.InstancedBufferAttribute( new Float32Array( instances * 3 ), 3, 1 );
 
             for ( var i = 0, ul = offsets.count; i < ul; i++ ) {
 
@@ -153,7 +153,7 @@
 
             geometry.addAttribute( 'offset', offsets );
 
-            var colors = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1, false );
+            var colors = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1 );
 
             for ( var i = 0, ul = colors.count; i < ul; i++ ) {
 
@@ -165,7 +165,7 @@
 
             var vector = new THREE.Vector4();
 
-            var orientationsStart = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1, false );
+            var orientationsStart = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1 );
 
             for ( var i = 0, ul = orientationsStart.count; i < ul; i++ ) {
 
@@ -178,7 +178,7 @@
 
             geometry.addAttribute( 'orientationStart', orientationsStart );
 
-            var orientationsEnd = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1, false );
+            var orientationsEnd = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1 );
 
             for ( var i = 0, ul = orientationsEnd.count; i < ul; i++ ) {
 

+ 2 - 2
examples/webgl_buffergeometry_instancing_billboards.html

@@ -148,8 +148,8 @@
 			}
 
 			geometry.addAttribute( "translate", new THREE.InstancedBufferAttribute( translateArray, 3, 1 ) );
-			geometry.addAttribute( "scale", new THREE.InstancedBufferAttribute( scaleArray, 1, 1, true ) );
-			geometry.addAttribute( "color", new THREE.InstancedBufferAttribute( colorsArray, 3, 1, true ) );
+			geometry.addAttribute( "scale", new THREE.InstancedBufferAttribute( scaleArray, 1, 1 ).setDynamic( true ) );
+			geometry.addAttribute( "color", new THREE.InstancedBufferAttribute( colorsArray, 3, 1 ).setDynamic( true ) ) );
 
 			material = new THREE.RawShaderMaterial( {
 				uniforms: {

+ 2 - 2
examples/webgl_buffergeometry_instancing_dynamic.html

@@ -210,7 +210,7 @@
 			geometry.addAttribute( 'index', new THREE.IndexBufferAttribute( indices, 1 ) );
 
 			// per instance data
-			var offsets = new THREE.InstancedBufferAttribute( new Float32Array( instances * 3 ), 3, 1, false );
+			var offsets = new THREE.InstancedBufferAttribute( new Float32Array( instances * 3 ), 3, 1 );
 
 			var vector = new THREE.Vector4();
 			for ( var i = 0, ul = offsets.count; i < ul; i++ ) {
@@ -226,7 +226,7 @@
 			geometry.addAttribute( 'offset', offsets ); // per mesh translation
 
 
-			orientations = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1, true );
+			orientations = new THREE.InstancedBufferAttribute( new Float32Array( instances * 4 ), 4, 1 ).setDynamic( true );
 
 			for ( var i = 0, ul = orientations.count; i < ul; i++ ) {
 

+ 2 - 2
examples/webgl_buffergeometry_instancing_interleaved_dynamic.html

@@ -154,7 +154,7 @@
             -1, -1, 1, 0, 0, 0, 0, 0,
             1, -1, -1, 0, 1, 1, 0, 0,
             -1, -1, -1, 0, 0, 1, 0, 0,
-        ] ), 8, false );
+        ] ), 8 );
 
         // Use vertexBuffer, starting at offset 0, 3 items in position attribute
         var positions = new THREE.InterleavedBufferAttribute( vertexBuffer, 3, 0 );
@@ -181,7 +181,7 @@
         geometry.addAttribute( 'index', new THREE.IndexBufferAttribute( indices, 1 ) );
 
         // per instance data
-        instanceBuffer = new THREE.InstancedInterleavedBuffer( new Float32Array( instances * 8 ), 8, true, 1 );
+        instanceBuffer = new THREE.InstancedInterleavedBuffer( new Float32Array( instances * 8 ), 8, 1 ).setDynamic( true );
         var offsets = new THREE.InterleavedBufferAttribute( instanceBuffer, 3, 0 );
 
         var vector = new THREE.Vector4();