Browse Source

Update GLBufferAttribute

Luis Blanco 5 years ago
parent
commit
a0f4661d5e

+ 7 - 14
examples/webgl_buffergeometry_points_glbufferattribute.html

@@ -32,19 +32,12 @@
 		<div id="container"></div>
 		<div id="container"></div>
 		<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - buffergeometry - custom VBOs</div>
 		<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - buffergeometry - custom VBOs</div>
 
 
-		<script src="../build/three.js"></script>
+		<script type="module">
 
 
-		<script src="js/WebGL.js"></script>
-		<script src="js/libs/stats.min.js"></script>
-
-		<script>
-
-			if ( WEBGL.isWebGLAvailable() === false ) {
-
-				document.body.appendChild( WEBGL.getWebGLErrorMessage() );
-
-			}
+			import * as THREE from '../build/three.module.js';
 
 
+			import Stats from './jsm/libs/stats.module.js';
+			
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer;
 			var camera, scene, renderer;
@@ -112,7 +105,7 @@
 
 
 				}
 				}
 
 
-				var gl = renderer.context;
+				var gl = renderer.getContext();
 
 
 				var pos = gl.createBuffer();
 				var pos = gl.createBuffer();
 				gl.bindBuffer( gl.ARRAY_BUFFER, pos );
 				gl.bindBuffer( gl.ARRAY_BUFFER, pos );
@@ -127,7 +120,7 @@
 				gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( colors ), gl.STATIC_DRAW );
 				gl.bufferData( gl.ARRAY_BUFFER, new Float32Array( colors ), gl.STATIC_DRAW );
 
 
 				var posAttr = new THREE.GLBufferAttribute( gl, pos, gl.FLOAT, 3, particles );
 				var posAttr = new THREE.GLBufferAttribute( gl, pos, gl.FLOAT, 3, particles );
-				geometry.addAttribute( 'position', posAttr );
+				geometry.setAttribute( 'position', posAttr );
 
 
 				setInterval( function () {
 				setInterval( function () {
 
 
@@ -144,7 +137,7 @@
 
 
 				}, 20 );
 				}, 20 );
 
 
-				geometry.addAttribute( 'color', new THREE.GLBufferAttribute( gl, rgb, gl.FLOAT, 3, particles ) );
+				geometry.setAttribute( 'color', new THREE.GLBufferAttribute( gl, rgb, gl.FLOAT, 3, particles ) );
 
 
 				//
 				//
 
 

+ 0 - 4
src/core/GLBufferAttribute.js

@@ -1,5 +1,3 @@
-import { _Math } from '../math/Math.js';
-
 /**
 /**
  * @author raub / https://github.com/raub
  * @author raub / https://github.com/raub
  */
  */
@@ -28,8 +26,6 @@ function GLBufferAttribute( gl, buffer, type, itemSize, count, normalized ) {
 
 
 	}
 	}
 
 
-	this.uuid = _Math.generateUUID();
-
 	this.buffer = buffer;
 	this.buffer = buffer;
 	this.type = type;
 	this.type = type;
 	this.itemSize = itemSize;
 	this.itemSize = itemSize;