This commit is contained in:
2025-11-25 17:45:50 +02:00
parent c6d4ce9007
commit b991b962f3
3 changed files with 11 additions and 8 deletions
@@ -11,7 +11,7 @@ class MazeObject {
let _tf = { let _tf = {
rotation: { rotation: {
r: 3 * Math.PI / 2, f: 0, l: Math.PI / 2, b: 0 r: 3 * Math.PI / 2, f: 0, l: Math.PI / 2, b: Math.PI
}, },
pNext: { pNext: {
r: [-wallSize/2, wallSize/2], r: [-wallSize/2, wallSize/2],
@@ -45,7 +45,7 @@ class MazeObject {
e[0].position.set(0, 0, offsetZ + wallSize/2); e[0].position.set(0, 0, offsetZ + wallSize/2);
e[1].rotateY(_tf.rotation.b); e[1].rotateY(_tf.rotation[elements[1] == 'door' ? 'f' : 'b']);
e[2].rotateY(_tf.rotation.r); e[2].rotateY(_tf.rotation.r);
e[3].rotateY(_tf.rotation.f); e[3].rotateY(_tf.rotation.f);
@@ -155,12 +155,14 @@ class MazeObject {
const floor = o.surface.clone(); const floor = o.surface.clone();
const mt = floor.material.clone(); const mt = floor.material.clone();
['map', 'normalMap'].forEach(m=>{ ['map', 'normalMap'].forEach(m=>{
if (!mt[m]) return; if (!mt[m]) return //console.log('missing', m);
mt[m] = mt[m].clone(); mt[m] = mt[m].clone();
mt[m].wrapS = mt[m].wrapT = RepeatWrapping; mt[m].wrapS = mt[m].wrapT = RepeatWrapping;
mt[m].repeat = new Vector2(Math.floor(floorSize.width/wallSize), Math.floor(floorSize.depth/wallSize)); mt[m].repeat = new Vector2(Math.floor(floorSize.width/wallSize), Math.floor(floorSize.depth/wallSize));
mt[m].needsUpdate = true; mt[m].needsUpdate = true;
}); });
mt.needsUpdate = true;
floor.material = mt;
floor.position.set((bbox.l + bbox.r)/2, 0, bbox.f/2); floor.position.set((bbox.l + bbox.r)/2, 0, bbox.f/2);
floor.scale.set(floorSize.width, scale, floorSize.depth) floor.scale.set(floorSize.width, scale, floorSize.depth)
root.add(floor); root.add(floor);
@@ -12,8 +12,8 @@ const imgParams = {
type: 'ImageObject', type: 'ImageObject',
width: params.wallSize*0.033, width: params.wallSize*0.033,
height: params.wallSize*0.033, height: params.wallSize*0.033,
value: 'arrow.png', value: 'arrow.webp',
path: '/static/textures/' path: '/static/meshes/quiz/'
} }
const textParams = { const textParams = {
@@ -147,7 +147,7 @@ class MazeQuizGame extends EventDispatcher {
len: 3, len: 3,
objects:[ objects:[
{ {
...textParams, color:0xff0000, text: question.h, fontSize:0.033, position:[0,.44,2+.96], rotation:[0,Math.PI, 0] ...textParams, color:0xff0000, text: question.h, fontSize:0.033, position:[0,.44,3+.96], rotation:[0,Math.PI, 0]
} }
] ]
} }
@@ -49,7 +49,8 @@ export default {
return { return {
styles:[ styles:[
{ title: 'Lake reeds', value: 'quiz.gltf' }, { title: 'Lake reeds', value: 'quiz.gltf' },
{ title: 'Grass and pavement pathway', value: 'quiz-s2.gltf' } { title: 'Grass and pavement pathway', value: 'quiz-s2.gltf' },
{ title: 'Medieval Fortress', value: 'quiz-fortress.gltf' },
] ]
} }
}, },