rhodonite 0.20.2 → 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/Physics/PhysicsComponent.d.ts +1 -1
- package/dist/esm/foundation/core/Component.d.ts +1 -8
- package/dist/esm/foundation/core/Config.d.ts +0 -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/materials/contents/CustomMaterialContent.d.ts +1 -1
- package/dist/esm/foundation/materials/core/AbstractMaterialContent.d.ts +1 -23
- package/dist/esm/foundation/materials/core/Material.d.ts +10 -14
- 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/system/Engine.d.ts +2 -2
- package/dist/esm/foundation/system/EngineState.d.ts +1 -1
- package/dist/esm/index.js +465 -588
- package/dist/esm/webgl/MultiDraw.d.ts +1 -1
- package/dist/esm/webgl/WebGLResourceRepository.d.ts +1 -2
- package/dist/{esmdev/webgl/WebGLStrategyDataTexture.d.ts → esm/webgl/WebGLStrategyWebGL2.d.ts} +4 -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/esmdev/foundation/components/Physics/PhysicsComponent.d.ts +1 -1
- package/dist/esmdev/foundation/core/Component.d.ts +1 -8
- package/dist/esmdev/foundation/core/Config.d.ts +0 -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/materials/contents/CustomMaterialContent.d.ts +1 -1
- package/dist/esmdev/foundation/materials/core/AbstractMaterialContent.d.ts +1 -23
- package/dist/esmdev/foundation/materials/core/Material.d.ts +10 -14
- 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/system/Engine.d.ts +2 -2
- package/dist/esmdev/foundation/system/EngineState.d.ts +1 -1
- package/dist/esmdev/index.js +1293 -2043
- package/dist/esmdev/webgl/MultiDraw.d.ts +1 -1
- package/dist/esmdev/webgl/WebGLResourceRepository.d.ts +1 -2
- package/dist/{esm/webgl/WebGLStrategyDataTexture.d.ts → esmdev/webgl/WebGLStrategyWebGL2.d.ts} +4 -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/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
|
@@ -120,7 +120,7 @@ export declare function makeMultiDrawRenderStateKey(primitive: Primitive, materi
|
|
|
120
120
|
* `Material.stateVersion`, so a cache hit costs a WeakMap lookup plus field compares.
|
|
121
121
|
*/
|
|
122
122
|
export declare function getMultiDrawStateKeyId(primitive: Primitive, material: Material, meshRendererFingerPrintId: number): number | null;
|
|
123
|
-
/** Draw arguments filled by
|
|
123
|
+
/** Draw arguments filled by WebGLStrategyWebGL2 when a draw is deferred into a batch. */
|
|
124
124
|
export type DeferredMultiDraw = {
|
|
125
125
|
primitive: Primitive;
|
|
126
126
|
mesh: Mesh;
|
|
@@ -372,10 +372,9 @@ export declare class WebGLResourceRepository extends CGAPIResourceRepository imp
|
|
|
372
372
|
* @param config - Configuration for the shader program
|
|
373
373
|
* @param shaderProgramUid - The handle of the shader program
|
|
374
374
|
* @param infoArray - Array of shader semantics information
|
|
375
|
-
* @param isUniformOnlyMode - Whether to set up only uniform locations
|
|
376
375
|
* @returns The WebGL program object with configured uniform locations
|
|
377
376
|
*/
|
|
378
|
-
setupUniformLocations(config: Config, shaderProgramUid: WebGLResourceHandle, infoArray: ShaderSemanticsInfo[]
|
|
377
|
+
setupUniformLocations(config: Config, shaderProgramUid: WebGLResourceHandle, infoArray: ShaderSemanticsInfo[]): WebGLProgram;
|
|
379
378
|
/**
|
|
380
379
|
* Sets up basic uniform locations required for data texture operations.
|
|
381
380
|
*
|
package/dist/{esm/webgl/WebGLStrategyDataTexture.d.ts → esmdev/webgl/WebGLStrategyWebGL2.d.ts}
RENAMED
|
@@ -19,7 +19,7 @@ import type { ShaderSources, WebGLStrategy } from './WebGLStrategy';
|
|
|
19
19
|
* a complete rendering pipeline for WebGL with data texture optimization.
|
|
20
20
|
* The strategy is particularly useful for rendering many instances with unique properties.
|
|
21
21
|
*/
|
|
22
|
-
export declare class
|
|
22
|
+
export declare class WebGLStrategyWebGL2 implements CGAPIStrategy, WebGLStrategy {
|
|
23
23
|
private __engine;
|
|
24
24
|
private __dataTextureUid;
|
|
25
25
|
private __dataUBOUid;
|
|
@@ -335,16 +335,16 @@ export declare class WebGLStrategyDataTexture implements CGAPIStrategy, WebGLStr
|
|
|
335
335
|
*/
|
|
336
336
|
dettachVertexData(glw: WebGLContextWrapper): void;
|
|
337
337
|
/**
|
|
338
|
-
* Gets the singleton instance of
|
|
338
|
+
* Gets the singleton instance of WebGLStrategyWebGL2.
|
|
339
339
|
* Creates the instance if it doesn't exist and initializes the WebXR system reference.
|
|
340
340
|
*
|
|
341
|
-
* @returns The singleton instance of
|
|
341
|
+
* @returns The singleton instance of WebGLStrategyWebGL2
|
|
342
342
|
*
|
|
343
343
|
* @remarks
|
|
344
344
|
* This method ensures only one instance of the strategy exists throughout the application
|
|
345
345
|
* and properly initializes the WebXR system for VR/AR rendering capabilities.
|
|
346
346
|
*/
|
|
347
|
-
static init(engine: Engine):
|
|
347
|
+
static init(engine: Engine): WebGLStrategyWebGL2;
|
|
348
348
|
/**
|
|
349
349
|
* Sets the current component SIDs for each display index in VR/non-VR rendering.
|
|
350
350
|
* This method configures camera component SIDs based on the rendering mode
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { type CompositionTypeEnum } from '../../foundation/definitions/CompositionType';
|
|
2
|
+
import type { ShaderSemanticsInfo } from '../../foundation/definitions/ShaderSemanticsInfo';
|
|
3
|
+
import type { Count, IndexOf16Bytes } from '../../types/CommonTypes';
|
|
4
|
+
import type { BufferLocationInfo, RawVec4 } from './types';
|
|
5
|
+
/**
|
|
6
|
+
* Source of the data texture layout. `readVec4` and `readScalar` read the CPU-side
|
|
7
|
+
* GPUInstanceData buffers, which are the same bytes that are uploaded to the texture.
|
|
8
|
+
*/
|
|
9
|
+
export type BufferLayoutSource = {
|
|
10
|
+
width: number;
|
|
11
|
+
readVec4: (vec4Index: number) => RawVec4 | null;
|
|
12
|
+
readScalar: (scalarIndex: number) => number | null;
|
|
13
|
+
};
|
|
14
|
+
type FetchPlan = {
|
|
15
|
+
fetchFunction: string;
|
|
16
|
+
unit: 'vec4' | 'scalar' | 'scalar-weird';
|
|
17
|
+
count: number;
|
|
18
|
+
warning?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Mirrors the `fetch*` helpers in `prerequisites.glsl` for each composition type.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getFetchPlan(compositionType: CompositionTypeEnum): FetchPlan;
|
|
24
|
+
/**
|
|
25
|
+
* Decodes the location(s) of a material semantic for a given material SID.
|
|
26
|
+
*
|
|
27
|
+
* Mirrors `WebGLStrategyWebGL2.__getShaderPropertyOfMaterial`:
|
|
28
|
+
* - `bufferViewIndex = floor(materialSID / materialCountPerBufferView)`
|
|
29
|
+
* - `indexInBufferView = materialSID % materialCountPerBufferView`
|
|
30
|
+
* - non-array: `vec4Index = offsets[bv] + vec4Size * indexInBufferView`
|
|
31
|
+
* - array: `offsets[bv] + vec4Size * arrayLength * indexInBufferView + vec4Size * elementIndex`
|
|
32
|
+
*/
|
|
33
|
+
export declare function decodeMaterialProperty(args: {
|
|
34
|
+
info: ShaderSemanticsInfo;
|
|
35
|
+
offsets: IndexOf16Bytes[];
|
|
36
|
+
materialSID: number;
|
|
37
|
+
materialCountPerBufferView: number;
|
|
38
|
+
layout: BufferLayoutSource;
|
|
39
|
+
maxArrayElements?: number;
|
|
40
|
+
}): BufferLocationInfo;
|
|
41
|
+
/**
|
|
42
|
+
* Decodes a global property. Global properties use instanceId 0, and array elements
|
|
43
|
+
* use a plain `vec4Size` / `scalarSize` stride (no arrayLength multiplier).
|
|
44
|
+
*/
|
|
45
|
+
export declare function decodeGlobalProperty(args: {
|
|
46
|
+
info: ShaderSemanticsInfo;
|
|
47
|
+
offset: IndexOf16Bytes;
|
|
48
|
+
layout: BufferLayoutSource;
|
|
49
|
+
maxArrayElements?: number;
|
|
50
|
+
}): BufferLocationInfo;
|
|
51
|
+
export type ComponentMemberLayoutInfo = {
|
|
52
|
+
compositionType: CompositionTypeEnum;
|
|
53
|
+
arrayLength?: Count;
|
|
54
|
+
isVariableLength?: boolean;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Decodes a component member. Mirrors `processForNonArrayType` / `processForArrayType`
|
|
58
|
+
* in `WebGLStrategyWebGL2`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function decodeComponentMember(args: {
|
|
61
|
+
memberInfo: ComponentMemberLayoutInfo;
|
|
62
|
+
offsets: IndexOf16Bytes[];
|
|
63
|
+
componentSID: number;
|
|
64
|
+
componentCountPerBufferView: number;
|
|
65
|
+
layout: BufferLayoutSource;
|
|
66
|
+
maxArrayElements?: number;
|
|
67
|
+
}): BufferLocationInfo;
|
|
68
|
+
/**
|
|
69
|
+
* Decodes a variable-length component member (e.g. SkeletalComponent.boneData).
|
|
70
|
+
* The per-instance location is stored in `${memberName}Location` as
|
|
71
|
+
* `location = x * 65536 + y`, with the element count in `z`.
|
|
72
|
+
*/
|
|
73
|
+
export declare function decodeVariableLengthComponentMember(args: {
|
|
74
|
+
memberInfo: ComponentMemberLayoutInfo;
|
|
75
|
+
offsets: IndexOf16Bytes[];
|
|
76
|
+
locationMemberOffsets: IndexOf16Bytes[];
|
|
77
|
+
componentSID: number;
|
|
78
|
+
componentCountPerBufferView: number;
|
|
79
|
+
layout: BufferLayoutSource;
|
|
80
|
+
radix?: number;
|
|
81
|
+
maxArrayElements?: number;
|
|
82
|
+
}): BufferLocationInfo;
|
|
83
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Component } from '../../foundation/core/Component';
|
|
2
|
+
import type { IEntity } from '../../foundation/core/Entity';
|
|
3
|
+
import type { Primitive } from '../../foundation/geometry/Primitive';
|
|
4
|
+
import type { Material } from '../../foundation/materials/core/Material';
|
|
5
|
+
import type { Engine } from '../../foundation/system/Engine';
|
|
6
|
+
import type { CGAPIResourceHandle } from '../../types/CommonTypes';
|
|
7
|
+
import type { AllParameterReport, ComponentParameterReport, EntityParameterReport, GlobalParameterReport, MaterialParameterReport, RawVec4, RealUniformInfo, ShaderParameterEntry } from './types';
|
|
8
|
+
/**
|
|
9
|
+
* Converts math classes, typed arrays and texture tuples to plain JSON values.
|
|
10
|
+
*/
|
|
11
|
+
export declare function serializeValue(value: unknown): unknown;
|
|
12
|
+
/**
|
|
13
|
+
* Inspector for the values Rhodonite uploads to WebGL2 or WebGPU shaders.
|
|
14
|
+
*
|
|
15
|
+
* It reports both the CPU-side value of a shader semantic and the location/value the
|
|
16
|
+
* shader reads from the WebGL2 data texture or the WebGPU storage buffer, plus the
|
|
17
|
+
* real uniform value when the WebGL2 shader uses one (for
|
|
18
|
+
* `needUniformInDataTextureMode` and sampler uniforms).
|
|
19
|
+
*
|
|
20
|
+
* The decoder reads the CPU-side GPUInstanceData buffers, which are the same bytes
|
|
21
|
+
* that are uploaded to the GPU. It does not read back GPU memory.
|
|
22
|
+
*/
|
|
23
|
+
export declare class ShaderParameterDebugger {
|
|
24
|
+
static reportMaterial(engine: Engine, material: Material, primitive?: Primitive): MaterialParameterReport;
|
|
25
|
+
static reportGlobals(engine: Engine, shaderProgramUid?: CGAPIResourceHandle): GlobalParameterReport;
|
|
26
|
+
static reportComponent(engine: Engine, component: Component): ComponentParameterReport;
|
|
27
|
+
static reportEntity(engine: Engine, entity: IEntity): EntityParameterReport;
|
|
28
|
+
static reportAll(engine: Engine): AllParameterReport;
|
|
29
|
+
static readRealUniforms(engine: Engine, shaderProgramUid: CGAPIResourceHandle): Map<string, RealUniformInfo> | null;
|
|
30
|
+
static decode(engine: Engine, vec4Index: number): {
|
|
31
|
+
vec4Index: number;
|
|
32
|
+
byteOffset: number;
|
|
33
|
+
row: number;
|
|
34
|
+
col: number;
|
|
35
|
+
vec4: RawVec4 | null;
|
|
36
|
+
} | null;
|
|
37
|
+
static formatEntries(entries: ShaderParameterEntry[]): Array<Record<string, unknown>>;
|
|
38
|
+
static format(report: MaterialParameterReport | GlobalParameterReport | ComponentParameterReport): unknown;
|
|
39
|
+
static dumpMaterial(engine: Engine, material: Material, primitive?: Primitive): MaterialParameterReport;
|
|
40
|
+
static dumpPrimitive(engine: Engine, primitive: Primitive): MaterialParameterReport;
|
|
41
|
+
static dumpGlobals(engine: Engine, shaderProgramUid?: CGAPIResourceHandle): GlobalParameterReport;
|
|
42
|
+
static dumpEntity(engine: Engine, entity: IEntity): EntityParameterReport;
|
|
43
|
+
static dumpAll(engine: Engine): AllParameterReport;
|
|
44
|
+
static installConsoleHelpers(engine: Engine, target?: any): void;
|
|
45
|
+
private static __getShaderProgramUid;
|
|
46
|
+
private static __isProgramMaterialMismatch;
|
|
47
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the shader parameter debugger.
|
|
3
|
+
*
|
|
4
|
+
* The debugger reports, for each shader semantic, both the CPU-side value and the
|
|
5
|
+
* location/value the shader will read from the WebGL2 data texture or the WebGPU
|
|
6
|
+
* storage buffer.
|
|
7
|
+
*/
|
|
8
|
+
export type ShaderParameterBackend = 'WebGL2' | 'WebGPU' | 'None';
|
|
9
|
+
export type ShaderParameterSource = 'dataTexture' | 'storageBuffer' | 'uniform' | 'texture' | 'soloDatum';
|
|
10
|
+
/** One raw vec4 value (a texel in WebGL2, a storage-buffer vec4 in WebGPU). */
|
|
11
|
+
export type RawVec4 = [number, number, number, number];
|
|
12
|
+
/**
|
|
13
|
+
* Location of a value inside the GPU data buffer.
|
|
14
|
+
*
|
|
15
|
+
* `vec4Index` is the global vec4 index the shader computes (or the base vec4 index for
|
|
16
|
+
* scalar-unaligned fetches). `byteOffset` is `vec4Index * 16`. `row` and `col` are the
|
|
17
|
+
* data-texture coordinates in WebGL2 and are `-1` in WebGPU, which has no texture rows.
|
|
18
|
+
*/
|
|
19
|
+
export type BufferLocation = {
|
|
20
|
+
bufferViewIndex: number;
|
|
21
|
+
vec4Index: number;
|
|
22
|
+
byteOffset: number;
|
|
23
|
+
row: number;
|
|
24
|
+
col: number;
|
|
25
|
+
fetchFunction: string;
|
|
26
|
+
vec4s: RawVec4[];
|
|
27
|
+
scalarIndex?: number;
|
|
28
|
+
arrayElement?: number;
|
|
29
|
+
warnings: string[];
|
|
30
|
+
};
|
|
31
|
+
export type BufferLocationInfo = {
|
|
32
|
+
bufferViewOffsets: number[];
|
|
33
|
+
bufferViewIndex: number;
|
|
34
|
+
indexInBufferView: number;
|
|
35
|
+
arrayLengthForShader: number;
|
|
36
|
+
locations: BufferLocation[];
|
|
37
|
+
};
|
|
38
|
+
export type RealUniformInfo = {
|
|
39
|
+
locationFound: boolean;
|
|
40
|
+
value: unknown;
|
|
41
|
+
};
|
|
42
|
+
export type TextureBindingInfo = {
|
|
43
|
+
/** WebGL2 sampler unit. Null in WebGPU. */
|
|
44
|
+
unit: number | null;
|
|
45
|
+
/** WebGL2 sampler unit / WebGPU bind-group binding. */
|
|
46
|
+
binding: number | null;
|
|
47
|
+
textureUid: number | null;
|
|
48
|
+
samplerUid: number | null;
|
|
49
|
+
};
|
|
50
|
+
export type ShaderParameterEntry = {
|
|
51
|
+
semantic: string;
|
|
52
|
+
stage: string;
|
|
53
|
+
compositionType: string;
|
|
54
|
+
componentType: string;
|
|
55
|
+
arrayLength?: number;
|
|
56
|
+
isTexture: boolean;
|
|
57
|
+
isInternalSetting: boolean;
|
|
58
|
+
needUniformInDataTextureMode: boolean;
|
|
59
|
+
soloDatum: boolean;
|
|
60
|
+
source: ShaderParameterSource;
|
|
61
|
+
/** Serializable preview of the CPU-side value. */
|
|
62
|
+
valuePreview: unknown;
|
|
63
|
+
buffer?: BufferLocationInfo;
|
|
64
|
+
realUniform?: RealUniformInfo;
|
|
65
|
+
texture?: TextureBindingInfo;
|
|
66
|
+
};
|
|
67
|
+
export type MaterialParameterReport = {
|
|
68
|
+
available: boolean;
|
|
69
|
+
reason?: string;
|
|
70
|
+
backend: ShaderParameterBackend;
|
|
71
|
+
processApproach: string;
|
|
72
|
+
materialTypeName: string;
|
|
73
|
+
materialUID: number;
|
|
74
|
+
materialSID: number;
|
|
75
|
+
materialCountPerBufferView: number;
|
|
76
|
+
bufferViewIndex: number;
|
|
77
|
+
shaderProgramUid: number;
|
|
78
|
+
/** Data-texture width in WebGL2. Zero in WebGPU. */
|
|
79
|
+
bufferWidth: number;
|
|
80
|
+
/**
|
|
81
|
+
* True when the shader program was last used with another material. Uniform values
|
|
82
|
+
* are per program (last-set state), so `realUniform.value` may belong to that material.
|
|
83
|
+
*/
|
|
84
|
+
sharedProgramMaterialMismatch: boolean;
|
|
85
|
+
entries: ShaderParameterEntry[];
|
|
86
|
+
};
|
|
87
|
+
export type GlobalParameterReport = {
|
|
88
|
+
available: boolean;
|
|
89
|
+
reason?: string;
|
|
90
|
+
backend: ShaderParameterBackend;
|
|
91
|
+
processApproach: string;
|
|
92
|
+
/** Data-texture width in WebGL2. Zero in WebGPU. */
|
|
93
|
+
bufferWidth: number;
|
|
94
|
+
shaderProgramUid: number;
|
|
95
|
+
entries: ShaderParameterEntry[];
|
|
96
|
+
};
|
|
97
|
+
export type ComponentParameterReport = {
|
|
98
|
+
available: boolean;
|
|
99
|
+
reason?: string;
|
|
100
|
+
backend: ShaderParameterBackend;
|
|
101
|
+
componentClassName: string;
|
|
102
|
+
componentSID: number;
|
|
103
|
+
componentCountPerBufferView: number;
|
|
104
|
+
entries: ShaderParameterEntry[];
|
|
105
|
+
};
|
|
106
|
+
export type EntityParameterReport = {
|
|
107
|
+
entityUID: number;
|
|
108
|
+
materials: MaterialParameterReport[];
|
|
109
|
+
components: ComponentParameterReport[];
|
|
110
|
+
};
|
|
111
|
+
export type AllParameterReport = {
|
|
112
|
+
globals: GlobalParameterReport;
|
|
113
|
+
materials: MaterialParameterReport[];
|
|
114
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from './debug/index';
|
|
1
2
|
export * from './getRenderingStrategy';
|
|
2
3
|
export * from './shaders/index';
|
|
3
4
|
export * from './textureLoader/index';
|
|
@@ -8,5 +9,4 @@ export * from './WebGLExtension';
|
|
|
8
9
|
export * from './WebGLResourceRepository';
|
|
9
10
|
export * from './WebGLStrategy';
|
|
10
11
|
export * from './WebGLStrategyCommonMethod';
|
|
11
|
-
export * from './
|
|
12
|
-
export * from './WebGLStrategyUniform';
|
|
12
|
+
export * from './WebGLStrategyWebGL2';
|
|
@@ -3,15 +3,13 @@ import { StandardShaderPart } from './shaders/StandardShaderPart';
|
|
|
3
3
|
import { WebGLContextWrapper } from './WebGLContextWrapper';
|
|
4
4
|
import { type VertexHandles as vertexHandles, WebGLResourceRepository } from './WebGLResourceRepository';
|
|
5
5
|
import type { WebGLStrategy as webGLStrategy } from './WebGLStrategy';
|
|
6
|
-
import {
|
|
7
|
-
import { WebGLStrategyUniform } from './WebGLStrategyUniform';
|
|
6
|
+
import { WebGLStrategyWebGL2 } from './WebGLStrategyWebGL2';
|
|
8
7
|
declare const WebGL: Readonly<{
|
|
9
8
|
getRenderingStrategy: typeof getRenderingStrategy;
|
|
10
9
|
StandardShaderPart: typeof StandardShaderPart;
|
|
11
10
|
WebGLContextWrapper: typeof WebGLContextWrapper;
|
|
12
11
|
WebGLResourceRepository: typeof WebGLResourceRepository;
|
|
13
|
-
|
|
14
|
-
WebGLStrategyDataTexture: typeof WebGLStrategyDataTexture;
|
|
12
|
+
WebGLStrategyWebGL2: typeof WebGLStrategyWebGL2;
|
|
15
13
|
}>;
|
|
16
14
|
export default WebGL;
|
|
17
15
|
export type RnWebGL = typeof WebGL;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ComponentTypeEnum } from '../../foundation/definitions/ComponentType';
|
|
2
2
|
import type { CompositionTypeEnum } from '../../foundation/definitions/CompositionType';
|
|
3
|
-
import {
|
|
3
|
+
import type { VertexAttributeEnum } from '../../foundation/definitions/VertexAttribute';
|
|
4
4
|
import { AbstractShaderNode } from '../../foundation/materials/core/AbstractShaderNode';
|
|
5
5
|
import type { Socket, SocketDefaultValue } from '../../foundation/materials/core/Socket';
|
|
6
6
|
import type { Engine } from '../../foundation/system/Engine';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhodonite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"rhodonite",
|
|
6
6
|
"webgl",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"test-e2e": "npm run test-e2e-part -- ./samples/test_e2e",
|
|
45
45
|
"test-e2e-serial": "npm run test-e2e-part -- --runInBand ./samples/test_e2e",
|
|
46
46
|
"test-e2e-part": "npx vitest run --config ./config/test/vitest.config.e2e.ts",
|
|
47
|
+
"test-e2e-update": "npm run test-e2e-part -- --update ./samples/test_e2e",
|
|
47
48
|
"test-e2e:docker": "bash ./config/e2e/run-in-docker.sh test",
|
|
48
49
|
"test-e2e:docker:update": "bash ./config/e2e/run-in-docker.sh update",
|
|
49
50
|
"test-e2e:docker:shell": "bash ./config/e2e/run-in-docker.sh shell",
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import type { Config } from '../../core/Config';
|
|
2
|
-
import type { ShapeInstance } from '../../geometry/Shape';
|
|
3
|
-
import type { ISceneGraphEntity } from '../../helpers';
|
|
4
|
-
import { type IVector3 } from '../../math';
|
|
5
|
-
import type { PhysicsBodyProperty, PhysicsColliderProperty, PhysicsMotionProperty, PhysicsPropertyInner } from '../PhysicsProperty';
|
|
6
|
-
import type { PhysicsStrategy } from '../PhysicsStrategy';
|
|
7
|
-
import type { PhysicsWorldProperty } from '../PhysicsWorldProperty';
|
|
8
|
-
/**
|
|
9
|
-
* Physics strategy implementation using the Oimo.js physics engine.
|
|
10
|
-
* This class provides physics simulation capabilities for 3D objects in the scene.
|
|
11
|
-
* It implements the PhysicsStrategy interface to integrate with the Rhodonite framework.
|
|
12
|
-
*/
|
|
13
|
-
export declare class OimoPhysicsStrategy implements PhysicsStrategy {
|
|
14
|
-
/**
|
|
15
|
-
* Global physics world properties shared across all instances.
|
|
16
|
-
* Contains gravity settings and randomization options.
|
|
17
|
-
*/
|
|
18
|
-
static __worldProperty: PhysicsWorldProperty;
|
|
19
|
-
/**
|
|
20
|
-
* The shared Oimo physics world instance.
|
|
21
|
-
* All physics bodies are added to this single world for simulation.
|
|
22
|
-
*/
|
|
23
|
-
static __world: any;
|
|
24
|
-
/**
|
|
25
|
-
* The Oimo physics body associated with this strategy instance.
|
|
26
|
-
*/
|
|
27
|
-
private __body;
|
|
28
|
-
/**
|
|
29
|
-
* The scene graph entity that this physics strategy is attached to.
|
|
30
|
-
*/
|
|
31
|
-
private __entity?;
|
|
32
|
-
/**
|
|
33
|
-
* Cached physics properties used for body recreation when needed.
|
|
34
|
-
*/
|
|
35
|
-
private __property;
|
|
36
|
-
/**
|
|
37
|
-
* The original local scale of the physics shape before any transformations.
|
|
38
|
-
*/
|
|
39
|
-
private __localScale;
|
|
40
|
-
private __shapeLocalPosition;
|
|
41
|
-
private __shapeLocalRotation;
|
|
42
|
-
private __resolvedShapeLocalRotation;
|
|
43
|
-
private __worldScale;
|
|
44
|
-
private __worldSignedScale;
|
|
45
|
-
private __usesShapeInstance;
|
|
46
|
-
private __shapeType?;
|
|
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;
|
|
61
|
-
/**
|
|
62
|
-
* Creates a new OimoPhysicsStrategy instance.
|
|
63
|
-
* Initializes the shared Oimo physics world if it doesn't exist yet.
|
|
64
|
-
*/
|
|
65
|
-
constructor();
|
|
66
|
-
/**
|
|
67
|
-
* Sets up the physics shape for the given entity with specified properties.
|
|
68
|
-
* Creates a physics body in the Oimo world with the provided configuration.
|
|
69
|
-
*
|
|
70
|
-
* @param prop - The physics properties defining the shape, size, position, and material properties
|
|
71
|
-
* @param entity - The scene graph entity to associate with this physics body
|
|
72
|
-
*/
|
|
73
|
-
setShape(prop: PhysicsPropertyInner, entity: ISceneGraphEntity): void;
|
|
74
|
-
setShapeInstance(shape: ShapeInstance, body: PhysicsBodyProperty, collider: PhysicsColliderProperty, entity: ISceneGraphEntity, worldScale?: IVector3, motion?: PhysicsMotionProperty): void;
|
|
75
|
-
clearShapeInstances(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Updates the associated entity's transform based on the physics body's current state.
|
|
78
|
-
* This method should be called each frame to synchronize the visual representation
|
|
79
|
-
* with the physics simulation results.
|
|
80
|
-
*/
|
|
81
|
-
update(_config: Config): void;
|
|
82
|
-
/**
|
|
83
|
-
* Sets the world position of the physics body.
|
|
84
|
-
* Recreates the physics body with the new position while preserving other properties.
|
|
85
|
-
*
|
|
86
|
-
* @param worldPosition - The new world position to set for the physics body
|
|
87
|
-
*/
|
|
88
|
-
setPosition(worldPosition: IVector3): void;
|
|
89
|
-
/**
|
|
90
|
-
* Sets the rotation of the physics body using Euler angles.
|
|
91
|
-
* Recreates the physics body with the new rotation while preserving other properties.
|
|
92
|
-
*
|
|
93
|
-
* @param eulerAngles - The new Euler angles (in radians) to set for the physics body
|
|
94
|
-
*/
|
|
95
|
-
setEulerAngle(eulerAngles: IVector3): void;
|
|
96
|
-
/**
|
|
97
|
-
* Sets the scale of the physics body.
|
|
98
|
-
* Recreates the physics body with the new scale applied to the original local scale
|
|
99
|
-
* while preserving other properties.
|
|
100
|
-
*
|
|
101
|
-
* @param scale - The scale factors to apply to the physics body's dimensions
|
|
102
|
-
*/
|
|
103
|
-
setScale(scale: IVector3): void;
|
|
104
|
-
private __canCreateBody;
|
|
105
|
-
private __removeBody;
|
|
106
|
-
private __resolveScaledShape;
|
|
107
|
-
private __createLegacyScaledSize;
|
|
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;
|
|
118
|
-
/**
|
|
119
|
-
* Advances the physics simulation by one time step.
|
|
120
|
-
* This static method should be called once per frame to update all physics bodies
|
|
121
|
-
* in the shared world. It processes collisions, applies forces, and updates positions.
|
|
122
|
-
*/
|
|
123
|
-
static update(): void;
|
|
124
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './OimoPhysicsStrategy';
|