Update: CC - Demo New - Key Up (194yv3pctj.js) 26 bytes modified

beta.r3js.org
-=yb4f310 2018-02-12 13:24:39 +01:00
parent f321b2f16e
commit bb5d49e151
1 changed files with 8 additions and 16 deletions

View File

@ -39,17 +39,7 @@ if (data.code === 'KeyL') {
var positions = [];
var quaternions = [];
var scales = [];
var colors = [
1,1,1,
1,1,1,
1,1,1,
1,1,1,
1,1,1,
1,1,1,
1,1,1,
1,1,1
];
for (x = 0; x < 128; x++) {
for (y = 0; y < 128; y++) {
positions.push(x, y, heightData[(x * y) + x + y]);
@ -61,7 +51,8 @@ if (data.code === 'KeyL') {
this.instancedGeometry.instance.attributes.position = this.boxGeometry.instance.attributes.position;
//this.instancedGeometry.instance.attributes.color = this.boxGeometry.instance.attributes.color;
this.instancedGeometry.instance.addAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
this.instancedGeometry.instance.removeAttribute('color');
this.instancedGeometry.instance.removeAttribute('instancePosition');
this.instancedGeometry.instance.removeAttribute('instanceQuaternion');
@ -70,14 +61,15 @@ if (data.code === 'KeyL') {
this.instancedGeometry.instance.addAttribute('instancePosition', new THREE.InstancedBufferAttribute( new Float32Array(positions), 3));
this.instancedGeometry.instance.addAttribute('instanceQuaternion', new THREE.InstancedBufferAttribute( new Float32Array(quaternions), 4));
this.instancedGeometry.instance.addAttribute('instanceScale', new THREE.InstancedBufferAttribute( new Float32Array(scales), 3));
this.instancedGeometry.instance.addAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
this.instancedGeometry.instance.addGroup(0, 1000, 0);
this.meshImageGrid.geometry.instance = this.instancedGeometry.instance;
//this.meshImageGrid.geometry.instance = this.instancedGeometry.instance;
this.meshImageGrid.materials[0].createInstance();
this.meshImageGrid.updateInstance('materials');
//this.meshImageGrid.materials[0].createInstance();
//this.meshImageGrid.updateInstance('materials');
console.log('got data');
}