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
|
@@ -2,6 +2,7 @@ import type { ComponentSID, ComponentTID, EntityUID, Index, TypedArray } from '.
|
|
|
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 BoneDataTypeEnum } from '../../definitions/BoneDataType';
|
|
5
6
|
import type { ISkeletalEntity } from '../../helpers/EntityHelper';
|
|
6
7
|
import type { IMatrix44 } from '../../math/IMatrix';
|
|
7
8
|
import { Matrix44 } from '../../math/Matrix44';
|
|
@@ -10,7 +11,7 @@ import { MutableVector4 } from '../../math/MutableVector4';
|
|
|
10
11
|
import type { Accessor } from '../../memory/Accessor';
|
|
11
12
|
import type { Engine } from '../../system/Engine';
|
|
12
13
|
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
13
|
-
import
|
|
14
|
+
import { SceneGraphComponent } from '../SceneGraph/SceneGraphComponent';
|
|
14
15
|
/**
|
|
15
16
|
* SkeletalComponent manages skeletal animation for entities.
|
|
16
17
|
* This component handles bone transformations, joint matrices, and skinning calculations
|
|
@@ -24,13 +25,36 @@ export declare class SkeletalComponent extends Component {
|
|
|
24
25
|
private __jointMatrices?;
|
|
25
26
|
topOfJointsHierarchy?: SceneGraphComponent;
|
|
26
27
|
isSkinning: boolean;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
/**
|
|
29
|
+
* GPU bone data of all joints. The layout per joint depends on the bone data type:
|
|
30
|
+
* - Mat43x1: 3 vec4 per joint (4x3 matrix, column-major)
|
|
31
|
+
* - Vec4x2: 2 vec4 per joint ([translation.xyz, logQuat.lo], [scale.xyz, logQuat.hi]).
|
|
32
|
+
* The x scale is negative for a mirrored joint matrix.
|
|
33
|
+
* - Vec4x1: 1 vec4 per joint ([logQuat.lo, logQuat.hi, packedTranslateScale.lo, packedTranslateScale.hi]).
|
|
34
|
+
* packedTranslateScale is snorm16 x 4: the translation divided by `_boneDataInfo.xyz`, and
|
|
35
|
+
* log2(|uniform scale|) / 16 (see MathUtil.encodeVec4x1Scale). Bit 31 of logQuat.hi is the sign of the scale.
|
|
36
|
+
*
|
|
37
|
+
* This is a variable-length member: each component gets exactly (joint count) x (vec4 per joint) vec4s,
|
|
38
|
+
* even though skeletal components share buffer views, and shaders find it through `_boneDataLocation`.
|
|
39
|
+
*/
|
|
40
|
+
private _boneData;
|
|
41
|
+
/**
|
|
42
|
+
* The location of `_boneData` in the GPU data (written by the memory allocation of Component).
|
|
43
|
+
*/
|
|
44
|
+
private _boneDataLocation;
|
|
45
|
+
/**
|
|
46
|
+
* Per-component bone data info: xyz = dequantization factors of translation (Vec4x1 only),
|
|
47
|
+
* w = bone data type index (used by shaders to select the decoding path).
|
|
48
|
+
*/
|
|
49
|
+
private _boneDataInfo;
|
|
50
|
+
private __boneDataUint32?;
|
|
51
|
+
private __boneDataType;
|
|
52
|
+
/** Whether __boneDataType was chosen automatically (an automatic Vec4x1 may be switched to Vec4x2) */
|
|
53
|
+
private __isBoneDataTypeAutoSelected;
|
|
54
|
+
private __hasWarnedNonUniformScale;
|
|
55
|
+
private __allocatedBoneDataType?;
|
|
56
|
+
private __boneDataArrayLength;
|
|
57
|
+
private __boneTranslateScaleWork;
|
|
34
58
|
private __jointMatrix;
|
|
35
59
|
private __isWorldMatrixVanilla;
|
|
36
60
|
_isCulled: boolean;
|
|
@@ -39,9 +63,20 @@ export declare class SkeletalComponent extends Component {
|
|
|
39
63
|
private static __bindShapeSignatureMap;
|
|
40
64
|
private __jointListKey?;
|
|
41
65
|
private __skinCacheKey?;
|
|
66
|
+
private __skinCacheKeyAnimationBindingVersion;
|
|
67
|
+
private __skinCacheKeyHierarchyVersion;
|
|
42
68
|
private __inverseBindMatricesSignature?;
|
|
69
|
+
/**
|
|
70
|
+
* Memoized input signature of the last skinning computation. When the skin cache key, the joint
|
|
71
|
+
* world matrices, the skinned node world matrix and the bind shape matrix are unchanged, the
|
|
72
|
+
* whole skinning loop can be skipped and the previous bone data reused.
|
|
73
|
+
*/
|
|
74
|
+
private __hasSkinComputeSignature;
|
|
75
|
+
private __lastSkinComputeCacheKey?;
|
|
76
|
+
private __lastSkinComputeJointVersionSum;
|
|
77
|
+
private __lastSkinComputeOwnVersion;
|
|
78
|
+
private __lastSkinComputeBindShapeMatrix?;
|
|
43
79
|
private static __tookGlobalDataNum;
|
|
44
|
-
private static __tmpVec3_0;
|
|
45
80
|
private static __tmp_mat4;
|
|
46
81
|
private static __tmp_q;
|
|
47
82
|
private static __tmp_mat4_2;
|
|
@@ -90,71 +125,85 @@ export declare class SkeletalComponent extends Component {
|
|
|
90
125
|
*/
|
|
91
126
|
setJoints(joints: SceneGraphComponent[]): void;
|
|
92
127
|
/**
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
128
|
+
* Gets the effective bone data type of this component.
|
|
129
|
+
* If Config.boneDataType is set, it overrides the bone data type of each component.
|
|
130
|
+
*
|
|
131
|
+
* @returns The effective bone data type
|
|
96
132
|
*/
|
|
97
|
-
|
|
133
|
+
get boneDataType(): BoneDataTypeEnum;
|
|
98
134
|
/**
|
|
99
|
-
*
|
|
135
|
+
* Sets the bone data type of this component.
|
|
136
|
+
* Mat43x1 is the most precise (and the largest), Vec4x2 supports non-uniform scale,
|
|
137
|
+
* and Vec4x1 is the most compact but supports only uniform scale.
|
|
138
|
+
* If joints are already set and the GPU data layout changes, the bone data is re-allocated.
|
|
139
|
+
* Note that Config.boneDataType, if set, takes precedence over this value.
|
|
100
140
|
*
|
|
101
|
-
*
|
|
141
|
+
* If a non-uniform scale is found at runtime with Vec4x1, an automatically selected Vec4x1 is switched to Vec4x2,
|
|
142
|
+
* while an explicitly specified Vec4x1 is kept (the largest scale is used, and a warning is logged once).
|
|
143
|
+
*
|
|
144
|
+
* @param boneDataType - The bone data type to use
|
|
145
|
+
* @param isAutoSelected - True if the type was chosen automatically (e.g. by the glTF importer) rather than
|
|
146
|
+
* specified by the user
|
|
102
147
|
*/
|
|
103
|
-
|
|
148
|
+
setBoneDataType(boneDataType: BoneDataTypeEnum, isAutoSelected?: boolean): void;
|
|
104
149
|
/**
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
* @returns The world matrix of the top joint, or undefined if no top joint exists
|
|
150
|
+
* Re-allocates the bone data if the effective bone data type differs from the allocated layout.
|
|
108
151
|
*/
|
|
109
|
-
|
|
152
|
+
private __ensureBoneDataLayout;
|
|
110
153
|
/**
|
|
111
|
-
*
|
|
154
|
+
* Calculates the array length (in vec4) of the bone data.
|
|
155
|
+
* The bone data is a variable-length member, so this is exact regardless of skeletalComponentCountPerBufferView.
|
|
112
156
|
*
|
|
113
|
-
* @
|
|
157
|
+
* @param boneDataType - The bone data type
|
|
158
|
+
* @param jointCount - The number of joints
|
|
159
|
+
* @returns The array length in vec4
|
|
114
160
|
*/
|
|
115
|
-
|
|
161
|
+
private static __calcBoneDataArrayLength;
|
|
116
162
|
/**
|
|
117
|
-
*
|
|
163
|
+
* Returns the per-instance array length of the bone data for memory allocation.
|
|
118
164
|
*
|
|
119
|
-
* @
|
|
165
|
+
* @param memberName - The name of the member field
|
|
166
|
+
* @returns The array length, or undefined for other members
|
|
120
167
|
*/
|
|
121
|
-
|
|
168
|
+
protected _getArrayLengthForAllocation(memberName: string): number | undefined;
|
|
169
|
+
private __setBoneDataInfo;
|
|
122
170
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
171
|
+
* Lightweight joint update for remapping during shallow copy.
|
|
172
|
+
* Only updates joint references without reinitializing buffers.
|
|
173
|
+
* Used when joints are remapped to new entities during shallow copy.
|
|
126
174
|
*/
|
|
127
|
-
|
|
175
|
+
updateJointsLightweight(joints: SceneGraphComponent[]): void;
|
|
128
176
|
/**
|
|
129
|
-
* Gets
|
|
177
|
+
* Gets a copy of the joints array.
|
|
130
178
|
*
|
|
131
|
-
* @returns
|
|
179
|
+
* @returns A copy of the SceneGraphComponents representing the joints
|
|
132
180
|
*/
|
|
133
|
-
|
|
181
|
+
getJoints(): SceneGraphComponent[];
|
|
134
182
|
/**
|
|
135
|
-
* Gets the
|
|
183
|
+
* Gets the world matrix of the root joint in the hierarchy.
|
|
136
184
|
*
|
|
137
|
-
* @returns The
|
|
185
|
+
* @returns The world matrix of the top joint, or undefined if no top joint exists
|
|
138
186
|
*/
|
|
139
|
-
get
|
|
187
|
+
get rootJointWorldMatrixInner(): MutableMatrix44 | undefined;
|
|
140
188
|
/**
|
|
141
|
-
* Gets the joint matrices array
|
|
189
|
+
* Gets the computed joint matrices array.
|
|
142
190
|
*
|
|
143
|
-
* @returns The
|
|
191
|
+
* @returns The joint matrices array
|
|
144
192
|
*/
|
|
145
|
-
get
|
|
193
|
+
get jointMatrices(): number[] | undefined;
|
|
146
194
|
/**
|
|
147
|
-
* Gets the
|
|
195
|
+
* Gets the GPU bone data array of all joints.
|
|
196
|
+
* The layout depends on the bone data type (see the `boneDataType` getter).
|
|
148
197
|
*
|
|
149
|
-
* @returns The Float32Array containing
|
|
198
|
+
* @returns The Float32Array containing the bone data
|
|
150
199
|
*/
|
|
151
|
-
get
|
|
200
|
+
get boneDataArray(): TypedArray;
|
|
152
201
|
/**
|
|
153
|
-
* Gets the
|
|
202
|
+
* Gets the bone data info (xyz: translation dequantization factors for Vec4x1, w: bone data type index).
|
|
154
203
|
*
|
|
155
|
-
* @returns The
|
|
204
|
+
* @returns The bone data info vector
|
|
156
205
|
*/
|
|
157
|
-
get
|
|
206
|
+
get boneDataInfo(): MutableVector4;
|
|
158
207
|
/**
|
|
159
208
|
* Gets a copy of the world matrix.
|
|
160
209
|
*
|
|
@@ -210,6 +259,53 @@ export declare class SkeletalComponent extends Component {
|
|
|
210
259
|
* Only follower joints are registered for early return (__currentFrameCachedEntityUIDs).
|
|
211
260
|
*/
|
|
212
261
|
$logic(): void;
|
|
262
|
+
/**
|
|
263
|
+
* Calculates the determinant of the upper-left 3x3 part of a column-major 4x4 matrix.
|
|
264
|
+
*
|
|
265
|
+
* @param v - The matrix elements (column-major)
|
|
266
|
+
* @returns The determinant
|
|
267
|
+
*/
|
|
268
|
+
private static __determinant3x3;
|
|
269
|
+
/**
|
|
270
|
+
* Extracts the rotation R of M = T * R * S, given the (signed) scales of S.
|
|
271
|
+
* The columns of the upper-left 3x3 of `m` are divided by the scales in place.
|
|
272
|
+
*
|
|
273
|
+
* If the rotation cannot be extracted (e.g. a zero scale used to hide a part of a mesh), the identity is
|
|
274
|
+
* returned without logging an error, since the rotation does not affect the result in that case.
|
|
275
|
+
*
|
|
276
|
+
* @param m - The matrix to decompose (overwritten)
|
|
277
|
+
* @param sx - The x scale (negative for a mirrored axis)
|
|
278
|
+
* @param sy - The y scale (negative for a mirrored axis)
|
|
279
|
+
* @param sz - The z scale (negative for a mirrored axis)
|
|
280
|
+
* @returns The rotation (a shared temporary quaternion)
|
|
281
|
+
*/
|
|
282
|
+
private static __extractRotation;
|
|
283
|
+
/**
|
|
284
|
+
* Handles a non-uniform scale found with the Vec4x1 bone data type, which supports only uniform scale.
|
|
285
|
+
* An automatically selected Vec4x1 is switched to Vec4x2. An explicitly specified Vec4x1 (setBoneDataType or
|
|
286
|
+
* Config.boneDataType) is kept, and a warning is logged once (the largest scale of each joint is used).
|
|
287
|
+
*
|
|
288
|
+
* The components sharing the skinning cache with this one are switched together. Otherwise they would get
|
|
289
|
+
* a different cache key and lose the shared result, and a follower would fall back to its own joints, which
|
|
290
|
+
* may not be animated (see the AnimationComponent early return). If any of them specifies Vec4x1 explicitly,
|
|
291
|
+
* none of them is switched.
|
|
292
|
+
*
|
|
293
|
+
* @returns True if the bone data type has been switched to Vec4x2
|
|
294
|
+
*/
|
|
295
|
+
private __handleNonUniformScaleOfVec4x1;
|
|
296
|
+
/**
|
|
297
|
+
* Gets the skeletal components that share the skinning cache with this component (including this one).
|
|
298
|
+
*
|
|
299
|
+
* @returns The components with the same skinning cache key
|
|
300
|
+
*/
|
|
301
|
+
private __getComponentsSharingSkinCache;
|
|
302
|
+
/**
|
|
303
|
+
* Gets a CPU-side work buffer for translation and scale (used only in Vec4x1 bone data type).
|
|
304
|
+
*
|
|
305
|
+
* @param boneDataType - The bone data type
|
|
306
|
+
* @returns The work buffer (empty unless Vec4x1)
|
|
307
|
+
*/
|
|
308
|
+
private __getTranslateScaleWork;
|
|
213
309
|
/**
|
|
214
310
|
* Copies matrix data to the matrix array in a specific format.
|
|
215
311
|
* Extracts the first 3 rows of a 4x4 matrix (Mat43 format) for efficient GPU storage.
|
|
@@ -280,13 +376,31 @@ export declare class SkeletalComponent extends Component {
|
|
|
280
376
|
*/
|
|
281
377
|
_getInverseBindMatrices(sg: SceneGraphComponent): IMatrix44;
|
|
282
378
|
private __copyBoneBuffersFrom;
|
|
283
|
-
|
|
379
|
+
/**
|
|
380
|
+
* Registers the bone data member and its location member.
|
|
381
|
+
* The bone data is a variable-length member, so its size is decided per component
|
|
382
|
+
* (see `_getArrayLengthForAllocation`).
|
|
383
|
+
*/
|
|
384
|
+
static _registerBoneDataMember(): void;
|
|
385
|
+
/**
|
|
386
|
+
* Registers the bone data info member (one vec4 per component).
|
|
387
|
+
*/
|
|
388
|
+
static _registerBoneDataInfoMember(): void;
|
|
284
389
|
private static __buildJointListKey;
|
|
285
390
|
private static __hashBytes;
|
|
286
391
|
private static __getAccessorSignature;
|
|
287
392
|
private static __getBindShapeSignature;
|
|
288
393
|
private __getAnimationTrackFeatureHash;
|
|
289
394
|
private __findAnimationTrackFeatureHash;
|
|
395
|
+
/**
|
|
396
|
+
* Updates the skinning cache key only when animation bindings or the scene graph hierarchy
|
|
397
|
+
* may have changed since the key was last computed.
|
|
398
|
+
* Searching animation track feature hashes walks the whole model hierarchy, so doing it
|
|
399
|
+
* every frame for every SkeletalComponent is too expensive when many models are animated.
|
|
400
|
+
* Other inputs of the key (joints, inverse bind matrices, bone data type) update the key
|
|
401
|
+
* immediately in their setters.
|
|
402
|
+
*/
|
|
403
|
+
private __updateSkinCacheKeyIfNeeded;
|
|
290
404
|
/**
|
|
291
405
|
* Updates the skinning cache key based on current animation state.
|
|
292
406
|
*
|
|
@@ -304,6 +418,29 @@ export declare class SkeletalComponent extends Component {
|
|
|
304
418
|
* - Each model maintains its own cache
|
|
305
419
|
*/
|
|
306
420
|
private __updateSkinCacheKey;
|
|
421
|
+
/**
|
|
422
|
+
* Drops the memoized skinning input signature so the next $logic recomputes skinning.
|
|
423
|
+
*/
|
|
424
|
+
private __invalidateSkinComputeSignature;
|
|
425
|
+
/**
|
|
426
|
+
* Returns true when every input that affects the bone data is identical to the last computation.
|
|
427
|
+
*
|
|
428
|
+
* The joint version sum works as a change detector because `worldMatrixVersion` only increases:
|
|
429
|
+
* if any joint (or the skinned node) was marked dirty, the sum necessarily differs.
|
|
430
|
+
*
|
|
431
|
+
* Constraint: like the world matrix cache itself, this signature only observes changes made
|
|
432
|
+
* through the transform/renderer APIs. Writing `matrixInner` directly or mutating
|
|
433
|
+
* `_bindShapeMatrix` in place is not detected; callers must invalidate through the setters.
|
|
434
|
+
*
|
|
435
|
+
* @param cacheKey - The current skinning cache key
|
|
436
|
+
* @returns True when the skinning loop can be skipped
|
|
437
|
+
*/
|
|
438
|
+
private __isSkinComputeInputUnchanged;
|
|
439
|
+
/**
|
|
440
|
+
* Records the inputs that produced the current bone data.
|
|
441
|
+
* @param cacheKey - The skinning cache key used for this computation
|
|
442
|
+
*/
|
|
443
|
+
private __recordSkinComputeSignature;
|
|
307
444
|
private __createSkinningCache;
|
|
308
445
|
private __applySkinningCache;
|
|
309
446
|
}
|
|
@@ -23,6 +23,20 @@ export type VrmExpression = {
|
|
|
23
23
|
export declare class VrmComponent extends Component {
|
|
24
24
|
private __expressions;
|
|
25
25
|
private __weights;
|
|
26
|
+
/** morph target key -> expressions that contribute to it (rebuilt when expressions change). */
|
|
27
|
+
private __morphTargetContributors;
|
|
28
|
+
/** expression name -> morph target keys it affects (rebuilt when expressions change). */
|
|
29
|
+
private __expressionMorphTargetKeys;
|
|
30
|
+
/** Reused scratch set of morph target keys affected by the current update. */
|
|
31
|
+
private __changedMorphTargetKeys;
|
|
32
|
+
/** True until all morph targets have been written once after the expression set changed. */
|
|
33
|
+
private __needsFullMorphTargetUpdate;
|
|
34
|
+
/**
|
|
35
|
+
* BlendShapeComponent.updateCount observed after the last morph target application.
|
|
36
|
+
* If the counter moved without this component writing, another writer (a weights animation
|
|
37
|
+
* channel, an editor slider, ...) changed morph weights and they must be recomputed.
|
|
38
|
+
*/
|
|
39
|
+
private __lastAppliedBlendShapeUpdateCount;
|
|
26
40
|
_version: string;
|
|
27
41
|
/**
|
|
28
42
|
* Creates a new VrmComponent instance.
|
|
@@ -49,6 +63,11 @@ export declare class VrmComponent extends Component {
|
|
|
49
63
|
* @param expressions - Array of VRM expressions to register
|
|
50
64
|
*/
|
|
51
65
|
setVrmExpressions(expressions: VrmExpression[]): void;
|
|
66
|
+
/**
|
|
67
|
+
* Builds the reverse index used for differential morph target updates.
|
|
68
|
+
* Called only when the expression set changes, never per frame.
|
|
69
|
+
*/
|
|
70
|
+
private __rebuildMorphTargetContributors;
|
|
52
71
|
/**
|
|
53
72
|
* Sets the weight for a specific VRM expression.
|
|
54
73
|
* This method clamps the input, applies binary-expression behavior, and updates
|
|
@@ -58,19 +77,30 @@ export declare class VrmComponent extends Component {
|
|
|
58
77
|
*/
|
|
59
78
|
setExpressionWeight(expressionName: VrmExpressionName, weight: number): void;
|
|
60
79
|
/**
|
|
61
|
-
* Sets multiple VRM expression weights and updates morph targets
|
|
80
|
+
* Sets multiple VRM expression weights and updates only the morph targets whose total changed.
|
|
62
81
|
* This is used when several expression animation channels are evaluated together.
|
|
63
82
|
* @param expressionWeights - Expression names and their evaluated weights
|
|
64
83
|
*/
|
|
65
84
|
setExpressionWeights(expressionWeights: ReadonlyMap<VrmExpressionName, number>): void;
|
|
85
|
+
/**
|
|
86
|
+
* Applies one expression weight.
|
|
87
|
+
* @param expressionName - The expression to update
|
|
88
|
+
* @param weight - The requested weight
|
|
89
|
+
* @param changedKeys - Receives the morph target keys affected by a change
|
|
90
|
+
* @returns True when the applied weight actually changed
|
|
91
|
+
*/
|
|
66
92
|
private __setExpressionWeight;
|
|
67
93
|
/**
|
|
68
|
-
* Recomputes morph
|
|
94
|
+
* Recomputes the given morph targets from all expression contributions.
|
|
69
95
|
*
|
|
70
96
|
* Multiple VRM expressions may bind the same morph target. Applying each expression directly
|
|
71
97
|
* would make the result depend on map insertion order, so contributions are accumulated first.
|
|
98
|
+
* The total is recomputed from the contributing expressions (not accumulated as a delta) to avoid
|
|
99
|
+
* floating point drift.
|
|
100
|
+
*
|
|
101
|
+
* @param morphTargetKeys - Keys of the morph targets to recompute
|
|
72
102
|
*/
|
|
73
|
-
private
|
|
103
|
+
private __applyMorphTargets;
|
|
74
104
|
/**
|
|
75
105
|
* Gets the current weight of a specific VRM expression.
|
|
76
106
|
* @param expressionName - The name of the expression to query
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ComponentTypeEnum } from '../../foundation/definitions/ComponentType';
|
|
2
2
|
import { type CompositionTypeEnum } from '../../foundation/definitions/CompositionType';
|
|
3
3
|
import type { ComponentSID, Count, EntityUID, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
4
4
|
import type { ComponentToComponentMethods } from '../components/ComponentTypes';
|
|
@@ -29,6 +29,15 @@ export type MemberInfo = {
|
|
|
29
29
|
componentType: ComponentTypeEnum;
|
|
30
30
|
initValues: number[] | VectorN;
|
|
31
31
|
convertToBool?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Multiplier applied to the uniform array length in uniform mode
|
|
34
|
+
* (the array length becomes Config.maxSkeletalBoneNumberForUniformMode * this value).
|
|
35
|
+
*/
|
|
36
|
+
uniformArrayLengthMultiplier?: number;
|
|
37
|
+
/**
|
|
38
|
+
* Whether this array member has a per-instance length (see `Component.registerMember`).
|
|
39
|
+
*/
|
|
40
|
+
isVariableLength?: boolean;
|
|
32
41
|
};
|
|
33
42
|
type MemberName = string;
|
|
34
43
|
/**
|
|
@@ -165,12 +174,45 @@ export declare class Component extends RnObject {
|
|
|
165
174
|
* @param memberName - The name of the member field
|
|
166
175
|
* @param dataClassType - The data class type for the member
|
|
167
176
|
* @param initValues - Initial values to set for the member
|
|
168
|
-
* @param
|
|
177
|
+
* @param _isReUse - Whether this component is being reused (the existing slot is detected from the accessor)
|
|
169
178
|
* @param componentSid - The component scoped ID
|
|
170
179
|
* @param componentCountPerBufferView - The number of components per buffer view
|
|
171
180
|
* @returns null on success
|
|
172
181
|
*/
|
|
173
182
|
private __takeOne;
|
|
183
|
+
/**
|
|
184
|
+
* Allocates memory for a variable-length array member of this component instance.
|
|
185
|
+
*
|
|
186
|
+
* Unlike fixed members, the data is not placed in the slot layout shared by the components of a buffer view.
|
|
187
|
+
* Each instance gets its own chunk sized by `_getArrayLengthForAllocation`, and the location of the chunk
|
|
188
|
+
* (index of 16 bytes in the GPU data) is written to the `${memberName}Location` member so that shaders can find it.
|
|
189
|
+
* The chunk is kept per component SID and reused when it is large enough.
|
|
190
|
+
*
|
|
191
|
+
* @param info - The member info of the variable-length array member
|
|
192
|
+
* @param componentSid - The component scoped ID
|
|
193
|
+
*/
|
|
194
|
+
private __takeVariableLengthOne;
|
|
195
|
+
/**
|
|
196
|
+
* Creates a new chunk of memory for a variable-length array member.
|
|
197
|
+
*
|
|
198
|
+
* @param engine - The engine instance
|
|
199
|
+
* @param bufferUse - The intended use of the buffer
|
|
200
|
+
* @param byteLength - The byte length of the chunk
|
|
201
|
+
* @returns The created chunk
|
|
202
|
+
*/
|
|
203
|
+
private static __createVariableLengthChunk;
|
|
204
|
+
/**
|
|
205
|
+
* The radix used to split the location of a variable-length array member into two floats
|
|
206
|
+
* (`location = x * radix + y`), so that both are exactly representable as 32-bit floats.
|
|
207
|
+
*/
|
|
208
|
+
static readonly _variableLengthLocationRadix = 65536;
|
|
209
|
+
/**
|
|
210
|
+
* Gets the name of the member which holds the location of a variable-length array member.
|
|
211
|
+
*
|
|
212
|
+
* @param memberName - The name of the variable-length array member
|
|
213
|
+
* @returns The name of the location member
|
|
214
|
+
*/
|
|
215
|
+
static _getVariableLengthLocationMemberName(memberName: string): string;
|
|
174
216
|
/**
|
|
175
217
|
* Gets the ComponentMemoryRegistry for this component's engine.
|
|
176
218
|
*/
|
|
@@ -195,6 +237,11 @@ export declare class Component extends RnObject {
|
|
|
195
237
|
* Registers a member field of the component class for memory allocation.
|
|
196
238
|
* This method defines the memory layout and characteristics of component data members.
|
|
197
239
|
*
|
|
240
|
+
* Variable-length array members (`isVariableLength: true`) are allocated per instance with the length
|
|
241
|
+
* returned by `_getArrayLengthForAllocation`, instead of the fixed slot layout shared by the components
|
|
242
|
+
* of a buffer view. Shaders find the data through a Vec4 member named `${memberName}Location`,
|
|
243
|
+
* which must be registered before the variable-length member.
|
|
244
|
+
*
|
|
198
245
|
* @param bufferUse - The intended purpose/type of buffer use
|
|
199
246
|
* @param memberName - The name of the member field
|
|
200
247
|
* @param dataClassType - The class type of the data
|
|
@@ -202,8 +249,10 @@ export declare class Component extends RnObject {
|
|
|
202
249
|
* @param componentType - The primitive data type (e.g., Float32, Int32)
|
|
203
250
|
* @param initValues - Initial values for the member field
|
|
204
251
|
* @param convertToBool - Whether to convert the member value to a boolean
|
|
252
|
+
* @param uniformArrayLengthMultiplier - Multiplier of the uniform array length in uniform mode
|
|
253
|
+
* @param isVariableLength - Whether the array member has a per-instance length
|
|
205
254
|
*/
|
|
206
|
-
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool, }: {
|
|
255
|
+
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool, uniformArrayLengthMultiplier, isVariableLength, }: {
|
|
207
256
|
bufferUse: BufferUseEnum;
|
|
208
257
|
memberName: string;
|
|
209
258
|
dataClassType: DataClassType;
|
|
@@ -214,6 +263,8 @@ export declare class Component extends RnObject {
|
|
|
214
263
|
arrayLength?: Count | undefined;
|
|
215
264
|
componentSID?: ComponentSID;
|
|
216
265
|
convertToBool?: boolean;
|
|
266
|
+
uniformArrayLengthMultiplier?: number;
|
|
267
|
+
isVariableLength?: boolean;
|
|
217
268
|
}): void;
|
|
218
269
|
/**
|
|
219
270
|
* Allocates memory for all member fields of this component instance.
|
|
@@ -224,6 +275,15 @@ export declare class Component extends RnObject {
|
|
|
224
275
|
* @param isReUse - Whether to reuse existing memory allocations
|
|
225
276
|
*/
|
|
226
277
|
submitToAllocation(componentCountPerBufferView: Count, isReUse: boolean): void;
|
|
278
|
+
/**
|
|
279
|
+
* Returns the array length to allocate for a variable-length array member of this component instance
|
|
280
|
+
* (see `registerMember`). Override this to allocate a per-instance size. When undefined is returned,
|
|
281
|
+
* the maximum array length registered for the component class is used.
|
|
282
|
+
*
|
|
283
|
+
* @param _memberName - The name of the variable-length array member
|
|
284
|
+
* @returns The array length, or undefined to use the class-wide value
|
|
285
|
+
*/
|
|
286
|
+
protected _getArrayLengthForAllocation(_memberName: string): Count | undefined;
|
|
227
287
|
/**
|
|
228
288
|
* Gets the entity that owns this component.
|
|
229
289
|
* This provides access to the entity and its other components.
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
import type { Byte, Count } from '../../types/CommonTypes';
|
|
1
|
+
import type { Byte, ComponentSID, Count, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
2
2
|
import type { Accessor } from '../memory/Accessor';
|
|
3
|
+
import type { BufferView } from '../memory/BufferView';
|
|
3
4
|
import type { Component } from './Component';
|
|
4
5
|
type MemberName = string;
|
|
5
6
|
type IndexOfTheBufferView = number;
|
|
7
|
+
/**
|
|
8
|
+
* A chunk of memory allocated for a variable-length array member of a component.
|
|
9
|
+
*/
|
|
10
|
+
export type VariableLengthChunk = {
|
|
11
|
+
/** The buffer view which owns the memory of the chunk */
|
|
12
|
+
bufferView: BufferView;
|
|
13
|
+
/** The capacity of the chunk in bytes */
|
|
14
|
+
byteCapacity: Byte;
|
|
15
|
+
/** The location of the chunk in the GPU data (index of 16 bytes) */
|
|
16
|
+
location: IndexOf16Bytes;
|
|
17
|
+
};
|
|
6
18
|
/**
|
|
7
19
|
* ComponentMemoryRegistry manages memory-related data for components per Engine instance.
|
|
8
20
|
*
|
|
@@ -41,6 +53,16 @@ export declare class ComponentMemoryRegistry {
|
|
|
41
53
|
* Tracks which byte offset keys exist for each component class and member name.
|
|
42
54
|
*/
|
|
43
55
|
private __byteOffsetKeysByMember;
|
|
56
|
+
/**
|
|
57
|
+
* Chunks of variable-length array members, per component SID.
|
|
58
|
+
* Key format: "ComponentTID:MemberName:ComponentSID"
|
|
59
|
+
*/
|
|
60
|
+
private __variableLengthChunks;
|
|
61
|
+
/**
|
|
62
|
+
* Chunks of variable-length array members which are no longer used, per member.
|
|
63
|
+
* Key format: "ComponentTID:MemberName"
|
|
64
|
+
*/
|
|
65
|
+
private __freeVariableLengthChunks;
|
|
44
66
|
/**
|
|
45
67
|
* The state version, incremented when component memory layout changes.
|
|
46
68
|
*/
|
|
@@ -137,6 +159,42 @@ export declare class ComponentMemoryRegistry {
|
|
|
137
159
|
* @returns True if byte offset data exists
|
|
138
160
|
*/
|
|
139
161
|
hasByteOffsetsForComponent(componentClass: typeof Component): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Gets the chunk of a variable-length array member of a component.
|
|
164
|
+
*
|
|
165
|
+
* @param componentClass - The component class
|
|
166
|
+
* @param memberName - The name of the variable-length array member
|
|
167
|
+
* @param componentSID - The component SID
|
|
168
|
+
* @returns The chunk or undefined if not allocated yet
|
|
169
|
+
*/
|
|
170
|
+
getVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, componentSID: ComponentSID): VariableLengthChunk | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* Sets the chunk of a variable-length array member of a component.
|
|
173
|
+
* Note that this does not change the state version, since shaders read the locations of chunks at runtime.
|
|
174
|
+
*
|
|
175
|
+
* @param componentClass - The component class
|
|
176
|
+
* @param memberName - The name of the variable-length array member
|
|
177
|
+
* @param componentSID - The component SID
|
|
178
|
+
* @param chunk - The chunk to set
|
|
179
|
+
*/
|
|
180
|
+
setVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, componentSID: ComponentSID, chunk: VariableLengthChunk): void;
|
|
181
|
+
/**
|
|
182
|
+
* Puts a chunk which is no longer used into the free list so that it can be reused.
|
|
183
|
+
*
|
|
184
|
+
* @param componentClass - The component class
|
|
185
|
+
* @param memberName - The name of the variable-length array member
|
|
186
|
+
* @param chunk - The chunk to release
|
|
187
|
+
*/
|
|
188
|
+
releaseVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, chunk: VariableLengthChunk): void;
|
|
189
|
+
/**
|
|
190
|
+
* Takes the smallest free chunk which has enough capacity.
|
|
191
|
+
*
|
|
192
|
+
* @param componentClass - The component class
|
|
193
|
+
* @param memberName - The name of the variable-length array member
|
|
194
|
+
* @param byteLength - The required byte length
|
|
195
|
+
* @returns The chunk, or undefined if there is no suitable free chunk
|
|
196
|
+
*/
|
|
197
|
+
takeFreeVariableLengthChunk(componentClass: typeof Component, memberName: MemberName, byteLength: Byte): VariableLengthChunk | undefined;
|
|
140
198
|
/**
|
|
141
199
|
* Gets the current state version.
|
|
142
200
|
* This is incremented whenever the memory layout changes.
|
|
@@ -114,6 +114,23 @@ export declare class ComponentRepository {
|
|
|
114
114
|
* ```
|
|
115
115
|
*/
|
|
116
116
|
getComponentFromComponentTID(componentTid: ComponentTID, componentSid: ComponentSID): Component | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* Checks whether at least one live component of the given type exists.
|
|
119
|
+
* This is allocation-free and is intended for hot paths such as the render
|
|
120
|
+
* loop, where building a filtered component list every frame is wasteful.
|
|
121
|
+
*
|
|
122
|
+
* @param componentTID - The ComponentTID to check
|
|
123
|
+
* @returns True if at least one live component of the type exists
|
|
124
|
+
*/
|
|
125
|
+
hasAnyComponent(componentTID: ComponentTID): boolean;
|
|
126
|
+
/**
|
|
127
|
+
* Counts live components of the given type without allocating a filtered
|
|
128
|
+
* array. Intended for per-frame checks in the render loop.
|
|
129
|
+
*
|
|
130
|
+
* @param componentTID - The ComponentTID to count
|
|
131
|
+
* @returns The number of live components of the type
|
|
132
|
+
*/
|
|
133
|
+
getComponentCount(componentTID: ComponentTID): number;
|
|
117
134
|
/**
|
|
118
135
|
* Gets an array of all component instances of the specified type.
|
|
119
136
|
* This is an internal method that includes undefined slots in the array.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Config.ts is a configuration file that contains the configuration for the library.
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import type { BoneDataTypeEnum } from '../definitions/BoneDataType';
|
|
5
5
|
import { LogLevel } from '../misc/Logger';
|
|
6
6
|
type ConfigInitDescription = {
|
|
7
7
|
scenegraphComponentCountPerBufferView?: number;
|
|
@@ -9,7 +9,6 @@ type ConfigInitDescription = {
|
|
|
9
9
|
cameraComponentCountPerBufferView?: number;
|
|
10
10
|
lightComponentCountPerBufferView?: number;
|
|
11
11
|
maxLightNumber?: number;
|
|
12
|
-
maxBoneNumberForMemoryBoostMode?: number;
|
|
13
12
|
materialCountPerBufferView?: number;
|
|
14
13
|
boneDataType?: BoneDataTypeEnum;
|
|
15
14
|
maxSkeletalBoneNumberForUniformMode?: number;
|
|
@@ -37,16 +36,19 @@ export declare class Config {
|
|
|
37
36
|
lightComponentCountPerBufferView: number;
|
|
38
37
|
/** The maximum number of lights that Rhodonite can handle */
|
|
39
38
|
maxLightNumber: number;
|
|
40
|
-
/** The maximum number of bones that Rhodonite can handle for Memory Boost Mode */
|
|
41
|
-
maxBoneNumberForMemoryBoostMode: number;
|
|
42
39
|
/**
|
|
43
40
|
* Number of instances of each material type to be placed consecutively in memory.
|
|
44
41
|
* This is on the memory layout, and the number of material instances that can be generated is not limited by this setting.
|
|
45
42
|
* If this limit is exceeded, the material type is internally treated as a separate material type.
|
|
46
43
|
*/
|
|
47
44
|
materialCountPerBufferView: number;
|
|
48
|
-
/**
|
|
49
|
-
|
|
45
|
+
/**
|
|
46
|
+
* Forces the bone data type of all SkeletalComponents.
|
|
47
|
+
* When undefined (default), each SkeletalComponent uses its own bone data type
|
|
48
|
+
* (see SkeletalComponent.setBoneDataType). Importers choose Vec4x1 or Vec4x2 automatically,
|
|
49
|
+
* and other SkeletalComponents default to Vec4x2.
|
|
50
|
+
*/
|
|
51
|
+
boneDataType: BoneDataTypeEnum | undefined;
|
|
50
52
|
/** The maximum number of bones of each skeleton that Rhodonite can handle for Uniform Mode */
|
|
51
53
|
maxSkeletalBoneNumberForUniformMode: number;
|
|
52
54
|
/** Whether the UBO is enabled */
|
|
@@ -68,6 +70,5 @@ export declare class Config {
|
|
|
68
70
|
/** The minimum log level that will be output. Messages below this level are ignored. */
|
|
69
71
|
logLevel: LogLevel;
|
|
70
72
|
constructor(initDescription?: ConfigInitDescription);
|
|
71
|
-
setUpAsMemoryBoostMode(): void;
|
|
72
73
|
}
|
|
73
74
|
export {};
|