rhodonite 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -2
- package/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +21 -0
- package/dist/esm/foundation/components/Physics/PhysicsComponent.d.ts +1 -1
- package/dist/esm/foundation/components/SceneGraph/SceneGraphComponent.d.ts +36 -1
- package/dist/esm/foundation/components/Skeletal/SkeletalComponent.d.ts +5 -2
- package/dist/esm/foundation/core/Component.d.ts +1 -8
- package/dist/esm/foundation/core/Config.d.ts +7 -3
- package/dist/esm/foundation/core/GlobalDataRepository.d.ts +12 -8
- package/dist/esm/foundation/core/MemoryManager.d.ts +12 -0
- package/dist/esm/foundation/definitions/ProcessApproach.d.ts +1 -6
- package/dist/esm/foundation/definitions/ShaderSemantics.d.ts +0 -1
- package/dist/esm/foundation/definitions/VertexAttribute.d.ts +2 -1
- package/dist/esm/foundation/geometry/Mesh.d.ts +52 -0
- package/dist/esm/foundation/geometry/Primitive.d.ts +31 -0
- package/dist/esm/foundation/geometry/shapes/Cone.d.ts +2 -0
- package/dist/esm/foundation/geometry/shapes/Cylinder.d.ts +2 -0
- package/dist/esm/foundation/geometry/shapes/Plane.d.ts +2 -0
- package/dist/esm/foundation/gizmos/Gizmo.d.ts +30 -0
- package/dist/esm/foundation/gizmos/RotationGizmo.d.ts +27 -0
- package/dist/esm/foundation/gizmos/ScaleGizmo.d.ts +17 -0
- package/dist/esm/foundation/gizmos/TranslationGizmo.d.ts +17 -0
- package/dist/esm/foundation/helpers/MeshHelper.d.ts +42 -7
- package/dist/esm/foundation/importer/ModelConverter.d.ts +12 -0
- package/dist/esm/foundation/materials/contents/CustomMaterialContent.d.ts +1 -1
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +7 -23
- package/dist/esm/foundation/materials/core/Material.d.ts +27 -13
- package/dist/esm/foundation/materials/core/MaterialRepository.d.ts +5 -0
- package/dist/esm/foundation/physics/PhysicsProperty.d.ts +9 -2
- package/dist/esm/foundation/physics/index.d.ts +0 -1
- package/dist/esm/foundation/renderer/RenderPass.d.ts +8 -0
- package/dist/esm/foundation/system/Engine.d.ts +2 -2
- package/dist/esm/foundation/system/EngineState.d.ts +1 -1
- package/dist/esm/index.js +650 -685
- package/dist/esm/webgl/InstanceSidTable.d.ts +70 -0
- package/dist/esm/webgl/MultiDraw.d.ts +167 -0
- package/dist/esm/webgl/MultiDrawRepository.d.ts +39 -0
- package/dist/esm/webgl/WebGLContextWrapper.d.ts +12 -0
- package/dist/esm/webgl/WebGLExtension.d.ts +1 -0
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +36 -2
- package/dist/{esmdev/webgl/WebGLStrategyDataTexture.d.ts → esm/webgl/WebGLStrategyWebGL2.d.ts} +73 -4
- package/dist/esm/webgl/debug/BufferLayoutDecoder.d.ts +83 -0
- package/dist/esm/webgl/debug/ShaderParameterDebugger.d.ts +47 -0
- package/dist/esm/webgl/debug/index.d.ts +3 -0
- package/dist/esm/webgl/debug/types.d.ts +114 -0
- package/dist/esm/webgl/index.d.ts +2 -2
- package/dist/esm/webgl/main.d.ts +2 -4
- package/dist/esm/webgl/shaders/StandardShaderPart.d.ts +1 -1
- package/dist/esm/webgl/types/CommonTypes.d.ts +0 -1
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +15 -1
- package/dist/esmdev/foundation/components/MeshRenderer/MeshRendererComponent.d.ts +21 -0
- package/dist/esmdev/foundation/components/Physics/PhysicsComponent.d.ts +1 -1
- package/dist/esmdev/foundation/components/SceneGraph/SceneGraphComponent.d.ts +36 -1
- package/dist/esmdev/foundation/components/Skeletal/SkeletalComponent.d.ts +5 -2
- package/dist/esmdev/foundation/core/Component.d.ts +1 -8
- package/dist/esmdev/foundation/core/Config.d.ts +7 -3
- package/dist/esmdev/foundation/core/GlobalDataRepository.d.ts +12 -8
- package/dist/esmdev/foundation/core/MemoryManager.d.ts +12 -0
- package/dist/esmdev/foundation/definitions/ProcessApproach.d.ts +1 -6
- package/dist/esmdev/foundation/definitions/ShaderSemantics.d.ts +0 -1
- package/dist/esmdev/foundation/definitions/VertexAttribute.d.ts +2 -1
- package/dist/esmdev/foundation/geometry/Mesh.d.ts +52 -0
- package/dist/esmdev/foundation/geometry/Primitive.d.ts +31 -0
- package/dist/esmdev/foundation/geometry/shapes/Cone.d.ts +2 -0
- package/dist/esmdev/foundation/geometry/shapes/Cylinder.d.ts +2 -0
- package/dist/esmdev/foundation/geometry/shapes/Plane.d.ts +2 -0
- package/dist/esmdev/foundation/gizmos/Gizmo.d.ts +30 -0
- package/dist/esmdev/foundation/gizmos/RotationGizmo.d.ts +27 -0
- package/dist/esmdev/foundation/gizmos/ScaleGizmo.d.ts +17 -0
- package/dist/esmdev/foundation/gizmos/TranslationGizmo.d.ts +17 -0
- package/dist/esmdev/foundation/helpers/MeshHelper.d.ts +42 -7
- package/dist/esmdev/foundation/importer/ModelConverter.d.ts +12 -0
- package/dist/esmdev/foundation/materials/contents/CustomMaterialContent.d.ts +1 -1
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +7 -23
- package/dist/esmdev/foundation/materials/core/Material.d.ts +27 -13
- package/dist/esmdev/foundation/materials/core/MaterialRepository.d.ts +5 -0
- package/dist/esmdev/foundation/physics/PhysicsProperty.d.ts +9 -2
- package/dist/esmdev/foundation/physics/index.d.ts +0 -1
- package/dist/esmdev/foundation/renderer/RenderPass.d.ts +8 -0
- package/dist/esmdev/foundation/system/Engine.d.ts +2 -2
- package/dist/esmdev/foundation/system/EngineState.d.ts +1 -1
- package/dist/esmdev/index.js +12831 -11280
- package/dist/esmdev/webgl/InstanceSidTable.d.ts +70 -0
- package/dist/esmdev/webgl/MultiDraw.d.ts +167 -0
- package/dist/esmdev/webgl/MultiDrawRepository.d.ts +39 -0
- package/dist/esmdev/webgl/WebGLContextWrapper.d.ts +12 -0
- package/dist/esmdev/webgl/WebGLExtension.d.ts +1 -0
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +36 -2
- package/dist/{esm/webgl/WebGLStrategyDataTexture.d.ts → esmdev/webgl/WebGLStrategyWebGL2.d.ts} +73 -4
- package/dist/esmdev/webgl/debug/BufferLayoutDecoder.d.ts +83 -0
- package/dist/esmdev/webgl/debug/ShaderParameterDebugger.d.ts +47 -0
- package/dist/esmdev/webgl/debug/index.d.ts +3 -0
- package/dist/esmdev/webgl/debug/types.d.ts +114 -0
- package/dist/esmdev/webgl/index.d.ts +2 -2
- package/dist/esmdev/webgl/main.d.ts +2 -4
- package/dist/esmdev/webgl/shaders/StandardShaderPart.d.ts +1 -1
- package/dist/esmdev/webgl/types/CommonTypes.d.ts +0 -1
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +15 -1
- package/package.json +2 -1
- package/dist/esm/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +0 -124
- package/dist/esm/foundation/physics/Oimo/index.d.ts +0 -1
- package/dist/esm/webgl/WebGLStrategyUniform.d.ts +0 -193
- package/dist/esmdev/foundation/physics/Oimo/OimoPhysicsStrategy.d.ts +0 -124
- package/dist/esmdev/foundation/physics/Oimo/index.d.ts +0 -1
- package/dist/esmdev/webgl/WebGLStrategyUniform.d.ts +0 -193
package/README.md
CHANGED
|
@@ -74,6 +74,14 @@ $ npm install rhodonite
|
|
|
74
74
|
|
|
75
75
|
If you get an error like "webxr-input-profiles not found" when building a project using Rhodonite, Try "npm install" or "pnpm install" again.
|
|
76
76
|
|
|
77
|
+
## Migration to WebGL2 mode
|
|
78
|
+
|
|
79
|
+
- `ProcessApproach.Uniform` was removed. Use `ProcessApproach.WebGL2`.
|
|
80
|
+
- `ProcessApproach.DataTexture` was renamed to `ProcessApproach.WebGL2` (mode name `"WebGL2"`).
|
|
81
|
+
- `WebGLStrategyDataTexture` was renamed to `WebGLStrategyWebGL2`.
|
|
82
|
+
- The shader define `RN_IS_DATATEXTURE_MODE` was renamed to `RN_IS_WEBGL2_MODE`.
|
|
83
|
+
- `Config.maxSkeletalBoneNumberForUniformMode` and the `setUniform` rendering argument were removed.
|
|
84
|
+
|
|
77
85
|
## Coding with Rhodonite
|
|
78
86
|
|
|
79
87
|
### In JavaScript
|
|
@@ -85,7 +93,7 @@ If you get an error like "webxr-input-profiles not found" when building a projec
|
|
|
85
93
|
<script>
|
|
86
94
|
// Init Rhodonite
|
|
87
95
|
const engine = await Rn.Engine.init({
|
|
88
|
-
approach: Rn.ProcessApproach.
|
|
96
|
+
approach: Rn.ProcessApproach.WebGL2,
|
|
89
97
|
canvas: document.getElementById('world'),
|
|
90
98
|
});
|
|
91
99
|
|
|
@@ -120,7 +128,7 @@ import Rn from 'rhodonite/dist/esm/index.js';
|
|
|
120
128
|
|
|
121
129
|
// Init Rhodonite
|
|
122
130
|
const engine = await Rn.Engine.init({
|
|
123
|
-
approach: Rn.ProcessApproach.
|
|
131
|
+
approach: Rn.ProcessApproach.WebGL2,
|
|
124
132
|
canvas: document.getElementById('world') as HTMLCanvasElement,
|
|
125
133
|
});
|
|
126
134
|
|
package/VERSION-FILE
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
v0.
|
|
1
|
+
v0.21.0-1-gbbd868bcd-dirty
|
|
2
2
|
main
|
|
@@ -15,6 +15,10 @@ import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
|
15
15
|
export type InstanceCullingState = {
|
|
16
16
|
readonly culledEntityStamp: Uint32Array;
|
|
17
17
|
readonly cullTick: number;
|
|
18
|
+
/** Number of entities culled by the latest culling. 0 means every instance stays visible. */
|
|
19
|
+
readonly culledEntityCount: number;
|
|
20
|
+
/** Globally unique id of the latest culling. */
|
|
21
|
+
readonly cullingId: number;
|
|
18
22
|
};
|
|
19
23
|
/**
|
|
20
24
|
* MeshRendererComponent is a component that manages the rendering of a mesh entity.
|
|
@@ -33,7 +37,17 @@ export declare class MeshRendererComponent extends Component {
|
|
|
33
37
|
private __updateCount;
|
|
34
38
|
private static __updateCount;
|
|
35
39
|
static _isFrustumCullingEnabled: boolean;
|
|
40
|
+
/** Monotonic id of the latest culling pass, used as a per-mesh visit stamp. */
|
|
41
|
+
private static __cullingIdCounter;
|
|
36
42
|
private __fingerPrint;
|
|
43
|
+
private __fingerPrintId;
|
|
44
|
+
/**
|
|
45
|
+
* Interned ids of mesh renderer fingerprints. The fingerprint changes only when the IBL cube
|
|
46
|
+
* maps change, and two mesh renderers with the same cube maps must share a multi-draw batch,
|
|
47
|
+
* so the id is interned by value instead of being unique per component.
|
|
48
|
+
*/
|
|
49
|
+
private static __fingerPrintIds;
|
|
50
|
+
private static __nextFingerPrintId;
|
|
37
51
|
/** Per-render-pass scratch buffers reused by sort_$render to avoid per-frame allocations. */
|
|
38
52
|
private static __sortScratchMap;
|
|
39
53
|
/** Memoized rendering strategy for common_$prerender (the hot path runs once per frame). */
|
|
@@ -118,11 +132,18 @@ export declare class MeshRendererComponent extends Component {
|
|
|
118
132
|
* The fingerprint is used for caching and optimization purposes.
|
|
119
133
|
*/
|
|
120
134
|
calcFingerPrint(): void;
|
|
135
|
+
private static __internFingerPrintId;
|
|
121
136
|
/**
|
|
122
137
|
* Gets the current fingerprint of this component.
|
|
123
138
|
* @returns The fingerprint string
|
|
124
139
|
*/
|
|
125
140
|
getFingerPrint(): string;
|
|
141
|
+
/**
|
|
142
|
+
* Gets the interned numeric id of the fingerprint. Numeric ids keep the per-frame
|
|
143
|
+
* multi-draw state keys cheap to compare.
|
|
144
|
+
* @returns The fingerprint id
|
|
145
|
+
*/
|
|
146
|
+
getFingerPrintId(): number;
|
|
126
147
|
/**
|
|
127
148
|
* Sets the IBL (Image-Based Lighting) cube maps for this mesh renderer.
|
|
128
149
|
* @param diffuseCubeTexture - The diffuse cube map texture for IBL
|
|
@@ -73,7 +73,7 @@ export declare class PhysicsComponent extends Component {
|
|
|
73
73
|
/**
|
|
74
74
|
* Common logic method that updates the global physics simulation.
|
|
75
75
|
* This is called once per frame for all physics components and handles
|
|
76
|
-
* the overall physics world update
|
|
76
|
+
* the overall physics world update through the Rapier physics backend.
|
|
77
77
|
*/
|
|
78
78
|
static common_$logic({ engine }: {
|
|
79
79
|
engine: Engine;
|
|
@@ -16,7 +16,7 @@ import { Quaternion } from '../../math/Quaternion';
|
|
|
16
16
|
import { Vector3 } from '../../math/Vector3';
|
|
17
17
|
import type { Vector4 } from '../../math/Vector4';
|
|
18
18
|
import type { Engine } from '../../system/Engine';
|
|
19
|
-
import
|
|
19
|
+
import { CameraComponent } from '../Camera/CameraComponent';
|
|
20
20
|
import type { ComponentToComponentMethods } from '../ComponentTypes';
|
|
21
21
|
import type { MeshComponent } from '../Mesh/MeshComponent';
|
|
22
22
|
/**
|
|
@@ -86,6 +86,10 @@ export declare class SceneGraphComponent extends Component {
|
|
|
86
86
|
private static __updateCountMap;
|
|
87
87
|
private static __tmpAABB;
|
|
88
88
|
private __lastTransformComponentsUpdateCount;
|
|
89
|
+
/** Scene graphs that currently own a visible transform gizmo, keyed by engine.objectUID. */
|
|
90
|
+
private static __transformGizmoOwners;
|
|
91
|
+
/** Last camera identity and update count applied to the transform gizmos, keyed by engine.objectUID. */
|
|
92
|
+
private static __lastCameraStateMap;
|
|
89
93
|
/**
|
|
90
94
|
* Creates a new SceneGraphComponent instance.
|
|
91
95
|
* @param engine - The engine instance
|
|
@@ -477,6 +481,37 @@ export declare class SceneGraphComponent extends Component {
|
|
|
477
481
|
* Updates all active gizmos for this scene graph node.
|
|
478
482
|
*/
|
|
479
483
|
private __updateGizmos;
|
|
484
|
+
/**
|
|
485
|
+
* Updates the translation, rotation and scale gizmos.
|
|
486
|
+
* Their size depends on the camera, so this is also called when only the camera changed.
|
|
487
|
+
*/
|
|
488
|
+
private __updateTransformGizmos;
|
|
489
|
+
/**
|
|
490
|
+
* Checks whether any transform gizmo is set up and visible on this node.
|
|
491
|
+
* @returns True if at least one of the translation/rotation/scale gizmos is visible
|
|
492
|
+
*/
|
|
493
|
+
private __hasVisibleTransformGizmo;
|
|
494
|
+
/**
|
|
495
|
+
* Registers this node as an owner of a visible transform gizmo so that the
|
|
496
|
+
* gizmos can be rescaled when only the camera changed.
|
|
497
|
+
*/
|
|
498
|
+
private __registerTransformGizmoOwner;
|
|
499
|
+
/**
|
|
500
|
+
* Removes this node from the transform gizmo registry when no transform gizmo is visible.
|
|
501
|
+
*/
|
|
502
|
+
private __unregisterTransformGizmoOwnerIfNeeded;
|
|
503
|
+
/**
|
|
504
|
+
* Re-applies the screen-space gizmo scale after the camera has been updated.
|
|
505
|
+
*
|
|
506
|
+
* The transform gizmos keep a constant on-screen size, so they must be rescaled whenever the
|
|
507
|
+
* camera changes. SceneGraphComponent (TID 4) is processed before CameraComponent (TID 9) in
|
|
508
|
+
* the Logic stage, so this is called by the Engine right after the Logic stage has finished,
|
|
509
|
+
* which also covers frames in which the Engine skips the Logic stage entirely.
|
|
510
|
+
*
|
|
511
|
+
* @param engine - The engine whose current camera may have changed
|
|
512
|
+
* @internal
|
|
513
|
+
*/
|
|
514
|
+
static _updateTransformGizmosByCameraChange(engine: Engine): void;
|
|
480
515
|
/**
|
|
481
516
|
* Sets the world position without updating physics simulation.
|
|
482
517
|
* @param vec - The world position to set
|
|
@@ -407,10 +407,13 @@ export declare class SkeletalComponent extends Component {
|
|
|
407
407
|
* The cache key determines which SkeletalComponents can share skinning results:
|
|
408
408
|
*
|
|
409
409
|
* ## With Animation Applied
|
|
410
|
-
* - Uses format: `anim|{animationHash}|{inverseBindMatricesSignature}`
|
|
410
|
+
* - Uses format: `anim|{animationHash}|{inverseBindMatricesSignature}|{jointListKey}`
|
|
411
411
|
* - animationHash is computed from animation track features (keyframes, timings, etc.)
|
|
412
412
|
* - inverseBindMatricesSignature ensures models with different bone structures don't share cache
|
|
413
|
-
* -
|
|
413
|
+
* - jointListKey ensures recursively nested chains that share local tracks/bind matrices
|
|
414
|
+
* but have different joint nodes (different parent transforms) don't share results
|
|
415
|
+
* - Only models with the same animation, bind matrices and joint hierarchy can share
|
|
416
|
+
* skinning results
|
|
414
417
|
*
|
|
415
418
|
* ## Without Animation
|
|
416
419
|
* - Uses format: `{jointListKey}|{accessorSignature}|no_animation`
|
|
@@ -29,11 +29,6 @@ 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
32
|
/**
|
|
38
33
|
* Whether this array member has a per-instance length (see `Component.registerMember`).
|
|
39
34
|
*/
|
|
@@ -249,10 +244,9 @@ export declare class Component extends RnObject {
|
|
|
249
244
|
* @param componentType - The primitive data type (e.g., Float32, Int32)
|
|
250
245
|
* @param initValues - Initial values for the member field
|
|
251
246
|
* @param convertToBool - Whether to convert the member value to a boolean
|
|
252
|
-
* @param uniformArrayLengthMultiplier - Multiplier of the uniform array length in uniform mode
|
|
253
247
|
* @param isVariableLength - Whether the array member has a per-instance length
|
|
254
248
|
*/
|
|
255
|
-
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool,
|
|
249
|
+
static registerMember(this: typeof Component, { bufferUse, memberName, dataClassType, shaderType, compositionType, componentType, initValues, arrayLength, componentSID, convertToBool, isVariableLength, }: {
|
|
256
250
|
bufferUse: BufferUseEnum;
|
|
257
251
|
memberName: string;
|
|
258
252
|
dataClassType: DataClassType;
|
|
@@ -263,7 +257,6 @@ export declare class Component extends RnObject {
|
|
|
263
257
|
arrayLength?: Count | undefined;
|
|
264
258
|
componentSID?: ComponentSID;
|
|
265
259
|
convertToBool?: boolean;
|
|
266
|
-
uniformArrayLengthMultiplier?: number;
|
|
267
260
|
isVariableLength?: boolean;
|
|
268
261
|
}): void;
|
|
269
262
|
/**
|
|
@@ -11,7 +11,6 @@ type ConfigInitDescription = {
|
|
|
11
11
|
maxLightNumber?: number;
|
|
12
12
|
materialCountPerBufferView?: number;
|
|
13
13
|
boneDataType?: BoneDataTypeEnum;
|
|
14
|
-
maxSkeletalBoneNumberForUniformMode?: number;
|
|
15
14
|
isUboEnabled?: boolean;
|
|
16
15
|
eventTargetDom?: HTMLElement;
|
|
17
16
|
cacheWebGpuRenderBundles?: boolean;
|
|
@@ -21,6 +20,7 @@ type ConfigInitDescription = {
|
|
|
21
20
|
isMobile?: boolean;
|
|
22
21
|
bufferSizeDivisionRatiosForGPUInstanceDataUsage?: number[];
|
|
23
22
|
logLevel?: LogLevel;
|
|
23
|
+
isMultiDrawEnabled?: boolean;
|
|
24
24
|
};
|
|
25
25
|
/**
|
|
26
26
|
* Config is a configuration class that contains the configuration for the library.
|
|
@@ -49,8 +49,6 @@ export declare class Config {
|
|
|
49
49
|
* and other SkeletalComponents default to Vec4x2.
|
|
50
50
|
*/
|
|
51
51
|
boneDataType: BoneDataTypeEnum | undefined;
|
|
52
|
-
/** The maximum number of bones of each skeleton that Rhodonite can handle for Uniform Mode */
|
|
53
|
-
maxSkeletalBoneNumberForUniformMode: number;
|
|
54
52
|
/** Whether the UBO is enabled */
|
|
55
53
|
isUboEnabled: boolean;
|
|
56
54
|
/** The event target DOM for mouse operation */
|
|
@@ -69,6 +67,12 @@ export declare class Config {
|
|
|
69
67
|
bufferSizeDivisionRatiosForGPUInstanceDataUsage: number[];
|
|
70
68
|
/** The minimum log level that will be output. Messages below this level are ignored. */
|
|
71
69
|
logLevel: LogLevel;
|
|
70
|
+
/**
|
|
71
|
+
* Whether to enable WebGL multi-draw rendering.
|
|
72
|
+
* When enabled (and supported), primitives sharing a source Buffer are merged into shared
|
|
73
|
+
* vertex/index buffers and consecutive draws with the same state are issued with WEBGL_multi_draw.
|
|
74
|
+
*/
|
|
75
|
+
isMultiDrawEnabled: boolean;
|
|
72
76
|
constructor(initDescription?: ConfigInitDescription);
|
|
73
77
|
}
|
|
74
78
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ProcessApproachEnum } from '../../foundation/definitions/ProcessApproach';
|
|
2
|
-
import type { CGAPIResourceHandle, Index, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
2
|
+
import type { CGAPIResourceHandle, Count, Index, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
3
3
|
import type { getShaderPropertyFuncOfGlobalDataRepository, ShaderSemanticsName } from '../definitions/ShaderSemantics';
|
|
4
|
+
import { type ShaderSemanticsInfo } from '../definitions/ShaderSemanticsInfo';
|
|
4
5
|
import type { Engine } from '../system/Engine';
|
|
5
6
|
/**
|
|
6
7
|
* The repository class that manages global data used throughout the rendering pipeline.
|
|
@@ -63,13 +64,16 @@ export declare class GlobalDataRepository {
|
|
|
63
64
|
*/
|
|
64
65
|
getValue(shaderSemantic: ShaderSemanticsName, countIndex: Index): any;
|
|
65
66
|
/**
|
|
66
|
-
*
|
|
67
|
-
* This is
|
|
68
|
-
*
|
|
69
|
-
* @param shaderProgramUid - The unique identifier of the shader program
|
|
70
|
-
* @internal
|
|
67
|
+
* Returns every registered global property with its current value and layout offset.
|
|
68
|
+
* This is intended for debugging tools; it does not allocate or modify anything.
|
|
71
69
|
*/
|
|
72
|
-
|
|
70
|
+
getPropertyTable(): Array<{
|
|
71
|
+
semantic: ShaderSemanticsName;
|
|
72
|
+
info: ShaderSemanticsInfo;
|
|
73
|
+
value: any;
|
|
74
|
+
vec4Index: IndexOf16Bytes;
|
|
75
|
+
maxCount: Count;
|
|
76
|
+
}>;
|
|
73
77
|
/**
|
|
74
78
|
* Sets up uniform locations for properties that need uniform access in data texture mode.
|
|
75
79
|
* Only sets up uniforms for properties marked with needUniformInDataTextureMode flag.
|
|
@@ -77,7 +81,7 @@ export declare class GlobalDataRepository {
|
|
|
77
81
|
* @param shaderProgramUid - The unique identifier of the shader program
|
|
78
82
|
* @internal
|
|
79
83
|
*/
|
|
80
|
-
|
|
84
|
+
_setUniformLocationsForWebGL2ModeOnly(shaderProgramUid: CGAPIResourceHandle): void;
|
|
81
85
|
/**
|
|
82
86
|
* Gets the memory location offset of a global property in 16-byte aligned units.
|
|
83
87
|
* This is used for data texture mode to determine where properties are stored in memory.
|
|
@@ -87,6 +87,18 @@ export declare class MemoryManager {
|
|
|
87
87
|
* @returns The byte offset of the existing buffers in bytes
|
|
88
88
|
*/
|
|
89
89
|
getByteOffsetOfExistingBuffers(bufferUse: BufferUseEnum, indexOfTheBufferLayer: Index): Byte;
|
|
90
|
+
/**
|
|
91
|
+
* Reads float values from the concatenated layers of a buffer usage.
|
|
92
|
+
*
|
|
93
|
+
* This is intended for debugging tools. The returned array is a copy when the range
|
|
94
|
+
* spans buffer layers, and a view into the layer otherwise.
|
|
95
|
+
*
|
|
96
|
+
* @param bufferUse - The buffer usage to read
|
|
97
|
+
* @param byteOffset - Byte offset from the start of the first layer
|
|
98
|
+
* @param count - Number of float values to read
|
|
99
|
+
* @returns The read values, or null when the range is outside the allocated buffers
|
|
100
|
+
*/
|
|
101
|
+
readFloat32Array(bufferUse: BufferUseEnum, byteOffset: Byte, count: Count): Float32Array | null;
|
|
90
102
|
/**
|
|
91
103
|
* Prints memory usage statistics for all managed buffers to the console.
|
|
92
104
|
* Shows used bytes, total bytes, and usage percentage for each buffer type.
|
|
@@ -8,17 +8,12 @@ export declare class ProcessApproachClass extends EnumClass implements EnumIO {
|
|
|
8
8
|
}
|
|
9
9
|
export type ProcessApproachEnum = ProcessApproachClass;
|
|
10
10
|
declare function from(index: number): ProcessApproachEnum | undefined;
|
|
11
|
-
declare const isDataTextureApproach: (processApproach: ProcessApproachEnum) => boolean;
|
|
12
|
-
declare const isUniformApproach: (processApproach: ProcessApproachEnum) => boolean;
|
|
13
11
|
declare const isWebGpuApproach: (processApproach: ProcessApproachEnum) => boolean;
|
|
14
12
|
declare const isWebGL2Approach: (processApproach: ProcessApproachEnum) => boolean;
|
|
15
13
|
export declare const ProcessApproach: Readonly<{
|
|
16
|
-
isDataTextureApproach: typeof isDataTextureApproach;
|
|
17
|
-
isUniformApproach: typeof isUniformApproach;
|
|
18
14
|
isWebGpuApproach: typeof isWebGpuApproach;
|
|
19
15
|
None: ProcessApproachClass;
|
|
20
|
-
|
|
21
|
-
DataTexture: ProcessApproachClass;
|
|
16
|
+
WebGL2: ProcessApproachClass;
|
|
22
17
|
WebGPU: ProcessApproachClass;
|
|
23
18
|
from: typeof from;
|
|
24
19
|
isWebGL2Approach: typeof isWebGL2Approach;
|
|
@@ -71,7 +71,6 @@ export declare const ShaderSemantics: Readonly<{
|
|
|
71
71
|
ShadingModel: ShaderSemanticsEnum;
|
|
72
72
|
SkinningMode: ShaderSemanticsEnum;
|
|
73
73
|
GeneralTexture: ShaderSemanticsEnum;
|
|
74
|
-
VertexAttributesExistenceArray: ShaderSemanticsEnum;
|
|
75
74
|
BoneQuaternion: ShaderSemanticsEnum;
|
|
76
75
|
BoneTranslateScale: ShaderSemanticsEnum;
|
|
77
76
|
BoneTranslatePackedQuat: ShaderSemanticsEnum;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Count, Index, VectorComponentN } from '../../types/CommonTypes';
|
|
2
2
|
import { EnumClass, type EnumIO } from '../misc/EnumIO';
|
|
3
3
|
type ComponentChar = 'X' | 'Y' | 'Z' | 'W';
|
|
4
|
-
export type VertexAttributeTypeName = 'UNKNOWN' | 'POSITION' | 'NORMAL' | 'TANGENT' | 'TEXCOORD_0' | 'TEXCOORD_1' | 'TEXCOORD_2' | 'COLOR_0' | 'JOINTS_0' | 'WEIGHTS_0' | 'INSTANCE' | 'FACE_NORMAL' | 'BARY_CENTRIC_COORD';
|
|
4
|
+
export type VertexAttributeTypeName = 'UNKNOWN' | 'POSITION' | 'NORMAL' | 'TANGENT' | 'TEXCOORD_0' | 'TEXCOORD_1' | 'TEXCOORD_2' | 'COLOR_0' | 'JOINTS_0' | 'WEIGHTS_0' | 'INSTANCE' | 'FACE_NORMAL' | 'BARY_CENTRIC_COORD' | 'MATERIAL_SID';
|
|
5
5
|
export type VertexAttributeComponent = `${VertexAttributeTypeName}.${ComponentChar}`;
|
|
6
6
|
export type VertexAttributeSemanticsJoinedString = `${string}.${ComponentChar}` | `${string}.${ComponentChar},${string}.${ComponentChar}` | `${string}.${ComponentChar},${string}.${ComponentChar},${string}.${ComponentChar}` | `${string}.${ComponentChar},${string}.${ComponentChar},${string}.${ComponentChar},${string}.${ComponentChar}`;
|
|
7
7
|
export interface VertexAttributeEnum extends EnumIO {
|
|
@@ -75,6 +75,7 @@ export declare const VertexAttribute: Readonly<{
|
|
|
75
75
|
Instance: VertexAttributeEnum;
|
|
76
76
|
FaceNormal: VertexAttributeEnum;
|
|
77
77
|
BaryCentricCoord: VertexAttributeEnum;
|
|
78
|
+
MaterialSid: VertexAttributeEnum;
|
|
78
79
|
AttributeTypeNumber: number;
|
|
79
80
|
integerTypeAttributes: VertexAttributeEnum[];
|
|
80
81
|
isInstanceOfVertexAttributeClass: typeof isInstanceOfVertexAttributeClass;
|
|
@@ -25,6 +25,8 @@ export declare class Mesh implements IMesh {
|
|
|
25
25
|
private __morphPrimitives;
|
|
26
26
|
private __localAABB;
|
|
27
27
|
private __vaoUids;
|
|
28
|
+
/** Indices of __vaoUids that refer to a MultiDrawRepository-owned group VAO. */
|
|
29
|
+
private __multiDrawVaoIndices;
|
|
28
30
|
private __variationVBOUid;
|
|
29
31
|
/** Instance variation data of all the entities, in the order of `__variationEntityUIDs`. */
|
|
30
32
|
private __variationEntityInfo?;
|
|
@@ -39,6 +41,11 @@ export declare class Mesh implements IMesh {
|
|
|
39
41
|
/** Culling state the variation VBO content was packed for; used to skip redundant packing. */
|
|
40
42
|
private __variationVBOCulledEntityStamp?;
|
|
41
43
|
private __variationVBOCullTick;
|
|
44
|
+
/** Stable slot range in the engine-wide instance SID table (WebGL multi-draw). */
|
|
45
|
+
private __instanceSidBase;
|
|
46
|
+
private __instanceSidCount;
|
|
47
|
+
/** Id of the last culling pass that visited this mesh in the per-pass instance prepass. */
|
|
48
|
+
private __remapPrepassId;
|
|
42
49
|
private __latestPrimitivePositionAccessorVersionForAABB;
|
|
43
50
|
private __latestPrimitivePositionAccessorVersionForSetUpDone;
|
|
44
51
|
private __belongToEntities;
|
|
@@ -143,6 +150,28 @@ export declare class Mesh implements IMesh {
|
|
|
143
150
|
* @returns The number of primitives
|
|
144
151
|
*/
|
|
145
152
|
getPrimitiveNumber(): number;
|
|
153
|
+
/**
|
|
154
|
+
* Whether the WebGL instance SID texture path (multi-draw) is active for this mesh.
|
|
155
|
+
*/
|
|
156
|
+
private __isInstanceSidTextureMode;
|
|
157
|
+
/**
|
|
158
|
+
* Ensures that this mesh owns a contiguous range of stable instance slots in the
|
|
159
|
+
* engine-wide instance SID table and writes the instance identity records.
|
|
160
|
+
* @returns The first stable slot index (instanceBase).
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
_ensureInstanceSidBase(): number;
|
|
164
|
+
/**
|
|
165
|
+
* Gets the first stable instance slot of this mesh (WebGL multi-draw).
|
|
166
|
+
* @internal
|
|
167
|
+
*/
|
|
168
|
+
get _instanceSidBase(): number;
|
|
169
|
+
/**
|
|
170
|
+
* Visit stamp of the per-pass instance prepass (WebGL multi-draw).
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
get _remapPrepassId(): number;
|
|
174
|
+
set _remapPrepassId(id: number);
|
|
146
175
|
/**
|
|
147
176
|
* Updates the variation VBO (Vertex Buffer Object) for instancing.
|
|
148
177
|
* @returns True if updated, false if not changed (not dirty)
|
|
@@ -163,6 +192,16 @@ export declare class Mesh implements IMesh {
|
|
|
163
192
|
* @internal
|
|
164
193
|
*/
|
|
165
194
|
_packVisibleInstancesToVariationVBO(culledEntityStamp: Uint32Array | undefined, cullTick: number): number;
|
|
195
|
+
/**
|
|
196
|
+
* Packs the visible instances into the engine-wide remap table so that the shader can
|
|
197
|
+
* resolve `instanceBase + gl_InstanceID` to a stable SID slot. WebGL multi-draw only.
|
|
198
|
+
*
|
|
199
|
+
* @param culledEntityStamp - Per-EntityUID stamps written by the render pass culling
|
|
200
|
+
* @param cullTick - The stamp value of the latest culling of the render pass
|
|
201
|
+
* @returns The number of visible instances
|
|
202
|
+
* @internal
|
|
203
|
+
*/
|
|
204
|
+
_packVisibleInstancesToInstanceRemap(culledEntityStamp: Uint32Array | undefined, cullTick: number): number;
|
|
166
205
|
/**
|
|
167
206
|
* Deletes the variation VBO (Vertex Buffer Object).
|
|
168
207
|
* @returns True if updated, false if not changed (not dirty)
|
|
@@ -175,8 +214,15 @@ export declare class Mesh implements IMesh {
|
|
|
175
214
|
updateVAO(): void;
|
|
176
215
|
/**
|
|
177
216
|
* Deletes all VAO (Vertex Array Object) resources for this mesh.
|
|
217
|
+
* Group VAOs are owned by the MultiDrawRepository and are skipped.
|
|
178
218
|
*/
|
|
179
219
|
deleteVAO(): void;
|
|
220
|
+
/**
|
|
221
|
+
* Clears the VAO entries that point at multi-draw group VAOs. The groups own those
|
|
222
|
+
* VAOs and delete them, so the mesh must forget them before the group is released.
|
|
223
|
+
* @internal
|
|
224
|
+
*/
|
|
225
|
+
_clearMultiDrawVaoUids(): void;
|
|
180
226
|
/**
|
|
181
227
|
* Performs ray casting against this mesh to find intersection points.
|
|
182
228
|
* @param srcPointInLocal - The ray origin point in local space
|
|
@@ -313,6 +359,12 @@ export declare class Mesh implements IMesh {
|
|
|
313
359
|
* Updates VBO (Vertex Buffer Object) and VAO (Vertex Array Object) for all primitives.
|
|
314
360
|
* @internal
|
|
315
361
|
*/
|
|
362
|
+
/**
|
|
363
|
+
* Marks this mesh's multi-draw groups (and the legacy setup) for a rebuild.
|
|
364
|
+
* Called when a primitive's attributes or indices change.
|
|
365
|
+
* @internal
|
|
366
|
+
*/
|
|
367
|
+
_invalidateMultiDrawStructure(): void;
|
|
316
368
|
_updateVBOAndVAO(): void;
|
|
317
369
|
/**
|
|
318
370
|
* Deletes all 3D API vertex data for this mesh.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Count, Index, Offset, PrimitiveUID, TypedArray } from '../../types/CommonTypes';
|
|
2
|
+
import type { MultiDrawEntry, MultiDrawGroup } from '../../webgl/MultiDraw';
|
|
2
3
|
import type { VertexHandles } from '../../webgl/WebGLResourceRepository';
|
|
3
4
|
import { RnObject } from '../core/RnObject';
|
|
4
5
|
import { type ComponentTypeEnum } from '../definitions/ComponentType';
|
|
@@ -43,6 +44,8 @@ export declare class Primitive extends RnObject {
|
|
|
43
44
|
private __targets;
|
|
44
45
|
private __vertexHandles?;
|
|
45
46
|
private __mesh?;
|
|
47
|
+
private __multiDrawGroup?;
|
|
48
|
+
private __multiDrawEntryIndex;
|
|
46
49
|
private static __primitives;
|
|
47
50
|
_sortkey: PrimitiveSortKey;
|
|
48
51
|
_viewDepth: number;
|
|
@@ -70,6 +73,28 @@ export declare class Primitive extends RnObject {
|
|
|
70
73
|
* @returns The fingerprint string used for primitive identification
|
|
71
74
|
*/
|
|
72
75
|
_getFingerPrint(): string;
|
|
76
|
+
/**
|
|
77
|
+
* Gets the index bit size used for rendering. Primitives merged into a multi-draw
|
|
78
|
+
* group use the shared uint32 index buffer regardless of their source accessor type.
|
|
79
|
+
*/
|
|
80
|
+
getRenderIndexBitSize(): 'uint16' | 'uint32';
|
|
81
|
+
/** The engine that owns this primitive (used to scope engine-wide scans). */
|
|
82
|
+
get _engine(): Engine;
|
|
83
|
+
/** The multi-draw group this primitive belongs to, if any. */
|
|
84
|
+
get _multiDrawGroup(): MultiDrawGroup | undefined;
|
|
85
|
+
/** The entry of this primitive inside its multi-draw group. */
|
|
86
|
+
get _multiDrawEntry(): MultiDrawEntry | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Associates this primitive with a multi-draw group entry and shares the group's
|
|
89
|
+
* GPU handles. The caller is responsible for the group's GPU resources.
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
_setMultiDrawGroup(group: MultiDrawGroup, entryIndex: number): void;
|
|
93
|
+
/**
|
|
94
|
+
* Detaches this primitive from its multi-draw group.
|
|
95
|
+
* @internal
|
|
96
|
+
*/
|
|
97
|
+
_clearMultiDrawGroup(): void;
|
|
73
98
|
/**
|
|
74
99
|
* Gets the index of a primitive with morph targets by its UID.
|
|
75
100
|
* @param primitiveUid - The unique identifier of the primitive
|
|
@@ -184,6 +209,11 @@ export declare class Primitive extends RnObject {
|
|
|
184
209
|
* @returns The primitive if found and still exists, otherwise undefined
|
|
185
210
|
*/
|
|
186
211
|
static getPrimitive(primitiveUid: PrimitiveUID): Primitive | undefined;
|
|
212
|
+
/**
|
|
213
|
+
* Iterates over all live primitives created in this application.
|
|
214
|
+
* @param callback - Called for each live primitive
|
|
215
|
+
*/
|
|
216
|
+
static forEachPrimitive(callback: (primitive: Primitive) => void): void;
|
|
187
217
|
/**
|
|
188
218
|
* Gets the total number of primitives created in the application.
|
|
189
219
|
* @returns The total count of primitives
|
|
@@ -308,6 +338,7 @@ export declare class Primitive extends RnObject {
|
|
|
308
338
|
* @param accessor - The accessor containing the attribute data
|
|
309
339
|
* @param vertexSemantic - The semantic meaning of the attribute
|
|
310
340
|
*/
|
|
341
|
+
private __invalidateMultiDrawGroup;
|
|
311
342
|
setVertexAttribute(accessor: Accessor, vertexSemantic: VertexAttributeSemanticsJoinedString): void;
|
|
312
343
|
/**
|
|
313
344
|
* Removes the index buffer from this primitive, converting it to non-indexed rendering.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Count } from '../../../types/CommonTypes';
|
|
2
|
+
import type { PhysicsProperty } from '../../physics/PhysicsProperty';
|
|
2
3
|
import type { IAnyPrimitiveDescriptor } from '../Primitive';
|
|
3
4
|
import { IShape } from './IShape';
|
|
4
5
|
/**
|
|
@@ -25,6 +26,7 @@ export interface ConeDescriptor extends IAnyPrimitiveDescriptor {
|
|
|
25
26
|
* @defaultValue true
|
|
26
27
|
*/
|
|
27
28
|
includeBase?: boolean;
|
|
29
|
+
physics?: PhysicsProperty;
|
|
28
30
|
}
|
|
29
31
|
/**
|
|
30
32
|
* Cone primitive aligned along the +Y axis (base on the XZ plane, tip along +Y).
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Count } from '../../../types/CommonTypes';
|
|
2
|
+
import type { PhysicsProperty } from '../../physics/PhysicsProperty';
|
|
2
3
|
import type { IAnyPrimitiveDescriptor } from '../Primitive';
|
|
3
4
|
import { IShape } from './IShape';
|
|
4
5
|
/** Descriptor for a capped cylinder or truncated cone aligned with the Y axis. */
|
|
@@ -8,6 +9,7 @@ export interface CylinderDescriptor extends IAnyPrimitiveDescriptor {
|
|
|
8
9
|
height?: number;
|
|
9
10
|
radialSegments?: Count;
|
|
10
11
|
includeCaps?: boolean;
|
|
12
|
+
physics?: PhysicsProperty;
|
|
11
13
|
}
|
|
12
14
|
/** A centered, capped cylinder that also supports different top and bottom radii. */
|
|
13
15
|
export declare class Cylinder extends IShape {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Size } from '../../../types/CommonTypes';
|
|
2
|
+
import type { PhysicsProperty } from '../../physics/PhysicsProperty';
|
|
2
3
|
import type { IAnyPrimitiveDescriptor } from '../Primitive';
|
|
3
4
|
import { IShape } from './IShape';
|
|
4
5
|
/**
|
|
@@ -19,6 +20,7 @@ export interface PlaneDescriptor extends IAnyPrimitiveDescriptor {
|
|
|
19
20
|
isUVRepeat?: boolean;
|
|
20
21
|
/** draw textures by flipping on the V(Y)-axis */
|
|
21
22
|
flipTextureCoordinateY?: boolean;
|
|
23
|
+
physics?: PhysicsProperty;
|
|
22
24
|
}
|
|
23
25
|
/**
|
|
24
26
|
* A class for generating plane geometry with customizable dimensions and tessellation
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { RnObject } from '../core/RnObject';
|
|
2
2
|
import type { IMeshEntity, ISceneGraphEntity } from '../helpers/EntityHelper';
|
|
3
|
+
import type { IVector3 } from '../math/IVector';
|
|
3
4
|
import type { Engine } from '../system/Engine';
|
|
4
5
|
/**
|
|
5
6
|
* Abstract Gizmo class that provides a foundation for creating interactive gizmo objects
|
|
@@ -7,6 +8,8 @@ import type { Engine } from '../system/Engine';
|
|
|
7
8
|
* rotation rings, or other interactive visual aids.
|
|
8
9
|
*/
|
|
9
10
|
export declare abstract class Gizmo extends RnObject {
|
|
11
|
+
/** Scratch vector used to transform a world position into view space. */
|
|
12
|
+
private static readonly __tmpViewPosition;
|
|
10
13
|
/**
|
|
11
14
|
* The top entity of this gizmo group.
|
|
12
15
|
* A programmer who implements a gizmo class has to make this entity
|
|
@@ -72,4 +75,31 @@ export declare abstract class Gizmo extends RnObject {
|
|
|
72
75
|
* and processing pipelines
|
|
73
76
|
*/
|
|
74
77
|
protected setGizmoTag(): void;
|
|
78
|
+
/**
|
|
79
|
+
* Marks the gizmo subtree's world matrices as dirty and materializes them immediately.
|
|
80
|
+
*
|
|
81
|
+
* The GPU instance data (world and normal matrices) is uploaded at the beginning of the Render
|
|
82
|
+
* stage from component buffers, and those buffers are only written when the matrices are
|
|
83
|
+
* recalculated. A gizmo updated after the Logic stage (for example when only the camera
|
|
84
|
+
* changed) therefore has to recalculate its matrices here, otherwise the gizmo keeps being
|
|
85
|
+
* rendered with its previous transform until some later frame re-uploads the data.
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
protected __updateWorldMatricesOfSubtree(): void;
|
|
89
|
+
/**
|
|
90
|
+
* Calculates a uniform world-space scale that keeps a unit-length gizmo element
|
|
91
|
+
* (an axis of length 1, or a ring of radius 1) at a constant fraction of the
|
|
92
|
+
* viewport height, independent of the target size and the camera distance.
|
|
93
|
+
*
|
|
94
|
+
* The scale is derived from the vertical scale of the camera's projection matrix,
|
|
95
|
+
* so the on-screen size stays proportional to the viewport height for both
|
|
96
|
+
* perspective and orthographic cameras.
|
|
97
|
+
*
|
|
98
|
+
* @param engine - The engine used to resolve the current camera
|
|
99
|
+
* @param worldPosition - The world-space position of the gizmo center
|
|
100
|
+
* @param screenSpaceRatio - The target size as a fraction of the viewport height
|
|
101
|
+
* @returns The uniform scale to apply to the gizmo's top entity
|
|
102
|
+
* @internal
|
|
103
|
+
*/
|
|
104
|
+
protected static __calcScreenSpaceScale(engine: Engine, worldPosition: IVector3, screenSpaceRatio: number): number;
|
|
75
105
|
}
|
|
@@ -11,6 +11,8 @@ export declare class RotationGizmo extends Gizmo {
|
|
|
11
11
|
private static __activeAxis;
|
|
12
12
|
private static __space;
|
|
13
13
|
private static __length;
|
|
14
|
+
/** Gizmo size as a fraction of the viewport height (ring radius). */
|
|
15
|
+
private static __screenSpaceRatio;
|
|
14
16
|
private static readonly __unitX;
|
|
15
17
|
private static readonly __unitY;
|
|
16
18
|
private static readonly __unitZ;
|
|
@@ -53,8 +55,33 @@ export declare class RotationGizmo extends Gizmo {
|
|
|
53
55
|
*/
|
|
54
56
|
private static __getResources;
|
|
55
57
|
get isSetup(): boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Sets the ring radius of the gizmo.
|
|
60
|
+
* @param val - The ring radius value
|
|
61
|
+
* @deprecated The gizmo size is now derived from the camera so that it stays
|
|
62
|
+
* constant in screen space. This value only affects the geometry generated
|
|
63
|
+
* before the gizmo resources are created.
|
|
64
|
+
*/
|
|
56
65
|
set length(val: number);
|
|
66
|
+
/**
|
|
67
|
+
* Gets the ring radius of the gizmo.
|
|
68
|
+
* @returns The ring radius value
|
|
69
|
+
* @deprecated The gizmo size is now derived from the camera so that it stays
|
|
70
|
+
* constant in screen space. This value only affects the geometry generated
|
|
71
|
+
* before the gizmo resources are created.
|
|
72
|
+
*/
|
|
57
73
|
get length(): number;
|
|
74
|
+
/**
|
|
75
|
+
* Sets the gizmo size as a fraction of the viewport height.
|
|
76
|
+
* The unit ring radius is projected to this fraction of the viewport height.
|
|
77
|
+
* @param val - The ratio of the viewport height (for example, 0.08 for 8%)
|
|
78
|
+
*/
|
|
79
|
+
set screenSpaceRatio(val: number);
|
|
80
|
+
/**
|
|
81
|
+
* Gets the gizmo size as a fraction of the viewport height.
|
|
82
|
+
* @returns The ratio of the viewport height occupied by the gizmo's unit ring radius
|
|
83
|
+
*/
|
|
84
|
+
get screenSpaceRatio(): number;
|
|
58
85
|
get isVisible(): boolean;
|
|
59
86
|
set isVisible(flg: boolean);
|
|
60
87
|
setSpace(space: 'local' | 'world'): void;
|