rhodonite 0.19.9 → 0.20.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 +32 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/effekseer/main.d.ts +3 -1
- package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esm/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esm/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esm/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esm/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esm/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esm/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esm/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esm/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esm/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esm/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esm/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esm/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esm/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esm/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esm/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esm/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esm/foundation/components/index.d.ts +3 -0
- package/dist/esm/foundation/core/Component.d.ts +63 -3
- package/dist/esm/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esm/foundation/core/Config.d.ts +8 -7
- package/dist/esm/foundation/core/Entity.d.ts +15 -0
- package/dist/esm/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esm/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esm/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esm/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esm/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esm/foundation/geometry/index.d.ts +1 -0
- package/dist/esm/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esm/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esm/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esm/foundation/gizmos/index.d.ts +1 -0
- package/dist/esm/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esm/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esm/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esm/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esm/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esm/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esm/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esm/foundation/importer/index.d.ts +2 -0
- package/dist/esm/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esm/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esm/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esm/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esm/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esm/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esm/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esm/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esm/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esm/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esm/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esm/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esm/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esm/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esm/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esm/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esm/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esm/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esm/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esm/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esm/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esm/foundation/math/Scalar.d.ts +13 -14
- package/dist/esm/foundation/math/Vector2.d.ts +38 -38
- package/dist/esm/foundation/math/Vector3.d.ts +55 -54
- package/dist/esm/foundation/math/Vector4.d.ts +54 -55
- package/dist/esm/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esm/foundation/misc/Time.d.ts +10 -1
- package/dist/esm/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esm/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esm/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esm/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esm/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esm/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esm/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esm/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esm/foundation/physics/index.d.ts +2 -0
- package/dist/esm/index.js +728 -723
- package/dist/esm/types/AnimationTypes.d.ts +1 -1
- package/dist/esm/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esm/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esm/types/VRMC.d.ts +12 -12
- package/dist/esm/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esm/types/glTF2.d.ts +8 -0
- package/dist/esm/types/index.d.ts +2 -0
- package/dist/esm/webgl/main.d.ts +2 -1
- package/dist/esm/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/dist/esmdev/effekseer/main.d.ts +3 -1
- package/dist/esmdev/foundation/components/Animation/AnimationComponent.d.ts +15 -1
- package/dist/esmdev/foundation/components/Animation/AnimationStateRepository.d.ts +26 -10
- package/dist/esmdev/foundation/components/AnimationState/AnimationStateComponent.d.ts +14 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterAnimationController.d.ts +63 -0
- package/dist/esmdev/foundation/components/CharacterController/CharacterControllerComponent.d.ts +67 -0
- package/dist/esmdev/foundation/components/CharacterController/ICharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/createCharacterControllerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/CharacterController/index.d.ts +4 -0
- package/dist/esmdev/foundation/components/ComponentTypes.d.ts +6 -0
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.d.ts +27 -0
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +30 -0
- package/dist/esmdev/foundation/components/Shape/IShapeEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Shape/ShapeComponent.d.ts +43 -0
- package/dist/esmdev/foundation/components/Shape/createShapeEntity.d.ts +3 -0
- package/dist/esmdev/foundation/components/Shape/index.d.ts +3 -0
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +138 -45
- package/dist/esmdev/foundation/components/Transform/TransformComponent.d.ts +2 -3
- package/dist/esmdev/foundation/components/Trigger/ITriggerEntity.d.ts +4 -0
- package/dist/esmdev/foundation/components/Trigger/TriggerComponent.d.ts +58 -0
- package/dist/esmdev/foundation/components/Trigger/index.d.ts +2 -0
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.d.ts +16 -1
- package/dist/esmdev/foundation/components/WellKnownComponentTIDs.d.ts +4 -1
- package/dist/esmdev/foundation/components/index.d.ts +3 -0
- package/dist/esmdev/foundation/core/Component.d.ts +63 -3
- package/dist/esmdev/foundation/core/ComponentMemoryRegistry.d.ts +59 -1
- package/dist/esmdev/foundation/core/Config.d.ts +8 -7
- package/dist/esmdev/foundation/core/Entity.d.ts +15 -0
- package/dist/esmdev/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esmdev/foundation/definitions/PhysicsShapeType.d.ts +1 -0
- package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +8 -4
- package/dist/esmdev/foundation/exporter/Gltf2ExporterOps.d.ts +2 -0
- package/dist/esmdev/foundation/geometry/Shape.d.ts +35 -0
- package/dist/esmdev/foundation/geometry/index.d.ts +1 -0
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.d.ts +16 -0
- package/dist/esmdev/foundation/geometry/shapes/index.d.ts +1 -0
- package/dist/esmdev/foundation/gizmos/ShapeGizmo.d.ts +22 -0
- package/dist/esmdev/foundation/gizmos/index.d.ts +1 -0
- package/dist/esmdev/foundation/helpers/EntityHelper.d.ts +6 -0
- package/dist/esmdev/foundation/helpers/MeshHelper.d.ts +275 -15
- package/dist/esmdev/foundation/importer/AnimationAssigner.d.ts +62 -3
- package/dist/esmdev/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esmdev/foundation/importer/Gltf2Importer.d.ts +6 -0
- package/dist/esmdev/foundation/importer/KhrPhysicsImporter.d.ts +58 -0
- package/dist/esmdev/foundation/importer/VrmaImporter.d.ts +11 -3
- package/dist/esmdev/foundation/importer/index.d.ts +2 -0
- package/dist/esmdev/foundation/math/AbstractMatrix.d.ts +3 -2
- package/dist/esmdev/foundation/math/AbstractQuaternion.d.ts +2 -1
- package/dist/esmdev/foundation/math/AnimatedQuaternion.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedScalar.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector2.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector3.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVector4.d.ts +4 -0
- package/dist/esmdev/foundation/math/AnimatedVectorN.d.ts +4 -0
- package/dist/esmdev/foundation/math/IAnimatedValue.d.ts +12 -0
- package/dist/esmdev/foundation/math/IMatrix.d.ts +2 -2
- package/dist/esmdev/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esmdev/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esmdev/foundation/math/MathUtil.d.ts +63 -1
- package/dist/esmdev/foundation/math/Matrix22.d.ts +176 -30
- package/dist/esmdev/foundation/math/Matrix33.d.ts +206 -38
- package/dist/esmdev/foundation/math/Matrix44.d.ts +222 -39
- package/dist/esmdev/foundation/math/MutableMatrix22.d.ts +125 -130
- package/dist/esmdev/foundation/math/MutableMatrix33.d.ts +148 -162
- package/dist/esmdev/foundation/math/MutableMatrix44.d.ts +159 -183
- package/dist/esmdev/foundation/math/MutableQuaternion.d.ts +241 -132
- package/dist/esmdev/foundation/math/MutableScalar.d.ts +11 -12
- package/dist/esmdev/foundation/math/MutableVector2.d.ts +30 -31
- package/dist/esmdev/foundation/math/MutableVector3.d.ts +28 -26
- package/dist/esmdev/foundation/math/MutableVector4.d.ts +37 -37
- package/dist/esmdev/foundation/math/Quaternion.d.ts +529 -36
- package/dist/esmdev/foundation/math/Scalar.d.ts +13 -14
- package/dist/esmdev/foundation/math/Vector2.d.ts +38 -38
- package/dist/esmdev/foundation/math/Vector3.d.ts +55 -54
- package/dist/esmdev/foundation/math/Vector4.d.ts +54 -55
- package/dist/esmdev/foundation/misc/MiscUtil.d.ts +79 -16
- package/dist/esmdev/foundation/misc/Time.d.ts +10 -1
- package/dist/esmdev/foundation/physics/CharacterControllerStrategy.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +17 -1
- package/dist/esmdev/foundation/physics/PhysicsProperty.d.ts +43 -0
- package/dist/esmdev/foundation/physics/PhysicsStrategy.d.ts +15 -0
- package/dist/esmdev/foundation/physics/PhysicsWorldQuery.d.ts +65 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +58 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +157 -19
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsWorldQueryStrategy.d.ts +11 -0
- package/dist/esmdev/foundation/physics/Rapier/index.d.ts +2 -0
- package/dist/esmdev/foundation/physics/ShapeTransformResolver.d.ts +19 -0
- package/dist/esmdev/foundation/physics/index.d.ts +2 -0
- package/dist/esmdev/index.js +35168 -27712
- package/dist/esmdev/types/AnimationTypes.d.ts +1 -1
- package/dist/esmdev/types/KHR_implicit_shapes.d.ts +47 -0
- package/dist/esmdev/types/KHR_physics_rigid_bodies.d.ts +54 -0
- package/dist/esmdev/types/VRMC.d.ts +12 -12
- package/dist/esmdev/types/VRMC_vrm_animation.d.ts +5 -0
- package/dist/esmdev/types/glTF2.d.ts +8 -0
- package/dist/esmdev/types/index.d.ts +2 -0
- package/dist/esmdev/webgl/main.d.ts +2 -1
- package/dist/esmdev/webgl/textureLoader/KTX2TextureLoader.d.ts +12 -0
- package/package.json +25 -23
package/README.md
CHANGED
|
@@ -207,8 +207,24 @@ The following command runs unit tests and E2E tests.
|
|
|
207
207
|
$ pnpm run test
|
|
208
208
|
```
|
|
209
209
|
|
|
210
|
-
The E2E test uses a headless browser for rendering.
|
|
211
|
-
|
|
210
|
+
The E2E test uses a headless browser for rendering. The reference images are generated in the CI environment: Ubuntu + Mesa's software stack (llvmpipe for GL/WebGL2, lavapipe for Vulkan) and Chromium's "WebGPU on Vulkan via GL interop" path, which is what makes WebGPU canvases capturable without a GPU. That environment is available locally as a Docker container, so the strict check and the reference images are reproducible on any machine:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
$ pnpm test-e2e:docker # strict run in the reference environment
|
|
214
|
+
$ pnpm test-e2e:docker:update # regenerate all reference images
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Running the suite natively (for example on macOS with a real GPU) renders slightly differently from the software rasterizer (measured at up to ~1%, mostly IBL samples), so native runs apply a 2% tolerance floor (`E2E_NON_REFERENCE_FAILURE_THRESHOLD`). CI runs on the `ubuntu-24.04-arm` runner and compares with the same strict thresholds as the container (`E2E_REFERENCE_FAILURE_THRESHOLD`, default `0`); the arm64 image is used because llvmpipe renders slightly differently on x64. If a hosted runner ever renders differently from the machine that generated the reference images, that floor can be raised for CI only.
|
|
218
|
+
|
|
219
|
+
If a Linux environment cannot provide the GL/Vulkan interop (no Mesa, or the flags are opted out), WebGPU canvases stay blank. In that case run the WebGPU cases as smoke tests:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
$ E2E_WEBGPU_SMOKE=1 pnpm run test-e2e
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
With `E2E_WEBGPU_SMOKE=1` the WebGPU samples only have to reach their render loop; no screenshot comparison is performed.
|
|
226
|
+
|
|
227
|
+
The E2E runner passes the Mesa-specific flags automatically on Linux. Set `E2E_SOFTWARE_RENDERING=0` to opt out, or `PUPPETEER_EXECUTABLE_PATH` to use a specific Chrome binary. `E2E_REFERENCE_FAILURE_THRESHOLD` (percent, default `0`) is a tolerance floor for the reference environment; CI sets it to `5` because GitHub's hosted runners use a different CPU/instance than the machine that generated the reference images (a few sensitive samples differ by up to ~3.5%). `E2E_NON_REFERENCE_FAILURE_THRESHOLD` (default `2`, percent) is the floor used outside the reference environment; `E2E_REFERENCE_ENVIRONMENT=0` forces that floor on Linux too.
|
|
212
228
|
|
|
213
229
|
You can execute a part of tests like this.
|
|
214
230
|
|
|
@@ -228,6 +244,20 @@ $ pnpm run test-unit-part -- ./src/foundation/core/Entity.test.ts
|
|
|
228
244
|
$ pnpm run test-e2e-part -- ./samples/test_e2e/DataTextureInstancedDrawing
|
|
229
245
|
```
|
|
230
246
|
|
|
247
|
+
### Running the E2E suite in the CI environment (Docker)
|
|
248
|
+
|
|
249
|
+
The E2E job runs on `ubuntu-latest` with Mesa's software stack (llvmpipe for GL, lavapipe for Vulkan). To reproduce exactly the same environment on any machine with Docker:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
$ pnpm test-e2e:docker # run the full E2E suite in the container
|
|
253
|
+
$ pnpm test-e2e:docker:update # regenerate all reference images in the container
|
|
254
|
+
$ pnpm test-e2e:docker:shell # open a shell inside the container
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
The repository is mounted into the container, but `node_modules`, `dist`, the pnpm store and the Puppeteer browser cache live in Docker volumes, so the host installation is never modified. The first run builds the image and downloads Chrome (a few minutes); later runs only rebuild the library and run the tests.
|
|
258
|
+
|
|
259
|
+
The reference images are generated by this container (`pnpm test-e2e:docker:update`), so the container is the source of truth: it compares strictly against them, while native runs apply the tolerance floor described above.
|
|
260
|
+
|
|
231
261
|
## Development using VSCode devcontainer
|
|
232
262
|
|
|
233
263
|
This project supports the VSCode devcontainer for any docker-installed OS.
|
package/VERSION-FILE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
v0.
|
|
1
|
+
v0.20.0-1-g556e99a8a-dirty
|
|
2
2
|
main
|
|
@@ -3,7 +3,9 @@ import type { ITransformEntityMethods } from '../foundation/components/Transform
|
|
|
3
3
|
import type { IEntity } from '../foundation/core/Entity';
|
|
4
4
|
import type { Engine } from '../foundation/system/Engine';
|
|
5
5
|
import { EffekseerComponent, type IEffekseerEntityMethods } from './EffekseerComponent';
|
|
6
|
+
declare const createEffekseerEntity: (engine: Engine) => IEntity & ITransformEntityMethods & ISceneGraphEntityMethods & IEffekseerEntityMethods;
|
|
6
7
|
export declare const Effekseer: Readonly<{
|
|
7
8
|
EffekseerComponent: typeof EffekseerComponent;
|
|
8
|
-
createEffekseerEntity:
|
|
9
|
+
createEffekseerEntity: typeof createEffekseerEntity;
|
|
9
10
|
}>;
|
|
11
|
+
export {};
|
|
@@ -61,6 +61,12 @@ export declare class AnimationComponent extends Component {
|
|
|
61
61
|
* @param value - The blending ratio value between 0 and 1
|
|
62
62
|
*/
|
|
63
63
|
set animationBlendingRatio(value: number);
|
|
64
|
+
/**
|
|
65
|
+
* Updates the animation blending ratio without evaluating animation channels immediately.
|
|
66
|
+
* @param value - The blending ratio value between 0 and 1
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
_setAnimationBlendingRatioWithoutApplying(value: number): void;
|
|
64
70
|
/**
|
|
65
71
|
* Gets the current animation blending ratio.
|
|
66
72
|
* @returns The blending ratio value between 0 and 1
|
|
@@ -251,6 +257,7 @@ export declare class AnimationComponent extends Component {
|
|
|
251
257
|
* @returns The animation global info map for the engine
|
|
252
258
|
*/
|
|
253
259
|
static getAnimationGlobalInfo(engine: Engine): Map<AnimationTrackName, AnimationInfo>;
|
|
260
|
+
private static __recalculateAnimationInfo;
|
|
254
261
|
/**
|
|
255
262
|
* Sets the animation state for the specified engine.
|
|
256
263
|
* @param engine - The engine instance to set the animation state for
|
|
@@ -285,10 +292,11 @@ export declare class AnimationComponent extends Component {
|
|
|
285
292
|
* Sets up animation retargeting from a source entity to this entity.
|
|
286
293
|
* @param retarget - The retargeting interface that defines how to map animations
|
|
287
294
|
* @param postfixToTrackName - Optional postfix to append to track names
|
|
295
|
+
* @param excludedPathNames - Animation paths to omit while copying source tracks
|
|
288
296
|
* @returns An array of created track names
|
|
289
297
|
* @private
|
|
290
298
|
*/
|
|
291
|
-
_setRetarget(retarget: IAnimationRetarget, postfixToTrackName?: string): string[];
|
|
299
|
+
_setRetarget(retarget: IAnimationRetarget, postfixToTrackName?: string, excludedPathNames?: readonly AnimationPathName[]): string[];
|
|
292
300
|
/**
|
|
293
301
|
* Resets all animation tracks, clearing all animation data from this component.
|
|
294
302
|
*/
|
|
@@ -304,6 +312,12 @@ export declare class AnimationComponent extends Component {
|
|
|
304
312
|
*/
|
|
305
313
|
resetAnimationTrackByPostfix(postfix: string): void;
|
|
306
314
|
currentTrackFeatureHash(): number | undefined;
|
|
315
|
+
/**
|
|
316
|
+
* Gets the feature hash for a specific animation track.
|
|
317
|
+
* @param trackName - The animation track whose feature hash should be returned
|
|
318
|
+
* @returns The feature hash, or undefined when the track is not registered
|
|
319
|
+
*/
|
|
320
|
+
getAnimationTrackFeatureHash(trackName: AnimationTrackName): number | undefined;
|
|
307
321
|
/**
|
|
308
322
|
* Destroys this component, cleaning up resources and clearing animation data.
|
|
309
323
|
* @override
|
|
@@ -24,11 +24,17 @@ export declare class AnimationStateRepository {
|
|
|
24
24
|
*/
|
|
25
25
|
private static __previousFrameCachedEntityUIDsMap;
|
|
26
26
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
27
|
+
* Process-frame tokens used to scope skinning-cache work to one Engine.process() call.
|
|
28
|
+
* These are intentionally separate from animation playback time: local-time animations
|
|
29
|
+
* may advance while the global animation clock remains unchanged.
|
|
30
|
+
*/
|
|
31
|
+
private static __processFrameTokenMap;
|
|
32
|
+
private static __nextProcessFrameToken;
|
|
33
|
+
/**
|
|
34
|
+
* Tracks the last process-frame token that swapped cached EntityUID sets.
|
|
29
35
|
* Managed per Engine instance for multi-engine support.
|
|
30
36
|
*/
|
|
31
|
-
private static
|
|
37
|
+
private static __lastCacheFrameTokenMap;
|
|
32
38
|
/**
|
|
33
39
|
* Maps each cache key to the EntityUID of its "leader" SkeletalComponent.
|
|
34
40
|
* The leader is the first SkeletalComponent to compute skinning for a given cache key.
|
|
@@ -71,25 +77,35 @@ export declare class AnimationStateRepository {
|
|
|
71
77
|
static getOrCreatePreviousFrameCachedEntityUIDs(engine: Engine): Set<EntityUID>;
|
|
72
78
|
static setCurrentFrameCachedEntityUIDs(engine: Engine, set: Set<EntityUID>): void;
|
|
73
79
|
static setPreviousFrameCachedEntityUIDs(engine: Engine, set: Set<EntityUID>): void;
|
|
74
|
-
|
|
75
|
-
|
|
80
|
+
/**
|
|
81
|
+
* Starts a new process frame for skinning-cache purposes.
|
|
82
|
+
* The token is globally unique so the static skinning cache cannot be shared across engines.
|
|
83
|
+
*/
|
|
84
|
+
static beginProcessFrame(engine: Engine): number;
|
|
85
|
+
/**
|
|
86
|
+
* Gets the current process-frame token. A lazily-created token keeps manual component
|
|
87
|
+
* processing safe before the first Engine.process() call.
|
|
88
|
+
*/
|
|
89
|
+
static getProcessFrameToken(engine: Engine): number;
|
|
90
|
+
static getLastCacheFrameToken(engine: Engine): number;
|
|
91
|
+
static setLastCacheFrameToken(engine: Engine, token: number): void;
|
|
76
92
|
static getOrCreateCacheLeaders(engine: Engine): Map<string, EntityUID>;
|
|
77
93
|
static getOrCreateLeaderJointIndexToEntityUID(engine: Engine): Map<number, EntityUID>;
|
|
78
94
|
/**
|
|
79
95
|
* Handles frame transition by swapping current/previous cached entity UIDs.
|
|
80
|
-
* Should be called when a new frame starts
|
|
96
|
+
* Should be called when a new Engine.process() frame starts.
|
|
81
97
|
* @param engine - The engine instance
|
|
82
|
-
* @param
|
|
98
|
+
* @param currentProcessFrameToken - The current Engine.process() frame token
|
|
83
99
|
* @returns True if frame transition occurred, false otherwise
|
|
84
100
|
*/
|
|
85
|
-
static handleFrameTransitionIfNeeded(engine: Engine,
|
|
101
|
+
static handleFrameTransitionIfNeeded(engine: Engine, currentProcessFrameToken: number): boolean;
|
|
86
102
|
/**
|
|
87
103
|
* Handles frame transition and clears leader tracking.
|
|
88
104
|
* Used by SkeletalComponent.isEntityCached which runs before SkeletalComponent.$logic.
|
|
89
105
|
* @param engine - The engine instance
|
|
90
|
-
* @param
|
|
106
|
+
* @param currentProcessFrameToken - The current Engine.process() frame token
|
|
91
107
|
*/
|
|
92
|
-
static handleFrameTransitionWithLeaderClear(engine: Engine,
|
|
108
|
+
static handleFrameTransitionWithLeaderClear(engine: Engine, currentProcessFrameToken: number): void;
|
|
93
109
|
/**
|
|
94
110
|
* Checks if an entity's AnimationComponent can perform early return.
|
|
95
111
|
*
|
|
@@ -68,12 +68,26 @@ export declare class AnimationStateComponent extends Component {
|
|
|
68
68
|
* @param animationTrackName - The name of the animation track to set as active
|
|
69
69
|
*/
|
|
70
70
|
setActiveAnimationTrack(animationTrackName: AnimationTrackName): void;
|
|
71
|
+
/**
|
|
72
|
+
* Rebinds a replaced first animation track without resetting the current blend.
|
|
73
|
+
* The logical current track is updated only when it referred to the replaced track.
|
|
74
|
+
* @param replacedAnimationTrackName - The name of the first track that was replaced
|
|
75
|
+
* @param replacementAnimationTrackName - The name of the replacement first track
|
|
76
|
+
*/
|
|
77
|
+
replaceFirstActiveAnimationTrack(replacedAnimationTrackName: AnimationTrackName, replacementAnimationTrackName: AnimationTrackName): void;
|
|
71
78
|
/**
|
|
72
79
|
* Sets the second active animation track for blending purposes.
|
|
73
80
|
* This track is used as the target during animation transitions.
|
|
74
81
|
* @param animationTrackName - The name of the animation track to set as the second active track
|
|
75
82
|
*/
|
|
76
83
|
setSecondActiveAnimationTrack(animationTrackName: AnimationTrackName): void;
|
|
84
|
+
/**
|
|
85
|
+
* Rebinds a replaced second animation track without restarting the current blend.
|
|
86
|
+
* The logical current track is updated only when it referred to the replaced track.
|
|
87
|
+
* @param replacedAnimationTrackName - The name of the second track that was replaced
|
|
88
|
+
* @param replacementAnimationTrackName - The name of the replacement second track
|
|
89
|
+
*/
|
|
90
|
+
replaceSecondActiveAnimationTrack(replacedAnimationTrackName: AnimationTrackName, replacementAnimationTrackName: AnimationTrackName): void;
|
|
77
91
|
/**
|
|
78
92
|
* Sets whether animations should use global time for synchronization.
|
|
79
93
|
* Applies the setting recursively to this entity and all its children.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { AnimationTrackName } from '../../../types/AnimationTypes';
|
|
2
|
+
import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
3
|
+
import type { CharacterControllerComponent } from './CharacterControllerComponent';
|
|
4
|
+
export type CharacterAnimationSemantic = 'idle' | 'walk' | 'run' | 'jump' | 'fall' | 'landing' | 'slide';
|
|
5
|
+
export type CharacterAnimationMapping = Partial<Record<CharacterAnimationSemantic, readonly AnimationTrackName[]>>;
|
|
6
|
+
export interface CharacterAnimationControllerOptions {
|
|
7
|
+
walkSpeedThreshold?: number;
|
|
8
|
+
referenceWalkSpeed?: number;
|
|
9
|
+
runSpeedThreshold?: number;
|
|
10
|
+
referenceRunSpeed?: number;
|
|
11
|
+
minPlaybackSpeed?: number;
|
|
12
|
+
maxPlaybackSpeed?: number;
|
|
13
|
+
crossFadeDuration?: number;
|
|
14
|
+
}
|
|
15
|
+
export interface CharacterAnimationSelection {
|
|
16
|
+
semantic: CharacterAnimationSemantic;
|
|
17
|
+
requestedTrack?: AnimationTrackName;
|
|
18
|
+
activeTrack?: AnimationTrackName;
|
|
19
|
+
playbackSpeed: number;
|
|
20
|
+
isFallback: boolean;
|
|
21
|
+
hasTrack: boolean;
|
|
22
|
+
isOneShotPlaying: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Maps character movement state to animation tracks and controls playback transitions.
|
|
26
|
+
*
|
|
27
|
+
* When tracks come from external VRMA files, assign them to `animationRoot` before creating
|
|
28
|
+
* this controller. `AnimationAssigner.assignCharacterAnimationsWithVrma()` returns the
|
|
29
|
+
* `CharacterAnimationMapping` accepted by this constructor. Grounded locomotion uses the
|
|
30
|
+
* requested movement speed when it is available, so collision correction on steps does not
|
|
31
|
+
* repeatedly switch walk and run tracks.
|
|
32
|
+
*/
|
|
33
|
+
export declare class CharacterAnimationController {
|
|
34
|
+
private readonly __characterController;
|
|
35
|
+
private readonly __animationRoot;
|
|
36
|
+
private readonly __options;
|
|
37
|
+
private readonly __mapping;
|
|
38
|
+
private readonly __availableTracks;
|
|
39
|
+
private readonly __animationState?;
|
|
40
|
+
private __selection;
|
|
41
|
+
private __playbackTime;
|
|
42
|
+
private __hasSelectedTrack;
|
|
43
|
+
private __oneShotEndTime?;
|
|
44
|
+
private __destroyed;
|
|
45
|
+
constructor(__characterController: CharacterControllerComponent, __animationRoot: ISceneGraphEntity, mapping?: CharacterAnimationMapping, options?: CharacterAnimationControllerOptions);
|
|
46
|
+
get selection(): CharacterAnimationSelection;
|
|
47
|
+
get availableTracks(): readonly AnimationTrackName[];
|
|
48
|
+
/**
|
|
49
|
+
* Applies an initial track immediately, without blending from the rest pose.
|
|
50
|
+
* Call this before the first `engine.process()` when a character should
|
|
51
|
+
* appear in a known pose from its first rendered frame.
|
|
52
|
+
*/
|
|
53
|
+
initialize(semantic?: CharacterAnimationSemantic): void;
|
|
54
|
+
update(deltaTime: number): void;
|
|
55
|
+
destroy(): void;
|
|
56
|
+
private __resolveSemantic;
|
|
57
|
+
private __resolveTrack;
|
|
58
|
+
private __activateTrack;
|
|
59
|
+
private __resolvePlaybackSpeed;
|
|
60
|
+
private __getLocomotionSpeed;
|
|
61
|
+
private __collectAnimationTracks;
|
|
62
|
+
private __validateOptions;
|
|
63
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { ComponentSID, ComponentTID, EntityUID } from '../../../types/CommonTypes';
|
|
2
|
+
import { Component } from '../../core/Component';
|
|
3
|
+
import type { IEntity } from '../../core/Entity';
|
|
4
|
+
import { type EntityRepository } from '../../core/EntityRepository';
|
|
5
|
+
import { type IVector3 } from '../../math';
|
|
6
|
+
import type { CharacterControllerOptions, CharacterControllerStrategy, CharacterGroundContact, CharacterMotionState } from '../../physics/CharacterControllerStrategy';
|
|
7
|
+
import type { Engine } from '../../system/Engine';
|
|
8
|
+
import { type EventSubscriberIndex } from '../../system/EventPubSub';
|
|
9
|
+
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
10
|
+
export type CharacterControllerEventType = 'stateChanged' | 'landed';
|
|
11
|
+
export interface CharacterControllerStateChangedEvent {
|
|
12
|
+
type: 'stateChanged';
|
|
13
|
+
component: CharacterControllerComponent;
|
|
14
|
+
entity: IEntity;
|
|
15
|
+
previous: CharacterMotionState;
|
|
16
|
+
current: CharacterMotionState;
|
|
17
|
+
}
|
|
18
|
+
export interface CharacterControllerLandedEvent {
|
|
19
|
+
type: 'landed';
|
|
20
|
+
component: CharacterControllerComponent;
|
|
21
|
+
entity: IEntity;
|
|
22
|
+
impactSpeed: number;
|
|
23
|
+
groundContact?: CharacterGroundContact;
|
|
24
|
+
}
|
|
25
|
+
export type CharacterControllerEvent = CharacterControllerStateChangedEvent | CharacterControllerLandedEvent;
|
|
26
|
+
/** ECS component for a backend-neutral kinematic character controller. */
|
|
27
|
+
export declare class CharacterControllerComponent extends Component {
|
|
28
|
+
private __strategy?;
|
|
29
|
+
private readonly __zeroMovement;
|
|
30
|
+
private readonly __pubsub;
|
|
31
|
+
private __lastObservedMotionState;
|
|
32
|
+
private __desiredHorizontalSpeed?;
|
|
33
|
+
private __generatedShapeComponent?;
|
|
34
|
+
private __generatedShapeIndex?;
|
|
35
|
+
private __ownsGeneratedShapeComponent;
|
|
36
|
+
constructor(engine: Engine, entityUid: EntityUID, componentSid: ComponentSID, entityRepository: EntityRepository, isReUse: boolean);
|
|
37
|
+
static get componentTID(): 17;
|
|
38
|
+
get componentTID(): ComponentTID;
|
|
39
|
+
static common_$logic({ engine }: {
|
|
40
|
+
engine: Engine;
|
|
41
|
+
}): void;
|
|
42
|
+
$logic(): void;
|
|
43
|
+
setup(strategy: CharacterControllerStrategy, options?: CharacterControllerOptions): void;
|
|
44
|
+
setDesiredHorizontalVelocity(velocity: IVector3): void;
|
|
45
|
+
/**
|
|
46
|
+
* Horizontal speed requested through {@link setDesiredHorizontalVelocity}, before
|
|
47
|
+
* collision and step correction. It is undefined until a desired velocity is supplied.
|
|
48
|
+
*/
|
|
49
|
+
get desiredHorizontalSpeed(): number | undefined;
|
|
50
|
+
requestJump(): void;
|
|
51
|
+
teleport(position: IVector3): void;
|
|
52
|
+
get isGrounded(): boolean;
|
|
53
|
+
get computedMovement(): IVector3;
|
|
54
|
+
/** Detailed ground information from the controller's foot probe. */
|
|
55
|
+
get groundContact(): CharacterGroundContact | undefined;
|
|
56
|
+
/** True during a frame where obstacle-stuck recovery adjusted movement. */
|
|
57
|
+
get isRecovering(): boolean;
|
|
58
|
+
get motionState(): CharacterMotionState;
|
|
59
|
+
subscribe(type: 'stateChanged', handler: (event: CharacterControllerStateChangedEvent) => void): EventSubscriberIndex;
|
|
60
|
+
subscribe(type: 'landed', handler: (event: CharacterControllerLandedEvent) => void): EventSubscriberIndex;
|
|
61
|
+
unsubscribe(type: CharacterControllerEventType, index: EventSubscriberIndex): void;
|
|
62
|
+
set enabled(value: boolean);
|
|
63
|
+
get enabled(): boolean;
|
|
64
|
+
_destroy(): void;
|
|
65
|
+
private __cleanupGeneratedShape;
|
|
66
|
+
addThisComponentToEntity<EntityBase extends IEntity, SomeComponentClass extends typeof Component>(base: EntityBase, _componentClass: SomeComponentClass): ComponentToComponentMethods<SomeComponentClass> & EntityBase;
|
|
67
|
+
}
|
package/dist/esm/foundation/components/CharacterController/createCharacterControllerEntity.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Engine } from '../../system/Engine';
|
|
2
|
+
import type { IShapeEntityMethods } from '../Shape/IShapeEntity';
|
|
3
|
+
import type { ICharacterControllerEntityMethods } from './ICharacterControllerEntity';
|
|
4
|
+
export declare function createCharacterControllerEntity(engine: Engine): (import("../..").IEntity & import("..").ITransformEntityMethods & import("..").ISceneGraphEntityMethods & IShapeEntityMethods) & ICharacterControllerEntityMethods;
|
|
@@ -6,6 +6,7 @@ import type { IAnimationStateEntityMethods } from './AnimationState';
|
|
|
6
6
|
import type { IBlendShapeEntityMethods } from './BlendShape/IBlendShapeEntity';
|
|
7
7
|
import type { ICameraEntityMethods } from './Camera/ICameraEntity';
|
|
8
8
|
import type { ICameraControllerEntityMethods } from './CameraController/ICameraControllerEntity';
|
|
9
|
+
import type { ICharacterControllerEntityMethods } from './CharacterController/ICharacterControllerEntity';
|
|
9
10
|
import type { IConstraintEntityMethods } from './Constraint/IConstraintEntity';
|
|
10
11
|
import type { ILightEntityMethods } from './Light/ILightEntity';
|
|
11
12
|
import type { IMeshEntityMethods } from './Mesh/IMeshEntity';
|
|
@@ -13,8 +14,10 @@ import type { IMeshRendererEntityMethods } from './MeshRenderer/IMeshRendererEnt
|
|
|
13
14
|
import type { IPhysicsEntityMethods } from './Physics/IPhysicsEntity';
|
|
14
15
|
import type { IRaymarchingEntityMethods } from './Raymarching/IRaymarchingEntity';
|
|
15
16
|
import type { ISceneGraphEntityMethods } from './SceneGraph/ISceneGraphEntity';
|
|
17
|
+
import type { IShapeEntityMethods } from './Shape/IShapeEntity';
|
|
16
18
|
import type { ISkeletalEntityMethods } from './Skeletal/ISkeletalEntity';
|
|
17
19
|
import type { ITransformEntityMethods } from './Transform/ITransformEntity';
|
|
20
|
+
import type { ITriggerEntityMethods } from './Trigger/ITriggerEntity';
|
|
18
21
|
import type { IVrmEntityMethods } from './Vrm/IVrmEntity';
|
|
19
22
|
import { WellKnownComponentTIDs } from './WellKnownComponentTIDs';
|
|
20
23
|
export type ComponentMixinFunction = <EntityBaseClass extends MixinBase>(baseClass: EntityBaseClass, components: (typeof Component)[]) => {
|
|
@@ -42,6 +45,9 @@ interface ComponentTIDToMethodsMap {
|
|
|
42
45
|
[WellKnownComponentTIDs.VrmComponentTID]: IVrmEntityMethods;
|
|
43
46
|
[WellKnownComponentTIDs.ConstraintComponentTID]: IConstraintEntityMethods;
|
|
44
47
|
[WellKnownComponentTIDs.RaymarchingComponentTID]: IRaymarchingEntityMethods;
|
|
48
|
+
[WellKnownComponentTIDs.CharacterControllerComponentTID]: ICharacterControllerEntityMethods;
|
|
49
|
+
[WellKnownComponentTIDs.ShapeComponentTID]: IShapeEntityMethods;
|
|
50
|
+
[WellKnownComponentTIDs.TriggerComponentTID]: ITriggerEntityMethods;
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Maps a Component class to its corresponding EntityMethods interface.
|
|
@@ -2,9 +2,17 @@ import type { ComponentSID, ComponentTID, EntityUID } from '../../../types/Commo
|
|
|
2
2
|
import { Component } from '../../core/Component';
|
|
3
3
|
import type { IEntity } from '../../core/Entity';
|
|
4
4
|
import { type EntityRepository } from '../../core/EntityRepository';
|
|
5
|
+
import type { PhysicsBodyProperty, PhysicsColliderProperty, PhysicsMotionProperty } from '../../physics/PhysicsProperty';
|
|
5
6
|
import type { PhysicsStrategy } from '../../physics/PhysicsStrategy';
|
|
6
7
|
import type { Engine } from '../../system/Engine';
|
|
7
8
|
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
9
|
+
import type { ShapeComponent } from '../Shape/ShapeComponent';
|
|
10
|
+
export type PhysicsShapeBinding = {
|
|
11
|
+
shapeComponent: ShapeComponent;
|
|
12
|
+
shapeIndex?: number;
|
|
13
|
+
body: PhysicsBodyProperty;
|
|
14
|
+
collider: PhysicsColliderProperty;
|
|
15
|
+
};
|
|
8
16
|
/**
|
|
9
17
|
* PhysicsComponent is a component that manages the physics simulation for an entity.
|
|
10
18
|
* It provides integration with physics engines through the strategy pattern and handles
|
|
@@ -12,6 +20,9 @@ import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
|
12
20
|
*/
|
|
13
21
|
export declare class PhysicsComponent extends Component {
|
|
14
22
|
private __strategy?;
|
|
23
|
+
private __shapeBindings;
|
|
24
|
+
private __nextShapeBindingId;
|
|
25
|
+
private __motion?;
|
|
15
26
|
/**
|
|
16
27
|
* Creates a new PhysicsComponent instance.
|
|
17
28
|
* @param engine - The engine instance
|
|
@@ -42,6 +53,22 @@ export declare class PhysicsComponent extends Component {
|
|
|
42
53
|
* @returns The physics strategy instance, or undefined if none is set
|
|
43
54
|
*/
|
|
44
55
|
get strategy(): PhysicsStrategy | undefined;
|
|
56
|
+
/** Sets properties shared by the complete rigid body and rebuilds its colliders. */
|
|
57
|
+
setMotionProperty(motion: PhysicsMotionProperty): void;
|
|
58
|
+
get motionProperty(): PhysicsMotionProperty | undefined;
|
|
59
|
+
/** Adds one generic ShapeComponent instance to this physical body. */
|
|
60
|
+
bindShape(binding: PhysicsShapeBinding): number;
|
|
61
|
+
updateShapeBinding(bindingId: number, binding: PhysicsShapeBinding): void;
|
|
62
|
+
removeShapeBinding(bindingId: number): boolean;
|
|
63
|
+
clearShapeBindings(): void;
|
|
64
|
+
rebuildShapeBindings(): void;
|
|
65
|
+
get shapeBindingCount(): number;
|
|
66
|
+
private __applyShapeBindingsTransaction;
|
|
67
|
+
private __applyShapeBindings;
|
|
68
|
+
private __applyBackendUpdate;
|
|
69
|
+
private static __copyBinding;
|
|
70
|
+
private __unregisterSensorBindings;
|
|
71
|
+
private static __copyMotion;
|
|
45
72
|
getVrmSpring(): import("../..").VRMSpring | undefined;
|
|
46
73
|
/**
|
|
47
74
|
* Common logic method that updates the global physics simulation.
|
|
@@ -27,6 +27,7 @@ export declare class SceneGraphComponent extends Component {
|
|
|
27
27
|
private __parent?;
|
|
28
28
|
private __children;
|
|
29
29
|
private __gizmoChildren;
|
|
30
|
+
private __physicsComponentCountInSubtree;
|
|
30
31
|
private _worldMatrix;
|
|
31
32
|
private _worldMatrixRest;
|
|
32
33
|
private _normalMatrix;
|
|
@@ -53,6 +54,9 @@ export declare class SceneGraphComponent extends Component {
|
|
|
53
54
|
jointIndex: number;
|
|
54
55
|
_isCulled: boolean;
|
|
55
56
|
private static readonly __originVector3;
|
|
57
|
+
private static readonly __axisX;
|
|
58
|
+
private static readonly __axisY;
|
|
59
|
+
private static readonly __axisZ;
|
|
56
60
|
private static returnVector3;
|
|
57
61
|
private static __sceneGraphs;
|
|
58
62
|
private static invertedMatrix44;
|
|
@@ -264,6 +268,25 @@ export declare class SceneGraphComponent extends Component {
|
|
|
264
268
|
get matrix(): MutableMatrix44;
|
|
265
269
|
setMatrixWithoutPhysics(matrix: IMatrix44): void;
|
|
266
270
|
setMatrixToPhysics(matrix: IMatrix44): void;
|
|
271
|
+
private __setMatrixToOwnPhysics;
|
|
272
|
+
private __syncDescendantPhysicsTransforms;
|
|
273
|
+
private __syncPhysicsTransformRecursively;
|
|
274
|
+
/**
|
|
275
|
+
* Records that this entity acquired a PhysicsComponent.
|
|
276
|
+
* @internal
|
|
277
|
+
*/
|
|
278
|
+
_onPhysicsComponentAdded(): void;
|
|
279
|
+
/**
|
|
280
|
+
* Records that this entity lost its PhysicsComponent.
|
|
281
|
+
* @internal
|
|
282
|
+
*/
|
|
283
|
+
_onPhysicsComponentRemoved(): void;
|
|
284
|
+
/**
|
|
285
|
+
* Returns whether this node or one of its descendants has a PhysicsComponent.
|
|
286
|
+
* @internal
|
|
287
|
+
*/
|
|
288
|
+
get _hasPhysicsComponentInSubtree(): boolean;
|
|
289
|
+
private __adjustPhysicsComponentCountInSubtree;
|
|
267
290
|
set matrix(matrix: MutableMatrix44);
|
|
268
291
|
/**
|
|
269
292
|
* Gets the internal world matrix in rest pose (mutable reference).
|
|
@@ -478,6 +501,7 @@ export declare class SceneGraphComponent extends Component {
|
|
|
478
501
|
* @param quat - The quaternion rotation to set in physics
|
|
479
502
|
*/
|
|
480
503
|
setRotationToPhysics(quat: IQuaternion): void;
|
|
504
|
+
private __syncPhysicsTransformsAfterRotation;
|
|
481
505
|
/**
|
|
482
506
|
* Updates the cached world rotation if it is dirty.
|
|
483
507
|
* This avoids repeated recursive traversal across the hierarchy.
|
|
@@ -521,6 +545,12 @@ export declare class SceneGraphComponent extends Component {
|
|
|
521
545
|
* @returns The world scale vector
|
|
522
546
|
*/
|
|
523
547
|
get scale(): MutableVector3;
|
|
548
|
+
/**
|
|
549
|
+
* Resolves world-scale magnitudes with signs relative to the entity's proper world rotation.
|
|
550
|
+
* Physics bodies use that rotation separately, so reflected local offsets need these signs.
|
|
551
|
+
* @internal
|
|
552
|
+
*/
|
|
553
|
+
_getPhysicsWorldScale(matrix?: IMatrix44): Vector3;
|
|
524
554
|
/**
|
|
525
555
|
* Creates a shallow copy of a child scene graph component.
|
|
526
556
|
* @param child - The child component to copy
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentSID, ComponentTID, EntityUID } from '../../../types/CommonTypes';
|
|
2
|
+
import { Component } from '../../core/Component';
|
|
3
|
+
import type { IEntity } from '../../core/Entity';
|
|
4
|
+
import { type EntityRepository } from '../../core/EntityRepository';
|
|
5
|
+
import { type ShapeDescriptor, type ShapeInstance, type ShapeLocalTransform } from '../../geometry/Shape';
|
|
6
|
+
import { ShapeGizmo } from '../../gizmos/ShapeGizmo';
|
|
7
|
+
import type { AABB } from '../../math/AABB';
|
|
8
|
+
import type { IVector3 } from '../../math/IVector';
|
|
9
|
+
import type { Engine } from '../../system/Engine';
|
|
10
|
+
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
11
|
+
/** Stores lightweight analytic shapes independently from their consumers. */
|
|
12
|
+
export declare class ShapeComponent extends Component {
|
|
13
|
+
private __shapes;
|
|
14
|
+
private __nextShapeIndex;
|
|
15
|
+
private __shapeGizmo?;
|
|
16
|
+
constructor(engine: Engine, entityUid: EntityUID, componentSid: ComponentSID, entityRepository: EntityRepository, isReUse: boolean);
|
|
17
|
+
static get componentTID(): 18;
|
|
18
|
+
get componentTID(): ComponentTID;
|
|
19
|
+
addShape(descriptor: ShapeDescriptor, localTransform?: ShapeLocalTransform): number;
|
|
20
|
+
/** Fits a foot-to-head capsule to an AABB and returns its new shape index. */
|
|
21
|
+
addCapsuleFromAabb(aabb: AABB, options?: CapsuleFromAabbOptions): number;
|
|
22
|
+
getShape(index?: number): ShapeInstance | undefined;
|
|
23
|
+
removeShape(index: number): boolean;
|
|
24
|
+
clearShapes(): void;
|
|
25
|
+
get shapeCount(): number;
|
|
26
|
+
/** @internal Iterates stable shape indices and their instances. */
|
|
27
|
+
_getShapeEntries(): IterableIterator<[number, ShapeInstance]>;
|
|
28
|
+
$logic(): void;
|
|
29
|
+
set isShapeGizmoVisible(visible: boolean);
|
|
30
|
+
get isShapeGizmoVisible(): boolean;
|
|
31
|
+
get shapeGizmo(): ShapeGizmo | undefined;
|
|
32
|
+
/** @internal Copies immutable ShapeInstances while preserving their stable indices. */
|
|
33
|
+
_shallowCopyFrom(component_: Component): void;
|
|
34
|
+
_destroy(): void;
|
|
35
|
+
addThisComponentToEntity<EntityBase extends IEntity, SomeComponentClass extends typeof Component>(base: EntityBase, _componentClass: SomeComponentClass): ComponentToComponentMethods<SomeComponentClass> & EntityBase;
|
|
36
|
+
}
|
|
37
|
+
export interface CapsuleFromAabbOptions {
|
|
38
|
+
/** Origin expressed in the same coordinates as the AABB. */
|
|
39
|
+
origin?: IVector3;
|
|
40
|
+
radiusScale?: number;
|
|
41
|
+
/** Maximum radius as a fraction of AABB height. Must be below 0.5. */
|
|
42
|
+
maxRadiusToHeightRatio?: number;
|
|
43
|
+
}
|