@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
69 lines (68 loc) • 1.9 kB
TypeScript
import { Behaviour } from "../Component.js";
export declare enum XRStateFlag {
Never = 0,
Browser = 1,
AR = 2,
VR = 4,
FirstPerson = 8,
ThirdPerson = 16,
All = 4294967295
}
export declare class XRState {
static Global: XRState;
Mask: XRStateFlag;
Has(state: XRStateFlag): boolean;
Set(state: number): void;
Enable(state: number): void;
Disable(state: number): void;
Toggle(state: number): void;
EnableAll(): void;
DisableAll(): void;
}
/**
* XRFlag shows or hides GameObjects based on the current XR state or session.
* Use for XR-responsive content that should only appear in specific modes.
*
* **XR states:**
* - `Browser` - Normal web browsing (no XR)
* - `AR` - Augmented reality session
* - `VR` - Virtual reality session
* - `FirstPerson` - First-person view mode
* - `ThirdPerson` - Third-person/spectator view mode
* - Combine with bitwise OR: `AR | VR`
*
* **Debug options:**
* - `?debugxrflags` - Log flag changes
* - `?disablexrflags` - Disable all XR flags
*
* @example Show only in VR
* ```ts
* const flag = myObject.addComponent(XRFlag);
* flag.visibleIn = XRStateFlag.VR;
* ```
*
* @example Show in AR and VR, hide in browser
* ```ts
* flag.visibleIn = XRStateFlag.AR | XRStateFlag.VR;
* ```
*
* @category XR
* @category Utilities
* @group Components
* @see {@link XRStateFlag} for state options
* @see {@link XRState} for global state management
* @see {@link DeviceFlag} for device-based visibility
* @see {@link WebXR} for XR session management
*/
export declare class XRFlag extends Behaviour {
private static registry;
static Apply(): void;
private static firstApply;
private static buffer;
visibleIn: number;
awake(): void;
onEnable(): void;
onDestroy(): void;
get isOn(): boolean;
UpdateVisible(state?: XRState | XRStateFlag | null): void;
}