From a224fc56a6564a10d31f8859768f2086ce23d433 Mon Sep 17 00:00:00 2001 From: -=yb4f310 Date: Fri, 16 Feb 2018 09:55:05 +0100 Subject: [PATCH] Update: CC - Demo New - Key Up (ip0443a52d.js) 169 bytes modified --- ip0443a52d.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/ip0443a52d.js b/ip0443a52d.js index a42c21f..612130f 100644 --- a/ip0443a52d.js +++ b/ip0443a52d.js @@ -33,7 +33,7 @@ if (data.code === 'KeyL') { var offsets = []; var orientations = []; - //var scales = []; + var scales = []; var height = 0; @@ -41,11 +41,11 @@ if (data.code === 'KeyL') { for (y = 0; y < 128; y++) { height = heightData[(y * 128) + x] * 10; - scale = height * 0.1; + scale = height * 0.19; offsets.push((x - 64) * 2, (64 - y) * 2, height); orientations.push(0, 0, 0, 1); - //scales.push(scale, scale, scale); + scales.push(scale, scale, scale); } } @@ -82,8 +82,14 @@ if (data.code === 'KeyL') { 4 ).setDynamic(true); - this.instancedGeometry.instance.addAttribute('offset', offsetAttribute); + var scaleAttribute = new THREE.InstancedBufferAttribute( + new Float32Array(scales), + 3 + ); + + this.instancedGeometry.instance.addAttribute('offset', offsetAttribute); this.instancedGeometry.instance.addAttribute('orientation', orientationAttribute); + this.instancedGeometry.instance.addAttribute('scale', scaleAttribute); // this.instancedGeometry.instance.removeAttribute('color');