instancedMesh.count
This commit is contained in:
parent
5a85c0cae2
commit
75f70a1bac
@ -12,19 +12,18 @@ export default class MazeMesh extends THREE.InstancedMesh {
|
|||||||
this.map = new Array(length).fill().map(() => new Array(width).fill(1))
|
this.map = new Array(length).fill().map(() => new Array(width).fill(1))
|
||||||
this.start = new THREE.Vector3(width/2, .1, length/2)
|
this.start = new THREE.Vector3(width/2, .1, length/2)
|
||||||
this.exit = new THREE.Vector3(Math.floor(width/2), 0, 1)
|
this.exit = new THREE.Vector3(Math.floor(width/2), 0, 1)
|
||||||
this.count = length * width - 2
|
|
||||||
|
|
||||||
this.dig(this.exit)
|
this.dig(this.exit)
|
||||||
this.dig(new THREE.Vector3(Math.floor(width/2), 0, 0))
|
this.dig(new THREE.Vector3(Math.floor(width/2), 0, 0))
|
||||||
this.build ( this.exit )
|
this.build ( this.exit )
|
||||||
let matrix = new THREE.Matrix4()
|
let matrix = new THREE.Matrix4()
|
||||||
let i=0
|
this.count = 0
|
||||||
this.map.forEach((row, z) => {
|
this.map.forEach((row, z) => {
|
||||||
row.forEach((isWall, x) => {
|
row.forEach((isWall, x) => {
|
||||||
if (isWall) {
|
if (isWall) {
|
||||||
matrix.setPosition( x + .5 - width/2, 0.5, z + .5 - length/2)
|
matrix.setPosition( x + .5 - width/2, 0.5, z + .5 - length/2)
|
||||||
this.setMatrixAt( i, matrix );
|
this.setMatrixAt( this.count, matrix );
|
||||||
i++
|
this.count++
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
4
main.js
4
main.js
@ -322,8 +322,6 @@ const raftFaceMaterial = new THREE.MeshStandardMaterial({
|
|||||||
roughnessMap: woodTexture,
|
roughnessMap: woodTexture,
|
||||||
color: 0xFFFFFF,
|
color: 0xFFFFFF,
|
||||||
emissive: 0,
|
emissive: 0,
|
||||||
specular: 0x505050,
|
|
||||||
shininess: 1,
|
|
||||||
bumpMap: woodTexture,
|
bumpMap: woodTexture,
|
||||||
bumpScale: .1,
|
bumpScale: .1,
|
||||||
depthFunc: 3,
|
depthFunc: 3,
|
||||||
@ -338,8 +336,6 @@ const raftSideMaterial = new THREE.MeshStandardMaterial({
|
|||||||
roughnessMap: woodTexture,
|
roughnessMap: woodTexture,
|
||||||
color: 0xFFFFFF,
|
color: 0xFFFFFF,
|
||||||
emissive: 0,
|
emissive: 0,
|
||||||
specular: 0x505050,
|
|
||||||
shininess: 1,
|
|
||||||
bumpMap: woodTexture,
|
bumpMap: woodTexture,
|
||||||
bumpScale: .1,
|
bumpScale: .1,
|
||||||
depthFunc: 3,
|
depthFunc: 3,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user