format
This commit is contained in:
parent
2075429566
commit
5e12aea559
BIN
img/ground.jpg
BIN
img/ground.jpg
Binary file not shown.
Before Width: | Height: | Size: 329 KiB |
26
main.js
26
main.js
@ -46,7 +46,7 @@ camera.rotation.order = 'YXZ';
|
|||||||
camera.position.set( 0, 0.7, 0);
|
camera.position.set( 0, 0.7, 0);
|
||||||
|
|
||||||
const worldOctree = new Octree();
|
const worldOctree = new Octree();
|
||||||
const raftOctree = new Octree();
|
const raftOctree = new Octree();
|
||||||
|
|
||||||
const container = document.getElementById( 'container' );
|
const container = document.getElementById( 'container' );
|
||||||
|
|
||||||
@ -74,9 +74,9 @@ const ocean = new Water(
|
|||||||
alpha : 0.7
|
alpha : 0.7
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
ocean.rotation.x = - Math.PI * 0.5;
|
ocean.rotation.x = - Math.PI * 0.5;
|
||||||
ocean.position.y = -.01
|
ocean.position.y = -.01
|
||||||
ocean.receiveShadow = true;
|
ocean.receiveShadow = true;
|
||||||
ocean.material.transparent = true;
|
ocean.material.transparent = true;
|
||||||
scene.add( ocean );
|
scene.add( ocean );
|
||||||
|
|
||||||
@ -152,7 +152,7 @@ function updateSun() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const phi = Math.PI/2 - elevation
|
const phi = Math.PI/2 - elevation
|
||||||
const theta = azimuth
|
const theta = azimuth
|
||||||
|
|
||||||
sun.setFromSphericalCoords( 100, phi, theta );
|
sun.setFromSphericalCoords( 100, phi, theta );
|
||||||
@ -163,7 +163,7 @@ function updateSun() {
|
|||||||
|
|
||||||
if ( elevation >= 0 ) {
|
if ( elevation >= 0 ) {
|
||||||
|
|
||||||
sunLight.visible = true
|
sunLight.visible = true
|
||||||
torchLight.visible = false
|
torchLight.visible = false
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -187,7 +187,7 @@ const updateSunIntervalId = setInterval( updateSun, 100 );
|
|||||||
// Ground
|
// Ground
|
||||||
|
|
||||||
const groundGeometry = new THREE.PlaneGeometry(mazeLength, mazeWidth)
|
const groundGeometry = new THREE.PlaneGeometry(mazeLength, mazeWidth)
|
||||||
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping
|
groundTexture.wrapS = groundTexture.wrapT = THREE.RepeatWrapping
|
||||||
groundTexture.repeat.set(50, 50)
|
groundTexture.repeat.set(50, 50)
|
||||||
const groundMaterial = new THREE.MeshPhongMaterial( {
|
const groundMaterial = new THREE.MeshPhongMaterial( {
|
||||||
map : groundTexture,
|
map : groundTexture,
|
||||||
@ -251,11 +251,13 @@ const wallMaterial = new THREE.MeshPhongMaterial( {
|
|||||||
} )
|
} )
|
||||||
|
|
||||||
const maze = new MazeMesh( mazeLength, mazeWidth, wallMaterial );
|
const maze = new MazeMesh( mazeLength, mazeWidth, wallMaterial );
|
||||||
maze.castShadow = true;
|
maze.castShadow = true;
|
||||||
maze.receiveShadow = true;
|
maze.receiveShadow = true;
|
||||||
maze.matrixAutoUpdate = false
|
maze.matrixAutoUpdate = false
|
||||||
scene.add(maze)
|
scene.add(maze)
|
||||||
|
|
||||||
|
console.log(String(maze))
|
||||||
|
|
||||||
const wall = new THREE.Mesh( maze.geometry );
|
const wall = new THREE.Mesh( maze.geometry );
|
||||||
let matrix = new THREE.Matrix4()
|
let matrix = new THREE.Matrix4()
|
||||||
for ( let i=0; i<maze.count; i++ ) {
|
for ( let i=0; i<maze.count; i++ ) {
|
||||||
@ -265,8 +267,6 @@ for ( let i=0; i<maze.count; i++ ) {
|
|||||||
worldOctree.fromGraphNode( clone )
|
worldOctree.fromGraphNode( clone )
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(String(maze))
|
|
||||||
|
|
||||||
// debug
|
// debug
|
||||||
|
|
||||||
let stats, octreeHelper, gui
|
let stats, octreeHelper, gui
|
||||||
@ -554,8 +554,8 @@ const waves = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getWaveInfo(x, z, time) {
|
function getWaveInfo(x, z, time) {
|
||||||
const pos = new THREE.Vector3()
|
const pos = new THREE.Vector3()
|
||||||
const tangent = new THREE.Vector3(1, 0, 0)
|
const tangent = new THREE.Vector3(1, 0, 0)
|
||||||
const binormal = new THREE.Vector3(0, 0, 1)
|
const binormal = new THREE.Vector3(0, 0, 1)
|
||||||
Object.keys(waves).forEach(function (wave) {
|
Object.keys(waves).forEach(function (wave) {
|
||||||
const w = waves[wave]
|
const w = waves[wave]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user