@iwsdk/core 0.4.2 → 0.5.1
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 +4 -7
- package/dist/asset/asset-manager.d.ts +136 -8
- package/dist/asset/asset-manager.d.ts.map +1 -1
- package/dist/asset/asset-manager.js +491 -47
- package/dist/asset/asset-manager.js.map +1 -1
- package/dist/asset/cache-manager.d.ts +4 -2
- package/dist/asset/cache-manager.d.ts.map +1 -1
- package/dist/asset/cache-manager.js +10 -3
- package/dist/asset/cache-manager.js.map +1 -1
- package/dist/asset/loaders/audio-loader.d.ts +1 -1
- package/dist/asset/loaders/audio-loader.d.ts.map +1 -1
- package/dist/asset/loaders/audio-loader.js +8 -26
- package/dist/asset/loaders/audio-loader.js.map +1 -1
- package/dist/asset/loaders/cached-asset-load.d.ts +35 -0
- package/dist/asset/loaders/cached-asset-load.d.ts.map +1 -0
- package/dist/asset/loaders/cached-asset-load.js +100 -0
- package/dist/asset/loaders/cached-asset-load.js.map +1 -0
- package/dist/asset/loaders/gltf-loader.d.ts +28 -1
- package/dist/asset/loaders/gltf-loader.d.ts.map +1 -1
- package/dist/asset/loaders/gltf-loader.js +254 -33
- package/dist/asset/loaders/gltf-loader.js.map +1 -1
- package/dist/asset/loaders/hdr-texture-loader.d.ts +1 -1
- package/dist/asset/loaders/hdr-texture-loader.d.ts.map +1 -1
- package/dist/asset/loaders/hdr-texture-loader.js +19 -29
- package/dist/asset/loaders/hdr-texture-loader.js.map +1 -1
- package/dist/asset/loaders/texture-loader.d.ts +1 -1
- package/dist/asset/loaders/texture-loader.d.ts.map +1 -1
- package/dist/asset/loaders/texture-loader.js +9 -26
- package/dist/asset/loaders/texture-loader.js.map +1 -1
- package/dist/asset/loaders/uikitml-loader.d.ts +12 -0
- package/dist/asset/loaders/uikitml-loader.d.ts.map +1 -0
- package/dist/asset/loaders/uikitml-loader.js +44 -0
- package/dist/asset/loaders/uikitml-loader.js.map +1 -0
- package/dist/audio/audio-pool.d.ts +7 -0
- package/dist/audio/audio-pool.d.ts.map +1 -1
- package/dist/audio/audio-pool.js.map +1 -1
- package/dist/audio/audio-system.d.ts +1 -0
- package/dist/audio/audio-system.d.ts.map +1 -1
- package/dist/audio/audio-system.js +16 -2
- package/dist/audio/audio-system.js.map +1 -1
- package/dist/camera/camera-system.d.ts.map +1 -1
- package/dist/camera/camera-system.js +5 -3
- package/dist/camera/camera-system.js.map +1 -1
- package/dist/depth/depth-sensing-system.d.ts.map +1 -1
- package/dist/depth/depth-sensing-system.js +31 -10
- package/dist/depth/depth-sensing-system.js.map +1 -1
- package/dist/ecs/builtin-components.d.ts +1239 -0
- package/dist/ecs/builtin-components.d.ts.map +1 -0
- package/dist/ecs/builtin-components.js +87 -0
- package/dist/ecs/builtin-components.js.map +1 -0
- package/dist/ecs/component-editor-metadata.d.ts +19 -0
- package/dist/ecs/component-editor-metadata.d.ts.map +1 -0
- package/dist/ecs/component-editor-metadata.js +19 -0
- package/dist/ecs/component-editor-metadata.js.map +1 -0
- package/dist/ecs/component-manifest.d.ts +24 -0
- package/dist/ecs/component-manifest.d.ts.map +1 -0
- package/dist/ecs/component-manifest.js +121 -0
- package/dist/ecs/component-manifest.js.map +1 -0
- package/dist/ecs/component.d.ts +1 -0
- package/dist/ecs/component.d.ts.map +1 -1
- package/dist/ecs/entity.d.ts +20 -2
- package/dist/ecs/entity.d.ts.map +1 -1
- package/dist/ecs/entity.js +59 -3
- package/dist/ecs/entity.js.map +1 -1
- package/dist/ecs/index.d.ts +3 -1
- package/dist/ecs/index.d.ts.map +1 -1
- package/dist/ecs/system.d.ts +9 -0
- package/dist/ecs/system.d.ts.map +1 -1
- package/dist/ecs/system.js.map +1 -1
- package/dist/ecs/world.d.ts +158 -4
- package/dist/ecs/world.d.ts.map +1 -1
- package/dist/ecs/world.js +304 -5
- package/dist/ecs/world.js.map +1 -1
- package/dist/environment/dome-gradient.d.ts +2 -1
- package/dist/environment/dome-gradient.d.ts.map +1 -1
- package/dist/environment/dome-gradient.js +2 -1
- package/dist/environment/dome-gradient.js.map +1 -1
- package/dist/environment/environment-system.d.ts +19 -3
- package/dist/environment/environment-system.d.ts.map +1 -1
- package/dist/environment/environment-system.js +78 -48
- package/dist/environment/environment-system.js.map +1 -1
- package/dist/environment/gradient-environment.d.ts.map +1 -1
- package/dist/environment/gradient-environment.js +13 -7
- package/dist/environment/gradient-environment.js.map +1 -1
- package/dist/environment/scene-ar-environment.d.ts +39 -0
- package/dist/environment/scene-ar-environment.d.ts.map +1 -0
- package/dist/environment/scene-ar-environment.js +93 -0
- package/dist/environment/scene-ar-environment.js.map +1 -0
- package/dist/grab/grab-helpers.d.ts +39 -0
- package/dist/grab/grab-helpers.d.ts.map +1 -0
- package/dist/grab/grab-helpers.js +59 -0
- package/dist/grab/grab-helpers.js.map +1 -0
- package/dist/grab/grab-system.d.ts +45 -0
- package/dist/grab/grab-system.d.ts.map +1 -1
- package/dist/grab/grab-system.js +67 -5
- package/dist/grab/grab-system.js.map +1 -1
- package/dist/grab/grab-warnings.d.ts +14 -0
- package/dist/grab/grab-warnings.d.ts.map +1 -0
- package/dist/grab/grab-warnings.js +53 -0
- package/dist/grab/grab-warnings.js.map +1 -0
- package/dist/grab/handles.d.ts.map +1 -1
- package/dist/grab/handles.js +8 -3
- package/dist/grab/handles.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -16
- package/dist/index.js.map +1 -1
- package/dist/init/world-initializer.d.ts +11 -7
- package/dist/init/world-initializer.d.ts.map +1 -1
- package/dist/init/world-initializer.js +118 -57
- package/dist/init/world-initializer.js.map +1 -1
- package/dist/init/xr.d.ts +0 -1
- package/dist/init/xr.d.ts.map +1 -1
- package/dist/init/xr.js +12 -3
- package/dist/init/xr.js.map +1 -1
- package/dist/input/input-system.d.ts.map +1 -1
- package/dist/input/input-system.js +26 -11
- package/dist/input/input-system.js.map +1 -1
- package/dist/layers/xr-layer-state.d.ts +47 -0
- package/dist/layers/xr-layer-state.d.ts.map +1 -0
- package/dist/layers/xr-layer-state.js +23 -0
- package/dist/layers/xr-layer-state.js.map +1 -0
- package/dist/layers/xr-layer-system.d.ts +45 -93
- package/dist/layers/xr-layer-system.d.ts.map +1 -1
- package/dist/layers/xr-layer-system.js +4 -25
- package/dist/layers/xr-layer-system.js.map +1 -1
- package/dist/level/index.d.ts +6 -2
- package/dist/level/index.d.ts.map +1 -1
- package/dist/level/level-component-applier.d.ts +24 -0
- package/dist/level/level-component-applier.d.ts.map +1 -0
- package/dist/level/level-component-applier.js +199 -0
- package/dist/level/level-component-applier.js.map +1 -0
- package/dist/level/level-player-rig.d.ts +17 -0
- package/dist/level/level-player-rig.d.ts.map +1 -0
- package/dist/level/level-player-rig.js +113 -0
- package/dist/level/level-player-rig.js.map +1 -0
- package/dist/level/level-scene-environment.d.ts +28 -0
- package/dist/level/level-scene-environment.d.ts.map +1 -0
- package/dist/level/level-scene-environment.js +121 -0
- package/dist/level/level-scene-environment.js.map +1 -0
- package/dist/level/level-scene-json-importer.d.ts +53 -0
- package/dist/level/level-scene-json-importer.d.ts.map +1 -0
- package/dist/level/level-scene-json-importer.js +256 -0
- package/dist/level/level-scene-json-importer.js.map +1 -0
- package/dist/level/level-scene-material.d.ts +22 -0
- package/dist/level/level-scene-material.d.ts.map +1 -0
- package/dist/level/level-scene-material.js +231 -0
- package/dist/level/level-scene-material.js.map +1 -0
- package/dist/level/level-scene-object.d.ts +49 -0
- package/dist/level/level-scene-object.d.ts.map +1 -0
- package/dist/level/level-scene-object.js +396 -0
- package/dist/level/level-scene-object.js.map +1 -0
- package/dist/level/level-scene-primitive.d.ts +21 -0
- package/dist/level/level-scene-primitive.d.ts.map +1 -0
- package/dist/level/level-scene-primitive.js +159 -0
- package/dist/level/level-scene-primitive.js.map +1 -0
- package/dist/level/level-system.d.ts +14 -20
- package/dist/level/level-system.d.ts.map +1 -1
- package/dist/level/level-system.js +114 -49
- package/dist/level/level-system.js.map +1 -1
- package/dist/lighting/index.d.ts +10 -0
- package/dist/lighting/index.d.ts.map +1 -0
- package/dist/lighting/index.js +4 -0
- package/dist/lighting/index.js.map +1 -0
- package/dist/lighting/light-binding.d.ts +76 -0
- package/dist/lighting/light-binding.d.ts.map +1 -0
- package/dist/lighting/light-binding.js +229 -0
- package/dist/lighting/light-binding.js.map +1 -0
- package/dist/lighting/light-components.d.ts +885 -0
- package/dist/lighting/light-components.d.ts.map +1 -0
- package/dist/lighting/light-components.js +146 -0
- package/dist/lighting/light-components.js.map +1 -0
- package/dist/lighting/light-system.d.ts +919 -0
- package/dist/lighting/light-system.d.ts.map +1 -0
- package/dist/lighting/light-system.js +244 -0
- package/dist/lighting/light-system.js.map +1 -0
- package/dist/locomotion/locomotion-environment.d.ts +27 -0
- package/dist/locomotion/locomotion-environment.d.ts.map +1 -0
- package/dist/locomotion/locomotion-environment.js +22 -0
- package/dist/locomotion/locomotion-environment.js.map +1 -0
- package/dist/locomotion/locomotion.d.ts +5 -34
- package/dist/locomotion/locomotion.d.ts.map +1 -1
- package/dist/locomotion/locomotion.js +33 -31
- package/dist/locomotion/locomotion.js.map +1 -1
- package/dist/locomotion/materials/line.js +1 -1
- package/dist/locomotion/slide.d.ts.map +1 -1
- package/dist/locomotion/slide.js +2 -2
- package/dist/locomotion/slide.js.map +1 -1
- package/dist/mcp/ecs-debug-tools.d.ts.map +1 -1
- package/dist/mcp/ecs-debug-tools.js +10 -2
- package/dist/mcp/ecs-debug-tools.js.map +1 -1
- package/dist/mcp/mcp-runtime.d.ts.map +1 -1
- package/dist/mcp/mcp-runtime.js +4 -1
- package/dist/mcp/mcp-runtime.js.map +1 -1
- package/dist/mcp/scene-tools.d.ts +152 -1
- package/dist/mcp/scene-tools.d.ts.map +1 -1
- package/dist/mcp/scene-tools.js +538 -8
- package/dist/mcp/scene-tools.js.map +1 -1
- package/dist/physics/index.js +11 -4
- package/dist/physics/index.js.map +1 -1
- package/dist/physics/physics-system.d.ts +704 -11
- package/dist/physics/physics-system.d.ts.map +1 -1
- package/dist/physics/physics-system.js +307 -25
- package/dist/physics/physics-system.js.map +1 -1
- package/dist/physics/physicsBody.d.ts +40 -1
- package/dist/physics/physicsBody.d.ts.map +1 -1
- package/dist/physics/physicsBody.js +39 -0
- package/dist/physics/physicsBody.js.map +1 -1
- package/dist/physics/physicsManipulation.d.ts +1 -1
- package/dist/physics/physicsManipulation.d.ts.map +1 -1
- package/dist/physics/physicsShape.d.ts +5 -3
- package/dist/physics/physicsShape.d.ts.map +1 -1
- package/dist/physics/physicsShape.js +2 -1
- package/dist/physics/physicsShape.js.map +1 -1
- package/dist/physics/utils.d.ts +10 -0
- package/dist/physics/utils.d.ts.map +1 -1
- package/dist/physics/utils.js +82 -48
- package/dist/physics/utils.js.map +1 -1
- package/dist/project/index.d.ts +11 -0
- package/dist/project/index.d.ts.map +1 -0
- package/dist/project/index.js +5 -0
- package/dist/project/index.js.map +1 -0
- package/dist/project/normalize.d.ts +19 -0
- package/dist/project/normalize.d.ts.map +1 -0
- package/dist/project/normalize.js +206 -0
- package/dist/project/normalize.js.map +1 -0
- package/dist/project/paths.d.ts +21 -0
- package/dist/project/paths.d.ts.map +1 -0
- package/dist/project/paths.js +75 -0
- package/dist/project/paths.js.map +1 -0
- package/dist/project/types.d.ts +159 -0
- package/dist/project/types.d.ts.map +1 -0
- package/dist/project/types.js +11 -0
- package/dist/project/types.js.map +1 -0
- package/dist/project/validation.d.ts +17 -0
- package/dist/project/validation.d.ts.map +1 -0
- package/dist/project/validation.js +501 -0
- package/dist/project/validation.js.map +1 -0
- package/dist/scene-understanding/scene-understanding-system.d.ts +23 -2
- package/dist/scene-understanding/scene-understanding-system.d.ts.map +1 -1
- package/dist/scene-understanding/scene-understanding-system.js +76 -54
- package/dist/scene-understanding/scene-understanding-system.js.map +1 -1
- package/dist/schemas/iwsdk-project.v1.schema.json +305 -0
- package/dist/transform/transform-component.d.ts +32 -0
- package/dist/transform/transform-component.d.ts.map +1 -0
- package/dist/transform/transform-component.js +24 -0
- package/dist/transform/transform-component.js.map +1 -0
- package/dist/transform/transform.d.ts +9 -42
- package/dist/transform/transform.d.ts.map +1 -1
- package/dist/transform/transform.js +8 -25
- package/dist/transform/transform.js.map +1 -1
- package/dist/ui/document.d.ts +9 -2
- package/dist/ui/document.d.ts.map +1 -1
- package/dist/ui/document.js +30 -5
- package/dist/ui/document.js.map +1 -1
- package/dist/ui/follow-component.d.ts +57 -0
- package/dist/ui/follow-component.d.ts.map +1 -0
- package/dist/ui/follow-component.js +38 -0
- package/dist/ui/follow-component.js.map +1 -0
- package/dist/ui/follow.d.ts +28 -102
- package/dist/ui/follow.d.ts.map +1 -1
- package/dist/ui/follow.js +10 -48
- package/dist/ui/follow.js.map +1 -1
- package/dist/ui/index.d.ts +3 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/panel-components.d.ts +29 -0
- package/dist/ui/panel-components.d.ts.map +1 -0
- package/dist/ui/panel-components.js +22 -0
- package/dist/ui/panel-components.js.map +1 -0
- package/dist/ui/screenspace-component.d.ts +39 -0
- package/dist/ui/screenspace-component.d.ts.map +1 -0
- package/dist/ui/screenspace-component.js +21 -0
- package/dist/ui/screenspace-component.js.map +1 -0
- package/dist/ui/screenspace.d.ts +47 -135
- package/dist/ui/screenspace.d.ts.map +1 -1
- package/dist/ui/screenspace.js +127 -65
- package/dist/ui/screenspace.js.map +1 -1
- package/dist/ui/ui.d.ts +20 -122
- package/dist/ui/ui.d.ts.map +1 -1
- package/dist/ui/ui.js +44 -107
- package/dist/ui/ui.js.map +1 -1
- package/dist/ui/uikitml-asset.d.ts +25 -0
- package/dist/ui/uikitml-asset.d.ts.map +1 -0
- package/dist/ui/uikitml-asset.js +56 -0
- package/dist/ui/uikitml-asset.js.map +1 -0
- package/dist/ui/uikitml.d.ts +41 -0
- package/dist/ui/uikitml.d.ts.map +1 -0
- package/dist/ui/uikitml.js +119 -0
- package/dist/ui/uikitml.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/visibility/visibility-component.d.ts +14 -0
- package/dist/visibility/visibility-component.d.ts.map +1 -0
- package/dist/visibility/visibility-component.js +15 -0
- package/dist/visibility/visibility-component.js.map +1 -0
- package/dist/visibility/visibility.d.ts +3 -10
- package/dist/visibility/visibility.d.ts.map +1 -1
- package/dist/visibility/visibility.js +9 -12
- package/dist/visibility/visibility.js.map +1 -1
- package/package.json +36 -8
- package/dist/ecs/component-registry.d.ts +0 -54
- package/dist/ecs/component-registry.d.ts.map +0 -1
- package/dist/ecs/component-registry.js +0 -86
- package/dist/ecs/component-registry.js.map +0 -1
- package/dist/level/level-entity-creator.d.ts +0 -27
- package/dist/level/level-entity-creator.d.ts.map +0 -1
- package/dist/level/level-entity-creator.js +0 -108
- package/dist/level/level-entity-creator.js.map +0 -1
- package/dist/level/level-glxf-importer.d.ts +0 -23
- package/dist/level/level-glxf-importer.d.ts.map +0 -1
- package/dist/level/level-glxf-importer.js +0 -40
- package/dist/level/level-glxf-importer.js.map +0 -1
|
@@ -48,14 +48,53 @@ const PhysicsBody = createComponent('PhysicsBody', {
|
|
|
48
48
|
enum: PhysicsState,
|
|
49
49
|
default: PhysicsState.Dynamic,
|
|
50
50
|
},
|
|
51
|
+
/**
|
|
52
|
+
* Linear velocity damping. Reactive: mutating it via
|
|
53
|
+
* `setValue(PhysicsBody, 'linearDamping', ...)` after the body is created is
|
|
54
|
+
* applied to the running simulation on the next frame.
|
|
55
|
+
*/
|
|
51
56
|
linearDamping: { type: Types.Float32, default: 0.0 },
|
|
57
|
+
/**
|
|
58
|
+
* Angular velocity damping. Reactive: mutating it via
|
|
59
|
+
* `setValue(PhysicsBody, 'angularDamping', ...)` after the body is created is
|
|
60
|
+
* applied to the running simulation on the next frame.
|
|
61
|
+
*/
|
|
52
62
|
angularDamping: { type: Types.Float32, default: 0.0 },
|
|
63
|
+
/**
|
|
64
|
+
* Per-body gravity multiplier (`0` floats, `1` is normal gravity). Reactive:
|
|
65
|
+
* mutating it via `setValue(PhysicsBody, 'gravityFactor', ...)` after the body
|
|
66
|
+
* is created is applied to the running simulation on the next frame.
|
|
67
|
+
*/
|
|
53
68
|
gravityFactor: { type: Types.Float32, default: 1.0 },
|
|
54
69
|
centerOfMass: { type: Types.Vec3, default: [Infinity, Infinity, Infinity] },
|
|
55
70
|
_linearVelocity: { type: Types.Vec3, default: [0.0, 0.0, 0.0] },
|
|
56
71
|
_angularVelocity: { type: Types.Vec3, default: [0.0, 0.0, 0.0] },
|
|
57
72
|
_engineBody: { type: Types.Float64, default: 0 },
|
|
58
73
|
_engineOffset: { type: Types.Float64, default: 0 },
|
|
74
|
+
/**
|
|
75
|
+
* Last `gravityFactor` value pushed to the engine. Internal shadow used by
|
|
76
|
+
* the reactive sync to detect changes without reading back from Havok.
|
|
77
|
+
*/
|
|
78
|
+
_engineGravityFactor: {
|
|
79
|
+
type: Types.Float32,
|
|
80
|
+
default: 1.0,
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Last `linearDamping` value pushed to the engine. Internal shadow used by
|
|
84
|
+
* the reactive sync to detect changes without reading back from Havok.
|
|
85
|
+
*/
|
|
86
|
+
_engineLinearDamping: {
|
|
87
|
+
type: Types.Float32,
|
|
88
|
+
default: 0.0,
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Last `angularDamping` value pushed to the engine. Internal shadow used by
|
|
92
|
+
* the reactive sync to detect changes without reading back from Havok.
|
|
93
|
+
*/
|
|
94
|
+
_engineAngularDamping: {
|
|
95
|
+
type: Types.Float32,
|
|
96
|
+
default: 0.0,
|
|
97
|
+
},
|
|
59
98
|
}, 'Component to define physics behavior of an entity.');
|
|
60
99
|
|
|
61
100
|
export { DEFAULT_ANGULAR_DAMPING, DEFAULT_GRAVITY_FACTOR, DEFAULT_LINEAR_DAMPING, PhysicsBody, PhysicsState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsBody.js","sources":["../../src/physics/physicsBody.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,YAAY,GAAG;AAC1B;AACwD;AACxD,IAAA,MAAM,EAAE,QAAQ;;AAEhB,IAAA,OAAO,EAAE,SAAS;AAClB;AACoI;AACpI,IAAA,SAAS,EAAE,WAAW;;AAGjB,MAAM,sBAAsB,GAAG;AAC/B,MAAM,uBAAuB,GAAG;AAChC,MAAM,sBAAsB,GAAG;AAEtC;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,WAAW,GAAG,eAAe,CACxC,aAAa,EACb;;AAEE,IAAA,KAAK,EAAE;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;AAChB,QAAA,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY,CAAC,OAAO;AAC9B,KAAA;
|
|
1
|
+
{"version":3,"file":"physicsBody.js","sources":["../../src/physics/physicsBody.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,YAAY,GAAG;AAC1B;AACwD;AACxD,IAAA,MAAM,EAAE,QAAQ;;AAEhB,IAAA,OAAO,EAAE,SAAS;AAClB;AACoI;AACpI,IAAA,SAAS,EAAE,WAAW;;AAGjB,MAAM,sBAAsB,GAAG;AAC/B,MAAM,uBAAuB,GAAG;AAChC,MAAM,sBAAsB,GAAG;AAEtC;;;;;;;;;;;;;;;;;;;;AAoBG;AACI,MAAM,WAAW,GAAG,eAAe,CACxC,aAAa,EACb;;AAEE,IAAA,KAAK,EAAE;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;AAChB,QAAA,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,YAAY,CAAC,OAAO;AAC9B,KAAA;AACD;;;;AAIG;IACH,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;AACpD;;;;AAIG;IACH,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;AACrD;;;;AAIG;IACH,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;AACpD,IAAA,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,EAAE;AAC3E,IAAA,eAAe,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;AAC/D,IAAA,gBAAgB,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IAChE,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;IAChD,aAAa,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;AAClD;;;AAGG;AACH,IAAA,oBAAoB,EAAE;QACpB,IAAI,EAAE,KAAK,CAAC,OAAO;AACnB,QAAA,OAAO,EAAE,GAAG;AACb,KAAA;AACD;;;AAGG;AACH,IAAA,oBAAoB,EAAE;QACpB,IAAI,EAAE,KAAK,CAAC,OAAO;AACnB,QAAA,OAAO,EAAE,GAAG;AACb,KAAA;AACD;;;AAGG;AACH,IAAA,qBAAqB,EAAE;QACrB,IAAI,EAAE,KAAK,CAAC,OAAO;AACnB,QAAA,OAAO,EAAE,GAAG;AACb,KAAA;CACF,EACD,oDAAoD;;;;"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { Types } from '
|
|
7
|
+
import { Types } from '../ecs/component.js';
|
|
8
8
|
/**
|
|
9
9
|
* Component for applying one‑time physics manipulations to an entity.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsManipulation.d.ts","sourceRoot":"","sources":["../../src/physics/physicsManipulation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"physicsManipulation.d.ts","sourceRoot":"","sources":["../../src/physics/physicsManipulation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,qBAAqB,CAAC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;EAQ/B,CAAC"}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import { Types } from '
|
|
7
|
+
import { Types } from '../ecs/component.js';
|
|
8
8
|
/** Available physics shape types for {@link PhysicsShape}. @category Physics */
|
|
9
9
|
export declare const PhysicsShapeType: {
|
|
10
10
|
/** The sphere is described by just the radius in dimensions[0]. Efficient for round objects. */
|
|
@@ -14,7 +14,8 @@ export declare const PhysicsShapeType: {
|
|
|
14
14
|
/** A cylinder shape is defined by the radius in dimensions[0] and height in dimensions[1]. */
|
|
15
15
|
readonly Cylinder: "Cylinder";
|
|
16
16
|
/** Capsules are similar to cylinders, but have two half-spheres on each end.
|
|
17
|
-
* A Capsules shape
|
|
17
|
+
* A Capsules shape uses radius in dimensions[0] and total end-to-end height in dimensions[1],
|
|
18
|
+
* which must be at least twice the radius. */
|
|
18
19
|
readonly Capsules: "Capsules";
|
|
19
20
|
/** A convex is a shape that, if two points are part of the shape, then the segment between these two points is
|
|
20
21
|
* also part of the shape. The physics engine would creates a convex wrapper around the mesh. This is a great
|
|
@@ -85,7 +86,8 @@ export declare const PhysicsShape: import("elics").Component<{
|
|
|
85
86
|
/** A cylinder shape is defined by the radius in dimensions[0] and height in dimensions[1]. */
|
|
86
87
|
readonly Cylinder: "Cylinder";
|
|
87
88
|
/** Capsules are similar to cylinders, but have two half-spheres on each end.
|
|
88
|
-
* A Capsules shape
|
|
89
|
+
* A Capsules shape uses radius in dimensions[0] and total end-to-end height in dimensions[1],
|
|
90
|
+
* which must be at least twice the radius. */
|
|
89
91
|
readonly Capsules: "Capsules";
|
|
90
92
|
/** A convex is a shape that, if two points are part of the shape, then the segment between these two points is
|
|
91
93
|
* also part of the shape. The physics engine would creates a convex wrapper around the mesh. This is a great
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsShape.d.ts","sourceRoot":"","sources":["../../src/physics/physicsShape.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,
|
|
1
|
+
{"version":3,"file":"physicsShape.d.ts","sourceRoot":"","sources":["../../src/physics/physicsShape.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,qBAAqB,CAAC;AAE7D,gFAAgF;AAChF,eAAO,MAAM,gBAAgB;IAC3B,gGAAgG;;IAEhG,4GAA4G;;IAE5G,8FAA8F;;IAE9F;;kDAE8C;;IAE9C;;uHAEmH;;IAEnH;mIAC+H;;IAE/H;;;;;;OAMG;;CAEK,CAAC;AAEX,eAAO,MAAM,eAAe,IAAM,CAAC;AACnC,eAAO,MAAM,mBAAmB,IAAM,CAAC;AACvC,eAAO,MAAM,gBAAgB,MAAM,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,eAAO,MAAM,YAAY;IAGrB,oFAAoF;;;;YAxEtF,gGAAgG;;YAEhG,4GAA4G;;YAE5G,8FAA8F;;YAE9F;;0DAE8C;;YAE9C;;+HAEmH;;YAEnH;2IAC+H;;YAE/H;;;;;;eAMG;;;;;IAuDD,sHAAsH;;;;;IAEtH,0EAA0E;;;;;IAE1E,2EAA2E;;;;;IAE3E,2DAA2D;;;;;;;;;EAK9D,CAAC"}
|
|
@@ -15,7 +15,8 @@ const PhysicsShapeType = {
|
|
|
15
15
|
/** A cylinder shape is defined by the radius in dimensions[0] and height in dimensions[1]. */
|
|
16
16
|
Cylinder: 'Cylinder',
|
|
17
17
|
/** Capsules are similar to cylinders, but have two half-spheres on each end.
|
|
18
|
-
* A Capsules shape
|
|
18
|
+
* A Capsules shape uses radius in dimensions[0] and total end-to-end height in dimensions[1],
|
|
19
|
+
* which must be at least twice the radius. */
|
|
19
20
|
Capsules: 'Capsules',
|
|
20
21
|
/** A convex is a shape that, if two points are part of the shape, then the segment between these two points is
|
|
21
22
|
* also part of the shape. The physics engine would creates a convex wrapper around the mesh. This is a great
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsShape.js","sources":["../../src/physics/physicsShape.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,gBAAgB,GAAG;;AAE9B,IAAA,MAAM,EAAE,QAAQ;;AAEhB,IAAA,GAAG,EAAE,KAAK;;AAEV,IAAA,QAAQ,EAAE,UAAU;AACpB;
|
|
1
|
+
{"version":3,"file":"physicsShape.js","sources":["../../src/physics/physicsShape.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;AAIH;AACO,MAAM,gBAAgB,GAAG;;AAE9B,IAAA,MAAM,EAAE,QAAQ;;AAEhB,IAAA,GAAG,EAAE,KAAK;;AAEV,IAAA,QAAQ,EAAE,UAAU;AACpB;;AAE8C;AAC9C,IAAA,QAAQ,EAAE,UAAU;AACpB;;AAEmH;AACnH,IAAA,UAAU,EAAE,YAAY;AACxB;AAC+H;AAC/H,IAAA,OAAO,EAAE,SAAS;AAClB;;;;;;AAMG;AACH,IAAA,IAAI,EAAE,MAAM;;AAGP,MAAM,eAAe,GAAG;AACxB,MAAM,mBAAmB,GAAG;AAC5B,MAAM,gBAAgB,GAAG;AAEhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCG;AACI,MAAM,YAAY,GAAG,eAAe,CACzC,cAAc,EACd;;AAEE,IAAA,KAAK,EAAE;QACL,IAAI,EAAE,KAAK,CAAC,IAAI;AAChB,QAAA,IAAI,EAAE,gBAAgB;QACtB,OAAO,EAAE,gBAAgB,CAAC,IAAI;AAC/B,KAAA;;AAED,IAAA,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;;IAE1D,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;IAE9C,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;IAElD,QAAQ,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;IAC/C,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE;CAClD,EACD,iDAAiD;;;;"}
|
package/dist/physics/utils.d.ts
CHANGED
|
@@ -5,6 +5,16 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import { BufferGeometry, Object3D } from '../runtime/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Build a sequential index buffer (`0, 1, 2, ...`) for a non-indexed geometry.
|
|
10
|
+
*
|
|
11
|
+
* Three.js `BufferGeometry.index` is `null` for non-indexed geometry, where the
|
|
12
|
+
* position attribute already lists vertices in triangle order. Tri-mesh
|
|
13
|
+
* colliders need an explicit index list, so synthesize the implicit one.
|
|
14
|
+
*
|
|
15
|
+
* @param vertexCount Number of vertices (i.e. `geometry.attributes.position.count`).
|
|
16
|
+
*/
|
|
17
|
+
export declare function sequentialIndices(vertexCount: number): Uint32Array;
|
|
8
18
|
export interface ShapeDetectionResult {
|
|
9
19
|
shapeType: string;
|
|
10
20
|
dimensions: [number, number, number] | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/physics/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAOL,cAAc,EAEd,QAAQ,EAGT,MAAM,qBAAqB,CAAC;AAW7B,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,GACjB,oBAAoB,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/physics/utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAOL,cAAc,EAEd,QAAQ,EAGT,MAAM,qBAAqB,CAAC;AAW7B;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,CAMlE;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAAC;CAC7C;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,GACjB,oBAAoB,CAiFtB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,QAAQ,GACjB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CA+B1B;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,QAAQ,GAAG,cAAc,CA6BzE"}
|
package/dist/physics/utils.js
CHANGED
|
@@ -15,67 +15,95 @@ const tempQuat = new Quaternion();
|
|
|
15
15
|
const tempMatrix = new Matrix4();
|
|
16
16
|
const tempMatrix2 = new Matrix4();
|
|
17
17
|
const UNIT_SCALE = new Vector3(1, 1, 1);
|
|
18
|
+
/**
|
|
19
|
+
* Build a sequential index buffer (`0, 1, 2, ...`) for a non-indexed geometry.
|
|
20
|
+
*
|
|
21
|
+
* Three.js `BufferGeometry.index` is `null` for non-indexed geometry, where the
|
|
22
|
+
* position attribute already lists vertices in triangle order. Tri-mesh
|
|
23
|
+
* colliders need an explicit index list, so synthesize the implicit one.
|
|
24
|
+
*
|
|
25
|
+
* @param vertexCount Number of vertices (i.e. `geometry.attributes.position.count`).
|
|
26
|
+
*/
|
|
27
|
+
function sequentialIndices(vertexCount) {
|
|
28
|
+
const indices = new Uint32Array(vertexCount);
|
|
29
|
+
for (let i = 0; i < vertexCount; i++) {
|
|
30
|
+
indices[i] = i;
|
|
31
|
+
}
|
|
32
|
+
return indices;
|
|
33
|
+
}
|
|
18
34
|
/**
|
|
19
35
|
* Automatically detects the best physics shape type and calculates dimensions based on the entity's Three.js geometry
|
|
20
36
|
*/
|
|
21
37
|
function detectShapeFromGeometry(object3D) {
|
|
22
38
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
39
|
+
// When object3D is not a Mesh we build a merged geometry purely to inspect
|
|
40
|
+
// it; it must be disposed before returning so shape auto-detection doesn't
|
|
41
|
+
// leak one merged geometry per call. A Mesh's own geometry stays in use and
|
|
42
|
+
// is never owned here. The try/finally guarantees disposal on every return.
|
|
43
|
+
const ownsGeometry = !(object3D instanceof Mesh);
|
|
23
44
|
const geometry = object3D instanceof Mesh
|
|
24
45
|
? object3D.geometry
|
|
25
46
|
: generateMergedGeometry(object3D);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
+
try {
|
|
48
|
+
// Check for specific geometry types and calculate their dimensions
|
|
49
|
+
if (geometry instanceof SphereGeometry) {
|
|
50
|
+
const radius = (_a = geometry.parameters.radius) !== null && _a !== void 0 ? _a : 1;
|
|
51
|
+
return {
|
|
52
|
+
shapeType: PhysicsShapeType.Sphere,
|
|
53
|
+
dimensions: [radius, 0, 0], // Only radius is needed for sphere
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (geometry instanceof BoxGeometry) {
|
|
57
|
+
const width = (_b = geometry.parameters.width) !== null && _b !== void 0 ? _b : 1;
|
|
58
|
+
const height = (_c = geometry.parameters.height) !== null && _c !== void 0 ? _c : 1;
|
|
59
|
+
const depth = (_d = geometry.parameters.depth) !== null && _d !== void 0 ? _d : 1;
|
|
60
|
+
return {
|
|
61
|
+
shapeType: PhysicsShapeType.Box,
|
|
62
|
+
dimensions: [width, height, depth],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (geometry instanceof PlaneGeometry) {
|
|
66
|
+
const width = (_e = geometry.parameters.width) !== null && _e !== void 0 ? _e : 1;
|
|
67
|
+
const height = (_f = geometry.parameters.height) !== null && _f !== void 0 ? _f : 1;
|
|
68
|
+
const thickness = 0.01; // Thin plane
|
|
69
|
+
return {
|
|
70
|
+
shapeType: PhysicsShapeType.Box,
|
|
71
|
+
dimensions: [width, height, thickness],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (geometry instanceof CylinderGeometry) {
|
|
75
|
+
const radiusTop = (_g = geometry.parameters.radiusTop) !== null && _g !== void 0 ? _g : 1;
|
|
76
|
+
const radiusBottom = (_h = geometry.parameters.radiusBottom) !== null && _h !== void 0 ? _h : 1;
|
|
77
|
+
if (radiusTop !== radiusBottom) {
|
|
78
|
+
console.warn('PhysicsSystem: detected cylinder with different radiusTop and radiusBottom. Using average radius for the physics shape.');
|
|
79
|
+
}
|
|
80
|
+
const height = (_j = geometry.parameters.height) !== null && _j !== void 0 ? _j : 1;
|
|
81
|
+
const avgRadius = (radiusTop + radiusBottom) / 2;
|
|
82
|
+
return {
|
|
83
|
+
shapeType: PhysicsShapeType.Cylinder,
|
|
84
|
+
dimensions: [avgRadius, height, 0], // Approximate bounding dimensions
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
// For generic BufferGeometry, fall back to the default ConvexHull shape type for better perf
|
|
88
|
+
if (geometry instanceof BufferGeometry) {
|
|
89
|
+
console.log(`PhysicsSystem: BufferGeometry detected for object ${object3D}, using ConvexHull.`);
|
|
90
|
+
return {
|
|
91
|
+
shapeType: PhysicsShapeType.ConvexHull,
|
|
92
|
+
dimensions: null,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
// Fallback for unknown geometry types
|
|
96
|
+
console.warn(`PhysicsSystem: Unknown geometry type for object ${object3D}, falling back to Box`);
|
|
47
97
|
return {
|
|
48
98
|
shapeType: PhysicsShapeType.Box,
|
|
49
|
-
dimensions:
|
|
99
|
+
dimensions: calculateObject3DBounds(object3D),
|
|
50
100
|
};
|
|
51
101
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
if (radiusTop !== radiusBottom) {
|
|
56
|
-
console.warn('PhysicsSystem: detected cylinder with different radiusTop and radiusBottom. Using average radius for the physics shape.');
|
|
102
|
+
finally {
|
|
103
|
+
if (ownsGeometry) {
|
|
104
|
+
geometry.dispose();
|
|
57
105
|
}
|
|
58
|
-
const height = (_j = geometry.parameters.height) !== null && _j !== void 0 ? _j : 1;
|
|
59
|
-
const avgRadius = (radiusTop + radiusBottom) / 2;
|
|
60
|
-
return {
|
|
61
|
-
shapeType: PhysicsShapeType.Cylinder,
|
|
62
|
-
dimensions: [avgRadius, height, 0], // Approximate bounding dimensions
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
// For generic BufferGeometry, fall back to the default ConvexHull shape type for better perf
|
|
66
|
-
if (geometry instanceof BufferGeometry) {
|
|
67
|
-
console.log(`PhysicsSystem: BufferGeometry detected for object ${object3D}, using ConvexHull.`);
|
|
68
|
-
return {
|
|
69
|
-
shapeType: PhysicsShapeType.ConvexHull,
|
|
70
|
-
dimensions: null,
|
|
71
|
-
};
|
|
72
106
|
}
|
|
73
|
-
// Fallback for unknown geometry types
|
|
74
|
-
console.warn(`PhysicsSystem: Unknown geometry type for object ${object3D}, falling back to Box`);
|
|
75
|
-
return {
|
|
76
|
-
shapeType: PhysicsShapeType.Box,
|
|
77
|
-
dimensions: calculateObject3DBounds(object3D),
|
|
78
|
-
};
|
|
79
107
|
}
|
|
80
108
|
/**
|
|
81
109
|
* Calculates bounding box dimensions from Object3D for fallback cases
|
|
@@ -120,11 +148,17 @@ function generateMergedGeometry(object3D) {
|
|
|
120
148
|
}
|
|
121
149
|
});
|
|
122
150
|
const mergedGeometry = mergeGeometries(geometries);
|
|
151
|
+
// The per-child clones were only working copies for the merge; their data is
|
|
152
|
+
// now copied into mergedGeometry, so free them to avoid leaking a clone of
|
|
153
|
+
// every child geometry each time a merged collider is built.
|
|
154
|
+
for (const geometry of geometries) {
|
|
155
|
+
geometry.dispose();
|
|
156
|
+
}
|
|
123
157
|
tempMatrix2.copy(tempMatrix).invert();
|
|
124
158
|
mergedGeometry.applyMatrix4(tempMatrix2);
|
|
125
159
|
object3D.matrixWorld.copy(tempMatrix);
|
|
126
160
|
return mergedGeometry;
|
|
127
161
|
}
|
|
128
162
|
|
|
129
|
-
export { calculateObject3DBounds, detectShapeFromGeometry, generateMergedGeometry };
|
|
163
|
+
export { calculateObject3DBounds, detectShapeFromGeometry, generateMergedGeometry, sequentialIndices };
|
|
130
164
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../src/physics/utils.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAA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AAC;IAErC,UAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;IAClD,UAAU,CAAC,OAAO,CAAC,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC;IAElD,MAAM,UAAU,GAAqB,EAAE;AACvC,IAAA,QAAQ,CAAC,QAAQ,CAAC,CAAC,KAAK,KAAI;QAC1B,IAAK,KAAc,CAAC,MAAM,IAAK,KAAc,CAAC,QAAQ,EAAE;YACtD,MAAM,QAAQ,GAAI,KAAc,CAAC,QAAQ,CAAC,KAAK,EAAE;AACjD,YAAA,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,WAAW,CAAC;AACxC,YAAA,UAAU,CAAC,IAAI,CAAC,QAAQ,CAAC;QAC3B;AACF,IAAA,CAAC,CAAC;AACF,IAAA,MAAM,cAAc,GAAG,eAAe,CAAC,UAAU,CAAC;;;;AAIlD,IAAA,KAAK,MAAM,QAAQ,IAAI,UAAU,EAAE;QACjC,QAAQ,CAAC,OAAO,EAAE;IACpB;IACA,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;AACrC,IAAA,cAAc,CAAC,YAAY,CAAC,WAAW,CAAC;AAExC,IAAA,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC;AAErC,IAAA,OAAO,cAAc;AACvB;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export * from './normalize.js';
|
|
8
|
+
export * from './paths.js';
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
export * from './validation.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/project/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { normalizeProjectDevOptions, normalizeProjectModuleSourcePath, normalizeProjectWorldOptions, projectRegexSpecToRegExp } from './normalize.js';
|
|
2
|
+
export { ProjectSourcePathError, normalizeProjectSourcePath, projectSceneSourcePathToRuntimeUrl } from './paths.js';
|
|
3
|
+
export { IWSDK_PROJECT_MANIFEST_VERSION } from './types.js';
|
|
4
|
+
export { ProjectManifestValidationError, assertValidIwsdkProjectManifest, isIwsdkProjectManifest, validateIwsdkProjectManifest } from './validation.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import type { NormalizedProjectDevOptions, NormalizedProjectWorldOptions, ProjectRegexSpec } from './types.js';
|
|
8
|
+
/**
|
|
9
|
+
* Normalize the JSON-safe world contract into the existing `World.create`
|
|
10
|
+
* option shape. Asset and component values are intentionally not injected.
|
|
11
|
+
*/
|
|
12
|
+
export declare function normalizeProjectWorldOptions(value: unknown): NormalizedProjectWorldOptions;
|
|
13
|
+
/** Normalize manifest-owned development settings for Vite/plugin consumers. */
|
|
14
|
+
export declare function normalizeProjectDevOptions(value: unknown): NormalizedProjectDevOptions;
|
|
15
|
+
/** Normalize an assets/components module declaration for Vite resolution. */
|
|
16
|
+
export declare function normalizeProjectModuleSourcePath(sourcePath: string): string;
|
|
17
|
+
/** Reconstruct a validated JSON regular-expression declaration. */
|
|
18
|
+
export declare function projectRegexSpecToRegExp(spec: ProjectRegexSpec): RegExp;
|
|
19
|
+
//# sourceMappingURL=normalize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../src/project/normalize.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,OAAO,KAAK,EAEV,2BAA2B,EAC3B,6BAA6B,EAE7B,gBAAgB,EAEjB,MAAM,YAAY,CAAC;AAUpB;;;GAGG;AACH,wBAAgB,4BAA4B,CAC1C,KAAK,EAAE,OAAO,GACb,6BAA6B,CAwC/B;AAED,+EAA+E;AAC/E,wBAAgB,0BAA0B,CACxC,KAAK,EAAE,OAAO,GACb,2BAA2B,CAyC7B;AAED,6EAA6E;AAC7E,wBAAgB,gCAAgC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAE3E;AAED,mEAAmE;AACnE,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import { normalizeProjectSourcePath, projectSceneSourcePathToRuntimeUrl } from './paths.js';
|
|
2
|
+
import { assertValidIwsdkProjectManifest } from './validation.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the MIT license found in the
|
|
8
|
+
* LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
const TURNING_METHOD = {
|
|
11
|
+
snap: 1,
|
|
12
|
+
smooth: 2,
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Normalize the JSON-safe world contract into the existing `World.create`
|
|
16
|
+
* option shape. Asset and component values are intentionally not injected.
|
|
17
|
+
*/
|
|
18
|
+
function normalizeProjectWorldOptions(value) {
|
|
19
|
+
assertValidIwsdkProjectManifest(value);
|
|
20
|
+
const manifest = value;
|
|
21
|
+
const source = manifest.world;
|
|
22
|
+
const xr = normalizeXR(source.xr);
|
|
23
|
+
return {
|
|
24
|
+
level: projectSceneSourcePathToRuntimeUrl(manifest.scene),
|
|
25
|
+
xr,
|
|
26
|
+
...(source.input == null
|
|
27
|
+
? {}
|
|
28
|
+
: {
|
|
29
|
+
input: {
|
|
30
|
+
...(typeof source.input.canvasPointerEvents === 'object'
|
|
31
|
+
? {
|
|
32
|
+
canvasPointerEvents: {
|
|
33
|
+
...source.input.canvasPointerEvents,
|
|
34
|
+
},
|
|
35
|
+
}
|
|
36
|
+
: 'canvasPointerEvents' in source.input
|
|
37
|
+
? {
|
|
38
|
+
canvasPointerEvents: source.input.canvasPointerEvents,
|
|
39
|
+
}
|
|
40
|
+
: {}),
|
|
41
|
+
},
|
|
42
|
+
}),
|
|
43
|
+
...(source.render == null
|
|
44
|
+
? {}
|
|
45
|
+
: {
|
|
46
|
+
render: {
|
|
47
|
+
...source.render,
|
|
48
|
+
...(source.render.camera == null
|
|
49
|
+
? {}
|
|
50
|
+
: { camera: { ...source.render.camera } }),
|
|
51
|
+
},
|
|
52
|
+
}),
|
|
53
|
+
...(source.features == null
|
|
54
|
+
? {}
|
|
55
|
+
: { features: normalizeFeatures(source.features) }),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** Normalize manifest-owned development settings for Vite/plugin consumers. */
|
|
59
|
+
function normalizeProjectDevOptions(value) {
|
|
60
|
+
assertValidIwsdkProjectManifest(value);
|
|
61
|
+
const manifest = value;
|
|
62
|
+
const dev = manifest.dev;
|
|
63
|
+
if (dev == null) {
|
|
64
|
+
return {};
|
|
65
|
+
}
|
|
66
|
+
const sourceEmulator = dev.emulator;
|
|
67
|
+
const emulator = sourceEmulator == null
|
|
68
|
+
? undefined
|
|
69
|
+
: {
|
|
70
|
+
...(sourceEmulator.device == null
|
|
71
|
+
? {}
|
|
72
|
+
: { device: sourceEmulator.device }),
|
|
73
|
+
...(sourceEmulator.iwer == null ? {} : { iwer: sourceEmulator.iwer }),
|
|
74
|
+
...(sourceEmulator.environment == null
|
|
75
|
+
? {}
|
|
76
|
+
: { environment: sourceEmulator.environment }),
|
|
77
|
+
...(sourceEmulator.activation == null
|
|
78
|
+
? {}
|
|
79
|
+
: {
|
|
80
|
+
activation: typeof sourceEmulator.activation === 'object'
|
|
81
|
+
? projectRegexSpecToRegExp(sourceEmulator.activation)
|
|
82
|
+
: sourceEmulator.activation,
|
|
83
|
+
}),
|
|
84
|
+
...(sourceEmulator.injectOnBuild == null
|
|
85
|
+
? {}
|
|
86
|
+
: { injectOnBuild: sourceEmulator.injectOnBuild }),
|
|
87
|
+
...(sourceEmulator.userAgentException == null
|
|
88
|
+
? {}
|
|
89
|
+
: {
|
|
90
|
+
userAgentException: projectRegexSpecToRegExp(sourceEmulator.userAgentException),
|
|
91
|
+
}),
|
|
92
|
+
};
|
|
93
|
+
return {
|
|
94
|
+
...(emulator == null ? {} : { emulator }),
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/** Normalize an assets/components module declaration for Vite resolution. */
|
|
98
|
+
function normalizeProjectModuleSourcePath(sourcePath) {
|
|
99
|
+
return normalizeProjectSourcePath(sourcePath, 'module');
|
|
100
|
+
}
|
|
101
|
+
/** Reconstruct a validated JSON regular-expression declaration. */
|
|
102
|
+
function projectRegexSpecToRegExp(spec) {
|
|
103
|
+
var _a;
|
|
104
|
+
return new RegExp(spec.source, (_a = spec.flags) !== null && _a !== void 0 ? _a : '');
|
|
105
|
+
}
|
|
106
|
+
function normalizeXR(source) {
|
|
107
|
+
if (source === false) {
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
110
|
+
const sessionMode = (source.mode === 'vr' ? 'immersive-vr' : 'immersive-ar');
|
|
111
|
+
return {
|
|
112
|
+
sessionMode,
|
|
113
|
+
...(source.offer == null ? {} : { offer: source.offer }),
|
|
114
|
+
...(source.referenceSpace == null
|
|
115
|
+
? {}
|
|
116
|
+
: {
|
|
117
|
+
referenceSpace: cloneReferenceSpace(source.referenceSpace),
|
|
118
|
+
}),
|
|
119
|
+
...(source.restoreCameraOnExit == null
|
|
120
|
+
? {}
|
|
121
|
+
: { restoreCameraOnExit: source.restoreCameraOnExit }),
|
|
122
|
+
...(source.features == null
|
|
123
|
+
? {}
|
|
124
|
+
: { features: cloneXRFeatures(source.features) }),
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function cloneReferenceSpace(source) {
|
|
128
|
+
return typeof source === 'string'
|
|
129
|
+
? source
|
|
130
|
+
: {
|
|
131
|
+
...source,
|
|
132
|
+
...(source.fallbackOrder == null
|
|
133
|
+
? {}
|
|
134
|
+
: { fallbackOrder: [...source.fallbackOrder] }),
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
function cloneXRFeatures(source) {
|
|
138
|
+
return Object.fromEntries(Object.entries(source).map(([key, value]) => [
|
|
139
|
+
key,
|
|
140
|
+
value != null && typeof value === 'object' ? { ...value } : value,
|
|
141
|
+
]));
|
|
142
|
+
}
|
|
143
|
+
function normalizeFeatures(source) {
|
|
144
|
+
const features = {};
|
|
145
|
+
if (source.locomotion != null) {
|
|
146
|
+
if (typeof source.locomotion === 'boolean') {
|
|
147
|
+
features.locomotion = source.locomotion;
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const { browserControls, initialPlayerPosition, turningMethod, ...rest } = source.locomotion;
|
|
151
|
+
features.locomotion = {
|
|
152
|
+
...rest,
|
|
153
|
+
...(initialPlayerPosition == null
|
|
154
|
+
? {}
|
|
155
|
+
: {
|
|
156
|
+
initialPlayerPosition: [...initialPlayerPosition],
|
|
157
|
+
}),
|
|
158
|
+
...(typeof browserControls === 'object'
|
|
159
|
+
? {
|
|
160
|
+
browserControls: {
|
|
161
|
+
...browserControls,
|
|
162
|
+
},
|
|
163
|
+
}
|
|
164
|
+
: browserControls == null
|
|
165
|
+
? {}
|
|
166
|
+
: { browserControls }),
|
|
167
|
+
...(turningMethod == null
|
|
168
|
+
? {}
|
|
169
|
+
: {
|
|
170
|
+
turningMethod: TURNING_METHOD[turningMethod],
|
|
171
|
+
}),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (source.grabbing != null) {
|
|
176
|
+
features.grabbing =
|
|
177
|
+
typeof source.grabbing === 'boolean'
|
|
178
|
+
? source.grabbing
|
|
179
|
+
: { ...source.grabbing };
|
|
180
|
+
}
|
|
181
|
+
if (source.physics != null) {
|
|
182
|
+
features.physics = source.physics;
|
|
183
|
+
}
|
|
184
|
+
if (source.sceneUnderstanding != null) {
|
|
185
|
+
features.sceneUnderstanding =
|
|
186
|
+
typeof source.sceneUnderstanding === 'boolean'
|
|
187
|
+
? source.sceneUnderstanding
|
|
188
|
+
: { ...source.sceneUnderstanding };
|
|
189
|
+
}
|
|
190
|
+
if (source.environmentRaycast != null) {
|
|
191
|
+
features.environmentRaycast = source.environmentRaycast;
|
|
192
|
+
}
|
|
193
|
+
if (source.camera != null) {
|
|
194
|
+
features.camera = source.camera;
|
|
195
|
+
}
|
|
196
|
+
if (source.spatialUI != null) {
|
|
197
|
+
features.spatialUI =
|
|
198
|
+
typeof source.spatialUI === 'boolean'
|
|
199
|
+
? source.spatialUI
|
|
200
|
+
: { ...source.spatialUI };
|
|
201
|
+
}
|
|
202
|
+
return features;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export { normalizeProjectDevOptions, normalizeProjectModuleSourcePath, normalizeProjectWorldOptions, projectRegexSpecToRegExp };
|
|
206
|
+
//# sourceMappingURL=normalize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize.js","sources":["../../src/project/normalize.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAAA;;;;;AAKG;AAmBH,MAAM,cAAc,GAAG;AACrB,IAAA,IAAI,EAAE,CAAC;AACP,IAAA,MAAM,EAAE,CAAC;CACD;AAEV;;;AAGG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QAAA,QAAQ,CAAC,QAAQ;AACf,YAAA,OAAO,MAAM,CAAC,QAAQ,KAAK;kBACvB,MAAM,CAAC;AACT,kBAAE,EAAE,GAAG,MAAM,CAAC,QAAQ,EAAE;IAC9B;AACA,IAAA,IAAI,MAAM,CAAC,OAAO,IAAI,IAAI,EAAE;AAC1B,QAAA,QAAQ,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO;IACnC;AACA,IAAA,IAAI,MAAM,CAAC,kBAAkB,IAAI,IAAI,EAAE;AACrC,QAAA,QAAQ,CAAC,kBAAkB;AACzB,YAAA,OAAO,MAAM,CAAC,kBAAkB,KAAK;kBACjC,MAAM,CAAC;AACT,kBAAE,EAAE,GAAG,MAAM,CAAC,kBAAkB,EAAE;IACxC;AACA,IAAA,IAAI,MAAM,CAAC,kBAAkB,IAAI,IAAI,EAAE;AACrC,QAAA,QAAQ,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB;IACzD;AACA,IAAA,IAAI,MAAM,CAAC,MAAM,IAAI,IAAI,EAAE;AACzB,QAAA,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM;IACjC;AACA,IAAA,IAAI,MAAM,CAAC,SAAS,IAAI,IAAI,EAAE;AAC5B,QAAA,QAAQ,CAAC,SAAS;AAChB,YAAA,OAAO,MAAM,CAAC,SAAS,KAAK;kBACxB,MAAM,CAAC;AACT,kBAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE;IAC/B;AACA,IAAA,OAAO,QAAQ;AACjB;;;;"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export type ProjectSourcePathKind = 'module' | 'scene';
|
|
8
|
+
/** Error raised when a project source path is not lexically root-confined. */
|
|
9
|
+
export declare class ProjectSourcePathError extends Error {
|
|
10
|
+
readonly sourcePath: string;
|
|
11
|
+
readonly kind: ProjectSourcePathKind;
|
|
12
|
+
constructor(sourcePath: string, kind: ProjectSourcePathKind, message: string);
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Validate and normalize a project-owned source path without filesystem or
|
|
16
|
+
* Node dependencies. Returned paths always begin with `./` and use `/`.
|
|
17
|
+
*/
|
|
18
|
+
export declare function normalizeProjectSourcePath(sourcePath: string, kind: ProjectSourcePathKind): string;
|
|
19
|
+
/** Convert a validated public scene source path into its runtime URL. */
|
|
20
|
+
export declare function projectSceneSourcePathToRuntimeUrl(sourcePath: string): string;
|
|
21
|
+
//# sourceMappingURL=paths.d.ts.map
|