@rings-webgpu/core 1.0.26 → 1.0.28
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 +344 -215
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +1854 -98
- package/dist/rings.umd.js +344 -215
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +1863 -97
- package/dist/types/assets/shader/pointcloud/PointCloudShader.d.ts +2 -0
- package/dist/types/components/renderer/PointCloudRenderer.d.ts +89 -0
- package/dist/types/gfx/graphics/webGpu/shader/RenderShaderPass.d.ts +1 -0
- package/dist/types/index.d.ts +6 -0
- package/dist/types/loader/parser/ply/PlyLoader.d.ts +10 -2
- package/dist/types/loader/parser/ply/PlyParser.d.ts +7 -0
- package/dist/types/loader/parser/ply/PlyTypes.d.ts +33 -0
- package/dist/types/loader/parser/prefab/mats/shader/PointCloudShader.d.ts +9 -0
- package/dist/types/materials/PointCloudMaterial.d.ts +44 -0
- package/dist/types/shape/GSplatGeometry.d.ts +1 -3
- package/dist/types/shape/PointCloudGeometry.d.ts +5 -0
- package/dist/types/textures/Float32ArrayTexture.d.ts +1 -1
- package/dist/types/util/BoundUtil.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { RenderNode } from "./RenderNode";
|
|
2
|
+
import { PointCloudMaterial } from "../../materials/PointCloudMaterial";
|
|
3
|
+
import { View3D } from "../../core/View3D";
|
|
4
|
+
import { RendererPassState } from "../../gfx/renderJob/passRenderer/state/RendererPassState";
|
|
5
|
+
import { ClusterLightingBuffer } from "../../gfx/renderJob/passRenderer/cluster/ClusterLightingBuffer";
|
|
6
|
+
import { PassType } from "../../gfx/renderJob/passRenderer/state/PassType";
|
|
7
|
+
import { Uint8ArrayTexture } from "../../textures/Uint8ArrayTexture";
|
|
8
|
+
import { Float32ArrayTexture } from "../../textures/Float32ArrayTexture";
|
|
9
|
+
import { R32UintTexture } from "../../textures/R32UintTexture";
|
|
10
|
+
import { Vector2 } from "../../math/Vector2";
|
|
11
|
+
import { RenderContext } from "../../gfx/renderJob/passRenderer/RenderContext";
|
|
12
|
+
import { Vector3 } from "../../math/Vector3";
|
|
13
|
+
/**
|
|
14
|
+
* Point Cloud Renderer Component
|
|
15
|
+
*
|
|
16
|
+
* Renders point clouds with billboard quads using instanced rendering.
|
|
17
|
+
* Manages point data, textures, and rendering state.
|
|
18
|
+
*/
|
|
19
|
+
export declare class PointCloudRenderer extends RenderNode {
|
|
20
|
+
count: number;
|
|
21
|
+
size: Vector2;
|
|
22
|
+
pointColor: Uint8ArrayTexture;
|
|
23
|
+
pointPosition: Float32ArrayTexture;
|
|
24
|
+
pointOrder: R32UintTexture;
|
|
25
|
+
texParams: Float32Array;
|
|
26
|
+
pointCloudMaterial: PointCloudMaterial;
|
|
27
|
+
private _positions;
|
|
28
|
+
get positions(): Float32Array;
|
|
29
|
+
private _colors;
|
|
30
|
+
private _orderData;
|
|
31
|
+
private _fullCount;
|
|
32
|
+
get fullCount(): number;
|
|
33
|
+
private _batchSize;
|
|
34
|
+
instanceCount: number;
|
|
35
|
+
private _texturesInitialized;
|
|
36
|
+
private _debugFullScreen;
|
|
37
|
+
private _centerOffset;
|
|
38
|
+
get centerOffset(): Vector3;
|
|
39
|
+
constructor();
|
|
40
|
+
/**
|
|
41
|
+
* Initialize point cloud from raw data
|
|
42
|
+
* @param positions Point positions (xyz per point, Float32Array)
|
|
43
|
+
* @param colors Point colors (rgba per point, Uint8Array)
|
|
44
|
+
* @param count Number of points
|
|
45
|
+
*/
|
|
46
|
+
initFromData(positions: Float32Array, colors: Uint8Array, count: number): void;
|
|
47
|
+
/**
|
|
48
|
+
* Calculate texture size for given point count
|
|
49
|
+
* @param count Number of points
|
|
50
|
+
* @returns Texture dimensions (width, height)
|
|
51
|
+
*/
|
|
52
|
+
private evalTextureSize;
|
|
53
|
+
/**
|
|
54
|
+
* Centerize positions to improve precision for large values
|
|
55
|
+
* Subtracts the center point from all positions to keep values near zero
|
|
56
|
+
*/
|
|
57
|
+
private centerizePositions;
|
|
58
|
+
private buildPositionTexture;
|
|
59
|
+
private buildColorTexture;
|
|
60
|
+
private buildOrderTexture;
|
|
61
|
+
/**
|
|
62
|
+
* Update node before rendering
|
|
63
|
+
*/
|
|
64
|
+
nodeUpdate(view: View3D, passType: PassType, renderPassState: RendererPassState, clusterLightingBuffer?: ClusterLightingBuffer): void;
|
|
65
|
+
/**
|
|
66
|
+
* Render pass
|
|
67
|
+
*/
|
|
68
|
+
renderPass(view: View3D, passType: PassType, renderContext: RenderContext): void;
|
|
69
|
+
/**
|
|
70
|
+
* Set point size in pixels
|
|
71
|
+
* @param size Point size in pixels
|
|
72
|
+
*/
|
|
73
|
+
setPointSize(size: number): void;
|
|
74
|
+
/**
|
|
75
|
+
* Set point shape
|
|
76
|
+
* @param shape 'square' or 'circle'
|
|
77
|
+
*/
|
|
78
|
+
setPointShape(shape: 'square' | 'circle'): void;
|
|
79
|
+
/**
|
|
80
|
+
* Enable a fullscreen debug quad to validate the render pipeline.
|
|
81
|
+
*/
|
|
82
|
+
enableDebugFullScreen(enabled: boolean): void;
|
|
83
|
+
/**
|
|
84
|
+
* Set batch size for instanced rendering
|
|
85
|
+
* @param batchSize Number of points per draw call
|
|
86
|
+
*/
|
|
87
|
+
setBatchSize(batchSize: number): void;
|
|
88
|
+
destroy(force?: boolean): void;
|
|
89
|
+
}
|
|
@@ -55,6 +55,7 @@ export declare class RenderShaderPass extends ShaderPassBase {
|
|
|
55
55
|
get depthCompare(): GPUCompareFunction;
|
|
56
56
|
set depthCompare(value: GPUCompareFunction);
|
|
57
57
|
setShaderEntry(vsEntryPoint?: string, fsEntryPoint?: string): void;
|
|
58
|
+
setUniformArray(name: string, value: Float32Array): void;
|
|
58
59
|
setUniform(name: string, value: UniformValue): void;
|
|
59
60
|
setTexture(name: string, texture: Texture): void;
|
|
60
61
|
get baseColor(): Color;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -98,6 +98,7 @@ export * from "./assets/shader/materials/uniforms/VideoUniform_frag";
|
|
|
98
98
|
export * from "./assets/shader/math/FastMathShader";
|
|
99
99
|
export * from "./assets/shader/math/MathShader";
|
|
100
100
|
export * from "./assets/shader/math/MatrixShader";
|
|
101
|
+
export * from "./assets/shader/pointcloud/PointCloudShader";
|
|
101
102
|
export * from "./assets/shader/post/FXAAShader";
|
|
102
103
|
export * from "./assets/shader/post/GlobalFog_shader";
|
|
103
104
|
export * from "./assets/shader/quad/Quad_shader";
|
|
@@ -186,6 +187,7 @@ export * from "./components/renderer/GlobalIlluminationComponent";
|
|
|
186
187
|
export * from "./components/renderer/InstanceDrawComponent";
|
|
187
188
|
export * from "./components/renderer/MeshFilter";
|
|
188
189
|
export * from "./components/renderer/MeshRenderer";
|
|
190
|
+
export * from "./components/renderer/PointCloudRenderer";
|
|
189
191
|
export * from "./components/renderer/Reflection";
|
|
190
192
|
export * from "./components/renderer/RenderNode";
|
|
191
193
|
export * from "./components/renderer/SkinnedMeshRenderer";
|
|
@@ -427,6 +429,7 @@ export * from "./loader/parser/kmz/dataDef/point";
|
|
|
427
429
|
export * from "./loader/parser/kmz/dataDef/template";
|
|
428
430
|
export * from "./loader/parser/kmz/dataDef/wayline";
|
|
429
431
|
export * from "./loader/parser/ply/PlyLoader";
|
|
432
|
+
export * from "./loader/parser/ply/PlyParser";
|
|
430
433
|
export * from "./loader/parser/ply/PlyTypes";
|
|
431
434
|
export * from "./loader/parser/ply/PlyUtils";
|
|
432
435
|
export * from "./loader/parser/prefab/PrefabAvatarParser";
|
|
@@ -440,6 +443,7 @@ export * from "./loader/parser/prefab/mats/shader/FatLineShader";
|
|
|
440
443
|
export * from "./loader/parser/prefab/mats/shader/GSplatShader";
|
|
441
444
|
export * from "./loader/parser/prefab/mats/shader/LitSSSShader";
|
|
442
445
|
export * from "./loader/parser/prefab/mats/shader/LitShader";
|
|
446
|
+
export * from "./loader/parser/prefab/mats/shader/PointCloudShader";
|
|
443
447
|
export * from "./loader/parser/prefab/mats/shader/QuadShader";
|
|
444
448
|
export * from "./loader/parser/prefab/mats/shader/ReflectionShader";
|
|
445
449
|
export * from "./loader/parser/prefab/mats/shader/SkyShader";
|
|
@@ -476,6 +480,7 @@ export * from "./materials/LambertMaterial";
|
|
|
476
480
|
export * from "./materials/LitMaterial";
|
|
477
481
|
export * from "./materials/Material";
|
|
478
482
|
export * from "./materials/MaterialRegister";
|
|
483
|
+
export * from "./materials/PointCloudMaterial";
|
|
479
484
|
export * from "./materials/ReflectionMaterial";
|
|
480
485
|
export * from "./materials/SkyMaterial";
|
|
481
486
|
export * from "./materials/UnLitMaterial";
|
|
@@ -557,6 +562,7 @@ export * from "./shape/BoxGeometry";
|
|
|
557
562
|
export * from "./shape/CylinderGeometry";
|
|
558
563
|
export * from "./shape/GSplatGeometry";
|
|
559
564
|
export * from "./shape/PlaneGeometry";
|
|
565
|
+
export * from "./shape/PointCloudGeometry";
|
|
560
566
|
export * from "./shape/SphereGeometry";
|
|
561
567
|
export * from "./shape/TorusGeometry";
|
|
562
568
|
export * from "./shape/TrailGeometry";
|
|
@@ -1,9 +1,17 @@
|
|
|
1
|
-
import { PlyHeader, PlyGaussianSplatData } from './PlyTypes';
|
|
1
|
+
import { PlyHeader, PlyGaussianSplatData, PlyMeshData, PlyPointCloudData } from './PlyTypes';
|
|
2
2
|
/**
|
|
3
3
|
* Parse PLY header from buffer
|
|
4
4
|
*/
|
|
5
5
|
export declare function parsePlyHeader(buffer: ArrayBuffer): PlyHeader;
|
|
6
6
|
/**
|
|
7
|
-
* Parse PLY
|
|
7
|
+
* Parse PLY data for Gaussian Splatting (supports both binary and ASCII)
|
|
8
8
|
*/
|
|
9
9
|
export declare function parsePlyGaussianSplat(buffer: ArrayBuffer): PlyGaussianSplatData;
|
|
10
|
+
/**
|
|
11
|
+
* Parse PLY data for Mesh
|
|
12
|
+
*/
|
|
13
|
+
export declare function parsePlyMesh(buffer: ArrayBuffer): PlyMeshData;
|
|
14
|
+
/**
|
|
15
|
+
* Parse PLY data for Point Cloud (supports both binary and ASCII)
|
|
16
|
+
*/
|
|
17
|
+
export declare function parsePlyPointCloud(buffer: ArrayBuffer): PlyPointCloudData;
|
|
@@ -5,14 +5,25 @@ export type PlyProperty = {
|
|
|
5
5
|
name: string;
|
|
6
6
|
type: string;
|
|
7
7
|
};
|
|
8
|
+
export declare const enum PlyMode {
|
|
9
|
+
Splat = 0,
|
|
10
|
+
PointCloud = 1,
|
|
11
|
+
Mesh = 2
|
|
12
|
+
}
|
|
13
|
+
export declare const splatProperties: string[];
|
|
14
|
+
export declare const splatColorProperties: string[];
|
|
8
15
|
/**
|
|
9
16
|
* PLY header information
|
|
10
17
|
*/
|
|
11
18
|
export type PlyHeader = {
|
|
12
19
|
format: string;
|
|
13
20
|
vertexCount: number;
|
|
21
|
+
faceCount: number;
|
|
14
22
|
properties: PlyProperty[];
|
|
23
|
+
faceProperties?: PlyProperty[];
|
|
24
|
+
textureFiles: string[];
|
|
15
25
|
headerByteLength: number;
|
|
26
|
+
mode: PlyMode;
|
|
16
27
|
};
|
|
17
28
|
/**
|
|
18
29
|
* Parsed PLY data for Gaussian Splatting
|
|
@@ -28,3 +39,25 @@ export type PlyGaussianSplatData = {
|
|
|
28
39
|
coeffs: Float32Array;
|
|
29
40
|
};
|
|
30
41
|
};
|
|
42
|
+
/**
|
|
43
|
+
* Parsed PLY data for Mesh
|
|
44
|
+
*/
|
|
45
|
+
export type PlyMeshData = {
|
|
46
|
+
vertexCount: number;
|
|
47
|
+
faceCount: number;
|
|
48
|
+
position: Float32Array;
|
|
49
|
+
normal: Float32Array;
|
|
50
|
+
color?: Float32Array;
|
|
51
|
+
uv?: Float32Array;
|
|
52
|
+
indices: Uint32Array;
|
|
53
|
+
textureFiles?: string[];
|
|
54
|
+
triangleTexnumbers?: number[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Parsed PLY data for Point Cloud
|
|
58
|
+
*/
|
|
59
|
+
export type PlyPointCloudData = {
|
|
60
|
+
vertexCount: number;
|
|
61
|
+
position: Float32Array;
|
|
62
|
+
color?: Uint8Array;
|
|
63
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Shader } from "../../../../../gfx/graphics/webGpu/shader/Shader";
|
|
2
|
+
/**
|
|
3
|
+
* PointCloud Shader
|
|
4
|
+
* Shader for rendering point clouds with billboard quads
|
|
5
|
+
*/
|
|
6
|
+
export declare class PointCloudShader extends Shader {
|
|
7
|
+
constructor();
|
|
8
|
+
setDefault(): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Material } from "./Material";
|
|
2
|
+
import { Float32ArrayTexture } from "../textures/Float32ArrayTexture";
|
|
3
|
+
import { Uint8ArrayTexture } from "../textures/Uint8ArrayTexture";
|
|
4
|
+
import { R32UintTexture } from "../textures/R32UintTexture";
|
|
5
|
+
import { Matrix4 } from "../math/Matrix4";
|
|
6
|
+
/**
|
|
7
|
+
* PointCloud Material
|
|
8
|
+
* Material for rendering point clouds with billboard quads
|
|
9
|
+
* @group Material
|
|
10
|
+
*/
|
|
11
|
+
export declare class PointCloudMaterial extends Material {
|
|
12
|
+
private _texParams;
|
|
13
|
+
private _pointParamsArray;
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Set point cloud textures
|
|
17
|
+
* @param pointPosition Position texture (RGB = xyz)
|
|
18
|
+
* @param pointColor Color texture (RGBA)
|
|
19
|
+
* @param texParams Texture parameters [numPoints, texWidth, validCount, pointSize]
|
|
20
|
+
* @param pointOrder Optional sorting texture (R32U format)
|
|
21
|
+
*/
|
|
22
|
+
setPointTextures(pointPosition: Float32ArrayTexture, pointColor: Uint8ArrayTexture, texParams: Float32Array, pointOrder?: R32UintTexture): void;
|
|
23
|
+
/**
|
|
24
|
+
* Set the model matrix for transforming points to world space
|
|
25
|
+
* @param matrix Model transformation matrix
|
|
26
|
+
*/
|
|
27
|
+
setTransformMatrix(matrix: Matrix4): void;
|
|
28
|
+
/**
|
|
29
|
+
* Set point size in pixels
|
|
30
|
+
* @param size Point size in pixels (default: 4.0)
|
|
31
|
+
*/
|
|
32
|
+
setPointSize(size: number): void;
|
|
33
|
+
/**
|
|
34
|
+
* Set point shape
|
|
35
|
+
* @param shape Point shape: 'square' or 'circle'
|
|
36
|
+
*/
|
|
37
|
+
setPointShape(shape: 'square' | 'circle'): void;
|
|
38
|
+
enableDebugFullScreen(enabled: boolean): void;
|
|
39
|
+
/**
|
|
40
|
+
* Set batch size for instanced rendering
|
|
41
|
+
* @param batchSize Number of points per draw call (default: 128)
|
|
42
|
+
*/
|
|
43
|
+
setBatchSize(batchSize: number): void;
|
|
44
|
+
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { GeometryBase } from "../core/geometry/GeometryBase";
|
|
2
2
|
/**
|
|
3
|
-
* GSplat Geometry
|
|
4
|
-
*
|
|
5
|
-
* Exactly like PlayCanvas gsplat-instance.js:
|
|
3
|
+
* GSplat Geometry
|
|
6
4
|
* - batchSize splats per draw call (default 128)
|
|
7
5
|
* - Each splat = 4 vertices (x, y, local_index)
|
|
8
6
|
* - Each splat = 6 indices (2 triangles)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Texture } from "../gfx/graphics/webGpu/core/texture/Texture";
|
|
2
2
|
export declare class Float32ArrayTexture extends Texture {
|
|
3
|
-
create(width: number, height: number, data: Float32Array, filtering?: boolean):
|
|
3
|
+
create(width: number, height: number, data: Float32Array, filtering?: boolean): this;
|
|
4
4
|
fromBuffer(width: number, height: number, textureDataBuffer: GPUBuffer): this;
|
|
5
5
|
}
|
|
@@ -7,6 +7,7 @@ export declare class BoundUtil {
|
|
|
7
7
|
private static readonly genMeshMaxVector;
|
|
8
8
|
private static readonly genMeshMinVector;
|
|
9
9
|
private static readonly genMeshVectorList8;
|
|
10
|
+
static genPointCloudBounds(obj: Object3D, bound?: BoundingBox): BoundingBox;
|
|
10
11
|
static genGSplatBounds(obj: Object3D, bound?: BoundingBox): BoundingBox;
|
|
11
12
|
static genMeshBounds(obj: Object3D, bound?: BoundingBox): BoundingBox;
|
|
12
13
|
static transformBound(matrix: Matrix4, source: BoundingBox, bound?: BoundingBox): BoundingBox;
|