import type {TemplateResult} from 'lit'; import {XR_BLOCKS_ASSETS_PATH} from '../constants'; import {Handedness} from '../input/Hands'; import {deepMerge} from '../utils/OptionsUtils'; import {DeepPartial, DeepReadonly} from '../utils/Types'; import {Keycodes} from '../utils/Keycodes'; export enum SimulatorMode { USER = 'User', POSE = 'Navigation', CONTROLLER = 'Hands', } const DEFAULT_MODE_TOGGLE_ORDER = { [SimulatorMode.USER]: SimulatorMode.POSE, [SimulatorMode.POSE]: SimulatorMode.CONTROLLER, [SimulatorMode.CONTROLLER]: SimulatorMode.USER, }; export interface SimulatorCustomInstruction { header: string | TemplateResult; videoSrc?: string; description: string | TemplateResult; } export interface SimulatorEnvironment { name: string; scenePath?: string | null; scenePlanesPath?: string | null; videoPath?: string; } export class SimulatorOptions { initialCameraPosition = {x: 0, y: 1.5, z: 0}; environments: SimulatorEnvironment[] = [ { name: 'Living Room', scenePath: XR_BLOCKS_ASSETS_PATH + 'simulator/scenes/XREmulatorsceneV5_livingRoom.glb', scenePlanesPath: XR_BLOCKS_ASSETS_PATH + 'simulator/scenes/XREmulatorsceneV5_livingRoom_planes.json', }, ]; activeEnvironmentIndex = 0; initialScenePosition = {x: -1.6, y: 0.3, z: 0}; defaultMode = SimulatorMode.USER; defaultHand = Handedness.LEFT; modeToggle = { enabled: false, toggleKey: Keycodes.LEFT_SHIFT_CODE as Keycodes | null, toggleOrder: DEFAULT_MODE_TOGGLE_ORDER, }; simulatorSettingsPanel = { enabled: true, element: 'xrblocks-simulator-settings', }; instructions = { enabled: false, element: 'xrblocks-simulator-instructions', customInstructions: [] as SimulatorCustomInstruction[], }; handPosePanel = { enabled: true, element: 'xrblocks-simulator-hand-pose-panel', }; geminiLivePanel = { enabled: false, element: 'xrblocks-simulator-geminilive', }; stereo = { enabled: false, }; deviceCamera = { // Whether to enable the simulator camera feed. // If disabled, the actual device camera will be used instead. enabled: true, }; // Whether to render the main scene to a render texture before rendering the simulator scene // or directly to the canvas after rendering the simulator scene. renderToRenderTexture = true; // Blending mode when rendering the virtual scene. blendingMode: 'normal' | 'screen' = 'normal'; constructor(options?: DeepReadonly>) { deepMerge(this, options); } }