rhodonite 0.20.0 → 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.
Files changed (92) hide show
  1. package/VERSION-FILE +1 -1
  2. package/dist/esm/foundation/components/Animation/AnimationComponent.d.ts +18 -0
  3. package/dist/esm/foundation/components/Animation/AnimationOps.d.ts +20 -1
  4. package/dist/esm/foundation/components/Animation/AnimationStateRepository.d.ts +49 -0
  5. package/dist/esm/foundation/components/AnimationState/AnimationStateComponent.d.ts +5 -0
  6. package/dist/esm/foundation/components/BlendShape/BlendShapeComponent.d.ts +21 -0
  7. package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +61 -1
  8. package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +50 -4
  9. package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +45 -1
  10. package/dist/esm/foundation/components/Vrm/VrmComponent.d.ts +33 -3
  11. package/dist/esm/foundation/core/ComponentRepository.d.ts +17 -0
  12. package/dist/esm/foundation/geometry/Mesh.d.ts +27 -0
  13. package/dist/esm/foundation/gizmos/RotationGizmo.d.ts +2 -0
  14. package/dist/esm/foundation/gizmos/ScaleGizmo.d.ts +7 -0
  15. package/dist/esm/foundation/gizmos/TranslationGizmo.d.ts +7 -0
  16. package/dist/esm/foundation/helpers/MaterialHelper.d.ts +1 -1
  17. package/dist/esm/foundation/helpers/Shadow/ShadowSystem.d.ts +14 -0
  18. package/dist/esm/foundation/materials/contents/CustomMaterialContent.d.ts +4 -0
  19. package/dist/esm/foundation/materials/core/Material.d.ts +16 -0
  20. package/dist/esm/foundation/materials/core/MaterialRepository.d.ts +17 -0
  21. package/dist/esm/foundation/math/AnimatedQuaternion.d.ts +17 -1
  22. package/dist/esm/foundation/math/AnimatedScalar.d.ts +17 -1
  23. package/dist/esm/foundation/math/AnimatedValueEvaluationState.d.ts +56 -0
  24. package/dist/esm/foundation/math/AnimatedVector2.d.ts +17 -1
  25. package/dist/esm/foundation/math/AnimatedVector3.d.ts +17 -1
  26. package/dist/esm/foundation/math/AnimatedVector4.d.ts +17 -1
  27. package/dist/esm/foundation/math/AnimatedVectorN.d.ts +17 -1
  28. package/dist/esm/foundation/math/IAnimatedValue.d.ts +18 -0
  29. package/dist/esm/foundation/math/IMatrix.d.ts +12 -0
  30. package/dist/esm/foundation/math/IdentityMatrix44.d.ts +9 -0
  31. package/dist/esm/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +22 -0
  32. package/dist/esm/foundation/physics/PhysicsStrategy.d.ts +8 -0
  33. package/dist/esm/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +2 -0
  34. package/dist/esm/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +12 -0
  35. package/dist/esm/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +26 -26
  36. package/dist/esm/foundation/system/Engine.d.ts +31 -0
  37. package/dist/esm/foundation/textures/Sampler.d.ts +14 -0
  38. package/dist/esm/index.js +555 -555
  39. package/dist/esm/webgl/WebGLExtendedTypes.d.ts +2 -0
  40. package/dist/esm/webgl/WebGLGpuTimer.d.ts +32 -0
  41. package/dist/esm/webgl/WebGLResourceRepository.d.ts +21 -1
  42. package/dist/esm/webgl/WebGLStrategyDataTexture.d.ts +9 -0
  43. package/dist/esm/webgpu/RangeAllocator.d.ts +39 -0
  44. package/dist/esm/webgpu/WebGpuBufferArena.d.ts +60 -0
  45. package/dist/esm/webgpu/WebGpuGpuTimer.d.ts +49 -0
  46. package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +212 -18
  47. package/dist/esmdev/foundation/components/Animation/AnimationComponent.d.ts +18 -0
  48. package/dist/esmdev/foundation/components/Animation/AnimationOps.d.ts +20 -1
  49. package/dist/esmdev/foundation/components/Animation/AnimationStateRepository.d.ts +49 -0
  50. package/dist/esmdev/foundation/components/AnimationState/AnimationStateComponent.d.ts +5 -0
  51. package/dist/esmdev/foundation/components/BlendShape/BlendShapeComponent.d.ts +21 -0
  52. package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +61 -1
  53. package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +50 -4
  54. package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +45 -1
  55. package/dist/esmdev/foundation/components/Vrm/VrmComponent.d.ts +33 -3
  56. package/dist/esmdev/foundation/core/ComponentRepository.d.ts +17 -0
  57. package/dist/esmdev/foundation/geometry/Mesh.d.ts +27 -0
  58. package/dist/esmdev/foundation/gizmos/RotationGizmo.d.ts +2 -0
  59. package/dist/esmdev/foundation/gizmos/ScaleGizmo.d.ts +7 -0
  60. package/dist/esmdev/foundation/gizmos/TranslationGizmo.d.ts +7 -0
  61. package/dist/esmdev/foundation/helpers/MaterialHelper.d.ts +1 -1
  62. package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.d.ts +14 -0
  63. package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.d.ts +4 -0
  64. package/dist/esmdev/foundation/materials/core/Material.d.ts +16 -0
  65. package/dist/esmdev/foundation/materials/core/MaterialRepository.d.ts +17 -0
  66. package/dist/esmdev/foundation/math/AnimatedQuaternion.d.ts +17 -1
  67. package/dist/esmdev/foundation/math/AnimatedScalar.d.ts +17 -1
  68. package/dist/esmdev/foundation/math/AnimatedValueEvaluationState.d.ts +56 -0
  69. package/dist/esmdev/foundation/math/AnimatedVector2.d.ts +17 -1
  70. package/dist/esmdev/foundation/math/AnimatedVector3.d.ts +17 -1
  71. package/dist/esmdev/foundation/math/AnimatedVector4.d.ts +17 -1
  72. package/dist/esmdev/foundation/math/AnimatedVectorN.d.ts +17 -1
  73. package/dist/esmdev/foundation/math/IAnimatedValue.d.ts +18 -0
  74. package/dist/esmdev/foundation/math/IMatrix.d.ts +12 -0
  75. package/dist/esmdev/foundation/math/IdentityMatrix44.d.ts +9 -0
  76. package/dist/esmdev/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +22 -0
  77. package/dist/esmdev/foundation/physics/PhysicsStrategy.d.ts +8 -0
  78. package/dist/esmdev/foundation/physics/Rapier/RapierCharacterControllerStrategy.d.ts +2 -0
  79. package/dist/esmdev/foundation/physics/Rapier/RapierPhysicsStrategy.d.ts +12 -0
  80. package/dist/esmdev/foundation/renderer/pipelines/ForwardRenderPipeline.d.ts +26 -26
  81. package/dist/esmdev/foundation/system/Engine.d.ts +31 -0
  82. package/dist/esmdev/foundation/textures/Sampler.d.ts +14 -0
  83. package/dist/esmdev/index.js +6620 -4050
  84. package/dist/esmdev/webgl/WebGLExtendedTypes.d.ts +2 -0
  85. package/dist/esmdev/webgl/WebGLGpuTimer.d.ts +32 -0
  86. package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +21 -1
  87. package/dist/esmdev/webgl/WebGLStrategyDataTexture.d.ts +9 -0
  88. package/dist/esmdev/webgpu/RangeAllocator.d.ts +39 -0
  89. package/dist/esmdev/webgpu/WebGpuBufferArena.d.ts +60 -0
  90. package/dist/esmdev/webgpu/WebGpuGpuTimer.d.ts +49 -0
  91. package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +212 -18
  92. package/package.json +1 -1
