rhodonite 0.21.0 → 0.22.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/VERSION-FILE +1 -1
- package/dist/esm/foundation/components/Camera/CameraComponent.d.ts +15 -0
- package/dist/esm/foundation/components/Light/LightComponent.d.ts +109 -4
- package/dist/esm/foundation/core/Config.d.ts +165 -3
- package/dist/esm/foundation/helpers/Shadow/PointShadowMap.d.ts +3 -1
- package/dist/esm/foundation/helpers/Shadow/ShadowSystem.d.ts +13 -0
- package/dist/esm/foundation/renderer/index.d.ts +1 -0
- package/dist/esm/foundation/renderer/lightCluster/LightClusterBuilder.d.ts +97 -0
- package/dist/esm/foundation/renderer/lightCluster/LightClusterLayout.d.ts +98 -0
- package/dist/esm/foundation/renderer/lightCluster/LightClusterSystem.d.ts +171 -0
- package/dist/esm/foundation/renderer/lightCluster/index.d.ts +1 -0
- package/dist/esm/foundation/system/Engine.d.ts +7 -0
- package/dist/esm/foundation/textures/TextureArray.d.ts +1 -1
- package/dist/esm/index.js +1096 -616
- package/dist/esm/webgl/WebGLStrategyWebGL2.d.ts +16 -0
- package/dist/esm/webgpu/WebGpuLightClusterBuilder.d.ts +34 -0
- package/dist/esm/webgpu/WebGpuResourceRepository.d.ts +28 -3
- package/dist/esm/webgpu/WebGpuStrategyBasic.d.ts +18 -1
- package/dist/esmdev/foundation/components/Camera/CameraComponent.d.ts +15 -0
- package/dist/esmdev/foundation/components/Light/LightComponent.d.ts +109 -4
- package/dist/esmdev/foundation/core/Config.d.ts +165 -3
- package/dist/esmdev/foundation/helpers/Shadow/PointShadowMap.d.ts +3 -1
- package/dist/esmdev/foundation/helpers/Shadow/ShadowSystem.d.ts +13 -0
- package/dist/esmdev/foundation/renderer/index.d.ts +1 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterBuilder.d.ts +97 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterLayout.d.ts +98 -0
- package/dist/esmdev/foundation/renderer/lightCluster/LightClusterSystem.d.ts +171 -0
- package/dist/esmdev/foundation/renderer/lightCluster/index.d.ts +1 -0
- package/dist/esmdev/foundation/system/Engine.d.ts +7 -0
- package/dist/esmdev/foundation/textures/TextureArray.d.ts +1 -1
- package/dist/esmdev/index.js +2141 -144
- package/dist/esmdev/webgl/WebGLStrategyWebGL2.d.ts +16 -0
- package/dist/esmdev/webgpu/WebGpuLightClusterBuilder.d.ts +34 -0
- package/dist/esmdev/webgpu/WebGpuResourceRepository.d.ts +28 -3
- package/dist/esmdev/webgpu/WebGpuStrategyBasic.d.ts +18 -1
- package/package.json +1 -1
|
@@ -56,6 +56,8 @@ export declare class WebGLStrategyWebGL2 implements CGAPIStrategy, WebGLStrategy
|
|
|
56
56
|
private __lastBlendShapeComponentsUpdateCountForWeights;
|
|
57
57
|
private __lastMorphMaxIndex;
|
|
58
58
|
private __lastMaterialsUpdateCount;
|
|
59
|
+
private __lastLightClusterDataVersion;
|
|
60
|
+
private __lastLightComponentsUpdateCount;
|
|
59
61
|
private __lastTotalSizeOfGPUShaderDataStorageExceptMorphData;
|
|
60
62
|
private __lastTransformComponentsUpdateCount;
|
|
61
63
|
private __lastSceneGraphComponentsUpdateCount;
|
|
@@ -232,6 +234,15 @@ export declare class WebGLStrategyWebGL2 implements CGAPIStrategy, WebGLStrategy
|
|
|
232
234
|
* - Manages texture alignment and padding requirements
|
|
233
235
|
*/
|
|
234
236
|
private __createAndUpdateDataTextureInner;
|
|
237
|
+
/**
|
|
238
|
+
* Uploads the bytes `[start, end)` of the GPU instance data (16-byte aligned, in the concatenated layers) to the
|
|
239
|
+
* data texture, where texel `n` holds bytes `16n` to `16n + 15`. The range is split into a partial first row, full
|
|
240
|
+
* rows and a partial last row.
|
|
241
|
+
*
|
|
242
|
+
* @param layerArray - The whole memory of the layer that contains the range
|
|
243
|
+
* @param layerByteOffset - The byte offset of the layer in the concatenated layers
|
|
244
|
+
*/
|
|
245
|
+
private __uploadDataTextureTexels;
|
|
235
246
|
/**
|
|
236
247
|
* Deletes the current data texture and frees associated GPU resources.
|
|
237
248
|
* This method should be called when the data texture needs to be recreated
|
|
@@ -483,6 +494,11 @@ export declare class WebGLStrategyWebGL2 implements CGAPIStrategy, WebGLStrategy
|
|
|
483
494
|
* same program by the previous upload. Uniform values persist in the program object, so
|
|
484
495
|
* consecutive draws of the same material (e.g. a shadow pass) do not need to upload again.
|
|
485
496
|
*/
|
|
497
|
+
/**
|
|
498
|
+
* Uploads the light cluster view of the camera of the draw (`u_lightClusterView`) when the program uses it and
|
|
499
|
+
* the camera or the light cluster data changed since the last upload to the program.
|
|
500
|
+
*/
|
|
501
|
+
private __uploadLightClusterView;
|
|
486
502
|
private __uploadCurrentComponentSIDs;
|
|
487
503
|
/**
|
|
488
504
|
* Binds the data texture to the WebGL context for shader access.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LightClusterGpuBuildParams } from '../foundation/renderer/lightCluster/LightClusterSystem';
|
|
2
|
+
/**
|
|
3
|
+
* Builds the light cluster tables of Clustered Forward rendering with compute shaders.
|
|
4
|
+
* The tables are written into the storage buffer of the GPU instance data, where the CPU build would write them.
|
|
5
|
+
*
|
|
6
|
+
* The sorted light input of the views (spheres, entries and Z slice ranges) is uploaded to a separate storage buffer,
|
|
7
|
+
* because it is small (some tens of KiB) and reused for all views.
|
|
8
|
+
*/
|
|
9
|
+
export declare class WebGpuLightClusterBuilder {
|
|
10
|
+
private __device;
|
|
11
|
+
private __bindGroupLayout;
|
|
12
|
+
private __pipeline;
|
|
13
|
+
private __paramsBuffer?;
|
|
14
|
+
private __paramsStride;
|
|
15
|
+
private __paramsCapacity;
|
|
16
|
+
private __paramsArray;
|
|
17
|
+
private __buildDataBuffer?;
|
|
18
|
+
private __buildDataCapacity;
|
|
19
|
+
private __bindGroup?;
|
|
20
|
+
private __bindGroupStorageBuffer?;
|
|
21
|
+
constructor(device: GPUDevice);
|
|
22
|
+
/**
|
|
23
|
+
* Builds the clusters of the views and submits the work immediately, so that it runs after the upload of the
|
|
24
|
+
* GPU instance data (queue.writeBuffer) and before the render commands of the frame.
|
|
25
|
+
*
|
|
26
|
+
* @param storageBuffer - The storage buffer of the GPU instance data
|
|
27
|
+
* @param params - The views to build and their sorted light input
|
|
28
|
+
*/
|
|
29
|
+
build(storageBuffer: GPUBuffer, params: LightClusterGpuBuildParams): void;
|
|
30
|
+
/**
|
|
31
|
+
* Releases the GPU resources.
|
|
32
|
+
*/
|
|
33
|
+
destroy(): void;
|
|
34
|
+
}
|
|
@@ -92,6 +92,8 @@ export declare class WebGpuResourceRepository extends CGAPIResourceRepository im
|
|
|
92
92
|
/** Cached `gpuDevice.queue` ([SameObject]), read on every frame by flush(). */
|
|
93
93
|
private __gpuQueue?;
|
|
94
94
|
private __renderBundles;
|
|
95
|
+
/** Fragment module of the depth prepass pipelines (it writes nothing; the color targets use writeMask 0). */
|
|
96
|
+
private __depthOnlyFragmentModule?;
|
|
95
97
|
private __renderBundleEncoder?;
|
|
96
98
|
private __renderBundleEncoderKey?;
|
|
97
99
|
private __systemDepthTexture?;
|
|
@@ -476,8 +478,13 @@ export declare class WebGpuResourceRepository extends CGAPIResourceRepository im
|
|
|
476
478
|
* @param renderPass - The render pass defining render targets and clear operations
|
|
477
479
|
* @param cameraId - Identifier for the camera used for rendering
|
|
478
480
|
* @param zWrite - Whether to enable depth writing during rendering
|
|
481
|
+
* @param options - `depthOnly` draws the primitive with a depth-only pipeline (the depth prepass);
|
|
482
|
+
* `allowEqualDepth` lets the color pass pass the depth written by the prepass
|
|
479
483
|
*/
|
|
480
|
-
draw(engine: Engine, primitive: Primitive, material: Material, renderPass: RenderPass, cameraId: number, zWrite: boolean, _displayIdx: number
|
|
484
|
+
draw(engine: Engine, primitive: Primitive, material: Material, renderPass: RenderPass, cameraId: number, zWrite: boolean, _displayIdx: number, options?: {
|
|
485
|
+
depthOnly?: boolean;
|
|
486
|
+
allowEqualDepth?: boolean;
|
|
487
|
+
}): void;
|
|
481
488
|
/**
|
|
482
489
|
* Creates a render bundle encoder for efficient rendering.
|
|
483
490
|
* Render bundles allow pre-recording of rendering commands for better performance.
|
|
@@ -575,7 +582,11 @@ export declare class WebGpuResourceRepository extends CGAPIResourceRepository im
|
|
|
575
582
|
finishRenderBundleEncoderAndKeepRenderPass(engine: Engine, renderPass: RenderPass, displayIdx: number): GPURenderPassEncoder | undefined;
|
|
576
583
|
getOrCreateRenderPassEncoderForExternalRendering(engine: Engine, renderPass: RenderPass, displayIdx: number): GPURenderPassEncoder | undefined;
|
|
577
584
|
endRenderPassEncoderForExternalRendering(): void;
|
|
578
|
-
|
|
585
|
+
private __getDepthOnlyFragmentModule;
|
|
586
|
+
getOrCreateRenderPipeline(renderPipelineId: string, pipelineLayoutKey: string, pipelineLayout: GPUPipelineLayout, primitive: Primitive, material: Material, renderPass: RenderPass, zWrite: boolean, options?: {
|
|
587
|
+
depthOnly?: boolean;
|
|
588
|
+
allowEqualDepth?: boolean;
|
|
589
|
+
}): [GPURenderPipeline, boolean];
|
|
579
590
|
/**
|
|
580
591
|
* Submits all recorded commands to the GPU queue and resets the command encoder.
|
|
581
592
|
* This method must be called to execute any recorded rendering commands.
|
|
@@ -633,7 +644,21 @@ export declare class WebGpuResourceRepository extends CGAPIResourceRepository im
|
|
|
633
644
|
* @param storageBufferHandle - Handle to the storage buffer to update
|
|
634
645
|
* @param gpuInstanceDataBuffers - New data to write to the buffer
|
|
635
646
|
*/
|
|
636
|
-
updateStorageBuffer(storageBufferHandle: WebGPUResourceHandle, gpuInstanceDataBuffers: Buffer[]): void;
|
|
647
|
+
updateStorageBuffer(storageBufferHandle: WebGPUResourceHandle, gpuInstanceDataBuffers: Buffer[], excludedByteRanges?: readonly [number, number][]): void;
|
|
648
|
+
/**
|
|
649
|
+
* Writes byte ranges of the GPU instance data to the storage buffer.
|
|
650
|
+
*
|
|
651
|
+
* @param storageBufferHandle - Handle to the storage buffer
|
|
652
|
+
* @param gpuInstanceDataBuffers - The GPU instance data buffers (layers)
|
|
653
|
+
* @param byteRanges - The ranges `[start, end)` in the concatenated layers. A range must not span layers.
|
|
654
|
+
*/
|
|
655
|
+
updateStorageBufferRanges(storageBufferHandle: WebGPUResourceHandle, gpuInstanceDataBuffers: Buffer[], byteRanges: readonly [number, number][]): void;
|
|
656
|
+
/**
|
|
657
|
+
* The storage buffer of the GPU instance data (bound at group 0, binding 0 of the render pipelines).
|
|
658
|
+
*
|
|
659
|
+
* @internal
|
|
660
|
+
*/
|
|
661
|
+
_getStorageBuffer(): GPUBuffer | undefined;
|
|
637
662
|
destroyStorageBuffer(storageBufferHandle: WebGPUResourceHandle): void;
|
|
638
663
|
/**
|
|
639
664
|
* Updates a portion of a storage buffer with new data at a specific offset.
|
|
@@ -32,6 +32,10 @@ export declare class WebGpuStrategyBasic implements CGAPIStrategy {
|
|
|
32
32
|
private __uniformMorphOffsetsTypedArray?;
|
|
33
33
|
private __uniformMorphWeightsTypedArray?;
|
|
34
34
|
private __lastMaterialsUpdateCount;
|
|
35
|
+
private __lastLightClusterDataVersion;
|
|
36
|
+
private __lastLightComponentsUpdateCount;
|
|
37
|
+
private __lightClusterBuilder?;
|
|
38
|
+
private __lastLightClusterBuildDataVersion;
|
|
35
39
|
private __lastTransformComponentsUpdateCount;
|
|
36
40
|
private __lastSceneGraphComponentsUpdateCount;
|
|
37
41
|
private __lastCameraComponentsUpdateCount;
|
|
@@ -157,6 +161,11 @@ export declare class WebGpuStrategyBasic implements CGAPIStrategy {
|
|
|
157
161
|
* @param renderPass - The render pass containing the material and rendering configuration
|
|
158
162
|
*/
|
|
159
163
|
private __renderWithoutBuffers;
|
|
164
|
+
/**
|
|
165
|
+
* Whether the depth prepass can run for the render pass: it must be enabled, draw the scene itself (render passes
|
|
166
|
+
* with a material override such as shadow maps and post effects are excluded), and write depth.
|
|
167
|
+
*/
|
|
168
|
+
private __isDepthPrepassAvailable;
|
|
160
169
|
/**
|
|
161
170
|
* Renders a single primitive with the specified material and render settings.
|
|
162
171
|
* Handles shader setup, uniform buffer updates, and the actual draw call.
|
|
@@ -167,13 +176,21 @@ export declare class WebGpuStrategyBasic implements CGAPIStrategy {
|
|
|
167
176
|
* @param displayIdx - The index of the display to render to
|
|
168
177
|
* @returns True if the primitive was successfully rendered
|
|
169
178
|
*/
|
|
170
|
-
renderInner(primitiveUid: PrimitiveUID, renderPass: RenderPass, zWrite: boolean, displayIdx: Index
|
|
179
|
+
renderInner(primitiveUid: PrimitiveUID, renderPass: RenderPass, zWrite: boolean, displayIdx: Index, options?: {
|
|
180
|
+
depthOnly?: boolean;
|
|
181
|
+
allowEqualDepth?: boolean;
|
|
182
|
+
}): boolean;
|
|
171
183
|
/**
|
|
172
184
|
* Creates or updates the main storage buffer containing all GPU instance data.
|
|
173
185
|
* This buffer holds transform matrices, material properties, and other per-instance data
|
|
174
186
|
* required for rendering all objects in the scene.
|
|
175
187
|
*/
|
|
176
188
|
private __createAndUpdateStorageBuffer;
|
|
189
|
+
/**
|
|
190
|
+
* Builds the Clustered Forward light cluster tables with compute shaders when the LightClusterSystem
|
|
191
|
+
* builds them on the GPU. It must run after every upload of the GPU instance data, which overwrites the tables.
|
|
192
|
+
*/
|
|
193
|
+
private __buildLightClustersOnGpu;
|
|
177
194
|
/**
|
|
178
195
|
* Creates or updates the storage buffer containing blend shape vertex data.
|
|
179
196
|
* This buffer holds morph target positions and other vertex attributes needed for blend shape animation.
|