@rings-webgpu/core 1.0.27 → 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.
@@ -0,0 +1,2 @@
1
+ export declare const PointCloud_VS: string;
2
+ export declare const PointCloud_FS: string;
@@ -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;
@@ -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";
@@ -441,6 +443,7 @@ export * from "./loader/parser/prefab/mats/shader/FatLineShader";
441
443
  export * from "./loader/parser/prefab/mats/shader/GSplatShader";
442
444
  export * from "./loader/parser/prefab/mats/shader/LitSSSShader";
443
445
  export * from "./loader/parser/prefab/mats/shader/LitShader";
446
+ export * from "./loader/parser/prefab/mats/shader/PointCloudShader";
444
447
  export * from "./loader/parser/prefab/mats/shader/QuadShader";
445
448
  export * from "./loader/parser/prefab/mats/shader/ReflectionShader";
446
449
  export * from "./loader/parser/prefab/mats/shader/SkyShader";
@@ -477,6 +480,7 @@ export * from "./materials/LambertMaterial";
477
480
  export * from "./materials/LitMaterial";
478
481
  export * from "./materials/Material";
479
482
  export * from "./materials/MaterialRegister";
483
+ export * from "./materials/PointCloudMaterial";
480
484
  export * from "./materials/ReflectionMaterial";
481
485
  export * from "./materials/SkyMaterial";
482
486
  export * from "./materials/UnLitMaterial";
@@ -558,6 +562,7 @@ export * from "./shape/BoxGeometry";
558
562
  export * from "./shape/CylinderGeometry";
559
563
  export * from "./shape/GSplatGeometry";
560
564
  export * from "./shape/PlaneGeometry";
565
+ export * from "./shape/PointCloudGeometry";
561
566
  export * from "./shape/SphereGeometry";
562
567
  export * from "./shape/TorusGeometry";
563
568
  export * from "./shape/TrailGeometry";
@@ -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,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 (PlayCanvas Style)
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)
@@ -0,0 +1,5 @@
1
+ import { GeometryBase } from "../core/geometry/GeometryBase";
2
+ export declare class PointCloudGeometry extends GeometryBase {
3
+ batchSize: number;
4
+ constructor(batchSize?: number);
5
+ }
@@ -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): void;
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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rings-webgpu/core",
3
- "version": "1.0.27",
3
+ "version": "1.0.28",
4
4
  "description": "Rings webgpu Engine",
5
5
  "main": "index.js",
6
6
  "exports": {