Compare commits

...

3 Commits

Author SHA1 Message Date
fa2bd33b98 cleanup 2026-02-02 10:32:56 +01:00
27e9e30cbc Merge pull request #1 from adrienmalin/refactor/js-split
refactor
2026-01-30 22:01:35 +01:00
2c3b0b06bb Add MazeMesh.js file for maze mesh implementation 2026-01-30 21:48:24 +01:00
21 changed files with 20 additions and 44 deletions

52
main.js
View File

@@ -5,7 +5,6 @@ import { Water } from 'three/addons/objects/Water.js'
import { PointerLockControls } from 'three/addons/controls/PointerLockControls.js'
import { GUI } from 'three/addons/libs/lil-gui.module.min.js'
import { OctreeHelper } from 'three/addons/helpers/OctreeHelper.js'
import { CSM } from 'three/addons/csm/CSM.js';
import Stats from 'three/addons/libs/stats.module.js'
import MazeMesh from './MazeMesh.js'
@@ -184,6 +183,16 @@ const sideGroundMaterial = new THREE.MeshStandardMaterial({
roughness : wallMaterial.roughness,
metalness : wallMaterial.metalness,
})
sideGroundMaterial.map.wrapS = sideGroundMaterial.map.wrapT = THREE.RepeatWrapping
sideGroundMaterial.map.repeat.set(mazeWidth, 20)
sideGroundMaterial.map.rotation = Math.PI
sideGroundMaterial.normalMap.wrapS = sideGroundMaterial.normalMap.wrapT = THREE.RepeatWrapping
sideGroundMaterial.normalMap.repeat.set(mazeWidth, 20)
sideGroundMaterial.normalMap.rotation = Math.PI
sideGroundMaterial.roughnessMap.wrapS = sideGroundMaterial.roughnessMap.wrapT = THREE.RepeatWrapping
sideGroundMaterial.roughnessMap.repeat.set(mazeWidth, 20)
sideGroundMaterial.roughnessMap.rotation = Math.PI
loader.load('Poly-cobblestone-wall/ao_map.jpg', (texture) => {
wallMaterial.aoMap = texture
wallMaterial.metalnessMap = texture
@@ -194,16 +203,7 @@ loader.load('Poly-cobblestone-wall/ao_map.jpg', (texture) => {
sidegroundTexture.repeat.set(mazeWidth, 20)
sidegroundTexture.rotation = Math.PI
sideGroundMaterial.map.wrapS = sideGroundMaterial.map.wrapT = THREE.RepeatWrapping
sideGroundMaterial.map.repeat.set(mazeWidth, 20)
sideGroundMaterial.map.rotation = Math.PI
sideGroundMaterial.normalMap.wrapS = sideGroundMaterial.normalMap.wrapT = THREE.RepeatWrapping
sideGroundMaterial.normalMap.repeat.set(mazeWidth, 20)
sideGroundMaterial.normalMap.rotation = Math.PI
sideGroundMaterial.aoMap = sidegroundTexture
sideGroundMaterial.roughnessMap.wrapS = sideGroundMaterial.roughnessMap.wrapT = THREE.RepeatWrapping
sideGroundMaterial.roughnessMap.repeat.set(mazeWidth, 20)
sideGroundMaterial.roughnessMap.rotation = Math.PI
sideGroundMaterial.metalnessMap = sidegroundTexture
sideGroundMaterial.needsUpdate = true
@@ -246,13 +246,7 @@ const groundMaterial = new THREE.MeshStandardMaterial({
aoMap : loader.load('angled-blocks-vegetation/ao.webp', repeatGroundMaterial),
metalnessMap: loader.load('angled-blocks-vegetation/ao-roughness-metalness.webp', repeatGroundMaterial),
normalMap : loader.load('angled-blocks-vegetation/normal-dx.webp', repeatGroundMaterial),
roughnessMap: loader.load('angled-blocks-vegetation/ao-roughness-metalness.webp', repeatGroundMaterial),
/*hexTiling : {
patchScale: 1,
useContrastCorrectedBlending: true,
lookupSkipThreshold: 0.01,
textureSampleCoefficientExponent: 32,
}*/
roughnessMap: loader.load('angled-blocks-vegetation/ao-roughness-metalness.webp', repeatGroundMaterial)
})
const ground = new THREE.Mesh(
@@ -296,7 +290,7 @@ const ocean = new Water(waterGeometry, {
waterColor : 0x001e0f,
distortionScale: 3.7,
fog : scene.fog !== undefined,
alpha : 0.7
alpha : 0.9
})
ocean.rotation.x = - Math.PI / 2
ocean.position.y = -0.2
@@ -526,27 +520,9 @@ if (dev) {
wallMaterialFolder.add(wallMaterial, "roughness").min(0).max(1)
wallMaterialFolder.add(wallMaterial, "metalness").min(0).max(1)
wallMaterialFolder.add(wallMaterial, "aoMapIntensity").min(-10).max(10)
wallMaterialFolder.add(wallMaterial, "bumpScale").min(-10).max(10).onChange(() => wallMaterial.needsUpdate = true)
wallMaterialFolder.add(wallMaterial.normalScale, "x")
wallMaterialFolder.add(wallMaterial.normalScale, "y")
wallMaterialFolder.close()
if (wallMaterial?.hexTiling) {
const hexTilingFolder = gui.addFolder('Hex Tiling')
if (wallMaterial?.hexTiling?.patchScale) {
const wallMaterialFolder = hexTilingFolder.addFolder("wall")
wallMaterialFolder.add(wallMaterial.hexTiling, "patchScale", 0, 10)
wallMaterialFolder.add(wallMaterial.hexTiling, "useContrastCorrectedBlending")
wallMaterialFolder.add(wallMaterial.hexTiling, "lookupSkipThreshold", 0, 1)
wallMaterialFolder.add(wallMaterial.hexTiling, "textureSampleCoefficientExponent", 0, 64).name("SampleCoefExp")
}
if (groundMaterial?.hexTiling?.patchScale) {
const groundMaterialFolder = hexTilingFolder.addFolder("ground")
groundMaterialFolder.add(groundMaterial.hexTiling, "patchScale", 0, 10)
groundMaterialFolder.add(groundMaterial.hexTiling, "useContrastCorrectedBlending")
groundMaterialFolder.add(groundMaterial.hexTiling, "lookupSkipThreshold", 0, 1)
groundMaterialFolder.add(groundMaterial.hexTiling, "textureSampleCoefficientExponent", 0, 64).name("SampleCoefExp")
}
hexTilingFolder.close()
}
}
//

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 542 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 475 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.2 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 396 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 252 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 243 KiB