From d0cca56c1976959dd7601850a860bfb21323b967 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Tue, 31 Mar 2026 05:52:30 +0200 Subject: [PATCH] Update viewport-host.ts to include new geometries and entity render objects --- src/viewport-three/viewport-host.ts | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/viewport-three/viewport-host.ts b/src/viewport-three/viewport-host.ts index c7688657..3a3a7dad 100644 --- a/src/viewport-three/viewport-host.ts +++ b/src/viewport-three/viewport-host.ts @@ -17,7 +17,9 @@ import { PerspectiveCamera, Raycaster, Scene, + SphereGeometry, Spherical, + TorusGeometry, Vector2, Vector3, WebGLRenderer @@ -27,7 +29,7 @@ import { isBrushFaceSelected, isBrushSelected, type EditorSelection } from "../c import type { ToolMode } from "../core/tool-mode"; import type { Vec3 } from "../core/vector"; import type { SceneDocument, WorldSettings } from "../document/scene-document"; -import { getPlayerStartEntities } from "../entities/entity-instances"; +import { getEntityInstances, type EntityInstance } from "../entities/entity-instances"; import { BOX_FACE_IDS, DEFAULT_BOX_BRUSH_SIZE, type BoxBrush, type BoxFaceId } from "../document/brushes"; import { applyBoxBrushFaceUvsToGeometry } from "../geometry/box-face-uvs"; import { DEFAULT_GRID_SIZE, snapValueToGrid } from "../geometry/grid-snapping"; @@ -47,6 +49,14 @@ const SELECTED_FACE_FALLBACK_COLOR = 0xcf7b42; const SELECTED_FACE_EMISSIVE = 0x4a2814; const PLAYER_START_COLOR = 0x7cb7ff; const PLAYER_START_SELECTED_COLOR = 0xf3be8f; +const SOUND_EMITTER_COLOR = 0x72d7c9; +const SOUND_EMITTER_SELECTED_COLOR = 0xf4d37d; +const TRIGGER_VOLUME_COLOR = 0x9f8cff; +const TRIGGER_VOLUME_SELECTED_COLOR = 0xf0b07f; +const TELEPORT_TARGET_COLOR = 0x7ee0ff; +const TELEPORT_TARGET_SELECTED_COLOR = 0xf6c48a; +const INTERACTABLE_COLOR = 0x92de7e; +const INTERACTABLE_SELECTED_COLOR = 0xf1cf7e; const BOX_CREATE_PREVIEW_FILL = 0x89b6ff; const BOX_CREATE_PREVIEW_EDGE = 0xf3be8f; const MIN_CAMERA_DISTANCE = 1.5; @@ -62,7 +72,7 @@ interface CachedMaterialTexture { texture: CanvasTexture; } -interface PlayerStartRenderObjects { +interface EntityRenderObjects { group: Group; meshes: Mesh[]; } @@ -86,7 +96,7 @@ export class ViewportHost { private readonly boxCreateIntersection = new Vector3(); private readonly boxCreatePlane = new Plane(new Vector3(0, 1, 0), 0); private readonly brushRenderObjects = new Map(); - private readonly playerStartRenderObjects = new Map(); + private readonly entityRenderObjects = new Map(); private readonly materialTextureCache = new Map(); private readonly boxCreatePreviewMesh = new Mesh( new BoxGeometry(DEFAULT_BOX_BRUSH_SIZE.x, DEFAULT_BOX_BRUSH_SIZE.y, DEFAULT_BOX_BRUSH_SIZE.z),