@@ -23,6 +23,13 @@ export declare class TranslationGizmo extends Gizmo {
23
23
  private __onPointerUpFunc;
24
24
  private __isCameraControllerDisabled;
25
25
  private static __length;
26
+ /** Reusable quaternions for world-rotation calculations (avoids per-frame allocations) */
27
+ private static readonly __tmpQuaternion_0;
28
+ private static readonly __tmpQuaternion_1;
29
+ /** Reusable vectors for drag calculations (avoids per-frame allocations) */
30
+ private static readonly __tmpVector3_0;
31
+ private static readonly __tmpVector3_1;
32
+ private static readonly __tmpVector3_2;
26
33
  /**
27
34
  * Gets the resources for a specific engine, or undefined if not initialized.
28
35
  */
@@ -11,7 +11,7 @@ import type { Material } from '../materials/core/Material';
11
11
  import type { RenderPass } from '../renderer/RenderPass';
12
12
  import type { Engine } from '../system/Engine';
13
13
  import type { AbstractTexture } from '../textures/AbstractTexture';
14
- import { Sampler } from '../textures/Sampler';
14
+ import { type Sampler } from '../textures/Sampler';
15
15
  import type { Texture } from '../textures/Texture';
16
16
  /**
17
17
  * Creates a new material with the specified material content and maximum instances.
@@ -15,6 +15,15 @@ export declare class ShadowSystem {
15
15
  private __lightTypes;
16
16
  private __lightEnables;
17
17
  private __lightCastShadows;
18
+ /** Reused by setDepthBiasPV() on every frame. */
19
+ private __depthBiasPVArray?;
20
+ private __depthBiasPV?;
21
+ /** Scratch buffer used to detect whether the bias matrices changed since the last frame. */
22
+ private __depthBiasPVScratch?;
23
+ /** Incremented whenever the content of the depth bias matrices changes. */
24
+ private __depthBiasPVVersion;
25
+ /** `__depthBiasPVVersion` last written to each material, indexed by material UID. */
26
+ private __depthBiasPVVersionOfMaterials;
18
27
  private __lastTransformUpdateCountForAutoFit;
19
28
  private __lastEntityCountForAutoFit;
20
29
  private __lastAutoFitCenter;
@@ -64,6 +73,11 @@ export declare class ShadowSystem {
64
73
  * @param entities - Array of scene graph entities to apply the bias matrices to
65
74
  */
66
75
  setDepthBiasPV(entities: ISceneGraphEntity[]): void;
76
+ /**
77
+ * Background assets (tagged `type: background-assets`, e.g. the environment cube and the grid
78
+ * in RhodoniteEditor2) do not cast shadows. The shadow volume auto-fit excludes them as well.
79
+ */
80
+ private static __isShadowCaster;
67
81
  private __autoFitDirectionalLightShadowVolume;
68
82
  private __applyAutoFitToDirectionalLights;
69
83
  /**
@@ -12,6 +12,10 @@ import type { Material } from '../core/Material';
12
12
  export declare class CustomMaterialContent extends AbstractMaterialContent {
13
13
  private __diffuseIblCubeMapSampler;
14
14
  private __specularIblCubeMapSampler;
15
+ /** Material and values of the last IBL parameter write (WebGL DataTexture mode). */
16
+ private __lastIblMaterial?;
17
+ private __lastIblMaterialStateVersion;
18
+ private __lastIblValues;
15
19
  /**
16
20
  * Creates a new CustomMaterialContent instance with custom shaders and configuration.
17
21
  *
@@ -88,6 +88,8 @@ export declare class Material extends RnObject {
88
88
  private __blendFuncAlphaSrcFactor;
89
89
  private __blendFuncAlphaDstFactor;
90
90
  private __stateVersion;
91
+ private __pipelineStateVersion;
92
+ private __textureStateVersion;
91
93
  private __fingerPrint;
92
94
  private __shaderDefines;
93
95
  private __shaderNodeJson?;
@@ -131,6 +133,7 @@ export declare class Material extends RnObject {
131
133
  * @internal
132
134
  */
133
135
  calcFingerPrint(): void;
136
+ private __incrementPipelineStateVersion;
134
137
  /**
135
138
  * Gets the current fingerprint of the material.
136
139
  * @returns The material's fingerprint string
@@ -499,6 +502,19 @@ export declare class Material extends RnObject {
499
502
  */
500
503
  makeShadersInvalidate(): void;
501
504
  updateStateVersion(): void;
505
+ /**
506
+ * Gets the version that is bumped only when the render pipeline
507
+ * configuration changes (shader program, blend state, cull mode, ...).
508
+ * Uniform parameter updates do not affect this version.
509
+ * @returns The pipeline state version number
510
+ */
511
+ get pipelineStateVersion(): number;
512
+ /**
513
+ * Gets the version that is bumped only when texture or sampler bindings
514
+ * change. Used to invalidate WebGPU bind groups and render bundles.
515
+ * @returns The texture binding state version number
516
+ */
517
+ get textureStateVersion(): number;
502
518
  /**
503
519
  * Gets the shader node JSON data for node-based materials.
504
520
  * This is used by RHODONITE_materials_node extension.
@@ -23,6 +23,12 @@ export declare class MaterialRepository {
23
23
  _soloDatumFields: Map<MaterialTypeName, Map<ShaderSemanticsName, ShaderVariable>>;
24
24
  /** State version counter for tracking material changes (engine-specific) */
25
25
  private __stateVersion;
26
+ /**
27
+ * State version counter for changes that invalidate WebGPU bind groups and
28
+ * render bundles (texture bindings, pipelines). Uniform-only updates do not
29
+ * bump this, so render bundles stay reusable across frames.
30
+ */
31
+ private __bindingStateVersion;
26
32
  private static __materialTidCount;
27
33
  private static __materialUidCount;
28
34
  /**
@@ -159,10 +165,21 @@ export declare class MaterialRepository {
159
165
  * @returns The current state version number
160
166
  */
161
167
  get stateVersion(): number;
168
+ /**
169
+ * Gets the state version that invalidates GPU bind groups and render bundles.
170
+ * @returns The binding state version number
171
+ */
172
+ get bindingStateVersion(): number;
162
173
  /**
163
174
  * Increments the state version counter.
164
175
  * Called when a material's state changes.
165
176
  * @internal
166
177
  */
167
178
  _incrementStateVersion(): void;
179
+ /**
180
+ * Increments the state version that invalidates WebGPU bind groups and
181
+ * render bundles.
182
+ * @internal
183
+ */
184
+ _incrementBindingStateVersion(): void;
168
185
  }
@@ -18,7 +18,7 @@ export declare class AnimatedQuaternion extends Quaternion implements IQuaternio
18
18
  private __secondActiveAnimationSampler?;
19
19
  private __blendingRatio;
20
20
  private __time?;
21
- private __lastTime;
21
+ private __evaluation;
22
22
  isLoop: boolean;
23
23
  /**
24
24
  * Creates a new AnimatedQuaternion instance.
@@ -32,6 +32,22 @@ export declare class AnimatedQuaternion extends Quaternion implements IQuaternio
32
32
  * @returns Array containing the x, y, z, w components of the quaternion
33
33
  */
34
34
  getNumberArray(): number[];
35
+ /**
36
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
37
+ */
38
+ invalidateAnimationCache(): void;
39
+ /**
40
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
41
+ */
42
+ getEvaluationCount(): number;
43
+ /**
44
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
45
+ */
46
+ getValueArray(): import("../../types").TypedArray;
47
+ /**
48
+ * Sets the time and blending ratio and evaluates the value at most once.
49
+ */
50
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
35
51
  /**
36
52
  * Sets the quaternion values from a Float32Array.
37
53
  * @param array - Float32Array containing the quaternion components [x, y, z, w]
@@ -17,7 +17,7 @@ export declare class AnimatedScalar extends Scalar implements IScalar, IAnimated
17
17
  private __secondActiveAnimationSampler?;
18
18
  private __blendingRatio;
19
19
  private __time?;
20
- private __lastTime;
20
+ private __evaluation;
21
21
  isLoop: boolean;
22
22
  /**
23
23
  * Creates a new AnimatedScalar instance.
@@ -31,6 +31,22 @@ export declare class AnimatedScalar extends Scalar implements IScalar, IAnimated
31
31
  * @returns An array containing the scalar value
32
32
  */
33
33
  getNumberArray(): number[];
34
+ /**
35
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
36
+ */
37
+ invalidateAnimationCache(): void;
38
+ /**
39
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
40
+ */
41
+ getEvaluationCount(): number;
42
+ /**
43
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
44
+ */
45
+ getValueArray(): import("../../types").TypedArray;
46
+ /**
47
+ * Sets the time and blending ratio and evaluates the value at most once.
48
+ */
49
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
34
50
  /**
35
51
  * Sets the internal Float32Array and triggers an update.
36
52
  * @param array - The new Float32Array to set
@@ -0,0 +1,56 @@
1
+ /**
2
+ * A memoized keyframe segment index for one animation sampler evaluation site.
3
+ * `i = -1` means "not searched yet".
4
+ */
5
+ export type KeyframeCursor = {
6
+ i: number;
7
+ };
8
+ /**
9
+ * Evaluation memo shared by the `Animated*` value classes.
10
+ *
11
+ * Interpolation results are reused while the effective animation time and the blending ratio
12
+ * (only when a second sampler participates in the result) are unchanged. All invalidation points
13
+ * that replace sampler data or rebind tracks must call {@link AnimatedValueEvaluationState.invalidate}.
14
+ */
15
+ export declare class AnimatedValueEvaluationState {
16
+ private __hasEvaluated;
17
+ private __lastEffectiveTime;
18
+ private __lastBlendingRatio;
19
+ private __evaluationCount;
20
+ /** Segment cursor for the first active sampler (used by keyframe search memoization). */
21
+ readonly firstCursor: KeyframeCursor;
22
+ /** Segment cursor for the second active sampler (used by keyframe search memoization). */
23
+ readonly secondCursor: KeyframeCursor;
24
+ /** Reused scratch buffers for two-track blending (double precision to match the previous math). */
25
+ private __scratchFirst;
26
+ private __scratchSecond;
27
+ /**
28
+ * Ensures the blending scratch buffers can hold `length` components.
29
+ */
30
+ ensureScratch(length: number): void;
31
+ get scratchFirst(): Float64Array;
32
+ get scratchSecond(): Float64Array;
33
+ /**
34
+ * Returns true when the animated value must be re-evaluated.
35
+ * @param effectiveTime - Time after loop wrapping
36
+ * @param blendingRatio - Current blending ratio
37
+ * @param hasSecondSampler - Whether a second sampler contributes to the result
38
+ */
39
+ shouldEvaluate(effectiveTime: number, blendingRatio: number, hasSecondSampler: boolean): boolean;
40
+ /**
41
+ * Records a completed evaluation and increments the evaluation counter.
42
+ */
43
+ markEvaluated(effectiveTime: number, blendingRatio: number): void;
44
+ /**
45
+ * Drops the memoized result and resets the keyframe cursors.
46
+ */
47
+ invalidate(): void;
48
+ /**
49
+ * Resets the keyframe segment cursors without discarding the evaluated value.
50
+ */
51
+ resetCursors(): void;
52
+ /**
53
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
54
+ */
55
+ get evaluationCount(): number;
56
+ }
@@ -17,7 +17,7 @@ export declare class AnimatedVector2 extends Vector2 implements IVector2, IAnima
17
17
  private __secondActiveAnimationSampler?;
18
18
  private __blendingRatio;
19
19
  private __time?;
20
- private __lastTime;
20
+ private __evaluation;
21
21
  isLoop: boolean;
22
22
  /**
23
23
  * Creates a new AnimatedVector2 instance.
@@ -31,6 +31,22 @@ export declare class AnimatedVector2 extends Vector2 implements IVector2, IAnima
31
31
  * @returns An array containing the x and y components of the vector
32
32
  */
33
33
  getNumberArray(): number[];
34
+ /**
35
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
36
+ */
37
+ invalidateAnimationCache(): void;
38
+ /**
39
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
40
+ */
41
+ getEvaluationCount(): number;
42
+ /**
43
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
44
+ */
45
+ getValueArray(): import("../../types").TypedArray;
46
+ /**
47
+ * Sets the time and blending ratio and evaluates the value at most once.
48
+ */
49
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
34
50
  /**
35
51
  * Sets the internal Float32Array and triggers an update.
36
52
  * @param array - The new Float32Array to use for the vector components
@@ -27,7 +27,7 @@ export declare class AnimatedVector3 extends Vector3 implements IVector3, IAnima
27
27
  private __secondActiveAnimationSampler?;
28
28
  private __blendingRatio;
29
29
  private __time?;
30
- private __lastTime;
30
+ private __evaluation;
31
31
  isLoop: boolean;
32
32
  /**
33
33
  * Creates a new AnimatedVector3 instance.
@@ -49,6 +49,22 @@ export declare class AnimatedVector3 extends Vector3 implements IVector3, IAnima
49
49
  * @param array - A Float32Array containing the new x, y, z values
50
50
  */
51
51
  setFloat32Array(array: Float32Array): void;
52
+ /**
53
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
54
+ */
55
+ invalidateAnimationCache(): void;
56
+ /**
57
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
58
+ */
59
+ getEvaluationCount(): number;
60
+ /**
61
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
62
+ */
63
+ getValueArray(): import("../../types").TypedArray;
64
+ /**
65
+ * Sets the time and blending ratio and evaluates the value at most once.
66
+ */
67
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
52
68
  /**
53
69
  * Sets the current animation time and triggers an update.
54
70
  *
@@ -25,7 +25,7 @@ export declare class AnimatedVector4 extends Vector4 implements IVector4, IAnima
25
25
  private __secondActiveAnimationSampler?;
26
26
  private __blendingRatio;
27
27
  private __time?;
28
- private __lastTime;
28
+ private __evaluation;
29
29
  isLoop: boolean;
30
30
  /**
31
31
  * Creates a new AnimatedVector4 instance.
@@ -41,6 +41,22 @@ export declare class AnimatedVector4 extends Vector4 implements IVector4, IAnima
41
41
  * @returns An array containing the x, y, z, and w components
42
42
  */
43
43
  getNumberArray(): number[];
44
+ /**
45
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
46
+ */
47
+ invalidateAnimationCache(): void;
48
+ /**
49
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
50
+ */
51
+ getEvaluationCount(): number;
52
+ /**
53
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
54
+ */
55
+ getValueArray(): import("../../types").TypedArray;
56
+ /**
57
+ * Sets the time and blending ratio and evaluates the value at most once.
58
+ */
59
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
44
60
  /**
45
61
  * Sets the internal Float32Array data and triggers an update.
46
62
  *
@@ -16,7 +16,7 @@ export declare class AnimatedVectorN extends VectorN implements IAnimatedValue {
16
16
  private __secondActiveAnimationSampler?;
17
17
  private __blendingRatio;
18
18
  private __time?;
19
- private __lastTime;
19
+ private __evaluation;
20
20
  isLoop: boolean;
21
21
  /**
22
22
  * Creates a new AnimatedVectorN instance.
@@ -30,6 +30,22 @@ export declare class AnimatedVectorN extends VectorN implements IAnimatedValue {
30
30
  * @returns A new array containing the vector components
31
31
  */
32
32
  getNumberArray(): number[];
33
+ /**
34
+ * Drops the memoized interpolation result. Call this after mutating sampler data directly.
35
+ */
36
+ invalidateAnimationCache(): void;
37
+ /**
38
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
39
+ */
40
+ getEvaluationCount(): number;
41
+ /**
42
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
43
+ */
44
+ getValueArray(): import("../../types").TypedArray;
45
+ /**
46
+ * Sets the time and blending ratio and evaluates the value at most once.
47
+ */
48
+ setTimeAndBlendingRatio(time: number, blendingRatio: number): void;
33
49
  /**
34
50
  * Sets the internal Float32Array and updates the animation state.
35
51
  * @param array - The new Float32Array to set
@@ -1,4 +1,5 @@
1
1
  import type { AnimationSampler, AnimationTrackName } from '../../types/AnimationTypes';
2
+ import type { TypedArray } from '../../types/CommonTypes';
2
3
  /**
3
4
  * Interface for animated values that can be controlled by animation tracks.
4
5
  * Provides functionality for managing animation samplers, time control, and value blending.
@@ -76,6 +77,23 @@ export interface IAnimatedValue {
76
77
  * Updates the animated value based on the current time and active animation tracks.
77
78
  */
78
79
  update(): void;
80
+ /**
81
+ * Drops the memoized interpolation result.
82
+ * Implementations must call this after their sampler data has been mutated externally.
83
+ */
84
+ invalidateAnimationCache?(): void;
85
+ /**
86
+ * Number of actual interpolations performed. Intended for tests and benchmarks.
87
+ */
88
+ getEvaluationCount?(): number;
89
+ /**
90
+ * Gets the internal value array without allocating a copy. Do not mutate the returned array.
91
+ */
92
+ getValueArray?(): TypedArray;
93
+ /**
94
+ * Sets the time and blending ratio, then evaluates the value at most once.
95
+ */
96
+ setTimeAndBlendingRatio?(time: number, blendingRatio: number): void;
79
97
  /**
80
98
  * Gets all available animation track names.
81
99
  * @returns An array of all animation track names
@@ -701,11 +701,23 @@ export interface IMatrix44 extends IMatrix {
701
701
  * @returns 3D vector containing translation components
702
702
  */
703
703
  getTranslate(): IVector3;
704
+ /**
705
+ * Extracts the translation part of this matrix and stores it in an output vector.
706
+ * @param outVec - The output vector to store the translation
707
+ * @returns The output vector containing the translation components
708
+ */
709
+ getTranslateTo(outVec: IMutableVector3): IMutableVector3;
704
710
  /**
705
711
  * Extracts the scale factors from this matrix.
706
712
  * @returns 3D vector containing scale factors
707
713
  */
708
714
  getScale(): IVector3;
715
+ /**
716
+ * Extracts the scale factors from this matrix and stores them in an output vector.
717
+ * @param outVec - The output vector to store the scale factors
718
+ * @returns The output vector containing the scale components
719
+ */
720
+ getScaleTo(outVec: IMutableVector3): IMutableVector3;
709
721
  /**
710
722
  * Multiplies this matrix by a 3D vector (treating it as a 4D vector with w=1).
711
723
  * @param vec - 3D vector to multiply
@@ -160,6 +160,15 @@ export declare class IdentityMatrix44 extends AbstractMatrix implements IMatrix,
160
160
  * @returns A Vector3 with all components set to 0
161
161
  */
162
162
  getTranslate(): Vector3;
163
+ /**
164
+ * Extracts the translation components from this transformation matrix
165
+ * and stores them in the output vector.
166
+ * For identity matrix, the translation is (0, 0, 0).
167
+ *
168
+ * @param outVec - The output vector to store the translation
169
+ * @returns The output vector with all components set to 0
170
+ */
171
+ getTranslateTo(outVec: MutableVector3): MutableVector3;
163
172
  /**
164
173
  * Gets the matrix element at row 0, column 0.
165
174
  * @returns Always 1 for identity matrix
@@ -45,6 +45,19 @@ export declare class OimoPhysicsStrategy implements PhysicsStrategy {
45
45
  private __usesShapeInstance;
46
46
  private __shapeType?;
47
47
  private __warnedScaleApproximation;
48
+ /** Reusable quaternion for world-rotation lookups (avoids per-frame allocations) */
49
+ private __tmpWorldRotation;
50
+ /** Reusable Euler angles for rotation conversions (avoids per-frame allocations) */
51
+ private __tmpEuler;
52
+ /** Reusable temporaries for body pose calculation (avoids per-frame allocations) */
53
+ private __tmpShapeScaledOffset;
54
+ private __tmpBodyWorldOffset;
55
+ private __tmpBodyPose;
56
+ /** Reusable temporaries for the per-frame physics sync */
57
+ private __tmpBodyRotation;
58
+ private __tmpEntityRotation;
59
+ private __tmpInverseLocalRotation;
60
+ private __tmpUpdatePosition;
48
61
  /**
49
62
  * Creates a new OimoPhysicsStrategy instance.
50
63
  * Initializes the shared Oimo physics world if it doesn't exist yet.
@@ -93,6 +106,15 @@ export declare class OimoPhysicsStrategy implements PhysicsStrategy {
93
106
  private __resolveScaledShape;
94
107
  private __createLegacyScaledSize;
95
108
  private __toBodyPose;
109
+ /**
110
+ * Fills the reusable body pose with the given position and rotation.
111
+ * Accepts plain `{ x, y, z }` objects as well as vector/quaternion instances
112
+ * (Oimo.js returns plain objects from its body getters).
113
+ * @param position - The body position to copy
114
+ * @param rotation - The body rotation to copy
115
+ * @returns The reusable body pose
116
+ */
117
+ private __reuseBodyPose;
96
118
  /**
97
119
  * Advances the physics simulation by one time step.
98
120
  * This static method should be called once per frame to update all physics bodies
@@ -22,24 +22,32 @@ export interface PhysicsStrategy {
22
22
  /**
23
23
  * Sets the world position of the physics body.
24
24
  * This is optional and only implemented by rigid-body physics strategies.
25
+ * The passed vector may be a shared reusable instance, so implementations
26
+ * must copy the values they need instead of retaining the reference.
25
27
  * @param worldPosition - The new world position
26
28
  */
27
29
  setPosition?(worldPosition: IVector3): void;
28
30
  /**
29
31
  * Sets the world rotation of the physics body.
30
32
  * This is optional and only implemented by rigid-body physics strategies.
33
+ * The passed quaternion may be a shared reusable instance, so implementations
34
+ * must copy the values they need instead of retaining the reference.
31
35
  * @param worldRotation - The new world rotation
32
36
  */
33
37
  setRotation?(worldRotation: IQuaternion): void;
34
38
  /**
35
39
  * Sets the world rotation of the physics body with Euler angles.
36
40
  * This is optional and only implemented by rigid-body physics strategies.
41
+ * The passed vector may be a shared reusable instance, so implementations
42
+ * must copy the values they need instead of retaining the reference.
37
43
  * @param eulerAngles - The new Euler angles in radians
38
44
  */
39
45
  setEulerAngle?(eulerAngles: IVector3): void;
40
46
  /**
41
47
  * Sets the world scale of the physics body.
42
48
  * This is optional and only implemented by rigid-body physics strategies.
49
+ * The passed vector may be a shared reusable instance, so implementations
50
+ * must copy the values they need instead of retaining the reference.
43
51
  * @param worldScale - The new world scale
44
52
  */
45
53
  setScale?(worldScale: IVector3): void;
@@ -31,6 +31,8 @@ export declare class RapierCharacterControllerStrategy implements CharacterContr
31
31
  private __worldScale;
32
32
  private __isGroundProbeRadiusDerived;
33
33
  private __warnedNonUniformScale;
34
+ /** Reusable quaternion for world-rotation lookups (avoids per-frame allocations) */
35
+ private __tmpWorldRotation;
34
36
  setup(entity: ISceneGraphEntity, shapeInstance: ShapeInstance, options?: CharacterControllerOptions): void;
35
37
  setDesiredHorizontalVelocity(velocity: IVector3): void;
36
38
  requestJump(): void;
@@ -166,6 +166,18 @@ export declare class RapierPhysicsStrategy implements PhysicsStrategy {
166
166
  private __warnedAsymmetricRadius;
167
167
  private __warnedNonUniformScale;
168
168
  private __warnedShearedBoxApproximation;
169
+ /** Reusable quaternion for world-rotation lookups (avoids per-frame allocations) */
170
+ private __tmpWorldRotation;
171
+ /** Reusable Euler angles for rotation conversions (avoids per-frame allocations) */
172
+ private __tmpEuler;
173
+ /** Reusable Euler angles stored in the cached physics property */
174
+ private __tmpPropertyRotation;
175
+ /** Reusable vectors for converting motion velocities */
176
+ private __tmpLinearVelocity;
177
+ private __tmpAngularVelocity;
178
+ /** Reusable temporaries for the per-frame physics sync */
179
+ private __tmpUpdatePosition;
180
+ private __tmpUpdateRotation;
169
181
  /**
170
182
  * Injects Rapier.js bindings. Physics worlds are created lazily per Engine.
171
183
  * @param rapierModule - Rapier module or compat module default export
@@ -57,37 +57,37 @@ export declare class ForwardRenderPipeline extends RnObject {
57
57
  private __isBloom;
58
58
  private __isSimple;
59
59
  private __shadowMapSize;
60
- private __oFrame;
61
- private __oFrameBufferMultiView;
62
- private __oFrameBufferMultiViewBlit;
63
- private __oFrameBufferMultiViewBlitBackBuffer;
64
- private __oFrameBufferMsaa;
65
- private __oFrameBufferResolve;
66
- private __oFrameBufferResolveForReference;
67
- private __oInitialExpression;
60
+ private __frame?;
61
+ private __frameBufferMultiView?;
62
+ private __frameBufferMultiViewBlit?;
63
+ private __frameBufferMultiViewBlitBackBuffer?;
64
+ private __frameBufferMsaa?;
65
+ private __frameBufferResolve?;
66
+ private __frameBufferResolveForReference?;
67
+ private __initialExpression?;
68
68
  /** main expressions */
69
69
  private __expressions;
70
70
  private __gizmoExpression;
71
- private __oGenerateMipmapsExpression;
72
- private __oMultiViewBlitBackBufferExpression;
73
- private __oMultiViewBlitExpression;
74
- private __oBloomExpression;
75
- private __oToneMappingExpression;
76
- private __oToneMappingMaterial;
71
+ private __generateMipmapsExpression?;
72
+ private __multiViewBlitBackBufferExpression?;
73
+ private __multiViewBlitExpression?;
74
+ private __bloomExpression?;
75
+ private __toneMappingExpression?;
76
+ private __toneMappingMaterial?;
77
77
  private __transparentOnlyExpressions;
78
- private __oWebXRSystem;
79
- private __oDrawFunc;
80
- private __oDiffuseCubeTexture;
81
- private __oSpecularCubeTexture;
82
- private __oSheenCubeTexture;
83
- private __oSamplerForBackBuffer;
78
+ private __webXRSystem?;
79
+ private __drawFunc?;
80
+ private __diffuseCubeTexture?;
81
+ private __specularCubeTexture?;
82
+ private __sheenCubeTexture?;
83
+ private __samplerForBackBuffer?;
84
84
  private __toneMappingType;
85
85
  private __bloomHelper;
86
- private __oShadowSystem;
86
+ private __shadowSystem?;
87
87
  private __shadowExpressions;
88
88
  private __entitiesForShadow;
89
- private __oRaymarchingExpression;
90
- private __oRaymarchingRenderPass;
89
+ private __raymarchingExpression?;
90
+ private __raymarchingRenderPass?;
91
91
  private __engine;
92
92
  constructor(engine: Engine);
93
93
  /**
@@ -142,7 +142,7 @@ export declare class ForwardRenderPipeline extends RnObject {
142
142
  /**
143
143
  * Gets the main frame buffer used for back buffer operations.
144
144
  *
145
- * @returns The frame buffer for back buffer operations, or None if not available
145
+ * @returns The frame buffer for back buffer operations, or undefined if not available
146
146
  *
147
147
  * @internal
148
148
  */
@@ -150,7 +150,7 @@ export declare class ForwardRenderPipeline extends RnObject {
150
150
  /**
151
151
  * Gets the main frame buffer used for resolve operations.
152
152
  *
153
- * @returns The frame buffer for resolve operations, or None if not available
153
+ * @returns The frame buffer for resolve operations, or undefined if not available
154
154
  *
155
155
  * @internal
156
156
  */
@@ -158,7 +158,7 @@ export declare class ForwardRenderPipeline extends RnObject {
158
158
  /**
159
159
  * Gets the main frame buffer used for rendering operations.
160
160
  *
161
- * @returns The main frame buffer, or None if not available
161
+ * @returns The main frame buffer, or undefined if not available
162
162
  *
163
163
  * @internal
164
164
  */