@aura3d/engine 1.4.4 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +65 -30
- package/dist/animation/Retargeting.d.ts +12 -0
- package/dist/animation/Retargeting.d.ts.map +1 -0
- package/dist/animation/Retargeting.js +19 -0
- package/dist/animation/Retargeting.js.map +1 -0
- package/dist/assets/GLTFLoader.d.ts +4 -0
- package/dist/assets/GLTFLoader.d.ts.map +1 -1
- package/dist/assets/GLTFLoader.js +39 -4
- package/dist/assets/GLTFLoader.js.map +1 -1
- package/dist/assets/GLTFRenderResources.d.ts +16 -0
- package/dist/assets/GLTFRenderResources.d.ts.map +1 -1
- package/dist/assets/GLTFRenderResources.js +42 -2
- package/dist/assets/GLTFRenderResources.js.map +1 -1
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.d.ts +6 -0
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.d.ts.map +1 -1
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.js +2 -1
- package/dist/assets/asset-corpus/ProductionGLTFRenderPipeline.js.map +1 -1
- package/dist/assets/index.d.ts +0 -1
- package/dist/assets/index.d.ts.map +1 -1
- package/dist/assets/index.js +0 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/assets/loaders/index.d.ts +0 -1
- package/dist/assets/loaders/index.d.ts.map +1 -1
- package/dist/assets/loaders/index.js +0 -1
- package/dist/assets/loaders/index.js.map +1 -1
- package/dist/aura3d-cli/asset-intent.d.ts +148 -0
- package/dist/aura3d-cli/asset-intent.d.ts.map +1 -0
- package/dist/aura3d-cli/asset-intent.js +145 -0
- package/dist/aura3d-cli/asset-intent.js.map +1 -0
- package/dist/aura3d-cli/asset-role-admission.d.ts +174 -0
- package/dist/aura3d-cli/asset-role-admission.d.ts.map +1 -0
- package/dist/aura3d-cli/asset-role-admission.js +381 -0
- package/dist/aura3d-cli/asset-role-admission.js.map +1 -0
- package/dist/aura3d-cli/asset-screening-effects.d.ts +95 -0
- package/dist/aura3d-cli/asset-screening-effects.d.ts.map +1 -0
- package/dist/aura3d-cli/asset-screening-effects.js +321 -0
- package/dist/aura3d-cli/asset-screening-effects.js.map +1 -0
- package/dist/aura3d-cli/asset-screening-pipeline.d.ts +132 -0
- package/dist/aura3d-cli/asset-screening-pipeline.d.ts.map +1 -0
- package/dist/aura3d-cli/asset-screening-pipeline.js +277 -0
- package/dist/aura3d-cli/asset-screening-pipeline.js.map +1 -0
- package/dist/aura3d-cli/cartoon-asset-profiles.d.ts +15 -0
- package/dist/aura3d-cli/cartoon-asset-profiles.d.ts.map +1 -0
- package/dist/aura3d-cli/cartoon-asset-profiles.js +46 -0
- package/dist/aura3d-cli/cartoon-asset-profiles.js.map +1 -0
- package/dist/aura3d-cli/cli-help.js +1 -1
- package/dist/aura3d-cli/cli.js +16 -2
- package/dist/aura3d-cli/cli.js.map +1 -1
- package/dist/aura3d-cli/index.d.ts +8 -0
- package/dist/aura3d-cli/index.d.ts.map +1 -1
- package/dist/aura3d-cli/index.js +390 -17
- package/dist/aura3d-cli/index.js.map +1 -1
- package/dist/aura3d-cli/pull-bridge/search.d.ts +4 -0
- package/dist/aura3d-cli/pull-bridge/search.d.ts.map +1 -1
- package/dist/aura3d-cli/pull-bridge/search.js +22 -0
- package/dist/aura3d-cli/pull-bridge/search.js.map +1 -1
- package/dist/aura3d-cli/pull-bridge.d.ts +20 -5
- package/dist/aura3d-cli/pull-bridge.d.ts.map +1 -1
- package/dist/aura3d-cli/pull-bridge.js +38 -1
- package/dist/aura3d-cli/pull-bridge.js.map +1 -1
- package/dist/controls/ControlState.d.ts +1 -1
- package/dist/controls/ControlState.d.ts.map +1 -1
- package/dist/controls/DragControls.d.ts +21 -1
- package/dist/controls/DragControls.d.ts.map +1 -1
- package/dist/controls/DragControls.js +24 -2
- package/dist/controls/DragControls.js.map +1 -1
- package/dist/controls/FirstPersonControls.d.ts +10 -1
- package/dist/controls/FirstPersonControls.d.ts.map +1 -1
- package/dist/controls/FirstPersonControls.js +18 -2
- package/dist/controls/FirstPersonControls.js.map +1 -1
- package/dist/controls/FlyControls.d.ts +42 -0
- package/dist/controls/FlyControls.d.ts.map +1 -1
- package/dist/controls/FlyControls.js +106 -3
- package/dist/controls/FlyControls.js.map +1 -1
- package/dist/controls/MapControls.d.ts +13 -0
- package/dist/controls/MapControls.d.ts.map +1 -1
- package/dist/controls/MapControls.js +40 -2
- package/dist/controls/MapControls.js.map +1 -1
- package/dist/controls/OrbitControls.d.ts +54 -0
- package/dist/controls/OrbitControls.d.ts.map +1 -1
- package/dist/controls/OrbitControls.js +133 -0
- package/dist/controls/OrbitControls.js.map +1 -1
- package/dist/controls/PointerLockControls.d.ts +12 -5
- package/dist/controls/PointerLockControls.d.ts.map +1 -1
- package/dist/controls/PointerLockControls.js +30 -11
- package/dist/controls/PointerLockControls.js.map +1 -1
- package/dist/controls/SelectionManager.d.ts +22 -1
- package/dist/controls/SelectionManager.d.ts.map +1 -1
- package/dist/controls/SelectionManager.js +64 -6
- package/dist/controls/SelectionManager.js.map +1 -1
- package/dist/controls/TransformControls.d.ts +135 -1
- package/dist/controls/TransformControls.d.ts.map +1 -1
- package/dist/controls/TransformControls.js +534 -10
- package/dist/controls/TransformControls.js.map +1 -1
- package/dist/controls/index.d.ts +7 -2
- package/dist/controls/index.d.ts.map +1 -1
- package/dist/controls/index.js +1 -1
- package/dist/controls/index.js.map +1 -1
- package/dist/create-aura3d/index.js +1 -1
- package/dist/create-aura3d/showcase-spec-game-geometry-extractor.d.ts +2 -0
- package/dist/create-aura3d/showcase-spec-game-geometry-extractor.d.ts.map +1 -1
- package/dist/create-aura3d/showcase-spec-game-geometry-extractor.js +781 -46
- package/dist/create-aura3d/showcase-spec-game-geometry-extractor.js.map +1 -1
- package/dist/create-aura3d/showcase-spec-game-template-evidence.d.ts.map +1 -1
- package/dist/create-aura3d/showcase-spec-game-template-evidence.js +24 -4
- package/dist/create-aura3d/showcase-spec-game-template-evidence.js.map +1 -1
- package/dist/create-aura3d/showcase-spec-platformer-artifacts.d.ts.map +1 -1
- package/dist/create-aura3d/showcase-spec-platformer-artifacts.js +28 -17
- package/dist/create-aura3d/showcase-spec-platformer-artifacts.js.map +1 -1
- package/dist/create-aura3d/showcase-spec-racing-artifacts.d.ts.map +1 -1
- package/dist/create-aura3d/showcase-spec-racing-artifacts.js +10 -5
- package/dist/create-aura3d/showcase-spec-racing-artifacts.js.map +1 -1
- package/dist/create-aura3d/showcase-spec-replacement-candidates.js +26 -0
- package/dist/create-aura3d/showcase-spec-replacement-candidates.js.map +1 -1
- package/dist/ecs/components/MeshComponent.d.ts +5 -2
- package/dist/ecs/components/MeshComponent.d.ts.map +1 -1
- package/dist/ecs/components/MeshComponent.js.map +1 -1
- package/dist/editor-runtime/CartoonSceneEditor.d.ts +111 -0
- package/dist/editor-runtime/CartoonSceneEditor.d.ts.map +1 -0
- package/dist/editor-runtime/CartoonSceneEditor.js +285 -0
- package/dist/editor-runtime/CartoonSceneEditor.js.map +1 -0
- package/dist/editor-runtime/InteractiveTransformGizmo.d.ts +142 -0
- package/dist/editor-runtime/InteractiveTransformGizmo.d.ts.map +1 -0
- package/dist/editor-runtime/InteractiveTransformGizmo.js +468 -0
- package/dist/editor-runtime/InteractiveTransformGizmo.js.map +1 -0
- package/dist/editor-runtime/index.d.ts +2 -0
- package/dist/editor-runtime/index.d.ts.map +1 -1
- package/dist/editor-runtime/index.js +1 -0
- package/dist/editor-runtime/index.js.map +1 -1
- package/dist/engine/agent-api/CartoonAssetManifest.d.ts +50 -0
- package/dist/engine/agent-api/CartoonAssetManifest.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonAssetManifest.js +65 -0
- package/dist/engine/agent-api/CartoonAssetManifest.js.map +1 -0
- package/dist/engine/agent-api/CartoonDirector.d.ts +120 -0
- package/dist/engine/agent-api/CartoonDirector.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonDirector.js +432 -0
- package/dist/engine/agent-api/CartoonDirector.js.map +1 -0
- package/dist/engine/agent-api/CartoonEpisodePackage.d.ts +51 -0
- package/dist/engine/agent-api/CartoonEpisodePackage.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonEpisodePackage.js +79 -0
- package/dist/engine/agent-api/CartoonEpisodePackage.js.map +1 -0
- package/dist/engine/agent-api/CartoonMotionQuality.d.ts +83 -0
- package/dist/engine/agent-api/CartoonMotionQuality.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonMotionQuality.js +128 -0
- package/dist/engine/agent-api/CartoonMotionQuality.js.map +1 -0
- package/dist/engine/agent-api/CartoonPerformance.d.ts +150 -0
- package/dist/engine/agent-api/CartoonPerformance.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonPerformance.js +345 -0
- package/dist/engine/agent-api/CartoonPerformance.js.map +1 -0
- package/dist/engine/agent-api/CartoonRenderQueue.d.ts +143 -0
- package/dist/engine/agent-api/CartoonRenderQueue.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonRenderQueue.js +410 -0
- package/dist/engine/agent-api/CartoonRenderQueue.js.map +1 -0
- package/dist/engine/agent-api/CartoonRouteProof.d.ts +112 -0
- package/dist/engine/agent-api/CartoonRouteProof.d.ts.map +1 -0
- package/dist/engine/agent-api/CartoonRouteProof.js +127 -0
- package/dist/engine/agent-api/CartoonRouteProof.js.map +1 -0
- package/dist/engine/agent-api/GameEvidence.d.ts +1 -0
- package/dist/engine/agent-api/GameEvidence.d.ts.map +1 -1
- package/dist/engine/agent-api/GameEvidence.js +1 -0
- package/dist/engine/agent-api/GameEvidence.js.map +1 -1
- package/dist/engine/agent-api/GameGenreKits.d.ts +13 -0
- package/dist/engine/agent-api/GameGenreKits.d.ts.map +1 -1
- package/dist/engine/agent-api/GameGenreKits.js +57 -11
- package/dist/engine/agent-api/GameGenreKits.js.map +1 -1
- package/dist/engine/agent-api/GameRuntime.d.ts +1 -0
- package/dist/engine/agent-api/GameRuntime.d.ts.map +1 -1
- package/dist/engine/agent-api/GameRuntime.js +1 -0
- package/dist/engine/agent-api/GameRuntime.js.map +1 -1
- package/dist/engine/agent-api/GameSceneGeometryBindings.d.ts +12 -0
- package/dist/engine/agent-api/GameSceneGeometryBindings.d.ts.map +1 -1
- package/dist/engine/agent-api/GameSceneGeometryBindings.js +2 -0
- package/dist/engine/agent-api/GameSceneGeometryBindings.js.map +1 -1
- package/dist/engine/agent-api/LayeredSceneComposition.d.ts +295 -0
- package/dist/engine/agent-api/LayeredSceneComposition.d.ts.map +1 -0
- package/dist/engine/agent-api/LayeredSceneComposition.js +387 -0
- package/dist/engine/agent-api/LayeredSceneComposition.js.map +1 -0
- package/dist/engine/agent-api/SceneGroundingUtils.d.ts +62 -0
- package/dist/engine/agent-api/SceneGroundingUtils.d.ts.map +1 -1
- package/dist/engine/agent-api/SceneGroundingUtils.js +37 -0
- package/dist/engine/agent-api/SceneGroundingUtils.js.map +1 -1
- package/dist/engine/agent-api/SubjectFramingUtils.d.ts +127 -0
- package/dist/engine/agent-api/SubjectFramingUtils.d.ts.map +1 -0
- package/dist/engine/agent-api/SubjectFramingUtils.js +126 -0
- package/dist/engine/agent-api/SubjectFramingUtils.js.map +1 -0
- package/dist/engine/agent-api/TouchControlBinding.d.ts +81 -0
- package/dist/engine/agent-api/TouchControlBinding.d.ts.map +1 -0
- package/dist/engine/agent-api/TouchControlBinding.js +116 -0
- package/dist/engine/agent-api/TouchControlBinding.js.map +1 -0
- package/dist/engine/agent-api/index.d.ts +39 -0
- package/dist/engine/agent-api/index.d.ts.map +1 -1
- package/dist/engine/agent-api/index.js +546 -74
- package/dist/engine/agent-api/index.js.map +1 -1
- package/dist/engine/agent-api/product-viewer-runtime.d.ts.map +1 -1
- package/dist/engine/production-runtime/GameRenderPreset.d.ts +32 -0
- package/dist/engine/production-runtime/GameRenderPreset.d.ts.map +1 -1
- package/dist/engine/production-runtime/GameRenderPreset.js +37 -2
- package/dist/engine/production-runtime/GameRenderPreset.js.map +1 -1
- package/dist/engine/production-runtime/TypedGLBActor.d.ts +8 -0
- package/dist/engine/production-runtime/TypedGLBActor.d.ts.map +1 -1
- package/dist/engine/production-runtime/TypedGLBActor.js +2 -1
- package/dist/engine/production-runtime/TypedGLBActor.js.map +1 -1
- package/dist/input/controls/PointerLockControls.d.ts +1 -1
- package/dist/input/controls/PointerLockControls.d.ts.map +1 -1
- package/dist/input/controls/PointerLockControls.js +12 -0
- package/dist/input/controls/PointerLockControls.js.map +1 -1
- package/dist/physics/Collider.d.ts +1 -1
- package/dist/physics/Collider.d.ts.map +1 -1
- package/dist/physics/Collider.js +2 -2
- package/dist/physics/Collider.js.map +1 -1
- package/dist/physics/CollisionEvents.d.ts +1 -0
- package/dist/physics/CollisionEvents.d.ts.map +1 -1
- package/dist/physics/CollisionEvents.js.map +1 -1
- package/dist/physics/NarrowPhase.d.ts +11 -0
- package/dist/physics/NarrowPhase.d.ts.map +1 -0
- package/dist/physics/NarrowPhase.js +565 -0
- package/dist/physics/NarrowPhase.js.map +1 -0
- package/dist/physics/PhysicsDebugDraw.js +19 -1
- package/dist/physics/PhysicsDebugDraw.js.map +1 -1
- package/dist/physics/PhysicsWorld.d.ts +43 -0
- package/dist/physics/PhysicsWorld.d.ts.map +1 -1
- package/dist/physics/PhysicsWorld.js +305 -30
- package/dist/physics/PhysicsWorld.js.map +1 -1
- package/dist/physics/RigidBody.d.ts +8 -1
- package/dist/physics/RigidBody.d.ts.map +1 -1
- package/dist/physics/RigidBody.js +32 -5
- package/dist/physics/RigidBody.js.map +1 -1
- package/dist/physics/Shape.d.ts +16 -2
- package/dist/physics/Shape.d.ts.map +1 -1
- package/dist/physics/Shape.js +93 -31
- package/dist/physics/Shape.js.map +1 -1
- package/dist/physics/TimeOfImpact.d.ts +15 -0
- package/dist/physics/TimeOfImpact.d.ts.map +1 -0
- package/dist/physics/TimeOfImpact.js +81 -0
- package/dist/physics/TimeOfImpact.js.map +1 -0
- package/dist/physics/index.d.ts +2 -0
- package/dist/physics/index.d.ts.map +1 -1
- package/dist/physics/index.js +2 -0
- package/dist/physics/index.js.map +1 -1
- package/dist/rendering/CascadedShadowMaps.d.ts +9 -1
- package/dist/rendering/CascadedShadowMaps.d.ts.map +1 -1
- package/dist/rendering/CascadedShadowMaps.js +68 -0
- package/dist/rendering/CascadedShadowMaps.js.map +1 -1
- package/dist/rendering/ClusteredForwardLighting.d.ts +28 -0
- package/dist/rendering/ClusteredForwardLighting.d.ts.map +1 -0
- package/dist/rendering/ClusteredForwardLighting.js +156 -0
- package/dist/rendering/ClusteredForwardLighting.js.map +1 -0
- package/dist/rendering/DepthPass.d.ts +14 -1
- package/dist/rendering/DepthPass.d.ts.map +1 -1
- package/dist/rendering/DepthPass.js +19 -4
- package/dist/rendering/DepthPass.js.map +1 -1
- package/dist/rendering/EnvironmentMapResources.d.ts +59 -1
- package/dist/rendering/EnvironmentMapResources.d.ts.map +1 -1
- package/dist/rendering/EnvironmentMapResources.js +140 -100
- package/dist/rendering/EnvironmentMapResources.js.map +1 -1
- package/dist/rendering/EnvironmentPlatform.d.ts +3 -2
- package/dist/rendering/EnvironmentPlatform.d.ts.map +1 -1
- package/dist/rendering/EnvironmentPlatform.js +99 -44
- package/dist/rendering/EnvironmentPlatform.js.map +1 -1
- package/dist/rendering/ForwardPass.d.ts +37 -0
- package/dist/rendering/ForwardPass.d.ts.map +1 -1
- package/dist/rendering/ForwardPass.js +234 -7
- package/dist/rendering/ForwardPass.js.map +1 -1
- package/dist/rendering/Geometry.d.ts +19 -0
- package/dist/rendering/Geometry.d.ts.map +1 -1
- package/dist/rendering/Geometry.js +64 -0
- package/dist/rendering/Geometry.js.map +1 -1
- package/dist/rendering/IBL.d.ts.map +1 -1
- package/dist/rendering/IBL.js +0 -1
- package/dist/rendering/IBL.js.map +1 -1
- package/dist/rendering/LightCollector.d.ts +5 -1
- package/dist/rendering/LightCollector.d.ts.map +1 -1
- package/dist/rendering/LightCollector.js +16 -3
- package/dist/rendering/LightCollector.js.map +1 -1
- package/dist/rendering/LightUniforms.d.ts +26 -1
- package/dist/rendering/LightUniforms.d.ts.map +1 -1
- package/dist/rendering/LightUniforms.js +140 -8
- package/dist/rendering/LightUniforms.js.map +1 -1
- package/dist/rendering/LightingRig.d.ts +77 -0
- package/dist/rendering/LightingRig.d.ts.map +1 -1
- package/dist/rendering/LightingRig.js +100 -11
- package/dist/rendering/LightingRig.js.map +1 -1
- package/dist/rendering/MeshConsolidation.d.ts +63 -0
- package/dist/rendering/MeshConsolidation.d.ts.map +1 -0
- package/dist/rendering/MeshConsolidation.js +251 -0
- package/dist/rendering/MeshConsolidation.js.map +1 -0
- package/dist/rendering/PMREM.d.ts +13 -1
- package/dist/rendering/PMREM.d.ts.map +1 -1
- package/dist/rendering/PMREM.js +18 -4
- package/dist/rendering/PMREM.js.map +1 -1
- package/dist/rendering/PostProcessPass.d.ts +24 -2
- package/dist/rendering/PostProcessPass.d.ts.map +1 -1
- package/dist/rendering/PostProcessPass.js +136 -18
- package/dist/rendering/PostProcessPass.js.map +1 -1
- package/dist/rendering/PrimitiveSubmissionAudit.d.ts +195 -0
- package/dist/rendering/PrimitiveSubmissionAudit.d.ts.map +1 -0
- package/dist/rendering/PrimitiveSubmissionAudit.js +280 -0
- package/dist/rendering/PrimitiveSubmissionAudit.js.map +1 -0
- package/dist/rendering/ProductTurntableFixtures.d.ts.map +1 -1
- package/dist/rendering/ProductTurntableFixtures.js +93 -13
- package/dist/rendering/ProductTurntableFixtures.js.map +1 -1
- package/dist/rendering/ReflectionProbe.d.ts +59 -0
- package/dist/rendering/ReflectionProbe.d.ts.map +1 -1
- package/dist/rendering/ReflectionProbe.js +224 -0
- package/dist/rendering/ReflectionProbe.js.map +1 -1
- package/dist/rendering/ReflectionSurfaces.d.ts +4 -2
- package/dist/rendering/ReflectionSurfaces.d.ts.map +1 -1
- package/dist/rendering/ReflectionSurfaces.js +13 -8
- package/dist/rendering/ReflectionSurfaces.js.map +1 -1
- package/dist/rendering/RenderBackend.d.ts +1 -1
- package/dist/rendering/RenderBackend.d.ts.map +1 -1
- package/dist/rendering/RenderBackend.js +5 -1
- package/dist/rendering/RenderBackend.js.map +1 -1
- package/dist/rendering/RenderDevice.d.ts +13 -2
- package/dist/rendering/RenderDevice.d.ts.map +1 -1
- package/dist/rendering/RenderDevice.js +5 -2
- package/dist/rendering/RenderDevice.js.map +1 -1
- package/dist/rendering/Renderer.d.ts +41 -1
- package/dist/rendering/Renderer.d.ts.map +1 -1
- package/dist/rendering/Renderer.js +406 -61
- package/dist/rendering/Renderer.js.map +1 -1
- package/dist/rendering/RendererPostprocessPlan.d.ts +10 -3
- package/dist/rendering/RendererPostprocessPlan.d.ts.map +1 -1
- package/dist/rendering/RendererPostprocessPlan.js +25 -5
- package/dist/rendering/RendererPostprocessPlan.js.map +1 -1
- package/dist/rendering/RendererVisualPipelineReport.d.ts +3 -2
- package/dist/rendering/RendererVisualPipelineReport.d.ts.map +1 -1
- package/dist/rendering/RendererVisualPipelineReport.js +2 -0
- package/dist/rendering/RendererVisualPipelineReport.js.map +1 -1
- package/dist/rendering/ScreenSpaceLineMaterial.d.ts +34 -0
- package/dist/rendering/ScreenSpaceLineMaterial.d.ts.map +1 -0
- package/dist/rendering/ScreenSpaceLineMaterial.js +93 -0
- package/dist/rendering/ScreenSpaceLineMaterial.js.map +1 -0
- package/dist/rendering/ShaderChunks.d.ts +7 -0
- package/dist/rendering/ShaderChunks.d.ts.map +1 -1
- package/dist/rendering/ShaderChunks.js +137 -0
- package/dist/rendering/ShaderChunks.js.map +1 -1
- package/dist/rendering/ShaderLibrary.d.ts +17 -0
- package/dist/rendering/ShaderLibrary.d.ts.map +1 -1
- package/dist/rendering/ShaderLibrary.js +940 -98
- package/dist/rendering/ShaderLibrary.js.map +1 -1
- package/dist/rendering/ShadowPass.d.ts +10 -0
- package/dist/rendering/ShadowPass.d.ts.map +1 -1
- package/dist/rendering/ShadowPass.js +8 -1
- package/dist/rendering/ShadowPass.js.map +1 -1
- package/dist/rendering/SkinnedLitMaterial.d.ts +6 -0
- package/dist/rendering/SkinnedLitMaterial.d.ts.map +1 -1
- package/dist/rendering/SkinnedLitMaterial.js +22 -8
- package/dist/rendering/SkinnedLitMaterial.js.map +1 -1
- package/dist/rendering/SkinnedUnlitMaterial.d.ts +8 -0
- package/dist/rendering/SkinnedUnlitMaterial.d.ts.map +1 -1
- package/dist/rendering/SkinnedUnlitMaterial.js +26 -9
- package/dist/rendering/SkinnedUnlitMaterial.js.map +1 -1
- package/dist/rendering/SpecularPrefilter.d.ts +42 -0
- package/dist/rendering/SpecularPrefilter.d.ts.map +1 -0
- package/dist/rendering/SpecularPrefilter.js +480 -0
- package/dist/rendering/SpecularPrefilter.js.map +1 -0
- package/dist/rendering/TerrainFixtures.d.ts +24 -0
- package/dist/rendering/TerrainFixtures.d.ts.map +1 -1
- package/dist/rendering/TerrainFixtures.js +96 -0
- package/dist/rendering/TerrainFixtures.js.map +1 -1
- package/dist/rendering/Texture.d.ts +7 -0
- package/dist/rendering/Texture.d.ts.map +1 -1
- package/dist/rendering/Texture.js +9 -0
- package/dist/rendering/Texture.js.map +1 -1
- package/dist/rendering/VertexFormat.d.ts +34 -1
- package/dist/rendering/VertexFormat.d.ts.map +1 -1
- package/dist/rendering/VertexFormat.js +61 -0
- package/dist/rendering/VertexFormat.js.map +1 -1
- package/dist/rendering/WebGL2Device.d.ts +48 -0
- package/dist/rendering/WebGL2Device.d.ts.map +1 -1
- package/dist/rendering/WebGL2Device.js +1298 -44
- package/dist/rendering/WebGL2Device.js.map +1 -1
- package/dist/rendering/WebGPUDevice.d.ts +7 -2
- package/dist/rendering/WebGPUDevice.d.ts.map +1 -1
- package/dist/rendering/WebGPUDevice.js +111 -17
- package/dist/rendering/WebGPUDevice.js.map +1 -1
- package/dist/rendering/WebGPUSkinningLimits.d.ts +14 -0
- package/dist/rendering/WebGPUSkinningLimits.d.ts.map +1 -0
- package/dist/rendering/WebGPUSkinningLimits.js +14 -0
- package/dist/rendering/WebGPUSkinningLimits.js.map +1 -0
- package/dist/rendering/cartoon/CartoonMaterialStyle.d.ts +19 -0
- package/dist/rendering/cartoon/CartoonMaterialStyle.d.ts.map +1 -0
- package/dist/rendering/cartoon/CartoonMaterialStyle.js +13 -0
- package/dist/rendering/cartoon/CartoonMaterialStyle.js.map +1 -0
- package/dist/rendering/cartoon/CartoonRenderPreset.d.ts +36 -0
- package/dist/rendering/cartoon/CartoonRenderPreset.d.ts.map +1 -0
- package/dist/rendering/cartoon/CartoonRenderPreset.js +23 -0
- package/dist/rendering/cartoon/CartoonRenderPreset.js.map +1 -0
- package/dist/rendering/cartoon/CartoonToonMaterial.d.ts +130 -0
- package/dist/rendering/cartoon/CartoonToonMaterial.d.ts.map +1 -0
- package/dist/rendering/cartoon/CartoonToonMaterial.js +303 -0
- package/dist/rendering/cartoon/CartoonToonMaterial.js.map +1 -0
- package/dist/rendering/cartoon/CartoonVisualQuality.d.ts +28 -0
- package/dist/rendering/cartoon/CartoonVisualQuality.d.ts.map +1 -0
- package/dist/rendering/cartoon/CartoonVisualQuality.js +39 -0
- package/dist/rendering/cartoon/CartoonVisualQuality.js.map +1 -0
- package/dist/rendering/cartoon/applyCartoonRenderPreset.d.ts +79 -0
- package/dist/rendering/cartoon/applyCartoonRenderPreset.d.ts.map +1 -0
- package/dist/rendering/cartoon/applyCartoonRenderPreset.js +88 -0
- package/dist/rendering/cartoon/applyCartoonRenderPreset.js.map +1 -0
- package/dist/rendering/cartoon/index.d.ts +6 -0
- package/dist/rendering/cartoon/index.d.ts.map +1 -0
- package/dist/rendering/cartoon/index.js +6 -0
- package/dist/rendering/cartoon/index.js.map +1 -0
- package/dist/rendering/index.d.ts +26 -15
- package/dist/rendering/index.d.ts.map +1 -1
- package/dist/rendering/index.js +15 -9
- package/dist/rendering/index.js.map +1 -1
- package/dist/rendering/postprocess/NativeLdrEffectLuts.d.ts +93 -0
- package/dist/rendering/postprocess/NativeLdrEffectLuts.d.ts.map +1 -0
- package/dist/rendering/postprocess/NativeLdrEffectLuts.js +202 -0
- package/dist/rendering/postprocess/NativeLdrEffectLuts.js.map +1 -0
- package/dist/rendering/production-runtime/PBRHDRPipeline.d.ts.map +1 -1
- package/dist/rendering/production-runtime/PBRHDRPipeline.js +3 -0
- package/dist/rendering/production-runtime/PBRHDRPipeline.js.map +1 -1
- package/dist/rendering/production-runtime/ProductionRendererTypes.d.ts +1 -0
- package/dist/rendering/production-runtime/ProductionRendererTypes.d.ts.map +1 -1
- package/dist/rendering/production-runtime/ProductionRendererTypes.js.map +1 -1
- package/dist/rendering/production-runtime/ProductionWebGL2Renderer.d.ts.map +1 -1
- package/dist/rendering/production-runtime/ProductionWebGL2Renderer.js +5 -3
- package/dist/rendering/production-runtime/ProductionWebGL2Renderer.js.map +1 -1
- package/dist/rendering/production-runtime/ProductionWebGPURenderer.d.ts.map +1 -1
- package/dist/rendering/production-runtime/ProductionWebGPURenderer.js +9 -5
- package/dist/rendering/production-runtime/ProductionWebGPURenderer.js.map +1 -1
- package/dist/rendering/production-runtime/TransmissionBackdropCapture.d.ts +5 -0
- package/dist/rendering/production-runtime/TransmissionBackdropCapture.d.ts.map +1 -1
- package/dist/rendering/production-runtime/TransmissionBackdropCapture.js +40 -0
- package/dist/rendering/production-runtime/TransmissionBackdropCapture.js.map +1 -1
- package/dist/rendering/production-runtime/environment/HDRLoader.d.ts +6 -0
- package/dist/rendering/production-runtime/environment/HDRLoader.d.ts.map +1 -1
- package/dist/rendering/production-runtime/environment/HDRLoader.js +19 -0
- package/dist/rendering/production-runtime/environment/HDRLoader.js.map +1 -1
- package/dist/rendering/production-runtime/index.d.ts +3 -1
- package/dist/rendering/production-runtime/index.d.ts.map +1 -1
- package/dist/rendering/production-runtime/index.js +1 -0
- package/dist/rendering/production-runtime/index.js.map +1 -1
- package/dist/scene/Light.d.ts +1 -1
- package/dist/scene/Light.d.ts.map +1 -1
- package/dist/scene/RectAreaLight.d.ts +22 -0
- package/dist/scene/RectAreaLight.d.ts.map +1 -0
- package/dist/scene/RectAreaLight.js +46 -0
- package/dist/scene/RectAreaLight.js.map +1 -0
- package/dist/scene/Scene.d.ts +6 -1
- package/dist/scene/Scene.d.ts.map +1 -1
- package/dist/scene/Scene.js +8 -1
- package/dist/scene/Scene.js.map +1 -1
- package/dist/scene/SceneSerializer.d.ts +3 -1
- package/dist/scene/SceneSerializer.d.ts.map +1 -1
- package/dist/scene/SceneSerializer.js +14 -7
- package/dist/scene/SceneSerializer.js.map +1 -1
- package/dist/scene/index.d.ts +1 -0
- package/dist/scene/index.d.ts.map +1 -1
- package/dist/scene/index.js +1 -0
- package/dist/scene/index.js.map +1 -1
- package/dist/scripting/CartoonNodeCategories.d.ts +3 -0
- package/dist/scripting/CartoonNodeCategories.d.ts.map +1 -0
- package/dist/scripting/CartoonNodeCategories.js +9 -0
- package/dist/scripting/CartoonNodeCategories.js.map +1 -0
- package/dist/scripting/CartoonVisualNodes.d.ts +3 -0
- package/dist/scripting/CartoonVisualNodes.d.ts.map +1 -0
- package/dist/scripting/CartoonVisualNodes.js +41 -0
- package/dist/scripting/CartoonVisualNodes.js.map +1 -0
- package/package.json +124 -113
- package/templates/cinematic-scene/package.json +1 -1
- package/templates/mini-game/package.json +1 -1
- package/templates/product-viewer/package.json +1 -1
- package/templates/production-asset-inspector/README.md +5 -0
- package/templates/production-asset-inspector/asset-manifest.json +9 -0
- package/templates/production-asset-inspector/index.html +2 -0
- package/templates/production-asset-inspector/package.json +17 -0
- package/templates/production-asset-inspector/src/main.ts +16 -0
- package/templates/production-material-studio/README.md +5 -0
- package/templates/production-material-studio/asset-manifest.json +9 -0
- package/templates/production-material-studio/index.html +2 -0
- package/templates/production-material-studio/package.json +17 -0
- package/templates/production-material-studio/src/main.ts +16 -0
- package/templates/production-product-configurator/README.md +5 -0
- package/templates/production-product-configurator/asset-manifest.json +9 -0
- package/templates/production-product-configurator/index.html +2 -0
- package/templates/production-product-configurator/package.json +17 -0
- package/templates/production-product-configurator/src/main.ts +16 -0
- package/templates/production-product-viewer/README.md +7 -0
- package/templates/production-product-viewer/asset-manifest.json +8 -0
- package/templates/production-product-viewer/index.html +26 -0
- package/templates/production-product-viewer/package.json +17 -0
- package/templates/production-product-viewer/src/main.ts +70 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative subject framing derived from typed asset metadata.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this exists
|
|
5
|
+
*
|
|
6
|
+
* Route code kept encoding *specific assets* into visual constants. Turbo's chase camera height was
|
|
7
|
+
* `0.46`, justified in a comment that recited one asset's bounds ("176.35 units tall over a 377.94
|
|
8
|
+
* longest axis"). Its `CAR_SCENE_HEIGHT` was worse: hardcoded to `2.209 / 6.958`, the bounds of a hero
|
|
9
|
+
* asset that had already been replaced twice, so every swap silently mis-seated the new car.
|
|
10
|
+
*
|
|
11
|
+
* The failure mode is structural, not careless. A number that is *correct* for one asset looks like a
|
|
12
|
+
* tuned design constant, so it survives review and survives asset swaps. The only durable fix is for
|
|
13
|
+
* routes to declare **intent** -- "frame a rear chase view where the subject occupies 25-40% of frame
|
|
14
|
+
* height and the lower silhouette stays visible" -- and let reusable code derive the numbers from the
|
|
15
|
+
* typed manifest.
|
|
16
|
+
*
|
|
17
|
+
* These helpers are pure and dependency-free so they can be unit tested against synthetic bounds and
|
|
18
|
+
* reused by any genre. They deliberately do **not** know about racing, platformers, or any route.
|
|
19
|
+
*/
|
|
20
|
+
import { type SceneAssetLike, type SceneBounds } from "./SceneGroundingUtils.js";
|
|
21
|
+
/** Rendered dimensions of a subject after the renderer's fit scale is applied. */
|
|
22
|
+
export interface SubjectRenderedSize {
|
|
23
|
+
/** Rendered extent along each axis, in world units. */
|
|
24
|
+
readonly size: readonly [number, number, number];
|
|
25
|
+
/** Rendered height (Y extent). */
|
|
26
|
+
readonly height: number;
|
|
27
|
+
/** Rendered longest axis. */
|
|
28
|
+
readonly maxDimension: number;
|
|
29
|
+
/** Rendered extent along the subject's longitudinal (longest horizontal) axis. */
|
|
30
|
+
readonly length: number;
|
|
31
|
+
/** Uniform scale the renderer applies to reach the requested fit. */
|
|
32
|
+
readonly fitScale: number;
|
|
33
|
+
}
|
|
34
|
+
export interface SubjectFitRequest {
|
|
35
|
+
/** Fit the subject's height to this world-unit value. */
|
|
36
|
+
readonly targetHeight?: number | undefined;
|
|
37
|
+
/** Fit the subject's longest axis to this world-unit value. */
|
|
38
|
+
readonly targetMaxDimension?: number | undefined;
|
|
39
|
+
/** Fit the subject's longitudinal (longest horizontal) axis to this world-unit value. */
|
|
40
|
+
readonly targetLength?: number | undefined;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Resolve what a subject actually measures once fit, straight from typed bounds.
|
|
44
|
+
*
|
|
45
|
+
* This replaces the `CAR_TARGET_MAX_DIMENSION * (BOUNDS_Y / BOUNDS_LONGEST)` arithmetic that routes
|
|
46
|
+
* were open-coding, and which is exactly where the stale-literal defect lived.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveSubjectRenderedSize(asset: SceneAssetLike, request: SubjectFitRequest): SubjectRenderedSize;
|
|
49
|
+
/** Bounds-level form of {@link resolveSubjectRenderedSize}, for fixtures and tests. */
|
|
50
|
+
export declare function resolveSubjectRenderedSizeFromBounds(bounds: SceneBounds, request: SubjectFitRequest): SubjectRenderedSize;
|
|
51
|
+
/**
|
|
52
|
+
* A route's framing *intent*, expressed without reference to any asset's dimensions.
|
|
53
|
+
*
|
|
54
|
+
* `subjectVerticalOccupancy` is the contract that matters: it states how much of the frame's height
|
|
55
|
+
* the subject should fill. Everything else (camera height, distance) is derived to satisfy it.
|
|
56
|
+
*/
|
|
57
|
+
export interface ChaseFramingIntent extends SubjectFitRequest {
|
|
58
|
+
/** Vertical fraction of the frame the subject should occupy, as `[min, max]`. */
|
|
59
|
+
readonly subjectVerticalOccupancy: readonly [number, number];
|
|
60
|
+
/** Vertical field of view in degrees. */
|
|
61
|
+
readonly fov: number;
|
|
62
|
+
/**
|
|
63
|
+
* Fraction of the subject's height the camera should sit at, measured from its contact plane.
|
|
64
|
+
*
|
|
65
|
+
* Expressed as a fraction rather than a world-unit height precisely so it survives asset swaps.
|
|
66
|
+
* The default 0.9 places the eye just above the subject's mid-height: high enough to see the ground
|
|
67
|
+
* ahead, low enough that the subject's own roof line does not occlude its lower silhouette.
|
|
68
|
+
*/
|
|
69
|
+
readonly eyeHeightFraction?: number | undefined;
|
|
70
|
+
/**
|
|
71
|
+
* Require the lowest `lowerSilhouetteFraction` of the subject to remain unoccluded by its own upper
|
|
72
|
+
* body, which is what makes wheels, feet, or landing gear readable.
|
|
73
|
+
*/
|
|
74
|
+
readonly lowerSilhouetteFraction?: number | undefined;
|
|
75
|
+
/**
|
|
76
|
+
* Require the subject's lower side features (wheels, feet) to be readable from this framing.
|
|
77
|
+
*
|
|
78
|
+
* A dead-astern or dead-ahead chase view cannot show them: the subject's own bodywork occludes its
|
|
79
|
+
* lower flanks by construction. This was learned the hard way — a hero car's tyres were reported as
|
|
80
|
+
* "not rendering" when in fact the renderer drew all of them and the camera was simply looking down
|
|
81
|
+
* the one axis where they cannot appear.
|
|
82
|
+
*
|
|
83
|
+
* When set, `resolveChaseFraming` derives a lateral offset large enough to bring the flank into view.
|
|
84
|
+
*/
|
|
85
|
+
readonly requireLowerSideFeatureVisibility?: boolean | undefined;
|
|
86
|
+
}
|
|
87
|
+
export interface ChaseFraming {
|
|
88
|
+
/** Camera height above the subject's contact plane. */
|
|
89
|
+
readonly height: number;
|
|
90
|
+
/** Camera distance behind the subject. */
|
|
91
|
+
readonly distance: number;
|
|
92
|
+
/**
|
|
93
|
+
* Lateral camera offset. Non-zero only when `requireLowerSideFeatureVisibility` is set.
|
|
94
|
+
*
|
|
95
|
+
* Derived from the subject's own half-width so it scales with the asset instead of being tuned: a
|
|
96
|
+
* fixed offset that reveals a small car's wheels is far too small for a truck.
|
|
97
|
+
*/
|
|
98
|
+
readonly sideOffset: number;
|
|
99
|
+
/**
|
|
100
|
+
* True when this framing can actually show the subject's lower side features.
|
|
101
|
+
*
|
|
102
|
+
* A caller must not claim wheels or feet are visible from a framing where this is false, however
|
|
103
|
+
* correct the grounding is.
|
|
104
|
+
*/
|
|
105
|
+
readonly lowerSideFeaturesReadable: boolean;
|
|
106
|
+
/** Rendered subject measurements this framing was derived from. */
|
|
107
|
+
readonly subject: SubjectRenderedSize;
|
|
108
|
+
/** Predicted fraction of frame height the subject occupies at this distance. */
|
|
109
|
+
readonly predictedVerticalOccupancy: number;
|
|
110
|
+
/** World-space Y band, relative to the contact plane, that must stay readable. */
|
|
111
|
+
readonly lowerSilhouetteBand: readonly [number, number];
|
|
112
|
+
/** True when the predicted occupancy falls inside the requested range. */
|
|
113
|
+
readonly withinRequestedOccupancy: boolean;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Derive a chase camera from framing intent plus typed asset bounds.
|
|
117
|
+
*
|
|
118
|
+
* The distance is solved from the occupancy contract rather than tuned: at vertical FOV `f` and
|
|
119
|
+
* distance `d`, a subject of rendered height `h` occupies `h / (2 * d * tan(f/2))` of the frame.
|
|
120
|
+
* Solving for the midpoint of the requested occupancy range gives the distance directly, so a new
|
|
121
|
+
* asset with different proportions produces a different distance automatically and the route never
|
|
122
|
+
* restates a dimension.
|
|
123
|
+
*/
|
|
124
|
+
export declare function resolveChaseFraming(asset: SceneAssetLike, intent: ChaseFramingIntent): ChaseFraming;
|
|
125
|
+
/** Bounds-level form of {@link resolveChaseFraming}, for fixtures and tests. */
|
|
126
|
+
export declare function resolveChaseFramingFromBounds(bounds: SceneBounds, intent: ChaseFramingIntent): ChaseFraming;
|
|
127
|
+
//# sourceMappingURL=SubjectFramingUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubjectFramingUtils.d.ts","sourceRoot":"","sources":["../../../../../packages/engine/src/agent-api/SubjectFramingUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAKL,KAAK,cAAc,EACnB,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAElC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;;;;;;;;;OASG;IACH,QAAQ,CAAC,iCAAiC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAClE;AAED,MAAM,WAAW,YAAY;IAC3B,uDAAuD;IACvD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,yBAAyB,EAAE,OAAO,CAAC;IAC5C,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC,gFAAgF;IAChF,QAAQ,CAAC,0BAA0B,EAAE,MAAM,CAAC;IAC5C,kFAAkF;IAClF,QAAQ,CAAC,mBAAmB,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxD,0EAA0E;IAC1E,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAC;CAC5C;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,kBAAkB,GAAG,YAAY,CAEnG;AAED,gFAAgF;AAChF,wBAAgB,6BAA6B,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,GAAG,YAAY,CA+C3G"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Declarative subject framing derived from typed asset metadata.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this exists
|
|
5
|
+
*
|
|
6
|
+
* Route code kept encoding *specific assets* into visual constants. Turbo's chase camera height was
|
|
7
|
+
* `0.46`, justified in a comment that recited one asset's bounds ("176.35 units tall over a 377.94
|
|
8
|
+
* longest axis"). Its `CAR_SCENE_HEIGHT` was worse: hardcoded to `2.209 / 6.958`, the bounds of a hero
|
|
9
|
+
* asset that had already been replaced twice, so every swap silently mis-seated the new car.
|
|
10
|
+
*
|
|
11
|
+
* The failure mode is structural, not careless. A number that is *correct* for one asset looks like a
|
|
12
|
+
* tuned design constant, so it survives review and survives asset swaps. The only durable fix is for
|
|
13
|
+
* routes to declare **intent** -- "frame a rear chase view where the subject occupies 25-40% of frame
|
|
14
|
+
* height and the lower silhouette stays visible" -- and let reusable code derive the numbers from the
|
|
15
|
+
* typed manifest.
|
|
16
|
+
*
|
|
17
|
+
* These helpers are pure and dependency-free so they can be unit tested against synthetic bounds and
|
|
18
|
+
* reused by any genre. They deliberately do **not** know about racing, platformers, or any route.
|
|
19
|
+
*/
|
|
20
|
+
import { boundsFromAsset, boundsHeight, boundsMaxDimension, boundsSize } from "./SceneGroundingUtils.js";
|
|
21
|
+
/**
|
|
22
|
+
* Resolve what a subject actually measures once fit, straight from typed bounds.
|
|
23
|
+
*
|
|
24
|
+
* This replaces the `CAR_TARGET_MAX_DIMENSION * (BOUNDS_Y / BOUNDS_LONGEST)` arithmetic that routes
|
|
25
|
+
* were open-coding, and which is exactly where the stale-literal defect lived.
|
|
26
|
+
*/
|
|
27
|
+
export function resolveSubjectRenderedSize(asset, request) {
|
|
28
|
+
const bounds = boundsFromAsset(asset);
|
|
29
|
+
return resolveSubjectRenderedSizeFromBounds(bounds, request);
|
|
30
|
+
}
|
|
31
|
+
/** Bounds-level form of {@link resolveSubjectRenderedSize}, for fixtures and tests. */
|
|
32
|
+
export function resolveSubjectRenderedSizeFromBounds(bounds, request) {
|
|
33
|
+
const rawSize = boundsSize(bounds);
|
|
34
|
+
const rawHeight = boundsHeight(bounds);
|
|
35
|
+
const rawMaxDimension = boundsMaxDimension(bounds);
|
|
36
|
+
const rawLength = Math.max(rawSize[0], rawSize[2]);
|
|
37
|
+
const fitScale = resolveSubjectFitScale({ height: rawHeight, maxDimension: rawMaxDimension, length: rawLength }, request);
|
|
38
|
+
return {
|
|
39
|
+
size: [rawSize[0] * fitScale, rawSize[1] * fitScale, rawSize[2] * fitScale],
|
|
40
|
+
height: rawHeight * fitScale,
|
|
41
|
+
maxDimension: rawMaxDimension * fitScale,
|
|
42
|
+
length: rawLength * fitScale,
|
|
43
|
+
fitScale
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
function resolveSubjectFitScale(raw, request) {
|
|
47
|
+
if (isPositive(request.targetHeight) && raw.height > 0)
|
|
48
|
+
return request.targetHeight / raw.height;
|
|
49
|
+
if (isPositive(request.targetLength) && raw.length > 0)
|
|
50
|
+
return request.targetLength / raw.length;
|
|
51
|
+
if (isPositive(request.targetMaxDimension) && raw.maxDimension > 0)
|
|
52
|
+
return request.targetMaxDimension / raw.maxDimension;
|
|
53
|
+
return 1;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Derive a chase camera from framing intent plus typed asset bounds.
|
|
57
|
+
*
|
|
58
|
+
* The distance is solved from the occupancy contract rather than tuned: at vertical FOV `f` and
|
|
59
|
+
* distance `d`, a subject of rendered height `h` occupies `h / (2 * d * tan(f/2))` of the frame.
|
|
60
|
+
* Solving for the midpoint of the requested occupancy range gives the distance directly, so a new
|
|
61
|
+
* asset with different proportions produces a different distance automatically and the route never
|
|
62
|
+
* restates a dimension.
|
|
63
|
+
*/
|
|
64
|
+
export function resolveChaseFraming(asset, intent) {
|
|
65
|
+
return resolveChaseFramingFromBounds(boundsFromAsset(asset), intent);
|
|
66
|
+
}
|
|
67
|
+
/** Bounds-level form of {@link resolveChaseFraming}, for fixtures and tests. */
|
|
68
|
+
export function resolveChaseFramingFromBounds(bounds, intent) {
|
|
69
|
+
const subject = resolveSubjectRenderedSizeFromBounds(bounds, intent);
|
|
70
|
+
const [minOccupancy, maxOccupancy] = normalizeOccupancy(intent.subjectVerticalOccupancy);
|
|
71
|
+
const targetOccupancy = (minOccupancy + maxOccupancy) / 2;
|
|
72
|
+
const fovRadians = clamp(intent.fov, 1, 170) * Math.PI / 180;
|
|
73
|
+
const halfFovTangent = Math.tan(fovRadians / 2);
|
|
74
|
+
// Solve d from occupancy = height / (2 * d * tan(fov/2)).
|
|
75
|
+
const distance = subject.height > 0 && targetOccupancy > 0 && halfFovTangent > 0
|
|
76
|
+
? subject.height / (2 * targetOccupancy * halfFovTangent)
|
|
77
|
+
: Math.max(subject.maxDimension, 0.001) * 2;
|
|
78
|
+
const eyeHeightFraction = intent.eyeHeightFraction ?? 0.9;
|
|
79
|
+
const height = subject.height * eyeHeightFraction;
|
|
80
|
+
const lowerFraction = clamp(intent.lowerSilhouetteFraction ?? 0.3, 0, 1);
|
|
81
|
+
const predictedVerticalOccupancy = distance > 0 && halfFovTangent > 0
|
|
82
|
+
? subject.height / (2 * distance * halfFovTangent)
|
|
83
|
+
: 0;
|
|
84
|
+
/*
|
|
85
|
+
* Lateral offset needed to bring the subject's flank into view.
|
|
86
|
+
*
|
|
87
|
+
* At offset `s` and distance `d` the view direction is rotated by `atan(s/d)` off-axis. Bringing a
|
|
88
|
+
* flank into view needs enough rotation that the near-side lower body is no longer occluded by the
|
|
89
|
+
* subject's own width; `0.45 * halfWidth / distance`-scaled offset yields roughly 12-20 degrees for
|
|
90
|
+
* typical chase distances, which is the range where a car's near wheels read without the frame
|
|
91
|
+
* becoming a side-on beauty shot.
|
|
92
|
+
*/
|
|
93
|
+
// The *narrower* horizontal axis is the subject's width; the wider one is its length. A chase camera
|
|
94
|
+
// steps sideways relative to width, so using the longest axis here would overshoot badly on a long car.
|
|
95
|
+
const halfWidth = Math.min(subject.size[0], subject.size[2]) / 2;
|
|
96
|
+
const sideOffset = intent.requireLowerSideFeatureVisibility ? halfWidth * 3.2 : 0;
|
|
97
|
+
const offAxisRadians = distance > 0 ? Math.atan(sideOffset / distance) : 0;
|
|
98
|
+
return {
|
|
99
|
+
height: round4(height),
|
|
100
|
+
distance: round4(distance),
|
|
101
|
+
sideOffset: round4(sideOffset),
|
|
102
|
+
// Below ~8 degrees off-axis the subject's own body still hides its lower flank.
|
|
103
|
+
lowerSideFeaturesReadable: offAxisRadians >= 0.14,
|
|
104
|
+
subject,
|
|
105
|
+
predictedVerticalOccupancy: round4(predictedVerticalOccupancy),
|
|
106
|
+
lowerSilhouetteBand: [0, round4(subject.height * lowerFraction)],
|
|
107
|
+
withinRequestedOccupancy: predictedVerticalOccupancy >= minOccupancy - 1e-6 &&
|
|
108
|
+
predictedVerticalOccupancy <= maxOccupancy + 1e-6
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function normalizeOccupancy(range) {
|
|
112
|
+
const low = Math.min(range[0], range[1]);
|
|
113
|
+
const high = Math.max(range[0], range[1]);
|
|
114
|
+
return [clamp(low, 0.001, 1), clamp(high, 0.001, 1)];
|
|
115
|
+
}
|
|
116
|
+
function clamp(value, low, high) {
|
|
117
|
+
return Math.min(high, Math.max(low, value));
|
|
118
|
+
}
|
|
119
|
+
function round4(value) {
|
|
120
|
+
const rounded = Math.round(value * 10_000) / 10_000;
|
|
121
|
+
return rounded === 0 ? 0 : rounded;
|
|
122
|
+
}
|
|
123
|
+
function isPositive(value) {
|
|
124
|
+
return typeof value === "number" && Number.isFinite(value) && value > 0;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=SubjectFramingUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SubjectFramingUtils.js","sourceRoot":"","sources":["../../../../../packages/engine/src/agent-api/SubjectFramingUtils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,eAAe,EACf,YAAY,EACZ,kBAAkB,EAClB,UAAU,EAGX,MAAM,0BAA0B,CAAC;AAyBlC;;;;;GAKG;AACH,MAAM,UAAU,0BAA0B,CAAC,KAAqB,EAAE,OAA0B;IAC1F,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IACtC,OAAO,oCAAoC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAC/D,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,oCAAoC,CAAC,MAAmB,EAAE,OAA0B;IAClG,MAAM,OAAO,GAAG,UAAU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,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC1C,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAED,SAAS,KAAK,CAAC,KAAa,EAAE,GAAW,EAAE,IAAY;IACrD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;IACpD,OAAO,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;AACrC,CAAC;AAED,SAAS,UAAU,CAAC,KAAyB;IAC3C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable touch/pointer bindings for on-screen game controls.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this is in the reusable layer
|
|
5
|
+
*
|
|
6
|
+
* The replicability metric's repeated-cluster detector (added in defect 113) found this code duplicated
|
|
7
|
+
* **byte-for-byte** between Skyline Runner and Turbo Drift Circuit: a `bindHoldControl` that translates
|
|
8
|
+
* pointer press/release into synthetic keyboard events, plus a `pulseKey` for momentary buttons. Two routes
|
|
9
|
+
* had independently authored the same 13 lines, and a third would have copied them again.
|
|
10
|
+
*
|
|
11
|
+
* That is precisely the duplication the brief asks the metric to surface and the reusable layer to absorb.
|
|
12
|
+
* Every public game route needs on-screen controls -- the route-primary probe gates
|
|
13
|
+
* `interactive-controls-outside-viewport` -- so this is genre-independent infrastructure, not art direction.
|
|
14
|
+
*
|
|
15
|
+
* ## Why synthetic keyboard events rather than a direct input API
|
|
16
|
+
*
|
|
17
|
+
* The routes already own a keyboard action map (`game.input({ actions: ... })`) that is the single source of
|
|
18
|
+
* truth for what a key does. Dispatching real `KeyboardEvent`s means a touch press and a physical key press
|
|
19
|
+
* travel the *same* path, so the gameplay proof that keyboard input changes state also covers the buttons.
|
|
20
|
+
* A parallel input path would need its own proof and could drift from the keyboard behaviour.
|
|
21
|
+
*
|
|
22
|
+
* Bindings are additive and idempotent per element: re-binding the same id replaces its listeners rather than
|
|
23
|
+
* stacking them, because a route that re-runs setup after a reset would otherwise fire one keydown per bind.
|
|
24
|
+
*/
|
|
25
|
+
/** A control that holds its key down while pressed, e.g. throttle or move-left. */
|
|
26
|
+
export interface HoldControlBinding {
|
|
27
|
+
/** DOM id of the button element. Missing elements are skipped, not thrown on. */
|
|
28
|
+
readonly elementId: string;
|
|
29
|
+
/** `KeyboardEvent.code` to synthesise, e.g. `"KeyA"`. */
|
|
30
|
+
readonly code: string;
|
|
31
|
+
}
|
|
32
|
+
/** A control that fires one press-and-release, e.g. jump or reset. */
|
|
33
|
+
export interface PulseControlBinding extends HoldControlBinding {
|
|
34
|
+
/** Milliseconds the synthetic key stays down. Defaults to 40ms. */
|
|
35
|
+
readonly holdMs?: number | undefined;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Minimal DOM surface this module needs.
|
|
39
|
+
*
|
|
40
|
+
* Declared structurally so the module is testable without a DOM environment. This repository runs its unit
|
|
41
|
+
* suite in plain Node with no `jsdom`, which is a deliberate convention: browser behaviour is proven in
|
|
42
|
+
* Playwright against a real browser, not against a DOM emulator. Accepting an injectable host keeps the
|
|
43
|
+
* *binding logic* -- press/release pairing, idempotence, teardown -- under fast unit coverage without
|
|
44
|
+
* pretending a shim is a browser.
|
|
45
|
+
*/
|
|
46
|
+
export interface TouchControlHost {
|
|
47
|
+
getElementById(id: string): TouchControlElement | null;
|
|
48
|
+
dispatchKey(code: string, type: "keydown" | "keyup"): void;
|
|
49
|
+
setTimer(callback: () => void, delayMs: number): unknown;
|
|
50
|
+
clearTimer(handle: unknown): void;
|
|
51
|
+
}
|
|
52
|
+
/** The element operations a control binding performs. */
|
|
53
|
+
export interface TouchControlElement {
|
|
54
|
+
addEventListener(type: string, listener: () => void): void;
|
|
55
|
+
removeEventListener(type: string, listener: () => void): void;
|
|
56
|
+
}
|
|
57
|
+
export interface GameControlBindingSpec {
|
|
58
|
+
readonly hold?: readonly HoldControlBinding[] | undefined;
|
|
59
|
+
readonly pulse?: readonly PulseControlBinding[] | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Override the DOM/timer host. Defaults to `window`/`document`, so routes pass nothing.
|
|
62
|
+
* Exists for unit coverage of the binding logic; see `TouchControlHost`.
|
|
63
|
+
*/
|
|
64
|
+
readonly host?: TouchControlHost | undefined;
|
|
65
|
+
}
|
|
66
|
+
export interface GameControlBindingResult {
|
|
67
|
+
/** Element ids that were found and bound. */
|
|
68
|
+
readonly bound: readonly string[];
|
|
69
|
+
/** Element ids named in the spec but absent from the DOM, so a typo is visible rather than silent. */
|
|
70
|
+
readonly missing: readonly string[];
|
|
71
|
+
/** Remove every listener this call attached. */
|
|
72
|
+
dispose(): void;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Bind on-screen controls to synthetic keyboard events.
|
|
76
|
+
*
|
|
77
|
+
* Returns which ids were bound and which were missing, so a route can assert its own control contract
|
|
78
|
+
* instead of discovering a typo through a failing probe.
|
|
79
|
+
*/
|
|
80
|
+
export declare function bindGameTouchControls(spec: GameControlBindingSpec): GameControlBindingResult;
|
|
81
|
+
//# sourceMappingURL=TouchControlBinding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TouchControlBinding.d.ts","sourceRoot":"","sources":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;AAED,MAAM,WAAW,wBAAwB;IACvC,6CAA6C;IAC7C,QAAQ,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,sGAAsG;IACtG,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;IACpC,gDAAgD;IAChD,OAAO,IAAI,IAAI,CAAC;CACjB;AAeD;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,sBAAsB,GAAG,wBAAwB,CAyE5F"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reusable touch/pointer bindings for on-screen game controls.
|
|
3
|
+
*
|
|
4
|
+
* ## Why this is in the reusable layer
|
|
5
|
+
*
|
|
6
|
+
* The replicability metric's repeated-cluster detector (added in defect 113) found this code duplicated
|
|
7
|
+
* **byte-for-byte** between Skyline Runner and Turbo Drift Circuit: a `bindHoldControl` that translates
|
|
8
|
+
* pointer press/release into synthetic keyboard events, plus a `pulseKey` for momentary buttons. Two routes
|
|
9
|
+
* had independently authored the same 13 lines, and a third would have copied them again.
|
|
10
|
+
*
|
|
11
|
+
* That is precisely the duplication the brief asks the metric to surface and the reusable layer to absorb.
|
|
12
|
+
* Every public game route needs on-screen controls -- the route-primary probe gates
|
|
13
|
+
* `interactive-controls-outside-viewport` -- so this is genre-independent infrastructure, not art direction.
|
|
14
|
+
*
|
|
15
|
+
* ## Why synthetic keyboard events rather than a direct input API
|
|
16
|
+
*
|
|
17
|
+
* The routes already own a keyboard action map (`game.input({ actions: ... })`) that is the single source of
|
|
18
|
+
* truth for what a key does. Dispatching real `KeyboardEvent`s means a touch press and a physical key press
|
|
19
|
+
* travel the *same* path, so the gameplay proof that keyboard input changes state also covers the buttons.
|
|
20
|
+
* A parallel input path would need its own proof and could drift from the keyboard behaviour.
|
|
21
|
+
*
|
|
22
|
+
* Bindings are additive and idempotent per element: re-binding the same id replaces its listeners rather than
|
|
23
|
+
* stacking them, because a route that re-runs setup after a reset would otherwise fire one keydown per bind.
|
|
24
|
+
*/
|
|
25
|
+
/** Tracks attached listeners per element id so a re-bind replaces rather than stacks. */
|
|
26
|
+
const attached = new Map();
|
|
27
|
+
/** The real browser host: synthetic keyboard events on `window`, elements from `document`. */
|
|
28
|
+
function browserHost() {
|
|
29
|
+
return {
|
|
30
|
+
getElementById: (id) => (typeof document === "undefined" ? null : document.getElementById(id)),
|
|
31
|
+
dispatchKey: (code, type) => window.dispatchEvent(new KeyboardEvent(type, { code, bubbles: true })),
|
|
32
|
+
setTimer: (callback, delayMs) => setTimeout(callback, delayMs),
|
|
33
|
+
clearTimer: (handle) => clearTimeout(handle)
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Bind on-screen controls to synthetic keyboard events.
|
|
38
|
+
*
|
|
39
|
+
* Returns which ids were bound and which were missing, so a route can assert its own control contract
|
|
40
|
+
* instead of discovering a typo through a failing probe.
|
|
41
|
+
*/
|
|
42
|
+
export function bindGameTouchControls(spec) {
|
|
43
|
+
const host = spec.host ?? browserHost();
|
|
44
|
+
const bound = [];
|
|
45
|
+
const missing = [];
|
|
46
|
+
const teardown = [];
|
|
47
|
+
const claim = (elementId) => {
|
|
48
|
+
const element = host.getElementById(elementId);
|
|
49
|
+
if (!element) {
|
|
50
|
+
missing.push(elementId);
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
// Replace any previous binding for this id; see the note on idempotence above.
|
|
54
|
+
attached.get(elementId)?.();
|
|
55
|
+
bound.push(elementId);
|
|
56
|
+
return element;
|
|
57
|
+
};
|
|
58
|
+
for (const control of spec.hold ?? []) {
|
|
59
|
+
const element = claim(control.elementId);
|
|
60
|
+
if (!element)
|
|
61
|
+
continue;
|
|
62
|
+
const press = () => host.dispatchKey(control.code, "keydown");
|
|
63
|
+
const release = () => host.dispatchKey(control.code, "keyup");
|
|
64
|
+
element.addEventListener("pointerdown", press);
|
|
65
|
+
element.addEventListener("pointerup", release);
|
|
66
|
+
// `pointercancel` and `pointerleave` both matter: a finger sliding off a button must not latch the key on.
|
|
67
|
+
element.addEventListener("pointercancel", release);
|
|
68
|
+
element.addEventListener("pointerleave", release);
|
|
69
|
+
const remove = () => {
|
|
70
|
+
element.removeEventListener("pointerdown", press);
|
|
71
|
+
element.removeEventListener("pointerup", release);
|
|
72
|
+
element.removeEventListener("pointercancel", release);
|
|
73
|
+
element.removeEventListener("pointerleave", release);
|
|
74
|
+
// Release on teardown, so disposing mid-press cannot leave the key stuck down.
|
|
75
|
+
release();
|
|
76
|
+
attached.delete(control.elementId);
|
|
77
|
+
};
|
|
78
|
+
attached.set(control.elementId, remove);
|
|
79
|
+
teardown.push(remove);
|
|
80
|
+
}
|
|
81
|
+
for (const control of spec.pulse ?? []) {
|
|
82
|
+
const element = claim(control.elementId);
|
|
83
|
+
if (!element)
|
|
84
|
+
continue;
|
|
85
|
+
const holdMs = Math.max(1, control.holdMs ?? 40);
|
|
86
|
+
const timers = new Set();
|
|
87
|
+
const press = () => {
|
|
88
|
+
host.dispatchKey(control.code, "keydown");
|
|
89
|
+
const timer = host.setTimer(() => {
|
|
90
|
+
timers.delete(timer);
|
|
91
|
+
host.dispatchKey(control.code, "keyup");
|
|
92
|
+
}, holdMs);
|
|
93
|
+
timers.add(timer);
|
|
94
|
+
};
|
|
95
|
+
element.addEventListener("click", press);
|
|
96
|
+
const remove = () => {
|
|
97
|
+
element.removeEventListener("click", press);
|
|
98
|
+
// Clear pending release timers, or a disposed control can still dispatch after teardown.
|
|
99
|
+
for (const timer of timers)
|
|
100
|
+
host.clearTimer(timer);
|
|
101
|
+
timers.clear();
|
|
102
|
+
attached.delete(control.elementId);
|
|
103
|
+
};
|
|
104
|
+
attached.set(control.elementId, remove);
|
|
105
|
+
teardown.push(remove);
|
|
106
|
+
}
|
|
107
|
+
return {
|
|
108
|
+
bound,
|
|
109
|
+
missing,
|
|
110
|
+
dispose: () => {
|
|
111
|
+
for (const remove of teardown)
|
|
112
|
+
remove();
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=TouchControlBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TouchControlBinding.js","sourceRoot":"","sources":["../../../../../packages/engine/src/agent-api/TouchControlBinding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAyDH,yFAAyF;AACzF,MAAM,QAAQ,GAAG,IAAI,GAAG,EAAsB,CAAC;AAE/C,8FAA8F;AAC9F,SAAS,WAAW;IAClB,OAAO;QACL,cAAc,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,QAAQ,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC;QAC9F,WAAW,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,aAAa,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACnG,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,OAAO,CAAC;QAC9D,UAAU,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAuC,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAA4B;IAChE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,WAAW,EAAE,CAAC;IACxC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,MAAM,QAAQ,GAAmB,EAAE,CAAC;IAEpC,MAAM,KAAK,GAAG,CAAC,SAAiB,EAAmC,EAAE;QACnE,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,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C,CAAC;YACnD,MAAM,CAAC,KAAK,EAAE,CAAC;YACf,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QACrC,CAAC,CAAC;QACF,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QACxC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACxB,CAAC;IAED,OAAO;QACL,KAAK;QACL,OAAO;QACP,OAAO,EAAE,GAAG,EAAE;YACZ,KAAK,MAAM,MAAM,IAAI,QAAQ;gBAAE,MAAM,EAAE,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -33,6 +33,9 @@ export * from "./CloudRenderAdapter.js";
|
|
|
33
33
|
export * from "./BatchEpisodeRenderer.js";
|
|
34
34
|
export * from "./AnimationAssetManifest.js";
|
|
35
35
|
export * from "./SceneGroundingUtils.js";
|
|
36
|
+
export * from "./SubjectFramingUtils.js";
|
|
37
|
+
export * from "./LayeredSceneComposition.js";
|
|
38
|
+
export * from "./TouchControlBinding.js";
|
|
36
39
|
export * from "./AssetLibraryBrowser.js";
|
|
37
40
|
export * from "./DialogueAlignment.js";
|
|
38
41
|
export * from "./PerformancePoseEditor.js";
|
|
@@ -104,6 +107,9 @@ export * from "./AnimationPerformance.js";
|
|
|
104
107
|
export * from "./AnimationRenderQueue.js";
|
|
105
108
|
export * from "./AnimationAssetManifest.js";
|
|
106
109
|
export * from "./SceneGroundingUtils.js";
|
|
110
|
+
export * from "./SubjectFramingUtils.js";
|
|
111
|
+
export * from "./LayeredSceneComposition.js";
|
|
112
|
+
export * from "./TouchControlBinding.js";
|
|
107
113
|
export * from "./AssetLibraryBrowser.js";
|
|
108
114
|
export type AuraVec3 = readonly [number, number, number];
|
|
109
115
|
export type AuraColor = `#${string}` | string;
|
|
@@ -607,7 +613,18 @@ export interface AuraRendererDiagnosticReport {
|
|
|
607
613
|
readonly antiBlowout: boolean;
|
|
608
614
|
};
|
|
609
615
|
readonly shadows: {
|
|
616
|
+
/** True only when a mounted runtime actually sampled a shadow map. */
|
|
610
617
|
readonly enabled: boolean;
|
|
618
|
+
/** The scene asked for shadows: a shadow-casting light was collected. */
|
|
619
|
+
readonly requested: boolean;
|
|
620
|
+
/** A shadow depth target was allocated and rendered by the device. */
|
|
621
|
+
readonly mapRendered: boolean;
|
|
622
|
+
/** A shader actually bound and sampled the shadow map. */
|
|
623
|
+
readonly mapSampled: boolean;
|
|
624
|
+
readonly mapSize?: number;
|
|
625
|
+
readonly label?: string;
|
|
626
|
+
readonly nativeShadowMapBindings: number;
|
|
627
|
+
readonly shadowRenderTargetsAllocated: number;
|
|
611
628
|
readonly contactShadows: number;
|
|
612
629
|
readonly mapType: "pcf-soft";
|
|
613
630
|
};
|
|
@@ -1618,6 +1635,7 @@ export interface AuraPlatformerPresentationSurfaceOptions {
|
|
|
1618
1635
|
readonly guideVisibility?: "public" | "evidence" | "full";
|
|
1619
1636
|
readonly platformColor?: AuraColor;
|
|
1620
1637
|
readonly platformTrimColor?: AuraColor;
|
|
1638
|
+
readonly checkpointColor?: AuraColor;
|
|
1621
1639
|
readonly hazardColor?: AuraColor;
|
|
1622
1640
|
readonly collectibleColor?: AuraColor;
|
|
1623
1641
|
readonly finishColor?: AuraColor;
|
|
@@ -2469,4 +2487,25 @@ export declare const performance: {
|
|
|
2469
2487
|
};
|
|
2470
2488
|
export declare function captureAuraScreenshot(target?: HTMLCanvasElement): AuraScreenshot;
|
|
2471
2489
|
export declare function createAuraAssetLoadError(asset: AuraAssetRef<"model">, reason: string): AuraRuntimeError;
|
|
2490
|
+
interface ProductionBoundsProbe {
|
|
2491
|
+
readonly assetId: string;
|
|
2492
|
+
readonly metadata: {
|
|
2493
|
+
readonly min: readonly number[];
|
|
2494
|
+
readonly max: readonly number[];
|
|
2495
|
+
};
|
|
2496
|
+
readonly loaded: {
|
|
2497
|
+
readonly min: readonly number[];
|
|
2498
|
+
readonly max: readonly number[];
|
|
2499
|
+
};
|
|
2500
|
+
}
|
|
2501
|
+
/**
|
|
2502
|
+
* Diagnostic: manifest `boundsMetadata` versus the bounds actually computed from the
|
|
2503
|
+
* loaded GLB, per typed asset routed through the production bridge.
|
|
2504
|
+
*
|
|
2505
|
+
* The bridge sizes models from loaded bounds because those are what the geometry
|
|
2506
|
+
* really occupies. This accessor exists so a disagreement with manifest metadata —
|
|
2507
|
+
* which `camera.frameAsset` must use, being synchronous — is observable instead of
|
|
2508
|
+
* silently producing mismatched framing.
|
|
2509
|
+
*/
|
|
2510
|
+
export declare function auraProductionBoundsProbes(): readonly ProductionBoundsProbe[];
|
|
2472
2511
|
//# sourceMappingURL=index.d.ts.map
|