instancedMesh.count

This commit is contained in:
Adrien MALINGREY 2023-07-13 21:05:40 +02:00
parent 5a85c0cae2
commit 75f70a1bac
2 changed files with 3 additions and 8 deletions

View File

@ -12,19 +12,18 @@ export default class MazeMesh extends THREE.InstancedMesh {
this.map = new Array(length).fill().map(() => new Array(width).fill(1))
this.start = new THREE.Vector3(width/2, .1, length/2)
this.exit = new THREE.Vector3(Math.floor(width/2), 0, 1)
this.count = length * width - 2
this.dig(this.exit)
this.dig(new THREE.Vector3(Math.floor(width/2), 0, 0))
this.build ( this.exit )
let matrix = new THREE.Matrix4()
let i=0
this.count = 0
this.map.forEach((row, z) => {
row.forEach((isWall, x) => {
if (isWall) {
matrix.setPosition( x + .5 - width/2, 0.5, z + .5 - length/2)
this.setMatrixAt( i, matrix );
i++
this.setMatrixAt( this.count, matrix );
this.count++
}
})
})

View File

@ -322,8 +322,6 @@ const raftFaceMaterial = new THREE.MeshStandardMaterial({
roughnessMap: woodTexture,
color: 0xFFFFFF,
emissive: 0,
specular: 0x505050,
shininess: 1,
bumpMap: woodTexture,
bumpScale: .1,
depthFunc: 3,
@ -338,8 +336,6 @@ const raftSideMaterial = new THREE.MeshStandardMaterial({
roughnessMap: woodTexture,
color: 0xFFFFFF,
emissive: 0,
specular: 0x505050,
shininess: 1,
bumpMap: woodTexture,
bumpScale: .1,
depthFunc: 3,