@babylonjs/core 9.12.1 → 9.13.0
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/Collisions/gpuPicker.d.ts +111 -4
- package/Collisions/gpuPicker.js +673 -106
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +1 -0
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/abstractEngine.pure.js +2 -2
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/nullEngine.pure.js +5 -1
- package/Engines/nullEngine.pure.js.map +1 -1
- package/Engines/thinNativeEngine.pure.d.ts +3 -0
- package/Engines/thinNativeEngine.pure.js +43 -4
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/Loading/sceneLoader.d.ts +5 -1
- package/Loading/sceneLoader.js +298 -401
- package/Loading/sceneLoader.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.d.ts +15 -0
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js +34 -1
- package/Materials/GaussianSplatting/gaussianSplattingGpuPickingMaterialPlugin.pure.js.map +1 -1
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.d.ts +9 -0
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js +26 -2
- package/Materials/GaussianSplatting/gaussianSplattingMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js +3 -1
- package/Materials/Node/Blocks/GaussianSplatting/gaussianSplattingBlock.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +27 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +44 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +2 -0
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +195 -47
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Shaders/ShadersInclude/gaussianSplatting.js +1 -0
- package/Shaders/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/Shaders/gaussianSplatting.fragment.js +17 -1
- package/Shaders/gaussianSplatting.fragment.js.map +1 -1
- package/Shaders/gaussianSplatting.vertex.js +1 -1
- package/Shaders/gaussianSplatting.vertex.js.map +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js +1 -1
- package/Shaders/gaussianSplattingDepth.vertex.js.map +1 -1
- package/Shaders/picking.fragment.js +39 -3
- package/Shaders/picking.fragment.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js +3 -1
- package/ShadersWGSL/ShadersInclude/gaussianSplatting.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js +14 -1
- package/ShadersWGSL/gaussianSplatting.fragment.js.map +1 -1
- package/ShadersWGSL/gaussianSplatting.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplatting.vertex.js.map +1 -1
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js +2 -2
- package/ShadersWGSL/gaussianSplattingDepth.vertex.js.map +1 -1
- package/ShadersWGSL/picking.fragment.js +22 -1
- package/ShadersWGSL/picking.fragment.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ShaderLanguage } from "../Materials/shaderLanguage.js";
|
|
2
2
|
import { ShaderMaterial } from "../Materials/shaderMaterial.pure.js";
|
|
3
3
|
import { type IVector2Like } from "../Maths/math.like.js";
|
|
4
|
+
import { Vector3 } from "../Maths/math.vector.pure.js";
|
|
4
5
|
import { type AbstractMesh } from "../Meshes/abstractMesh.js";
|
|
5
6
|
import { type Nullable } from "../types.js";
|
|
6
7
|
/**
|
|
@@ -15,9 +16,23 @@ export interface IGPUPickingInfo {
|
|
|
15
16
|
* Picked thin instance index
|
|
16
17
|
*/
|
|
17
18
|
thinInstanceIndex?: number;
|
|
19
|
+
/**
|
|
20
|
+
* Picked point in world space.
|
|
21
|
+
*
|
|
22
|
+
* Only available when enableDepthPicking is true and a valid depth value can be read.
|
|
23
|
+
* Custom picking materials or special material plugins that do not write the depth attachment may return undefined.
|
|
24
|
+
*/
|
|
25
|
+
pickedPoint?: Vector3;
|
|
26
|
+
/**
|
|
27
|
+
* Reconstructed normal in world space.
|
|
28
|
+
*
|
|
29
|
+
* Only available when enableDepthPicking is true and enough valid depth neighbors can be read.
|
|
30
|
+
* Custom picking materials or special material plugins that do not write the depth attachment may return undefined.
|
|
31
|
+
*/
|
|
32
|
+
normal?: Vector3;
|
|
18
33
|
}
|
|
19
34
|
/**
|
|
20
|
-
* Stores the result of a multi GPU
|
|
35
|
+
* Stores the result of a multi GPU picking operation
|
|
21
36
|
*/
|
|
22
37
|
export interface IGPUMultiPickingInfo {
|
|
23
38
|
/**
|
|
@@ -28,14 +43,74 @@ export interface IGPUMultiPickingInfo {
|
|
|
28
43
|
* Picked thin instance index
|
|
29
44
|
*/
|
|
30
45
|
thinInstanceIndexes?: number[];
|
|
46
|
+
/**
|
|
47
|
+
* Picked points in world space.
|
|
48
|
+
*
|
|
49
|
+
* Only available when enableDepthPicking is true and a valid depth value can be read.
|
|
50
|
+
* Custom picking materials or special material plugins that do not write the depth attachment may return null.
|
|
51
|
+
*/
|
|
52
|
+
pickedPoints?: Nullable<Vector3>[];
|
|
53
|
+
/**
|
|
54
|
+
* Reconstructed normals in world space.
|
|
55
|
+
*
|
|
56
|
+
* Only available when enableDepthPicking is true and enough valid depth neighbors can be read.
|
|
57
|
+
* Custom picking materials or special material plugins that do not write the depth attachment may return null.
|
|
58
|
+
*/
|
|
59
|
+
normals?: Nullable<Vector3>[];
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Defines how multi pick texture readbacks should be performed.
|
|
63
|
+
*/
|
|
64
|
+
export declare enum GPUMultiPickReadbackStrategy {
|
|
65
|
+
/**
|
|
66
|
+
* Chooses between a single rectangle readback and small per-point readbacks using the thresholds in IGPUMultiPickOptions.
|
|
67
|
+
*/
|
|
68
|
+
Auto = 0,
|
|
69
|
+
/**
|
|
70
|
+
* Always reads the full bounding rectangle of the picked points. This minimizes readback calls and is best for dense point sets.
|
|
71
|
+
*/
|
|
72
|
+
Rectangle = 1,
|
|
73
|
+
/**
|
|
74
|
+
* Always reads each picked point independently. This minimizes transferred pixels for sparse point sets but can be slower when many points are picked.
|
|
75
|
+
*/
|
|
76
|
+
Individual = 2
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Options used to tune multi GPU picking.
|
|
80
|
+
*/
|
|
81
|
+
export interface IGPUMultiPickOptions {
|
|
82
|
+
/**
|
|
83
|
+
* Defines how multi pick texture readbacks should be performed.
|
|
84
|
+
*
|
|
85
|
+
* Defaults to GPUMultiPickReadbackStrategy.Auto.
|
|
86
|
+
*/
|
|
87
|
+
readbackStrategy?: GPUMultiPickReadbackStrategy;
|
|
88
|
+
/**
|
|
89
|
+
* Maximum number of in-bounds points allowed for the automatic individual readback path.
|
|
90
|
+
* This value is ignored when readbackStrategy is set to GPUMultiPickReadbackStrategy.Rectangle or GPUMultiPickReadbackStrategy.Individual.
|
|
91
|
+
*
|
|
92
|
+
* Defaults to 32.
|
|
93
|
+
*/
|
|
94
|
+
maxIndividualReadbackCount?: number;
|
|
95
|
+
/**
|
|
96
|
+
* Minimum rectangle-area / individual-area ratio required before the automatic path uses individual readbacks.
|
|
97
|
+
* This value is ignored when readbackStrategy is set to GPUMultiPickReadbackStrategy.Rectangle or GPUMultiPickReadbackStrategy.Individual.
|
|
98
|
+
*
|
|
99
|
+
* Defaults to 16.
|
|
100
|
+
*/
|
|
101
|
+
individualReadbackAreaRatio?: number;
|
|
31
102
|
}
|
|
32
103
|
/**
|
|
33
104
|
* Class used to perform a picking operation using GPU
|
|
34
|
-
*
|
|
105
|
+
* GPUPicker can pick meshes, instances and thin instances
|
|
35
106
|
*/
|
|
36
107
|
export declare class GPUPicker {
|
|
37
108
|
private static readonly _AttributeName;
|
|
38
109
|
private static readonly _MaxPickingId;
|
|
110
|
+
private static readonly _DepthPixelRadius;
|
|
111
|
+
private static readonly _MaxMultiPickIndividualReadbackCount;
|
|
112
|
+
private static readonly _MultiPickIndividualReadbackAreaRatio;
|
|
113
|
+
private static readonly _DepthNeighborOffsets;
|
|
39
114
|
private _pickingTexture;
|
|
40
115
|
private readonly _idMap;
|
|
41
116
|
private readonly _thinIdMap;
|
|
@@ -47,10 +122,16 @@ export declare class GPUPicker {
|
|
|
47
122
|
private _pickableMeshes;
|
|
48
123
|
private readonly _meshMaterialMap;
|
|
49
124
|
private _readbuffer;
|
|
125
|
+
private _depthReadbuffer;
|
|
126
|
+
private _depthTextureType;
|
|
127
|
+
private _isDepthTexturePacked;
|
|
128
|
+
private _useDepthPicking;
|
|
129
|
+
private _isUsingDepthPickingRenderTarget;
|
|
50
130
|
private _meshRenderingCount;
|
|
51
131
|
private _renderWarningIssued;
|
|
52
132
|
private _renderPickingTexture;
|
|
53
133
|
private _sceneBeforeRenderObserver;
|
|
134
|
+
private _pickingTextureClearObserver;
|
|
54
135
|
private _pickingTextureAfterRenderObserver;
|
|
55
136
|
private _nextFreeId;
|
|
56
137
|
private readonly _gsPickingMaterials;
|
|
@@ -72,7 +153,22 @@ export declare class GPUPicker {
|
|
|
72
153
|
* index is Material filling mode
|
|
73
154
|
*/
|
|
74
155
|
get defaultRenderMaterials(): readonly Nullable<ShaderMaterial>[];
|
|
156
|
+
/**
|
|
157
|
+
* Gets or sets a boolean indicating if depth-based pickedPoint and normal reconstruction should be enabled.
|
|
158
|
+
*
|
|
159
|
+
* When disabled, GPUPicker uses the original single-color render target and shader path. When enabled, GPUPicker
|
|
160
|
+
* switches to a MultiRenderTarget and compiles the default picking shader with GPUPICKER_DEPTH to output both the
|
|
161
|
+
* picking id and the depth required to reconstruct the picked point and normal.
|
|
162
|
+
*
|
|
163
|
+
* Custom picking materials and special picking material plugins should also write the depth attachment. If they do
|
|
164
|
+
* not, GPUPicker will still try to reconstruct pickedPoint and normal from the depth target, but the returned values
|
|
165
|
+
* may be missing or incorrect.
|
|
166
|
+
*/
|
|
167
|
+
get enableDepthPicking(): boolean;
|
|
168
|
+
set enableDepthPicking(value: boolean);
|
|
75
169
|
private _getColorIdFromReadBuffer;
|
|
170
|
+
private _getReadBufferOffset;
|
|
171
|
+
private _createColorPickingRenderTarget;
|
|
76
172
|
private _createRenderTarget;
|
|
77
173
|
private _clearPickingMaterials;
|
|
78
174
|
private _getPickingMaterial;
|
|
@@ -111,9 +207,10 @@ export declare class GPUPicker {
|
|
|
111
207
|
* Execute a picking operation on multiple coordinates
|
|
112
208
|
* @param xy defines the X,Y coordinates where to run the pick
|
|
113
209
|
* @param disposeWhenDone defines a boolean indicating we do not want to keep resources alive (false by default)
|
|
210
|
+
* @param options defines options used to tune the multi pick readback strategy
|
|
114
211
|
* @returns A promise with the picking results. Always returns an array with the same length as the number of coordinates. The mesh or null at the index where no mesh was picked.
|
|
115
212
|
*/
|
|
116
|
-
multiPickAsync(xy: IVector2Like[], disposeWhenDone?: boolean): Promise<Nullable<IGPUMultiPickingInfo>>;
|
|
213
|
+
multiPickAsync(xy: IVector2Like[], disposeWhenDone?: boolean, options?: IGPUMultiPickOptions): Promise<Nullable<IGPUMultiPickingInfo>>;
|
|
117
214
|
/**
|
|
118
215
|
* Execute a picking operation on box defined by two screen coordinates
|
|
119
216
|
* @param x1 defines the X coordinate of the first corner of the box where to run the pick
|
|
@@ -121,12 +218,16 @@ export declare class GPUPicker {
|
|
|
121
218
|
* @param x2 defines the X coordinate of the opposite corner of the box where to run the pick
|
|
122
219
|
* @param y2 defines the Y coordinate of the opposite corner of the box where to run the pick
|
|
123
220
|
* @param disposeWhenDone defines a boolean indicating we do not want to keep resources alive (false by default)
|
|
124
|
-
* @returns A promise with the picking results.
|
|
221
|
+
* @returns A promise with the picking results. Contains one entry for each picked pixel in the box.
|
|
125
222
|
*/
|
|
126
223
|
boxPickAsync(x1: number, y1: number, x2: number, y2: number, disposeWhenDone?: boolean): Promise<Nullable<IGPUMultiPickingInfo>>;
|
|
127
224
|
private _getRenderInfo;
|
|
128
225
|
private _prepareForPicking;
|
|
226
|
+
private _getPickingRenderRegion;
|
|
227
|
+
private _shouldUseIndividualMultiPickReadback;
|
|
129
228
|
private _preparePickingBuffer;
|
|
229
|
+
private _addPickingTextureToRenderTargets;
|
|
230
|
+
private _removePickingTextureFromRenderTargets;
|
|
130
231
|
private _executePickingAsync;
|
|
131
232
|
private _executeMultiPickingAsync;
|
|
132
233
|
private _executeBoxPickingAsync;
|
|
@@ -149,6 +250,7 @@ export declare class GPUPicker {
|
|
|
149
250
|
*/
|
|
150
251
|
private _waitForPickingMaterialsReadyAsync;
|
|
151
252
|
private _getMeshFromMultiplePoints;
|
|
253
|
+
private _getMeshFromReadBuffer;
|
|
152
254
|
/**
|
|
153
255
|
* Updates the render list with the current pickable meshes.
|
|
154
256
|
*/
|
|
@@ -163,6 +265,11 @@ export declare class GPUPicker {
|
|
|
163
265
|
*/
|
|
164
266
|
private _createGaussianSplattingPickingMaterial;
|
|
165
267
|
private _readTexturePixelsAsync;
|
|
268
|
+
private _readDepthTexturePixelsAsync;
|
|
269
|
+
private _getDepthPickingInfoAsync;
|
|
270
|
+
private _getDepthPickingInfoFromBuffer;
|
|
271
|
+
private _getDepthPointFromBufferToRef;
|
|
272
|
+
private _getDepthFromBuffer;
|
|
166
273
|
/** Release the resources */
|
|
167
274
|
dispose(): void;
|
|
168
275
|
}
|