@rings-webgpu/core 1.0.27 → 1.0.29
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 +321 -194
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +1226 -114
- package/dist/rings.umd.js +314 -187
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +1233 -113
- 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 +8 -0
- package/dist/types/loader/parser/b3dm/FeatureTable.d.ts +2 -1
- package/dist/types/loader/parser/ply/PlyLoader.d.ts +5 -1
- package/dist/types/loader/parser/ply/PlyTypes.d.ts +8 -0
- package/dist/types/loader/parser/pnts/PNTSLoader.d.ts +10 -0
- package/dist/types/loader/parser/pnts/PNTSLoaderBase.d.ts +8 -0
- package/dist/types/loader/parser/pnts/PNTSParser.d.ts +7 -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";
|
|
@@ -430,6 +432,9 @@ export * from "./loader/parser/ply/PlyLoader";
|
|
|
430
432
|
export * from "./loader/parser/ply/PlyParser";
|
|
431
433
|
export * from "./loader/parser/ply/PlyTypes";
|
|
432
434
|
export * from "./loader/parser/ply/PlyUtils";
|
|
435
|
+
export * from "./loader/parser/pnts/PNTSLoader";
|
|
436
|
+
export * from "./loader/parser/pnts/PNTSLoaderBase";
|
|
437
|
+
export * from "./loader/parser/pnts/PNTSParser";
|
|
433
438
|
export * from "./loader/parser/prefab/PrefabAvatarParser";
|
|
434
439
|
export * from "./loader/parser/prefab/PrefabMaterialParser";
|
|
435
440
|
export * from "./loader/parser/prefab/PrefabMeshParser";
|
|
@@ -441,6 +446,7 @@ export * from "./loader/parser/prefab/mats/shader/FatLineShader";
|
|
|
441
446
|
export * from "./loader/parser/prefab/mats/shader/GSplatShader";
|
|
442
447
|
export * from "./loader/parser/prefab/mats/shader/LitSSSShader";
|
|
443
448
|
export * from "./loader/parser/prefab/mats/shader/LitShader";
|
|
449
|
+
export * from "./loader/parser/prefab/mats/shader/PointCloudShader";
|
|
444
450
|
export * from "./loader/parser/prefab/mats/shader/QuadShader";
|
|
445
451
|
export * from "./loader/parser/prefab/mats/shader/ReflectionShader";
|
|
446
452
|
export * from "./loader/parser/prefab/mats/shader/SkyShader";
|
|
@@ -477,6 +483,7 @@ export * from "./materials/LambertMaterial";
|
|
|
477
483
|
export * from "./materials/LitMaterial";
|
|
478
484
|
export * from "./materials/Material";
|
|
479
485
|
export * from "./materials/MaterialRegister";
|
|
486
|
+
export * from "./materials/PointCloudMaterial";
|
|
480
487
|
export * from "./materials/ReflectionMaterial";
|
|
481
488
|
export * from "./materials/SkyMaterial";
|
|
482
489
|
export * from "./materials/UnLitMaterial";
|
|
@@ -558,6 +565,7 @@ export * from "./shape/BoxGeometry";
|
|
|
558
565
|
export * from "./shape/CylinderGeometry";
|
|
559
566
|
export * from "./shape/GSplatGeometry";
|
|
560
567
|
export * from "./shape/PlaneGeometry";
|
|
568
|
+
export * from "./shape/PointCloudGeometry";
|
|
561
569
|
export * from "./shape/SphereGeometry";
|
|
562
570
|
export * from "./shape/TorusGeometry";
|
|
563
571
|
export * from "./shape/TrailGeometry";
|
|
@@ -2,7 +2,8 @@ export declare class FeatureTable {
|
|
|
2
2
|
private buffer;
|
|
3
3
|
private binOffset;
|
|
4
4
|
private binLength;
|
|
5
|
-
private
|
|
5
|
+
private _header;
|
|
6
|
+
get header(): any;
|
|
6
7
|
constructor(buffer: any, start: any, headerLength: any, binLength: any);
|
|
7
8
|
getKeys(): string[];
|
|
8
9
|
getData(key: any, count?: any, defaultComponentType?: any, defaultType?: any): any;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PlyHeader, PlyGaussianSplatData, PlyMeshData } from './PlyTypes';
|
|
1
|
+
import { PlyHeader, PlyGaussianSplatData, PlyMeshData, PlyPointCloudData } from './PlyTypes';
|
|
2
2
|
/**
|
|
3
3
|
* Parse PLY header from buffer
|
|
4
4
|
*/
|
|
@@ -11,3 +11,7 @@ export declare function parsePlyGaussianSplat(buffer: ArrayBuffer): PlyGaussianS
|
|
|
11
11
|
* Parse PLY data for Mesh
|
|
12
12
|
*/
|
|
13
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;
|
|
@@ -53,3 +53,11 @@ export type PlyMeshData = {
|
|
|
53
53
|
textureFiles?: string[];
|
|
54
54
|
triangleTexnumbers?: number[];
|
|
55
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,10 @@
|
|
|
1
|
+
import { PNTSLoaderBase } from "./PNTSLoaderBase";
|
|
2
|
+
export declare class PNTSLoader extends PNTSLoaderBase {
|
|
3
|
+
parse(buffer: ArrayBuffer): Promise<any>;
|
|
4
|
+
private parsePositions;
|
|
5
|
+
private parseColors;
|
|
6
|
+
private parseNormals;
|
|
7
|
+
private decodeRGB565;
|
|
8
|
+
private decodeOctNormals;
|
|
9
|
+
private parseDraco;
|
|
10
|
+
}
|
|
@@ -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;
|