diff --git a/examples/js/SimulatorRenderer.js b/examples/js/SimulationRenderer.js similarity index 99% rename from examples/js/SimulatorRenderer.js rename to examples/js/SimulationRenderer.js index 57d35778529f737cba5eed427ad5dbc5b90e35a2..04e41cf967b481f483917a66c77165f5b135e3af 100644 --- a/examples/js/SimulatorRenderer.js +++ b/examples/js/SimulationRenderer.js @@ -10,7 +10,7 @@ * */ -function SimulatorRenderer(WIDTH, renderer) { +function SimulationRenderer(WIDTH, renderer) { WIDTH = WIDTH || 4; var camera = new THREE.Camera(); diff --git a/examples/webgl_gpgpu_birds.html b/examples/webgl_gpgpu_birds.html index 43dd6a9d69ab34d888f65eee244208ea71a663a1..008b3c0f7e12374419ee0f47d811c78c7943f9db 100644 --- a/examples/webgl_gpgpu_birds.html +++ b/examples/webgl_gpgpu_birds.html @@ -43,11 +43,10 @@ - + @@ -388,89 +372,94 @@ /* TEXTURE WIDTH FOR SIMULATION */ var WIDTH = hash || 32; - var BIRDS = 1024; + var BIRDS = WIDTH * WIDTH; - // Custom Geometry + // Custom Geometry - using 3 triangles each. No UVs, no normals currently. THREE.BirdGeometry = function () { - THREE.Geometry.call( this ); + var triangles = BIRDS * 3; + var points = triangles * 3; + + THREE.BufferGeometry.call( this ); + // THREE.Geometry2.call( this, points ); + + var vertices = new Float32Array( points * 3 ); + var birdColors = new Float32Array( points * 3 ); + var references = new Float32Array( points * 2 ); + var birdVertex = new Float32Array( points ); - BIRDS = WIDTH * WIDTH; + this.addAttribute( 'position', vertices, 3 ); + this.addAttribute( 'birdColor', birdColors, 3 ); + this.addAttribute( 'reference', references, 2 ); + this.addAttribute( 'birdVertex', birdVertex, 1 ); - var verts = this.vertices; - var faces = this.faces; - var uvs = this.faceVertexUvs[ 0 ]; + // this.addAttribute( 'normal', new Float32Array( points * 3 ), 3 ); + + + var v = 0; + + function verts_push() { + for (var i=0; i < arguments.length; i++) { + vertices[v++] = arguments[i]; + } + } - var fi = 0; + var wingsSpan = 20; for (var f = 0; f