@rings-webgpu/core 1.0.11 → 1.0.13
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/dist/rings.es.js +519 -337
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +1837 -1078
- package/dist/rings.umd.js +503 -321
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +1842 -1077
- package/dist/types/assets/shader/core/base/Common_frag.d.ts +3 -0
- package/dist/types/assets/shader/core/struct/VertexAttributes.d.ts +3 -0
- package/dist/types/assets/shader/lines/FatLineShader.d.ts +5 -0
- package/dist/types/components/renderer/FatLineRenderer.d.ts +38 -0
- package/dist/types/components/renderer/GSplatRenderer.d.ts +16 -5
- package/dist/types/core/geometry/FatLineGeometry.d.ts +48 -0
- package/dist/types/gfx/renderJob/jobs/RendererJob.d.ts +2 -1
- package/dist/types/index.d.ts +9 -1
- package/dist/types/loader/parser/prefab/mats/shader/FatLineShader.d.ts +11 -0
- package/dist/types/loader/parser/prefab/mats/shader/GSplatShader.d.ts +12 -0
- package/dist/types/materials/FatLineMaterial.d.ts +57 -0
- package/dist/types/materials/GSplatMaterial.d.ts +9 -2
- package/dist/types/shape/GSplatGeometry.d.ts +13 -0
- package/dist/types/textures/R32UintTexture.d.ts +11 -0
- package/package.json +1 -1
- /package/dist/types/assets/shader/{materials → gsplat}/GSplatShader.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Object3D } from "../../core/entities/Object3D";
|
|
2
|
+
import { RenderNode } from "./RenderNode";
|
|
3
|
+
import { FatLineMaterial } from "../../materials/FatLineMaterial";
|
|
4
|
+
import { FatLineGeometry } from "../../core/geometry/FatLineGeometry";
|
|
5
|
+
import { View3D } from "../../core/View3D";
|
|
6
|
+
import { PassType } from "../../gfx/renderJob/passRenderer/state/PassType";
|
|
7
|
+
import { RendererPassState } from "../../gfx/renderJob/passRenderer/state/RendererPassState";
|
|
8
|
+
import { ClusterLightingBuffer } from "../../gfx/renderJob/passRenderer/cluster/ClusterLightingBuffer";
|
|
9
|
+
/**
|
|
10
|
+
* FatLine Renderer Component
|
|
11
|
+
* Specialized renderer for FatLine geometries that automatically updates
|
|
12
|
+
* model matrix and resolution uniforms each frame
|
|
13
|
+
*
|
|
14
|
+
* @group Components
|
|
15
|
+
*/
|
|
16
|
+
export declare class FatLineRenderer extends RenderNode {
|
|
17
|
+
private _fatLineMaterial;
|
|
18
|
+
private _fatLineGeometry;
|
|
19
|
+
constructor();
|
|
20
|
+
onEnable(): void;
|
|
21
|
+
onDisable(): void;
|
|
22
|
+
cloneTo(obj: Object3D): void;
|
|
23
|
+
copyComponent(from: this): this;
|
|
24
|
+
/**
|
|
25
|
+
* Set FatLine geometry
|
|
26
|
+
*/
|
|
27
|
+
set geometry(value: FatLineGeometry);
|
|
28
|
+
get geometry(): FatLineGeometry;
|
|
29
|
+
/**
|
|
30
|
+
* Set FatLine material
|
|
31
|
+
*/
|
|
32
|
+
set material(value: FatLineMaterial);
|
|
33
|
+
get material(): FatLineMaterial;
|
|
34
|
+
/**
|
|
35
|
+
* Override nodeUpdate to automatically update FatLine-specific uniforms
|
|
36
|
+
*/
|
|
37
|
+
nodeUpdate(view: View3D, passType: PassType, renderPassState: RendererPassState, clusterLightingBuffer?: ClusterLightingBuffer): void;
|
|
38
|
+
}
|
|
@@ -7,6 +7,7 @@ import { PassType } from "../../gfx/renderJob/passRenderer/state/PassType";
|
|
|
7
7
|
import { GaussianSplatAsset } from "../../loader/parser/3dgs/GaussianSplatAsset";
|
|
8
8
|
import { Uint8ArrayTexture } from "../../textures/Uint8ArrayTexture";
|
|
9
9
|
import { Uint32ArrayTexture } from "../../textures/Uint32ArrayTexture";
|
|
10
|
+
import { R32UintTexture } from "../../textures/R32UintTexture";
|
|
10
11
|
import { Float16ArrayTexture } from "../../textures/Float16ArrayTexture";
|
|
11
12
|
import { Vector2 } from "../../math/Vector2";
|
|
12
13
|
/**
|
|
@@ -22,7 +23,7 @@ export declare class GSplatRenderer extends RenderNode {
|
|
|
22
23
|
transformA: Uint32ArrayTexture;
|
|
23
24
|
transformB: Float16ArrayTexture;
|
|
24
25
|
texParams: Float32Array;
|
|
25
|
-
splatOrder:
|
|
26
|
+
splatOrder: R32UintTexture;
|
|
26
27
|
gsplatMaterial: GSplatMaterial;
|
|
27
28
|
private _positions;
|
|
28
29
|
get positions(): Float32Array;
|
|
@@ -35,6 +36,8 @@ export declare class GSplatRenderer extends RenderNode {
|
|
|
35
36
|
private _lastViewMatrixHash;
|
|
36
37
|
private _lastCameraSpeed;
|
|
37
38
|
private _adaptiveSorting;
|
|
39
|
+
private _lastPixelCullParams;
|
|
40
|
+
private _texturesInitialized;
|
|
38
41
|
private _lodEnabled;
|
|
39
42
|
private _lodDistances;
|
|
40
43
|
private _lodRatios;
|
|
@@ -45,6 +48,8 @@ export declare class GSplatRenderer extends RenderNode {
|
|
|
45
48
|
private _mapping;
|
|
46
49
|
private _fullCount;
|
|
47
50
|
get fullCount(): number;
|
|
51
|
+
private _batchSize;
|
|
52
|
+
instanceCount: number;
|
|
48
53
|
constructor();
|
|
49
54
|
/**
|
|
50
55
|
* Initialize from Gaussian Splat asset
|
|
@@ -108,6 +113,16 @@ export declare class GSplatRenderer extends RenderNode {
|
|
|
108
113
|
maxEnabled: boolean;
|
|
109
114
|
distanceEnabled: boolean;
|
|
110
115
|
};
|
|
116
|
+
/**
|
|
117
|
+
* Get batching statistics
|
|
118
|
+
*/
|
|
119
|
+
getBatchingStats(): {
|
|
120
|
+
enabled: boolean;
|
|
121
|
+
batchSize: number;
|
|
122
|
+
instanceCount: number;
|
|
123
|
+
splatCount: number;
|
|
124
|
+
reduction: number;
|
|
125
|
+
};
|
|
111
126
|
/**
|
|
112
127
|
* Calculate texture size for given splat count
|
|
113
128
|
*/
|
|
@@ -136,10 +151,6 @@ export declare class GSplatRenderer extends RenderNode {
|
|
|
136
151
|
* Update node before rendering
|
|
137
152
|
*/
|
|
138
153
|
nodeUpdate(view: View3D, passType: PassType, renderPassState: RendererPassState, clusterLightingBuffer?: ClusterLightingBuffer): void;
|
|
139
|
-
/**
|
|
140
|
-
* Render pass
|
|
141
|
-
*/
|
|
142
|
-
renderPass2(view: View3D, passType: PassType, rendererPassState: RendererPassState, clusterLightingBuffer: ClusterLightingBuffer, encoder: GPURenderPassEncoder, useBundle?: boolean): void;
|
|
143
154
|
/**
|
|
144
155
|
* Render pass (fallback)
|
|
145
156
|
*/
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { GeometryBase } from "./GeometryBase";
|
|
2
|
+
import { StorageGPUBuffer } from "../../gfx/graphics/webGpu/core/buffer/StorageGPUBuffer";
|
|
3
|
+
/**
|
|
4
|
+
* FatLine Geometry
|
|
5
|
+
* Using instance rendering, each line segment as an instance
|
|
6
|
+
* @group Geometry
|
|
7
|
+
*/
|
|
8
|
+
export declare class FatLineGeometry extends GeometryBase {
|
|
9
|
+
private _instanceBuffer;
|
|
10
|
+
private _instanceData;
|
|
11
|
+
private _instanceCount;
|
|
12
|
+
constructor();
|
|
13
|
+
/**
|
|
14
|
+
* Initialize base quad geometry (shared by all line segments)
|
|
15
|
+
* This is similar to ThreeJS LineSegmentsGeometry base geometry
|
|
16
|
+
*/
|
|
17
|
+
private initBaseGeometry;
|
|
18
|
+
/**
|
|
19
|
+
* Set line positions from continuous points array
|
|
20
|
+
* @param positions Array of positions [x1,y1,z1, x2,y2,z2, ...]
|
|
21
|
+
*/
|
|
22
|
+
setPositions(positions: Float32Array | number[]): this;
|
|
23
|
+
/**
|
|
24
|
+
* Set colors for line segments
|
|
25
|
+
* @param colors Array of colors [r1,g1,b1, r2,g2,b2, ...] for each point
|
|
26
|
+
*/
|
|
27
|
+
setColors(colors: Float32Array | number[]): this;
|
|
28
|
+
/**
|
|
29
|
+
* Compute bounding box from positions
|
|
30
|
+
*/
|
|
31
|
+
private computeBoundingBox;
|
|
32
|
+
/**
|
|
33
|
+
* Get instance data for GPU upload
|
|
34
|
+
*/
|
|
35
|
+
get instanceData(): Float32Array;
|
|
36
|
+
/**
|
|
37
|
+
* Get number of line segments (instances)
|
|
38
|
+
*/
|
|
39
|
+
get instanceCount(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Get or create instance buffer
|
|
42
|
+
*/
|
|
43
|
+
get instanceBuffer(): StorageGPUBuffer;
|
|
44
|
+
/**
|
|
45
|
+
* Update instance buffer with new data
|
|
46
|
+
*/
|
|
47
|
+
updateInstanceBuffer(): void;
|
|
48
|
+
}
|
|
@@ -18,7 +18,8 @@ export declare class RendererJob {
|
|
|
18
18
|
shadowMapPassRenderer: ShadowMapPassRenderer;
|
|
19
19
|
pointLightShadowRenderer: PointLightShadowRenderer;
|
|
20
20
|
ddgiProbeRenderer: DDGIProbeRenderer;
|
|
21
|
-
|
|
21
|
+
_postRenderer: PostRenderer;
|
|
22
|
+
get postRenderer(): PostRenderer;
|
|
22
23
|
clusterLightingRender: ClusterLightingRender;
|
|
23
24
|
reflectionRenderer: ReflectionRenderer;
|
|
24
25
|
occlusionSystem: OcclusionSystem;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export * from "./assets/shader/core/struct/VertexAttributeIndexShader";
|
|
|
64
64
|
export * from "./assets/shader/core/struct/VertexAttributes";
|
|
65
65
|
export * from "./assets/shader/env/ReflectionCG";
|
|
66
66
|
export * from "./assets/shader/glsl/Quad_glsl";
|
|
67
|
+
export * from "./assets/shader/gsplat/GSplatShader";
|
|
67
68
|
export * from "./assets/shader/lighting/BRDF_frag";
|
|
68
69
|
export * from "./assets/shader/lighting/BsDF_frag";
|
|
69
70
|
export * from "./assets/shader/lighting/BxDF_frag";
|
|
@@ -73,9 +74,9 @@ export * from "./assets/shader/lighting/IrradianceVolumeData_frag";
|
|
|
73
74
|
export * from "./assets/shader/lighting/Irradiance_frag";
|
|
74
75
|
export * from "./assets/shader/lighting/LightingFunction_frag";
|
|
75
76
|
export * from "./assets/shader/lighting/UnLit_frag";
|
|
77
|
+
export * from "./assets/shader/lines/FatLineShader";
|
|
76
78
|
export * from "./assets/shader/materials/ColorLitShader";
|
|
77
79
|
export * from "./assets/shader/materials/GIProbeShader";
|
|
78
|
-
export * from "./assets/shader/materials/GSplatShader";
|
|
79
80
|
export * from "./assets/shader/materials/GlassShader";
|
|
80
81
|
export * from "./assets/shader/materials/Hair_shader";
|
|
81
82
|
export * from "./assets/shader/materials/Lambert_shader";
|
|
@@ -179,6 +180,7 @@ export * from "./components/lights/LightData";
|
|
|
179
180
|
export * from "./components/lights/PointLight";
|
|
180
181
|
export * from "./components/lights/SpotLight";
|
|
181
182
|
export * from "./components/post/PostProcessingComponent";
|
|
183
|
+
export * from "./components/renderer/FatLineRenderer";
|
|
182
184
|
export * from "./components/renderer/GSplatRenderer";
|
|
183
185
|
export * from "./components/renderer/GlobalIlluminationComponent";
|
|
184
186
|
export * from "./components/renderer/InstanceDrawComponent";
|
|
@@ -212,6 +214,7 @@ export * from "./core/entities/Entity";
|
|
|
212
214
|
export * from "./core/entities/InstancedMesh";
|
|
213
215
|
export * from "./core/entities/Object3D";
|
|
214
216
|
export * from "./core/geometry/ExtrudeGeometry";
|
|
217
|
+
export * from "./core/geometry/FatLineGeometry";
|
|
215
218
|
export * from "./core/geometry/GeometryBase";
|
|
216
219
|
export * from "./core/geometry/GeometryIndicesBuffer";
|
|
217
220
|
export * from "./core/geometry/GeometryVertexBuffer";
|
|
@@ -432,6 +435,8 @@ export * from "./loader/parser/prefab/PrefabParser";
|
|
|
432
435
|
export * from "./loader/parser/prefab/PrefabStringUtil";
|
|
433
436
|
export * from "./loader/parser/prefab/PrefabTextureParser";
|
|
434
437
|
export * from "./loader/parser/prefab/mats/MaterialUtilities";
|
|
438
|
+
export * from "./loader/parser/prefab/mats/shader/FatLineShader";
|
|
439
|
+
export * from "./loader/parser/prefab/mats/shader/GSplatShader";
|
|
435
440
|
export * from "./loader/parser/prefab/mats/shader/LitSSSShader";
|
|
436
441
|
export * from "./loader/parser/prefab/mats/shader/LitShader";
|
|
437
442
|
export * from "./loader/parser/prefab/mats/shader/QuadShader";
|
|
@@ -454,6 +459,7 @@ export * from "./loader/parser/tileRenderer/TileSet";
|
|
|
454
459
|
export * from "./loader/parser/tileRenderer/TilesRenderer";
|
|
455
460
|
export * from "./materials/BlendMode";
|
|
456
461
|
export * from "./materials/ColorLitMaterial";
|
|
462
|
+
export * from "./materials/FatLineMaterial";
|
|
457
463
|
export * from "./materials/GIProbeMaterial";
|
|
458
464
|
export * from "./materials/GSplatMaterial";
|
|
459
465
|
export * from "./materials/LambertMaterial";
|
|
@@ -539,6 +545,7 @@ export * from "./setting/post/SSRSetting";
|
|
|
539
545
|
export * from "./setting/post/TAASetting";
|
|
540
546
|
export * from "./shape/BoxGeometry";
|
|
541
547
|
export * from "./shape/CylinderGeometry";
|
|
548
|
+
export * from "./shape/GSplatGeometry";
|
|
542
549
|
export * from "./shape/PlaneGeometry";
|
|
543
550
|
export * from "./shape/SphereGeometry";
|
|
544
551
|
export * from "./shape/TorusGeometry";
|
|
@@ -555,6 +562,7 @@ export * from "./textures/Float32ArrayTexture";
|
|
|
555
562
|
export * from "./textures/HDRTexture";
|
|
556
563
|
export * from "./textures/HDRTextureCube";
|
|
557
564
|
export * from "./textures/LDRTextureCube";
|
|
565
|
+
export * from "./textures/R32UintTexture";
|
|
558
566
|
export * from "./textures/RenderTexture";
|
|
559
567
|
export * from "./textures/SolidColorSky";
|
|
560
568
|
export * from "./textures/TextureCubeFaceData";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Shader } from "../../../../../gfx/graphics/webGpu/shader/Shader";
|
|
2
|
+
/**
|
|
3
|
+
* GSplat Shader
|
|
4
|
+
* Shader for rendering 3D Gaussian Splats
|
|
5
|
+
*/
|
|
6
|
+
export declare class GSplatShader extends Shader {
|
|
7
|
+
constructor();
|
|
8
|
+
/**
|
|
9
|
+
* Set default uniform values
|
|
10
|
+
*/
|
|
11
|
+
setDefault(): void;
|
|
12
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Material } from "./Material";
|
|
2
|
+
import { Color } from "../math/Color";
|
|
3
|
+
import { Vector2 } from "../math/Vector2";
|
|
4
|
+
import { Matrix4 } from "../math/Matrix4";
|
|
5
|
+
import { StorageGPUBuffer } from "../gfx/graphics/webGpu/core/buffer/StorageGPUBuffer";
|
|
6
|
+
/**
|
|
7
|
+
* FatLine Material
|
|
8
|
+
* Material for rendering thick lines
|
|
9
|
+
* Supports pixel-accurate line width and round endcaps
|
|
10
|
+
* @group Material
|
|
11
|
+
*/
|
|
12
|
+
export declare class FatLineMaterial extends Material {
|
|
13
|
+
constructor();
|
|
14
|
+
/**
|
|
15
|
+
* Set instance buffer for line segments
|
|
16
|
+
* This should be called after setting the geometry
|
|
17
|
+
*/
|
|
18
|
+
setInstanceBuffer(buffer: StorageGPUBuffer): void;
|
|
19
|
+
/**
|
|
20
|
+
* Set model matrix for transforming line segments
|
|
21
|
+
* This should be updated each frame if the object moves
|
|
22
|
+
*/
|
|
23
|
+
setModelMatrix(matrix: Matrix4): void;
|
|
24
|
+
/**
|
|
25
|
+
* Set base color (tint color)
|
|
26
|
+
*/
|
|
27
|
+
set baseColor(color: Color);
|
|
28
|
+
/**
|
|
29
|
+
* Get base color (tint color)
|
|
30
|
+
*/
|
|
31
|
+
get baseColor(): Color;
|
|
32
|
+
/**
|
|
33
|
+
* Set line width in pixels
|
|
34
|
+
*/
|
|
35
|
+
set lineWidth(value: number);
|
|
36
|
+
/**
|
|
37
|
+
* Get line width in pixels
|
|
38
|
+
*/
|
|
39
|
+
get lineWidth(): number;
|
|
40
|
+
/**
|
|
41
|
+
* Set opacity (0-1)
|
|
42
|
+
*/
|
|
43
|
+
set opacity(value: number);
|
|
44
|
+
/**
|
|
45
|
+
* Get opacity (0-1)
|
|
46
|
+
*/
|
|
47
|
+
get opacity(): number;
|
|
48
|
+
/**
|
|
49
|
+
* Set viewport resolution for correct pixel-space calculations
|
|
50
|
+
* This should be set automatically by the renderer
|
|
51
|
+
*/
|
|
52
|
+
set resolution(value: Vector2);
|
|
53
|
+
/**
|
|
54
|
+
* Get viewport resolution
|
|
55
|
+
*/
|
|
56
|
+
get resolution(): Vector2;
|
|
57
|
+
}
|
|
@@ -2,10 +2,17 @@ import { Material } from "./Material";
|
|
|
2
2
|
import { Float16ArrayTexture } from "../textures/Float16ArrayTexture";
|
|
3
3
|
import { Uint8ArrayTexture } from "../textures/Uint8ArrayTexture";
|
|
4
4
|
import { Uint32ArrayTexture } from "../textures/Uint32ArrayTexture";
|
|
5
|
+
import { R32UintTexture } from "../textures/R32UintTexture";
|
|
5
6
|
import { Matrix4 } from "../math/Matrix4";
|
|
7
|
+
/**
|
|
8
|
+
* GSplat Material
|
|
9
|
+
* Material for rendering 3D Gaussian Splats
|
|
10
|
+
* @group Material
|
|
11
|
+
*/
|
|
6
12
|
export declare class GSplatMaterial extends Material {
|
|
13
|
+
private _pixelCullArray;
|
|
7
14
|
constructor();
|
|
8
|
-
setSplatTextures(splatColor: Uint8ArrayTexture, transformA: Uint32ArrayTexture, transformB: Float16ArrayTexture, texParams: Float32Array, splatOrder?:
|
|
15
|
+
setSplatTextures(splatColor: Uint8ArrayTexture, transformA: Uint32ArrayTexture, transformB: Float16ArrayTexture, texParams: Float32Array, splatOrder?: R32UintTexture): void;
|
|
9
16
|
/**
|
|
10
17
|
* Set the model matrix for transforming splats to world space
|
|
11
18
|
*/
|
|
@@ -16,5 +23,5 @@ export declare class GSplatMaterial extends Material {
|
|
|
16
23
|
* @param maxPixels Maximum pixel coverage (cull oversized splats), default: 0 (disabled)
|
|
17
24
|
* @param maxPixelCullDistance Only cull oversized splats within this distance, 0 = always cull
|
|
18
25
|
*/
|
|
19
|
-
setPixelCulling(minPixels: number, maxPixels: number, maxPixelCullDistance?: number): void;
|
|
26
|
+
setPixelCulling(minPixels: number, maxPixels: number, maxPixelCullDistance?: number, batchSize?: number): void;
|
|
20
27
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { GeometryBase } from "../core/geometry/GeometryBase";
|
|
2
|
+
/**
|
|
3
|
+
* GSplat Geometry (PlayCanvas Style)
|
|
4
|
+
*
|
|
5
|
+
* Exactly like PlayCanvas gsplat-instance.js:
|
|
6
|
+
* - batchSize splats per draw call (default 128)
|
|
7
|
+
* - Each splat = 4 vertices (x, y, local_index)
|
|
8
|
+
* - Each splat = 6 indices (2 triangles)
|
|
9
|
+
*/
|
|
10
|
+
export declare class GSplatGeometry extends GeometryBase {
|
|
11
|
+
batchSize: number;
|
|
12
|
+
constructor(batchSize?: number);
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Texture } from "../gfx/graphics/webGpu/core/texture/Texture";
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* R32Uint texture backed by Uint32Array
|
|
5
|
+
* @group Texture
|
|
6
|
+
*/
|
|
7
|
+
export declare class R32UintTexture extends Texture {
|
|
8
|
+
private _dataBuffer;
|
|
9
|
+
create(width: number, height: number, data: Uint32Array): this;
|
|
10
|
+
updateTexture(width: number, height: number, data: Uint32Array): void;
|
|
11
|
+
}
|
package/package.json
CHANGED
|
File without changes
|