Skip to content

Commit

Permalink
Diorama
Browse files Browse the repository at this point in the history
Prefab
  • Loading branch information
jasonsturges committed Nov 26, 2024
1 parent ed46c57 commit 7029723
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/models/architecture/Diorama.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Mesh, MeshStandardMaterial } from "three";
import { ColorPalette } from "../../constants/ColorPalette";
import { DioramaGeometry } from "../../geometry/architecture/DioramaGeometry";

/**
* A diorama with a floor and walls.
*
* Material indices:
* 0: Interior walls
* 1: Floor
* 2: Exterior walls
*/
export class Diorama extends Mesh<DioramaGeometry, MeshStandardMaterial[]> {
constructor({
width = 5,
height = 3,
depth = 5,
wallThickness = 0.05,
interiorColor = ColorPalette.WHITE_SMOKE,
floorColor = ColorPalette.RAW_SIENNA,
exteriorColor = ColorPalette.GRAY,
} = {}) {
super(
new DioramaGeometry({ width, height, depth, wallThickness }),
[
new MeshStandardMaterial({ color: interiorColor }),
new MeshStandardMaterial({ color: floorColor }),
new MeshStandardMaterial({ color: exteriorColor }),
],
);
}
}

0 comments on commit 7029723

Please sign in to comment.