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

beta.r3js.org
-=yb4f310 2018-02-12 13:21:11 +01:00
parent f23be0eccc
commit f321b2f16e
1 changed files with 15 additions and 2 deletions

View File

@ -39,7 +39,16 @@ if (data.code === 'KeyL') {
var positions = [];
var quaternions = [];
var scales = [];
var colors = [];
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++) {
@ -50,8 +59,10 @@ 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.attributes.color = this.boxGeometry.instance.attributes.color;
this.instancedGeometry.instance.addAttribute('color', new THREE.Float32BufferAttribute(colors, 3));
this.instancedGeometry.instance.removeAttribute('instancePosition');
this.instancedGeometry.instance.removeAttribute('instanceQuaternion');
this.instancedGeometry.instance.removeAttribute('instanceScale');
@ -61,6 +72,8 @@ if (data.code === 'KeyL') {
this.instancedGeometry.instance.addAttribute('instanceScale', new THREE.InstancedBufferAttribute( new Float32Array(scales), 3));
this.instancedGeometry.instance.addGroup(0, 1000, 0);
this.meshImageGrid.geometry.instance = this.instancedGeometry.instance;
this.meshImageGrid.materials[0].createInstance();