import hexTiling

This commit is contained in:
Adrien MALINGREY 2023-11-18 11:38:19 +01:00
parent 6e51b2f115
commit cb1b0bb541
2 changed files with 18 additions and 2 deletions

View File

@ -12,8 +12,9 @@
<script type="importmap"> <script type="importmap">
{ {
"imports": { "imports": {
"three": "https://unpkg.com/three@0.157/build/three.module.js?module", "three": "https://unpkg.com/three@0.158/build/three.module.js?module",
"three/addons/": "https://unpkg.com/three@0.157/examples/jsm/" "three/addons/": "https://unpkg.com/three@0.158/examples/jsm/",
"three-hex-tiling": "https://cdn.jsdelivr.net/npm/three-hex-tiling@0.1.1/+esm"
} }
} }
</script> </script>

15
main.js
View File

@ -10,6 +10,8 @@ import Stats from 'three/addons/libs/stats.module.js';
import MazeMesh from './MazeMesh.js'; import MazeMesh from './MazeMesh.js';
import 'three-hex-tiling';
const playerHeight = 0.5; const playerHeight = 0.5;
const mazeWidth = 23 const mazeWidth = 23
@ -86,6 +88,7 @@ scene.background = new THREE.CubeTextureLoader(loadMngr)
'lf.jpg', 'lf.jpg',
] ); ] );
scene.backgroundBlurriness = 0.03; scene.backgroundBlurriness = 0.03;
scene.backgroundIntensity = 1.4;
scene.environment = scene.background; scene.environment = scene.background;
window.scene = scene; window.scene = scene;
@ -104,6 +107,12 @@ const wallMaterial = new THREE.MeshStandardMaterial({
aoMap : loader.load('textures/Poly-cobblestone-wall/ao_map.jpg'), aoMap : loader.load('textures/Poly-cobblestone-wall/ao_map.jpg'),
roughnessMap : loader.load('textures/Poly-cobblestone-wall/roughness_map.jpg'), roughnessMap : loader.load('textures/Poly-cobblestone-wall/roughness_map.jpg'),
roughness : 1, roughness : 1,
hexTiling: {
patchScale: 2,
useContrastCorrectedBlending: true,
lookupSkipThreshold: 0.01,
textureSampleCoefficientExponent: 8,
}
}) })
const maze = new MazeMesh(mazeWidth, mazeWidth, 1, wallMaterial); const maze = new MazeMesh(mazeWidth, mazeWidth, 1, wallMaterial);
@ -169,6 +178,12 @@ const groundMaterial = new THREE.MeshStandardMaterial({
texture.repeat.set(mazeWidth / 4, mazeWidth / 4) texture.repeat.set(mazeWidth / 4, mazeWidth / 4)
} }
), ),
hexTiling: {
patchScale: 2,
useContrastCorrectedBlending: true,
lookupSkipThreshold: 0.01,
textureSampleCoefficientExponent: 8,
}
}) })
const sideGroundMaterial = new THREE.MeshStandardMaterial({ const sideGroundMaterial = new THREE.MeshStandardMaterial({