Simpler scene
This commit is contained in:
parent
e0bb0fb083
commit
bdafb77667
123
src/index.ts
123
src/index.ts
|
@ -12,8 +12,8 @@ import {
|
|||
Vector3,
|
||||
} from '@babylonjs/core/Legacy/legacy';
|
||||
|
||||
import { box, PhotoSemiDome } from './shapes.js';
|
||||
import { DEFAULT_THICKNESS, room } from './interiors.js';
|
||||
import { box } from './shapes.js';
|
||||
import { attachTexture } from './interiors.js';
|
||||
import { startEngine } from './engine.js';
|
||||
import { uuid } from './uuid.js';
|
||||
|
||||
|
@ -25,127 +25,12 @@ async function createScene(_canvas: HTMLCanvasElement, engine: Engine): Promise<
|
|||
|
||||
new HemisphericLight("light", new Vector3(0, 1, 0), scene);
|
||||
|
||||
const streetDome = new PhotoSemiDome("street", "papenweg-textures/individual/street-panorama.jpg", {
|
||||
halfDomeMode: true,
|
||||
size: 10,
|
||||
}, scene);
|
||||
streetDome.position.z = (3.80 / 2) - 0.4;
|
||||
streetDome.position.y = 0.4;
|
||||
|
||||
const gardenDome = new PhotoSemiDome("garden", "papenweg-textures/individual/garden-panorama.jpg", {
|
||||
halfDomeMode: true,
|
||||
size: 10,
|
||||
}, scene);
|
||||
gardenDome.position.z = -4.06 - (3.80 / 2) - 1.2;
|
||||
gardenDome.position.y = 1.2;
|
||||
gardenDome.rotation.y = Math.PI;
|
||||
|
||||
const sittingroom = await room(
|
||||
"sittingroom", 3.80, 4.06, scene,
|
||||
"papenweg-textures/individual/floor1.jpg",
|
||||
"papenweg-textures/individual/wallpaper1.jpg",
|
||||
{
|
||||
texture: "papenweg-textures/individual/sittingroom_0_window.jpg",
|
||||
thickness: DEFAULT_THICKNESS / 2,
|
||||
holes: [
|
||||
box("w0b", 0.55, 1.25, DEFAULT_THICKNESS, -0.4, 1.55),
|
||||
box("w0c", 0.55, 1.25, DEFAULT_THICKNESS, 0.3, 1.55),
|
||||
box("w0d", 0.55, 1.25, DEFAULT_THICKNESS, 1.0, 1.55),
|
||||
box("w0a", 0.55, 1.25, DEFAULT_THICKNESS, -1.1, 1.55),
|
||||
]
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/sittingroom_1_tvwall.jpg",
|
||||
holes: []
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/sittingroom_2_doors.jpg",
|
||||
thickness: DEFAULT_THICKNESS / 2,
|
||||
holes: [
|
||||
box("w2a", 0.6, 1.99, DEFAULT_THICKNESS, 0.2),
|
||||
box("ww1", 0.28, 0.28, DEFAULT_THICKNESS, -0.64, 1.7),
|
||||
box("ww2", 0.28, 0.28, DEFAULT_THICKNESS, -0.64, 1.4),
|
||||
box("ww3", 0.28, 0.28, DEFAULT_THICKNESS, -0.64, 1.1),
|
||||
box("ww4", 0.28, 0.28, DEFAULT_THICKNESS, -0.64, 0.8),
|
||||
box("ww5", 0.28, 0.28, DEFAULT_THICKNESS, -0.34, 1.7),
|
||||
box("ww6", 0.28, 0.28, DEFAULT_THICKNESS, -0.34, 1.4),
|
||||
box("ww7", 0.28, 0.28, DEFAULT_THICKNESS, -0.34, 1.1),
|
||||
box("ww8", 0.28, 0.28, DEFAULT_THICKNESS, -0.34, 0.8),
|
||||
box("ww9", 0.20, 0.28, DEFAULT_THICKNESS, 0.74, 1.7),
|
||||
box("wwA", 0.20, 0.28, DEFAULT_THICKNESS, 0.74, 1.4),
|
||||
box("wwB", 0.20, 0.28, DEFAULT_THICKNESS, 0.74, 1.1),
|
||||
box("wwC", 0.20, 0.28, DEFAULT_THICKNESS, 0.74, 0.8),
|
||||
]
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/sittingroom_3_sofawall.jpg",
|
||||
holes: [
|
||||
box("w3a", 0.83, 2.08, DEFAULT_THICKNESS, -1.33),
|
||||
]
|
||||
});
|
||||
|
||||
const diningroom = await room(
|
||||
"diningroom", 3.80, 4.06, scene,
|
||||
"papenweg-textures/individual/floor1.jpg",
|
||||
"papenweg-textures/individual/wallpaper1.jpg",
|
||||
{
|
||||
texture: "papenweg-textures/individual/diningroom_0_doors.jpg",
|
||||
thickness: DEFAULT_THICKNESS / 2,
|
||||
holes: [
|
||||
box("dw2a", 0.6, 1.99, DEFAULT_THICKNESS, -0.2),
|
||||
box("dww1", 0.28, 0.28, DEFAULT_THICKNESS, 0.64, 1.7),
|
||||
box("dww2", 0.28, 0.28, DEFAULT_THICKNESS, 0.64, 1.4),
|
||||
box("dww3", 0.28, 0.28, DEFAULT_THICKNESS, 0.64, 1.1),
|
||||
box("dww4", 0.28, 0.28, DEFAULT_THICKNESS, 0.64, 0.8),
|
||||
box("dww5", 0.28, 0.28, DEFAULT_THICKNESS, 0.34, 1.7),
|
||||
box("dww6", 0.28, 0.28, DEFAULT_THICKNESS, 0.34, 1.4),
|
||||
box("dww7", 0.28, 0.28, DEFAULT_THICKNESS, 0.34, 1.1),
|
||||
box("dww8", 0.28, 0.28, DEFAULT_THICKNESS, 0.34, 0.8),
|
||||
box("dww9", 0.20, 0.28, DEFAULT_THICKNESS, -0.74, 1.7),
|
||||
box("dwwA", 0.20, 0.28, DEFAULT_THICKNESS, -0.74, 1.4),
|
||||
box("dwwB", 0.20, 0.28, DEFAULT_THICKNESS, -0.74, 1.1),
|
||||
box("dwwC", 0.20, 0.28, DEFAULT_THICKNESS, -0.74, 0.8),
|
||||
]
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/diningroom_1_fireplace.jpg",
|
||||
holes: []
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/diningroom_2_window.jpg",
|
||||
thickness: DEFAULT_THICKNESS / 2,
|
||||
holes: (() => {
|
||||
const bc = (name: string, left: number, top: number, bw: number, bh: number) => [
|
||||
box(name + "1", bw, bh, DEFAULT_THICKNESS, left + (0 * (bw + 0.02)), top - (0 * (bh + 0.02))),
|
||||
box(name + "2", bw, bh, DEFAULT_THICKNESS, left + (0 * (bw + 0.02)), top - (1 * (bh + 0.02))),
|
||||
box(name + "3", bw, bh, DEFAULT_THICKNESS, left + (0 * (bw + 0.02)), top - (2 * (bh + 0.02))),
|
||||
box(name + "4", bw, bh, DEFAULT_THICKNESS, left + (0 * (bw + 0.02)), top - (3 * (bh + 0.02))),
|
||||
box(name + "5", bw, bh, DEFAULT_THICKNESS, left + (1 * (bw + 0.02)), top - (0 * (bh + 0.02))),
|
||||
box(name + "6", bw, bh, DEFAULT_THICKNESS, left + (1 * (bw + 0.02)), top - (1 * (bh + 0.02))),
|
||||
box(name + "7", bw, bh, DEFAULT_THICKNESS, left + (1 * (bw + 0.02)), top - (2 * (bh + 0.02))),
|
||||
box(name + "8", bw, bh, DEFAULT_THICKNESS, left + (1 * (bw + 0.02)), top - (3 * (bh + 0.02))),
|
||||
];
|
||||
return [
|
||||
... bc("dwA", -0.84, 1.69, 0.25, 0.29),
|
||||
... bc("dwB", -0.09, 1.69, 0.25, 0.29),
|
||||
... bc("dwC", 0.57, 1.69, 0.24, 0.28),
|
||||
... bc("dwD", -1.47, 1.69, 0.24, 0.28),
|
||||
];
|
||||
})(),
|
||||
},
|
||||
{
|
||||
texture: "papenweg-textures/individual/diningroom_3_heater.jpg",
|
||||
holes: [
|
||||
box("w3a", 0.83, 2.01, DEFAULT_THICKNESS, 1.46),
|
||||
]
|
||||
});
|
||||
diningroom.position.z = -(4.06 + DEFAULT_THICKNESS);
|
||||
const b = attachTexture(box('b', 1, 1, 1, 0, 2, 2), scene, 'papenweg-textures/individual/floor1.jpg');
|
||||
|
||||
return {
|
||||
scene,
|
||||
floorMeshes: [
|
||||
sittingroom,
|
||||
diningroom,
|
||||
b,
|
||||
MeshBuilder.CreateGround("ground", {width:30, height:30}),
|
||||
],
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue