Browse Source

instance changes

graphics
Cailean Finn 6 months ago
parent
commit
c383046b48
  1. 6
      public/css/styles.css
  2. 4
      public/js/list.js

6
public/css/styles.css

@ -266,6 +266,10 @@ hr {
width: 100%; width: 100%;
} }
#article-information {
font-size: 20px;
}
#article-title { #article-title {
font-size: 40px; font-size: 40px;
font-family: 'Syne Mono', monospace; font-family: 'Syne Mono', monospace;
@ -397,7 +401,7 @@ hr {
margin-right: 25px; margin-right: 25px;
text-align: center; text-align: center;
} }
#list-container { #list-container {
padding-left: 20px; padding-left: 20px;
padding-right: 20px; padding-right: 20px;

4
public/js/list.js

@ -47,7 +47,7 @@ import { randFloat } from 'three/src/math/MathUtils.js';
const cubeMaterial = new THREE.MeshPhongMaterial({ map: texture }); const cubeMaterial = new THREE.MeshPhongMaterial({ map: texture });
// Create an InstancedMesh // Create an InstancedMesh
count = 100; count = 80;
instancedMesh = new THREE.InstancedMesh(cubeGeometry, cubeMaterial, count); instancedMesh = new THREE.InstancedMesh(cubeGeometry, cubeMaterial, count);
scene.add(instancedMesh) scene.add(instancedMesh)
dummy = new THREE.Object3D(); dummy = new THREE.Object3D();
@ -55,7 +55,7 @@ import { randFloat } from 'three/src/math/MathUtils.js';
for (let i = 0; i < count; i++) { for (let i = 0; i < count; i++) {
let size = randFloat(5, 8); let size = randFloat(5, 8);
dummy.scale.set(size, size, size); dummy.scale.set(size, size, size);
dummy.position.set(randFloat(-10, 10), randFloat(-6, 3), 0); dummy.position.set(randFloat(-10, 10), randFloat(-8, 8), 0);
dummy.updateMatrix(); dummy.updateMatrix();
instancedMesh.setMatrixAt(i, dummy.matrix); instancedMesh.setMatrixAt(i, dummy.matrix);
} }

Loading…
Cancel
Save