/** * Tracking state of the AR session */ export enum ARTrackingState { NOT_AVAILABLE = 'NOT_AVAILABLE', LIMITED = 'LIMITED', NORMAL = 'NORMAL', } /** * Reason for limited tracking */ export enum ARTrackingStateReason { NONE = 'NONE', INITIALIZING = 'INITIALIZING', EXCESSIVE_MOTION = 'EXCESSIVE_MOTION', INSUFFICIENT_FEATURES = 'INSUFFICIENT_FEATURES', RELOCALIZING = 'RELOCALIZING', } /** * Occlusion quality level */ export enum AROcclusionQuality { HIGH = 'high', MEDIUM = 'medium', LOW = 'low', } /** * Depth smoothing mode */ export enum ARDepthSmoothingMode { SMOOTH = 'smooth', RAW = 'raw', DISABLED = 'disabled', } /** * ARCore depth mode */ export enum ARDepthMode { AUTOMATIC = 'automatic', RAW = 'raw', } /** * Depth update frequency */ export enum ARDepthUpdateFrequency { HIGH = 'high', MEDIUM = 'medium', LOW = 'low', } /** * Type of plane detected */ export enum ARPlaneOrientation { HORIZONTAL = 'HORIZONTAL', VERTICAL = 'VERTICAL', } /** * Supported 3D model file formats */ export enum ARModelFormat { GLB = 'glb', GLTF = 'gltf', OBJ = 'obj', USDZ = 'usdz', // iOS only SCNASSETS = 'scnassets' // iOS only } /** * Material information for model rendering */ export interface ARModelMaterial { /** * Color of the material */ color?: string; /** * URL or local path to the texture file */ textureUrl?: string; /** * Metalness factor (0-1) */ metalness?: number; /** * Roughness factor (0-1) */ roughness?: number; /** * Whether the material is transparent */ transparent?: boolean; /** * Opacity of the material (0-1) */ opacity?: number; /** * Emissive color (self-illuminating glow) */ emissive?: string; /** * Emissive intensity factor (0-1) * Controls the strength of the emissive glow */ emissiveIntensity?: number; /** * URL or local path to the emissive texture */ emissiveMap?: string; } /** * 3D object model information */ export interface ARObjectModel { /** * URL or local path to the 3D model file */ uri: string; /** * Format of the 3D model */ format?: ARModelFormat; /** * Initial position of the object */ position?: { x: number; y: number; z: number; }; /** * Initial scale of the object */ scale?: number; /** * Initial rotation of the object in radians */ rotation?: { x: number; y: number; z: number; }; /** * Materials to apply to the model * Key is the node/mesh name, value is the material info */ materials?: Record; /** * Whether to cast shadows */ castsShadow?: boolean; /** * Whether to receive shadows */ receivesShadow?: boolean; /** * Animations to play when the model is loaded */ animations?: { /** * Name of the animation to play */ name: string; /** * Whether to loop the animation */ loop?: boolean; /** * Speed of the animation (1 is normal speed) */ speed?: number; }[]; } /** * Event data for plane detection */ export interface ARPlaneEvent { /** * Unique ID of the detected plane */ id: string; /** * Position of the center of the plane */ position: { x: number; y: number; z: number; }; /** * Estimated dimensions of the plane */ extent: { width: number; height: number; }; /** * Orientation of the detected plane */ orientation: ARPlaneOrientation; } /** * Event data for object placement */ export interface ARObjectEvent { /** * Unique ID of the placed object */ id: string; /** * Position of the placed object */ position: { x: number; y: number; z: number; }; /** * Scale of the placed object */ scale: number; /** * Rotation of the placed object in radians */ rotation: { x: number; y: number; z: number; }; } /** * Event data for user tap */ export interface ARTapEvent { /** * Position in the AR world space where the tap occurred */ position: { x: number; y: number; z: number; }; /** * ID of the plane that was tapped, if any */ planeId?: string; /** * ID of the object that was tapped, if any */ objectId?: string; } /** * Event data for tracking state changes */ export interface ARTrackingStateEvent { /** * Current tracking state */ state: ARTrackingState; /** * Reason for limited tracking, if applicable */ reason?: ARTrackingStateReason; } /** * Depth options configuration for AR session */ export interface ARDepthOptions { /** * Quality level for occlusion */ occlusionQuality?: AROcclusionQuality; /** * iOS-specific: Depth accuracy */ accuracy?: 'high' | 'low'; /** * iOS-specific: Depth smoothing mode */ smoothingMode?: ARDepthSmoothingMode; /** * iOS-specific: Enable temporal filtering for smoother results */ temporalFiltering?: boolean; /** * iOS-specific: Enable person segmentation (People Occlusion) */ personSegmentation?: boolean; /** * Android-specific: Depth mode */ depthMode?: ARDepthMode; /** * Android-specific: How frequently to update depth */ depthUpdateFrequency?: ARDepthUpdateFrequency; /** * Android-specific: Use depth for more accurate hit testing */ useDepthForRaycasting?: boolean; } /** * Options for configuring an AR session */ export interface ARSessionOptions { /** * Type of planes to detect */ planeDetection?: 'horizontal' | 'vertical' | 'horizontal_and_vertical' | 'none'; /** * Whether to enable basic light estimation (deprecated, use lightingOptions instead) */ lightEstimation?: boolean; /** * Advanced lighting options for environmental lighting and shadows */ lightingOptions?: { /** * Light estimation mode */ estimationMode?: ARLightEstimationMode; /** * Update frequency for light estimation (in frames) * Lower values provide more accurate lighting but use more resources * Default: 20 frames */ updateFrequency?: number; /** * Additional manual lights to add to the scene (beyond environment lighting) */ additionalLights?: ARLightConfiguration[]; /** * Whether to visualize light sources in debug mode */ debugVisualization?: boolean; /** * Whether to use environment probes for reflections * Only available with ARLightEstimationMode.ENVIRONMENTAL_HDR */ useEnvironmentProbes?: boolean; }; /** * Shadow rendering configuration */ shadowOptions?: ARShadowConfiguration; /** * Whether to enable object occlusion with depth */ enableOcclusion?: boolean; /** * Detailed configuration for depth-based features */ depthOptions?: ARDepthOptions; /** * Whether to enable point cloud visualization */ enablePointCloud?: boolean; /** * Maximum number of planes to track */ maxPlanes?: number; /** * Target frame rate for the AR session */ preferredFramesPerSecond?: number; } /** * Event data for depth update */ export interface ARDepthUpdateEvent { /** * Depth value at the center of the screen (in meters) */ centerDepth: number; /** * Timestamp of the depth frame */ timestamp: number; /** * Whether depth data is currently available */ depthAvailable: boolean; } /** * Shadow rendering quality */ export enum ARShadowQuality { HIGH = 'high', MEDIUM = 'medium', LOW = 'low', DISABLED = 'disabled', } /** * Light estimation mode */ export enum ARLightEstimationMode { /** * Automatic mode - uses the best available light estimation technique for the device */ AUTOMATIC = 'automatic', /** * Ambient intensity only - estimates overall scene brightness */ AMBIENT_INTENSITY = 'ambient_intensity', /** * Environmental HDR - provides detailed spherical harmonics * for realistic reflections and lighting (requires iOS 13+ or ARCore 1.24+) */ ENVIRONMENTAL_HDR = 'environmental_hdr', /** * Disabled - does not perform light estimation */ DISABLED = 'disabled', } /** * Light source type for manual lights */ export enum ARLightType { /** * Directional light - parallel rays from a direction (like the sun) */ DIRECTIONAL = 'directional', /** * Point light - light emitted in all directions from a point */ POINT = 'point', /** * Spot light - like a flashlight, emitting a cone of light */ SPOT = 'spot', /** * Ambient light - general illumination from all directions */ AMBIENT = 'ambient', } /** * Light configuration properties */ export interface ARLightConfiguration { /** * Type of light */ type: ARLightType; /** * Color of the light, CSS-style hex code */ color?: string; /** * Intensity of the light (0.0 - 1.0) */ intensity?: number; /** * Position of the light (for point and spot lights) */ position?: { x: number; y: number; z: number; }; /** * Direction vector (for directional and spot lights) */ direction?: { x: number; y: number; z: number; }; /** * Attenuation factors (for point and spot lights) */ attenuation?: { constant: number; linear: number; quadratic: number; }; /** * Spotlight cone angles in degrees (for spot lights) */ spotAngles?: { innerConeAngle: number; outerConeAngle: number; }; /** * Whether this light casts shadows */ castsShadow?: boolean; /** * Shadow properties */ shadow?: { radius?: number; bias?: number; intensity?: number; resolution?: 'low' | 'medium' | 'high'; }; } /** * Light estimation result for adaptive lighting */ export interface ARLightEstimation { /** * Ambient intensity factor (0.0 - 1.0) */ ambientIntensity: number; /** * Ambient color temperature in Kelvin */ ambientColorTemperature?: number; /** * Spherical harmonic coefficients for environmental lighting * Only available with ARLightEstimationMode.ENVIRONMENTAL_HDR */ sphericalHarmonics?: number[]; /** * Main light direction (if detected) - represents the sun/main light source */ mainLightDirection?: { x: number; y: number; z: number; }; /** * Main light intensity (if detected) */ mainLightIntensity?: number; /** * Main light color (if detected) as a CSS-style hex code */ mainLightColor?: string; /** * Timestamp of the light estimation */ timestamp: number; } /** * Event data for light estimation updates */ export interface ARLightEstimationEvent extends ARLightEstimation { /** * Whether environmental HDR data is available */ environmentalHDRAvailable: boolean; } /** * Shadow configuration properties */ export interface ARShadowConfiguration { /** * Shadow quality level */ quality: ARShadowQuality; /** * Shadow opacity (0.0 - 1.0) */ opacity?: number; /** * Shadow radius - controls softness of shadow edges */ radius?: number; /** * Shadow bias to prevent shadow acne */ bias?: number; /** * Shadow map size (for performance tuning) */ mapSize?: 256 | 512 | 1024 | 2048 | 4096; } /** * Supported AR features */ export interface ARFeatures { /** * Whether depth occlusion is supported */ depthOcclusion: boolean; /** * Whether the device has a LiDAR scanner (iOS only) */ lidarSupport: boolean; /** * Whether plane detection is supported */ planeDetection: boolean; /** * Whether face tracking is supported */ faceTracking: boolean; /** * Whether image tracking is supported */ imageTracking: boolean; /** * Whether environmental HDR lighting is supported */ environmentalHDRLighting: boolean; /** * Whether advanced shadow rendering is supported */ advancedShadows: boolean; /** * Whether geographic anchors are supported */ geoAnchors: boolean; /** * Whether cloud anchors are supported */ cloudAnchors: boolean; }