From adcc3b1a86d5c87309e659c72457f2858795ee81 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Mon, 12 Feb 2018 12:23:06 +0100 Subject: [PATCH] Update: CC - Demo New - Key Up (194yv3pctj.js) 304 bytes modified --- 194yv3pctj.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/194yv3pctj.js b/194yv3pctj.js index 2b840ba..a55cebd 100644 --- a/194yv3pctj.js +++ b/194yv3pctj.js @@ -23,9 +23,19 @@ if (data.code === 'KeyL') { var heightData = this.imageSpoon.getHeightData(); - var instances = 128 * 128; + var instances = 16384; //128 x 128 + var x, y = 0; + var positions = []; + + for (x = 0; x < 128; x++) { + for (y = 0; y < 128; y++) { + positions.push(x, y, heightData[(x * y) + x + y]); + } + } + + this.instancedGeometry.instance.addAttribute('instancePosition', new THREE.InstancedBufferAttribute( new Float32Array(positions), 3)); console.log('got data'); }