@rings-webgpu/core 1.0.49 → 1.0.51
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 +189 -189
- package/dist/rings.es.js.map +3 -3
- package/dist/rings.es.max.js +619 -108
- package/dist/rings.umd.js +127 -127
- package/dist/rings.umd.js.map +3 -3
- package/dist/rings.umd.max.js +618 -107
- package/dist/types/components/renderer/PointCloudRenderer.d.ts +0 -2
- package/dist/types/components/renderer/PointCloudStreamRenderer.d.ts +126 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/textures/Float32ArrayTexture.d.ts +15 -0
- package/package.json +1 -1
|
@@ -28,8 +28,6 @@ export declare class PointCloudRenderer extends RenderNode {
|
|
|
28
28
|
get positions(): Float32Array;
|
|
29
29
|
private _colors;
|
|
30
30
|
private _orderData;
|
|
31
|
-
private _fullCount;
|
|
32
|
-
get fullCount(): number;
|
|
33
31
|
private _batchSize;
|
|
34
32
|
instanceCount: number;
|
|
35
33
|
private _texturesInitialized;
|
|
@@ -0,0 +1,126 @@
|
|
|
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 Data structure for streaming
|
|
15
|
+
*/
|
|
16
|
+
export type PointCloudData = {
|
|
17
|
+
position: [number, number, number];
|
|
18
|
+
color?: [number, number, number, number];
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Point Cloud Stream Renderer Component
|
|
22
|
+
*
|
|
23
|
+
* Renders point clouds with streaming support, allowing incremental updates.
|
|
24
|
+
* Similar to GSplatStreamRenderer but for simple point clouds.
|
|
25
|
+
*/
|
|
26
|
+
export declare class PointCloudStreamRenderer extends RenderNode {
|
|
27
|
+
static flushFrameLimit: number;
|
|
28
|
+
totalCount: number;
|
|
29
|
+
size: Vector2;
|
|
30
|
+
pointColor: Uint8ArrayTexture;
|
|
31
|
+
pointPosition: Float32ArrayTexture;
|
|
32
|
+
pointOrder: R32UintTexture;
|
|
33
|
+
texParams: Float32Array;
|
|
34
|
+
private _texParamDirty;
|
|
35
|
+
pointCloudMaterial: PointCloudMaterial;
|
|
36
|
+
private _colorData;
|
|
37
|
+
private _positionData;
|
|
38
|
+
private _orderData;
|
|
39
|
+
private _pointSetFlags;
|
|
40
|
+
private _validCount;
|
|
41
|
+
private _batchSize;
|
|
42
|
+
instanceCount: number;
|
|
43
|
+
private _pendingUpdates;
|
|
44
|
+
private _autoFlushThreshold;
|
|
45
|
+
private _frameCount;
|
|
46
|
+
private _centerOffset;
|
|
47
|
+
get centerOffset(): Vector3;
|
|
48
|
+
private _texturesInitialized;
|
|
49
|
+
private _debugFullScreen;
|
|
50
|
+
constructor();
|
|
51
|
+
/**
|
|
52
|
+
* Initialize renderer with total point count
|
|
53
|
+
* Pre-allocates all GPU resources with zero-initialized data
|
|
54
|
+
* @param totalCount Total number of points that will be streamed
|
|
55
|
+
* @param batchSize Points per draw call (default: 128)
|
|
56
|
+
*/
|
|
57
|
+
initCount(totalCount: number, batchSize?: number): void;
|
|
58
|
+
/**
|
|
59
|
+
* Set data for a single point at the given index
|
|
60
|
+
* Updates CPU buffers and marks for GPU update
|
|
61
|
+
* @param index Point index (0 to count-1)
|
|
62
|
+
* @param data Point data (position is required, color optional)
|
|
63
|
+
*/
|
|
64
|
+
setPointCloudData(index: number, data: PointCloudData): void;
|
|
65
|
+
/**
|
|
66
|
+
* Update center offset for precision (called when new points are added)
|
|
67
|
+
*/
|
|
68
|
+
private _updateCenterOffset;
|
|
69
|
+
/**
|
|
70
|
+
* Flush pending updates to GPU
|
|
71
|
+
* Updates GPU textures with all pending changes
|
|
72
|
+
* Uses partial updates when possible for better performance
|
|
73
|
+
*/
|
|
74
|
+
flushUpdates(): void;
|
|
75
|
+
/**
|
|
76
|
+
* Set auto-flush threshold
|
|
77
|
+
* @param threshold Number of pending updates before auto-flush (default: 100)
|
|
78
|
+
*/
|
|
79
|
+
setAutoFlushThreshold(threshold: number): void;
|
|
80
|
+
/**
|
|
81
|
+
* Get current streaming statistics
|
|
82
|
+
*/
|
|
83
|
+
getStreamingStats(): {
|
|
84
|
+
totalCount: number;
|
|
85
|
+
validCount: number;
|
|
86
|
+
pendingUpdates: number;
|
|
87
|
+
progress: number;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* Calculate texture size for given point count
|
|
91
|
+
* @param count Number of points
|
|
92
|
+
* @returns Texture dimensions (width, height)
|
|
93
|
+
*/
|
|
94
|
+
private evalTextureSize;
|
|
95
|
+
/**
|
|
96
|
+
* Update node before rendering
|
|
97
|
+
*/
|
|
98
|
+
nodeUpdate(view: View3D, passType: PassType, renderPassState: RendererPassState, clusterLightingBuffer?: ClusterLightingBuffer): void;
|
|
99
|
+
/**
|
|
100
|
+
* Render pass
|
|
101
|
+
*/
|
|
102
|
+
renderPass(view: View3D, passType: PassType, renderContext: RenderContext): void;
|
|
103
|
+
/**
|
|
104
|
+
* Set point size in pixels
|
|
105
|
+
* @param size Point size in pixels
|
|
106
|
+
*/
|
|
107
|
+
setPointSize(size: number): void;
|
|
108
|
+
/**
|
|
109
|
+
* Set point shape
|
|
110
|
+
* @param shape 'square' or 'circle'
|
|
111
|
+
*/
|
|
112
|
+
setPointShape(shape: 'square' | 'circle'): void;
|
|
113
|
+
/**
|
|
114
|
+
* Enable a fullscreen debug quad to validate the render pipeline.
|
|
115
|
+
*/
|
|
116
|
+
enableDebugFullScreen(enabled: boolean): void;
|
|
117
|
+
/**
|
|
118
|
+
* Set batch size for instanced rendering
|
|
119
|
+
* @param batchSize Number of points per draw call
|
|
120
|
+
*/
|
|
121
|
+
setBatchSize(batchSize: number): void;
|
|
122
|
+
/**
|
|
123
|
+
* Clean up resources
|
|
124
|
+
*/
|
|
125
|
+
destroy(force?: boolean): void;
|
|
126
|
+
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -189,6 +189,7 @@ export * from "./components/renderer/InstanceDrawComponent";
|
|
|
189
189
|
export * from "./components/renderer/MeshFilter";
|
|
190
190
|
export * from "./components/renderer/MeshRenderer";
|
|
191
191
|
export * from "./components/renderer/PointCloudRenderer";
|
|
192
|
+
export * from "./components/renderer/PointCloudStreamRenderer";
|
|
192
193
|
export * from "./components/renderer/Reflection";
|
|
193
194
|
export * from "./components/renderer/RenderNode";
|
|
194
195
|
export * from "./components/renderer/SkinnedMeshRenderer";
|
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
import { Texture } from "../gfx/graphics/webGpu/core/texture/Texture";
|
|
2
2
|
export declare class Float32ArrayTexture extends Texture {
|
|
3
|
+
private _dataBuffer;
|
|
3
4
|
create(width: number, height: number, data: Float32Array, filtering?: boolean): this;
|
|
4
5
|
fromBuffer(width: number, height: number, textureDataBuffer: GPUBuffer): this;
|
|
6
|
+
/**
|
|
7
|
+
* Clean up resources
|
|
8
|
+
*/
|
|
9
|
+
destroy(force?: boolean): void;
|
|
10
|
+
/**
|
|
11
|
+
* Update texture content
|
|
12
|
+
* @param width Texture width
|
|
13
|
+
* @param height Texture height
|
|
14
|
+
* @param data Float32Array data (RGBA format: width * height * 4)
|
|
15
|
+
* @param filtering Whether to use filtering (default: true)
|
|
16
|
+
* @param startRow Start row for partial update (optional)
|
|
17
|
+
* @param rowCount Number of rows to update for partial update (optional)
|
|
18
|
+
*/
|
|
19
|
+
updateTexture(width: number, height: number, data: Float32Array, filtering?: boolean, startRow?: number, rowCount?: number): void;
|
|
5
20
|
}
|