rhodonite 0.19.10 → 0.20.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 +32 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +18 -0
- package/dist/esm/foundation/components/Animation/AnimationOps.d.ts +20 -1
- package/dist/esm/foundation/components/Animation/AnimationStateRepository.d.ts +49 -0
- package/dist/esm/foundation/components/AnimationState/AnimationStateComponent.d.ts +5 -0
- package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +21 -0
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +61 -1
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +50 -4
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +183 -46
- package/dist/esm/foundation/components/Vrm/VrmComponent.d.ts +33 -3
- 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/ComponentRepository.d.ts +17 -0
- package/dist/esm/foundation/core/Config.d.ts +8 -7
- package/dist/esm/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esm/foundation/geometry/Mesh.d.ts +27 -0
- package/dist/esm/foundation/gizmos/RotationGizmo.d.ts +2 -0
- package/dist/esm/foundation/gizmos/ScaleGizmo.d.ts +7 -0
- package/dist/esm/foundation/gizmos/TranslationGizmo.d.ts +7 -0
- package/dist/esm/foundation/helpers/MaterialHelper.d.ts +1 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.d.ts +14 -0
- package/dist/esm/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esm/foundation/importer/index.d.ts +1 -0
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.d.ts +4 -0
- package/dist/esm/foundation/materials/core/Material.d.ts +16 -0
- package/dist/esm/foundation/materials/core/MaterialRepository.d.ts +17 -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 +17 -1
- package/dist/esm/foundation/math/AnimatedScalar.d.ts +17 -1
- package/dist/esm/foundation/math/AnimatedValueEvaluationState.d.ts +56 -0
- package/dist/esm/foundation/math/AnimatedVector2.d.ts +17 -1
- package/dist/esm/foundation/math/AnimatedVector3.d.ts +17 -1
- package/dist/esm/foundation/math/AnimatedVector4.d.ts +17 -1
- package/dist/esm/foundation/math/AnimatedVectorN.d.ts +17 -1
- package/dist/esm/foundation/math/IAnimatedValue.d.ts +18 -0
- package/dist/esm/foundation/math/IMatrix.d.ts +14 -2
- package/dist/esm/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esm/foundation/math/IdentityMatrix44.d.ts +9 -0
- package/dist/esm/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esm/foundation/math/MathUtil.d.ts +55 -0
- 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/physics/Oimo/OimoPhysicsStrategy.d.ts +22 -0
- package/dist/esm/foundation/physics/PhysicsStrategy.d.ts +8 -0
- package/dist/esm/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +2 -0
- package/dist/esm/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +12 -0
- package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +26 -26
- package/dist/esm/foundation/system/Engine.d.ts +31 -0
- package/dist/esm/foundation/textures/Sampler.d.ts +14 -0
- package/dist/esm/index.js +755 -750
- package/dist/esm/types/glTF2.d.ts +7 -0
- package/dist/esm/webgl/WebGLExtendedTypes.d.ts +2 -0
- package/dist/esm/webgl/WebGLGpuTimer.d.ts +32 -0
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +21 -1
- package/dist/esm/webgl/WebGLStrategyDataTexture.d.ts +9 -0
- package/dist/esm/webgpu/RangeAllocator.d.ts +39 -0
- package/dist/esm/webgpu/WebGpuBufferArena.d.ts +60 -0
- package/dist/esm/webgpu/WebGpuGpuTimer.d.ts +49 -0
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +212 -18
- package/dist/esmdev/foundation/components/Animation/AnimationComponent.d.ts +18 -0
- package/dist/esmdev/foundation/components/Animation/AnimationOps.d.ts +20 -1
- package/dist/esmdev/foundation/components/Animation/AnimationStateRepository.d.ts +49 -0
- package/dist/esmdev/foundation/components/AnimationState/AnimationStateComponent.d.ts +5 -0
- package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +21 -0
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +61 -1
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +50 -4
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +183 -46
- package/dist/esmdev/foundation/components/Vrm/VrmComponent.d.ts +33 -3
- 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/ComponentRepository.d.ts +17 -0
- package/dist/esmdev/foundation/core/Config.d.ts +8 -7
- package/dist/esmdev/foundation/definitions/BoneDataType.d.ts +12 -1
- package/dist/esmdev/foundation/geometry/Mesh.d.ts +27 -0
- package/dist/esmdev/foundation/gizmos/RotationGizmo.d.ts +2 -0
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.d.ts +7 -0
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.d.ts +7 -0
- package/dist/esmdev/foundation/helpers/MaterialHelper.d.ts +1 -1
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.d.ts +14 -0
- package/dist/esmdev/foundation/importer/BoneDataTypeDetector.d.ts +31 -0
- package/dist/esmdev/foundation/importer/index.d.ts +1 -0
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.d.ts +4 -0
- package/dist/esmdev/foundation/materials/core/Material.d.ts +16 -0
- package/dist/esmdev/foundation/materials/core/MaterialRepository.d.ts +17 -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 +17 -1
- package/dist/esmdev/foundation/math/AnimatedScalar.d.ts +17 -1
- package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.d.ts +56 -0
- package/dist/esmdev/foundation/math/AnimatedVector2.d.ts +17 -1
- package/dist/esmdev/foundation/math/AnimatedVector3.d.ts +17 -1
- package/dist/esmdev/foundation/math/AnimatedVector4.d.ts +17 -1
- package/dist/esmdev/foundation/math/AnimatedVectorN.d.ts +17 -1
- package/dist/esmdev/foundation/math/IAnimatedValue.d.ts +18 -0
- package/dist/esmdev/foundation/math/IMatrix.d.ts +14 -2
- package/dist/esmdev/foundation/math/IQuaternion.d.ts +4 -4
- package/dist/esmdev/foundation/math/IdentityMatrix44.d.ts +9 -0
- package/dist/esmdev/foundation/math/LogQuaternion.d.ts +110 -38
- package/dist/esmdev/foundation/math/MathUtil.d.ts +55 -0
- 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/physics/Oimo/OimoPhysicsStrategy.d.ts +22 -0
- package/dist/esmdev/foundation/physics/PhysicsStrategy.d.ts +8 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +2 -0
- package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +12 -0
- package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +26 -26
- package/dist/esmdev/foundation/system/Engine.d.ts +31 -0
- package/dist/esmdev/foundation/textures/Sampler.d.ts +14 -0
- package/dist/esmdev/index.js +11969 -7128
- package/dist/esmdev/types/glTF2.d.ts +7 -0
- package/dist/esmdev/webgl/WebGLExtendedTypes.d.ts +2 -0
- package/dist/esmdev/webgl/WebGLGpuTimer.d.ts +32 -0
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +21 -1
- package/dist/esmdev/webgl/WebGLStrategyDataTexture.d.ts +9 -0
- package/dist/esmdev/webgpu/RangeAllocator.d.ts +39 -0
- package/dist/esmdev/webgpu/WebGpuBufferArena.d.ts +60 -0
- package/dist/esmdev/webgpu/WebGpuGpuTimer.d.ts +49 -0
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +212 -18
- package/package.json +12 -10
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.1-1-gb72877519-dirty
|
|
2
2
|
main
|
|
@@ -20,6 +20,10 @@ export declare class AnimationComponent extends Component {
|
|
|
20
20
|
/** Map to store animation global info per Engine instance for multi-engine support */
|
|
21
21
|
private static __animationGlobalInfoMap;
|
|
22
22
|
private __isEffekseerState;
|
|
23
|
+
/** Reused map for VRM expression weights to avoid a per-frame allocation. */
|
|
24
|
+
private __vrmExpressionWeights;
|
|
25
|
+
/** Cache of the leaf parameter name of `material/...` animation paths. */
|
|
26
|
+
private __materialParameterNameCache;
|
|
23
27
|
private __isAnimating;
|
|
24
28
|
isLoop: boolean;
|
|
25
29
|
useGlobalTime: boolean;
|
|
@@ -80,11 +84,25 @@ export declare class AnimationComponent extends Component {
|
|
|
80
84
|
private __applyAnimation;
|
|
81
85
|
private __applyChannelAnimation;
|
|
82
86
|
private __applyTransformAnimation;
|
|
87
|
+
/**
|
|
88
|
+
* Returns true when the animated value differs from the value already stored in the transform.
|
|
89
|
+
*
|
|
90
|
+
* Writing an identical value would still increment the transform update count and invalidate the
|
|
91
|
+
* world matrix and skinning caches downstream, so identical writes are skipped. The comparison is
|
|
92
|
+
* against the target value (not the last applied value), so external transform edits are still
|
|
93
|
+
* overwritten by the animation on the next frame.
|
|
94
|
+
*
|
|
95
|
+
* Physics subtrees set `canSkipIdenticalTransformWrite` to false: their setters also notify the
|
|
96
|
+
* physics strategies with the parent world transform, which must keep running even when the local
|
|
97
|
+
* value is unchanged.
|
|
98
|
+
*/
|
|
99
|
+
private __shouldWriteTransformValue;
|
|
83
100
|
private __applyBlendShapeAnimation;
|
|
84
101
|
private __applyVisibilityAnimation;
|
|
85
102
|
private __applyEffectiveVisibility;
|
|
86
103
|
private __getLocalVisibility;
|
|
87
104
|
private __applyMaterialAnimation;
|
|
105
|
+
private __getMaterialParameterName;
|
|
88
106
|
private __applyLightAnimation;
|
|
89
107
|
private __applyCameraAnimation;
|
|
90
108
|
private __applyEffekseerAnimation;
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { AnimationSampler } from '../../../types/AnimationTypes';
|
|
7
7
|
import type { Index } from '../../../types/CommonTypes';
|
|
8
|
+
import type { KeyframeCursor } from '../../math/AnimatedValueEvaluationState';
|
|
8
9
|
/**
|
|
9
10
|
* Extracts the output value at a specific keyframe from the animation sampler data.
|
|
10
11
|
* Handles different interpolation methods and component counts appropriately.
|
|
@@ -15,6 +16,23 @@ import type { Index } from '../../../types/CommonTypes';
|
|
|
15
16
|
* @returns The extracted value as an array of numbers
|
|
16
17
|
*/
|
|
17
18
|
export declare function __getOutputValue(keyFrameId: Index, sampler: AnimationSampler, array_: Float32Array | number[]): number[];
|
|
19
|
+
/**
|
|
20
|
+
* A mutable array-like target for interpolation results (number[], Float32Array, Float64Array).
|
|
21
|
+
*/
|
|
22
|
+
export type WritableNumberArray = {
|
|
23
|
+
[index: number]: number;
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Interpolates animation values at a specific time and writes them into an existing array.
|
|
27
|
+
* This is the allocation-free path used by the Animated* value classes every frame.
|
|
28
|
+
*
|
|
29
|
+
* @param sampler - Animation sampler containing input/output data and interpolation settings
|
|
30
|
+
* @param currentTime - Time value to interpolate at
|
|
31
|
+
* @param animationAttributeIndex - Type of animation attribute being interpolated
|
|
32
|
+
* @param out - Destination array (length must be at least `sampler.outputComponentN`)
|
|
33
|
+
* @param cursor - Optional memoized keyframe segment index
|
|
34
|
+
*/
|
|
35
|
+
export declare function __interpolateTo(sampler: AnimationSampler, currentTime: number, animationAttributeIndex: Index, out: WritableNumberArray, cursor?: KeyframeCursor): void;
|
|
18
36
|
/**
|
|
19
37
|
* Interpolates animation values at a specific time using the specified interpolation method.
|
|
20
38
|
* Supports linear, step, and cubic spline interpolation methods according to glTF 2.0 specification.
|
|
@@ -22,6 +40,7 @@ export declare function __getOutputValue(keyFrameId: Index, sampler: AnimationSa
|
|
|
22
40
|
* @param sampler - Animation sampler containing input/output data and interpolation settings
|
|
23
41
|
* @param currentTime - Time value to interpolate at
|
|
24
42
|
* @param animationAttributeIndex - Type of animation attribute being interpolated
|
|
43
|
+
* @param cursor - Optional memoized keyframe segment index
|
|
25
44
|
* @returns Interpolated animation values as an array
|
|
26
45
|
*/
|
|
27
|
-
export declare function __interpolate(sampler: AnimationSampler, currentTime: number, animationAttributeIndex: Index): Array<number>;
|
|
46
|
+
export declare function __interpolate(sampler: AnimationSampler, currentTime: number, animationAttributeIndex: Index, cursor?: KeyframeCursor): Array<number>;
|
|
@@ -4,11 +4,33 @@ import type { Engine } from '../../system/Engine';
|
|
|
4
4
|
* Repository for managing shared animation state between AnimationComponent and SkeletalComponent.
|
|
5
5
|
* This module exists to break the circular dependency between these two components.
|
|
6
6
|
*/
|
|
7
|
+
/**
|
|
8
|
+
* Joint information needed to decide whether a joint can skip animation.
|
|
9
|
+
*/
|
|
10
|
+
type JointForEarlyReturn = {
|
|
11
|
+
readonly jointIndex: number;
|
|
12
|
+
readonly entityUID: EntityUID;
|
|
13
|
+
};
|
|
7
14
|
export declare class AnimationStateRepository {
|
|
8
15
|
/** Map to store globalTime per Engine instance for multi-engine support */
|
|
9
16
|
private static __globalTimeMap;
|
|
10
17
|
/** Map to store isAnimating flag per Engine instance for multi-engine support */
|
|
11
18
|
private static __isAnimatingMap;
|
|
19
|
+
/**
|
|
20
|
+
* Version counter of animation bindings (channels, samplers and active tracks).
|
|
21
|
+
* Incremented whenever data that affects animation track feature hashes may change,
|
|
22
|
+
* so that consumers (e.g. SkeletalComponent skin cache keys) can avoid recomputing every frame.
|
|
23
|
+
*/
|
|
24
|
+
private static __animationBindingVersion;
|
|
25
|
+
/**
|
|
26
|
+
* Marks that animation bindings (channels, samplers or active tracks) may have changed.
|
|
27
|
+
*/
|
|
28
|
+
static markAnimationBindingChanged(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Gets the current version of animation bindings.
|
|
31
|
+
* @returns The version counter, which changes whenever animation bindings may have changed
|
|
32
|
+
*/
|
|
33
|
+
static getAnimationBindingVersion(): number;
|
|
12
34
|
/**
|
|
13
35
|
* Joint EntityUIDs that can skip animation in the CURRENT frame.
|
|
14
36
|
* Populated during SkeletalComponent.$logic when cache hits occur.
|
|
@@ -49,6 +71,13 @@ export declare class AnimationStateRepository {
|
|
|
49
71
|
* Managed per Engine instance for multi-engine support.
|
|
50
72
|
*/
|
|
51
73
|
private static __leaderJointIndexToEntityUIDMap;
|
|
74
|
+
/**
|
|
75
|
+
* Joints of frustum-culled SkeletalComponents collected during the current frame.
|
|
76
|
+
* They are resolved at the next frame transition, after the leaders of the frame are decided,
|
|
77
|
+
* so that leader joints are never registered for early return.
|
|
78
|
+
* Managed per Engine instance for multi-engine support.
|
|
79
|
+
*/
|
|
80
|
+
private static __pendingCulledSkeletonJointsMap;
|
|
52
81
|
/**
|
|
53
82
|
* Sets the global animation time for the specified engine.
|
|
54
83
|
* @param engine - The engine instance to set the global time for
|
|
@@ -99,6 +128,25 @@ export declare class AnimationStateRepository {
|
|
|
99
128
|
* @returns True if frame transition occurred, false otherwise
|
|
100
129
|
*/
|
|
101
130
|
static handleFrameTransitionIfNeeded(engine: Engine, currentProcessFrameToken: number): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Registers the joints of a frustum-culled SkeletalComponent as candidates for early return.
|
|
133
|
+
*
|
|
134
|
+
* A culled SkeletalComponent neither computes nor applies skinning, so its joints do not need to
|
|
135
|
+
* be animated as long as another (visible) SkeletalComponent with the same cache key is the leader.
|
|
136
|
+
* The candidates are resolved at the next frame transition, when the leaders of this frame are known:
|
|
137
|
+
* joints that are the same entities as the leader's joints (e.g. a culled Face mesh sharing joints
|
|
138
|
+
* with a visible Body mesh) keep animating.
|
|
139
|
+
*
|
|
140
|
+
* @param engine - The engine instance for multi-engine support
|
|
141
|
+
* @param cacheKey - The skinning cache key of the culled SkeletalComponent
|
|
142
|
+
* @param joints - The joints of the culled SkeletalComponent
|
|
143
|
+
*/
|
|
144
|
+
static addCulledSkeletonJoints(engine: Engine, cacheKey: string, joints: readonly JointForEarlyReturn[]): void;
|
|
145
|
+
/**
|
|
146
|
+
* Moves the joints of culled SkeletalComponents whose cache key had a leader in the finished frame
|
|
147
|
+
* into the given cached EntityUID set, excluding the leader joints.
|
|
148
|
+
*/
|
|
149
|
+
private static __resolvePendingCulledSkeletonJoints;
|
|
102
150
|
/**
|
|
103
151
|
* Handles frame transition and clears leader tracking.
|
|
104
152
|
* Used by SkeletalComponent.isEntityCached which runs before SkeletalComponent.$logic.
|
|
@@ -126,3 +174,4 @@ export declare class AnimationStateRepository {
|
|
|
126
174
|
*/
|
|
127
175
|
static _cleanupForEngine(engine: Engine): void;
|
|
128
176
|
}
|
|
177
|
+
export {};
|
|
@@ -50,6 +50,11 @@ export declare class AnimationStateComponent extends Component {
|
|
|
50
50
|
* Handles animation blending calculations and updates the blending ratio over time.
|
|
51
51
|
*/
|
|
52
52
|
$logic(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Propagates the blending ratio to all descendants without evaluating the animation channels.
|
|
55
|
+
* @param ratio - The blending ratio value between 0.0 and 1.0
|
|
56
|
+
*/
|
|
57
|
+
private __setAnimationBlendingRatioWithoutApplying;
|
|
53
58
|
/**
|
|
54
59
|
* Sets the first active animation track without blending.
|
|
55
60
|
* This is typically used for initial animation setup.
|
|
@@ -11,9 +11,18 @@ import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
|
11
11
|
*/
|
|
12
12
|
export declare class BlendShapeComponent extends Component {
|
|
13
13
|
private __weights;
|
|
14
|
+
/**
|
|
15
|
+
* True when `__weights` is an array owned by this component.
|
|
16
|
+
* Importers and the `weights` setter may hand over arrays shared with the parsed glTF data or
|
|
17
|
+
* with other nodes, so mutations must clone first (see __ensureOwnWeights).
|
|
18
|
+
*/
|
|
19
|
+
private __ownsWeights;
|
|
14
20
|
private __targetNames;
|
|
15
21
|
private static __updateCount;
|
|
16
22
|
private static __weightsLengthBySid;
|
|
23
|
+
/** Incremented whenever the weight layout (lengths or slot count) may have changed. */
|
|
24
|
+
private static __layoutVersion;
|
|
25
|
+
private static __offsetsCache;
|
|
17
26
|
/**
|
|
18
27
|
* Creates a new BlendShapeComponent instance.
|
|
19
28
|
* @param engine - The engine instance
|
|
@@ -63,6 +72,18 @@ export declare class BlendShapeComponent extends Component {
|
|
|
63
72
|
* @returns Array of target names for blend shapes
|
|
64
73
|
*/
|
|
65
74
|
get targetNames(): string[];
|
|
75
|
+
/**
|
|
76
|
+
* Ensures that `__weights` is an array this component owns before mutating it in place.
|
|
77
|
+
* Arrays passed to the `weights` setter may be shared with the parsed glTF data or with other
|
|
78
|
+
* nodes, so the first in-place write clones them.
|
|
79
|
+
*/
|
|
80
|
+
private __ensureOwnWeights;
|
|
81
|
+
/**
|
|
82
|
+
* Copies weights from any array-like source, skipping the update when all values are unchanged.
|
|
83
|
+
* This is the allocation-free path used by animation each frame.
|
|
84
|
+
* @param source - Array-like source of weight values
|
|
85
|
+
*/
|
|
86
|
+
setWeightsFromArrayLike(source: ArrayLike<number>): void;
|
|
66
87
|
/**
|
|
67
88
|
* Sets the weight value for a specific blend shape target by index.
|
|
68
89
|
* @param index - The index of the blend shape target
|
|
@@ -8,6 +8,14 @@ import type { Engine } from '../../system/Engine';
|
|
|
8
8
|
import type { CubeTexture } from '../../textures/CubeTexture';
|
|
9
9
|
import type { RenderTargetTextureCube } from '../../textures/RenderTargetTextureCube';
|
|
10
10
|
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
11
|
+
/**
|
|
12
|
+
* Culling result of a render pass for per-instance culling of instanced draw calls.
|
|
13
|
+
* An entity was culled in the render pass while `culledEntityStamp[entityUID] === cullTick`.
|
|
14
|
+
*/
|
|
15
|
+
export type InstanceCullingState = {
|
|
16
|
+
readonly culledEntityStamp: Uint32Array;
|
|
17
|
+
readonly cullTick: number;
|
|
18
|
+
};
|
|
11
19
|
/**
|
|
12
20
|
* MeshRendererComponent is a component that manages the rendering of a mesh entity.
|
|
13
21
|
* It handles mesh rendering pipeline, IBL (Image-Based Lighting) cube maps, frustum culling,
|
|
@@ -26,6 +34,11 @@ export declare class MeshRendererComponent extends Component {
|
|
|
26
34
|
private static __updateCount;
|
|
27
35
|
static _isFrustumCullingEnabled: boolean;
|
|
28
36
|
private __fingerPrint;
|
|
37
|
+
/** Per-render-pass scratch buffers reused by sort_$render to avoid per-frame allocations. */
|
|
38
|
+
private static __sortScratchMap;
|
|
39
|
+
/** Memoized rendering strategy for common_$prerender (the hot path runs once per frame). */
|
|
40
|
+
private static __prerenderStrategyEngineUid;
|
|
41
|
+
private static __prerenderStrategy;
|
|
29
42
|
/**
|
|
30
43
|
* Creates a new MeshRendererComponent instance.
|
|
31
44
|
* @param engine - The engine instance
|
|
@@ -144,9 +157,56 @@ export declare class MeshRendererComponent extends Component {
|
|
|
144
157
|
* Filters out mesh components that are not visible from the camera's perspective.
|
|
145
158
|
* @param cameraComponent - The camera component used for frustum culling
|
|
146
159
|
* @param meshComponents - Array of mesh components to be culled
|
|
147
|
-
* @
|
|
160
|
+
* @param outPrimitives - Reusable output array. It is cleared and filled with the primitives that passed culling
|
|
161
|
+
* @param scratch - The scratch of the render pass. The entities culled in this pass are stamped into it
|
|
162
|
+
* so that instanced draw calls can skip their instances
|
|
163
|
+
* @returns The `outPrimitives` array (same reference) for convenience
|
|
148
164
|
*/
|
|
149
165
|
private static __cullingWithViewFrustum;
|
|
166
|
+
/**
|
|
167
|
+
* Culls the instances that share a mesh with the mesh components of the render pass but are not
|
|
168
|
+
* registered in the render pass themselves.
|
|
169
|
+
*
|
|
170
|
+
* Instanced draw calls render every entity sharing a mesh. For example, the VRM outline pass only holds
|
|
171
|
+
* the original model, while its shallow copies are drawn through instancing. Such sibling instances are
|
|
172
|
+
* culled with the camera of this render pass as well, once per mesh. Their visibility flags are left
|
|
173
|
+
* untouched because they belong to the render passes the entities are registered in.
|
|
174
|
+
*/
|
|
175
|
+
private static __cullSiblingInstances;
|
|
176
|
+
private static __stampCulledEntity;
|
|
177
|
+
/**
|
|
178
|
+
* Writes `cullTick` into `stamp[entityUID]`, growing the array up to the largest EntityUID seen so far.
|
|
179
|
+
* @returns The stamp array, which is a new array when it has grown
|
|
180
|
+
*/
|
|
181
|
+
private static __stampEntity;
|
|
182
|
+
/**
|
|
183
|
+
* Gets the latest culling result of a render pass for per-instance culling of instanced draw calls.
|
|
184
|
+
* The result stays valid while `sort_$render` reuses its cached primitive list for the render pass.
|
|
185
|
+
* @param renderPass - The render pass
|
|
186
|
+
* @returns The culling state, or undefined if no culling has run for the render pass
|
|
187
|
+
* @internal
|
|
188
|
+
*/
|
|
189
|
+
static _getInstanceCullingState(renderPass: RenderPass): InstanceCullingState | undefined;
|
|
190
|
+
/**
|
|
191
|
+
* Appends the primitives of a mesh component to `outPrimitives` and computes the
|
|
192
|
+
* view depth for blended primitives.
|
|
193
|
+
*/
|
|
194
|
+
private static __appendPrimitivesOfMeshComponent;
|
|
195
|
+
/**
|
|
196
|
+
* Removes duplicated primitives in place without allocating a `Set` or a new array.
|
|
197
|
+
* A primitive UID is unique, so a stamp array indexed by the UID is enough to detect
|
|
198
|
+
* duplicates. `primitives.length` is updated to the deduplicated length.
|
|
199
|
+
*/
|
|
200
|
+
private static __removeDuplicatedPrimitives;
|
|
201
|
+
/** Sort comparator shared by every render pass (avoids allocating a closure per frame). */
|
|
202
|
+
private static __comparePrimitives;
|
|
203
|
+
/**
|
|
204
|
+
* Builds the primitive UID list used for drawing. The trailing `-1` is the sentinel
|
|
205
|
+
* that terminates the list.
|
|
206
|
+
*/
|
|
207
|
+
private static __createPrimitiveUids;
|
|
208
|
+
/** Returns (and lazily creates) the reusable scratch buffers of a render pass. */
|
|
209
|
+
private static __getSortScratch;
|
|
150
210
|
/**
|
|
151
211
|
* Common pre-rendering setup method that prepares the rendering strategy.
|
|
152
212
|
* Initializes the rendering strategy if not already set and calls its prerender method.
|
|
@@ -6,7 +6,7 @@ import type { RaycastResultEx2 } from '../../geometry/types/GeometryTypes';
|
|
|
6
6
|
import type { ISceneGraphEntity } from '../../helpers/EntityHelper';
|
|
7
7
|
import { AABB } from '../../math/AABB';
|
|
8
8
|
import type { IMatrix44 } from '../../math/IMatrix';
|
|
9
|
-
import type { IQuaternion } from '../../math/IQuaternion';
|
|
9
|
+
import type { IMutableQuaternion, IQuaternion } from '../../math/IQuaternion';
|
|
10
10
|
import type { IVector3 } from '../../math/IVector';
|
|
11
11
|
import { MutableMatrix33 } from '../../math/MutableMatrix33';
|
|
12
12
|
import { MutableMatrix44 } from '../../math/MutableMatrix44';
|
|
@@ -27,12 +27,20 @@ export declare class SceneGraphComponent extends Component {
|
|
|
27
27
|
private __parent?;
|
|
28
28
|
private __children;
|
|
29
29
|
private __gizmoChildren;
|
|
30
|
+
/** True while this node is attached to its parent as a gizmo child (see _addGizmoChild). */
|
|
31
|
+
private __isGizmoChild;
|
|
30
32
|
private __physicsComponentCountInSubtree;
|
|
33
|
+
private static __hierarchyVersion;
|
|
31
34
|
private _worldMatrix;
|
|
32
35
|
private _worldMatrixRest;
|
|
33
36
|
private _normalMatrix;
|
|
34
37
|
private _worldRotation;
|
|
35
38
|
private __isWorldMatrixUpToDate;
|
|
39
|
+
/**
|
|
40
|
+
* Monotonically increasing counter that advances whenever this node's world matrix is invalidated.
|
|
41
|
+
* Consumers such as SkeletalComponent sum these counters to detect whether any input changed.
|
|
42
|
+
*/
|
|
43
|
+
private __worldMatrixVersion;
|
|
36
44
|
private __isWorldMatrixRestUpToDate;
|
|
37
45
|
private __isNormalMatrixUpToDate;
|
|
38
46
|
private __isWorldRotationUpToDate;
|
|
@@ -61,11 +69,19 @@ export declare class SceneGraphComponent extends Component {
|
|
|
61
69
|
private static __sceneGraphs;
|
|
62
70
|
private static invertedMatrix44;
|
|
63
71
|
private static __tmp_mat4;
|
|
64
|
-
private static __tmp_mat4_2;
|
|
65
72
|
private static __tmp_mat4_3;
|
|
66
73
|
private static __tmp_mat4_4;
|
|
67
74
|
private static __tmp_quat_0;
|
|
68
75
|
private static __tmp_quat_1;
|
|
76
|
+
private static __tmp_quat_2;
|
|
77
|
+
private static __tmp_quat_3;
|
|
78
|
+
private static __tmp_vec3_0;
|
|
79
|
+
private static __tmp_vec3_1;
|
|
80
|
+
private static __tmp_vec3_2;
|
|
81
|
+
private static __tmp_matrixScale;
|
|
82
|
+
private static __tmp_physicsWorldScale;
|
|
83
|
+
private static __tmp_euler;
|
|
84
|
+
private static __tmp_translate;
|
|
69
85
|
/** Map to store update count per Engine instance for multi-engine support */
|
|
70
86
|
private static __updateCountMap;
|
|
71
87
|
private static __tmpAABB;
|
|
@@ -195,6 +211,12 @@ export declare class SceneGraphComponent extends Component {
|
|
|
195
211
|
* Gets the component type identifier for SceneGraphComponent.
|
|
196
212
|
* @returns The component type ID
|
|
197
213
|
*/
|
|
214
|
+
/**
|
|
215
|
+
* Gets the version counter of the scene graph hierarchy.
|
|
216
|
+
* It changes whenever a parent-child relationship of any SceneGraphComponent may have changed.
|
|
217
|
+
* @returns The hierarchy version counter
|
|
218
|
+
*/
|
|
219
|
+
static get hierarchyVersion(): number;
|
|
198
220
|
static get componentTID(): 4;
|
|
199
221
|
/**
|
|
200
222
|
* Gets the component type identifier for this instance.
|
|
@@ -209,6 +231,13 @@ export declare class SceneGraphComponent extends Component {
|
|
|
209
231
|
* Recursively marks the world matrix rest state as dirty for this node and all children.
|
|
210
232
|
*/
|
|
211
233
|
setWorldMatrixRestDirtyRecursively(): void;
|
|
234
|
+
/**
|
|
235
|
+
* Gets the monotonically increasing world matrix version of this node.
|
|
236
|
+
* The value changes whenever the node is marked dirty, so summing it over a set of nodes detects
|
|
237
|
+
* whether any of them may need to be recomputed.
|
|
238
|
+
* @returns The world matrix version
|
|
239
|
+
*/
|
|
240
|
+
get worldMatrixVersion(): number;
|
|
212
241
|
/**
|
|
213
242
|
* Marks the world matrix as dirty and propagates changes up the hierarchy.
|
|
214
243
|
*/
|
|
@@ -325,7 +354,12 @@ export declare class SceneGraphComponent extends Component {
|
|
|
325
354
|
isWorldMatrixUpToDateRecursively(): boolean;
|
|
326
355
|
/**
|
|
327
356
|
* Recursively calculates the world matrix from this node up to the root.
|
|
328
|
-
*
|
|
357
|
+
*
|
|
358
|
+
* The result is memoized into `_worldMatrix` for every node visited by the recursion, not only the
|
|
359
|
+
* node that was requested. Without the write-back, processing children before their parents would
|
|
360
|
+
* recompute the same ancestor matrices once per descendant.
|
|
361
|
+
*
|
|
362
|
+
* @returns The cached world matrix of this node
|
|
329
363
|
*/
|
|
330
364
|
private __calcWorldMatrixRecursively;
|
|
331
365
|
/**
|
|
@@ -335,9 +369,18 @@ export declare class SceneGraphComponent extends Component {
|
|
|
335
369
|
private __calcWorldMatrixRestRecursively;
|
|
336
370
|
/**
|
|
337
371
|
* Gets the world rotation quaternion by recursively combining local rotations.
|
|
372
|
+
* This allocates a new quaternion. Use {@link getQuaternionRecursivelyTo}
|
|
373
|
+
* when a pre-allocated output quaternion is available (e.g. in hot per-frame paths).
|
|
338
374
|
* @returns The world rotation quaternion
|
|
339
375
|
*/
|
|
340
376
|
getQuaternionRecursively(): IQuaternion;
|
|
377
|
+
/**
|
|
378
|
+
* Gets the world rotation quaternion by recursively combining local rotations
|
|
379
|
+
* and stores the result in the given output quaternion without allocating.
|
|
380
|
+
* @param out - The output quaternion to store the result
|
|
381
|
+
* @returns The output quaternion containing the world rotation
|
|
382
|
+
*/
|
|
383
|
+
getQuaternionRecursivelyTo(out: IMutableQuaternion): IMutableQuaternion;
|
|
341
384
|
/**
|
|
342
385
|
* Gets the world position of this node.
|
|
343
386
|
* @returns The world position as a Vector3
|
|
@@ -548,9 +591,12 @@ export declare class SceneGraphComponent extends Component {
|
|
|
548
591
|
/**
|
|
549
592
|
* Resolves world-scale magnitudes with signs relative to the entity's proper world rotation.
|
|
550
593
|
* Physics bodies use that rotation separately, so reflected local offsets need these signs.
|
|
594
|
+
*
|
|
595
|
+
* The returned vector is a shared reusable instance, so callers must copy it
|
|
596
|
+
* when they need to keep the values around.
|
|
551
597
|
* @internal
|
|
552
598
|
*/
|
|
553
|
-
_getPhysicsWorldScale(matrix?: IMatrix44):
|
|
599
|
+
_getPhysicsWorldScale(matrix?: IMatrix44): IVector3;
|
|
554
600
|
/**
|
|
555
601
|
* Creates a shallow copy of a child scene graph component.
|
|
556
602
|
* @param child - The child component to copy
|