@babylonjs/loaders 9.20.0 → 9.21.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/SPLAT/gaussianSplattingStream.d.ts +170 -1
- package/SPLAT/gaussianSplattingStream.js +516 -40
- package/SPLAT/gaussianSplattingStream.js.map +1 -1
- package/SPLAT/gaussianSplattingWorkBuffer.d.ts +163 -4
- package/SPLAT/gaussianSplattingWorkBuffer.js +683 -35
- package/SPLAT/gaussianSplattingWorkBuffer.js.map +1 -1
- package/SPLAT/gaussianSplattingWorkBufferShaders.d.ts +70 -2
- package/SPLAT/gaussianSplattingWorkBufferShaders.js +465 -4
- package/SPLAT/gaussianSplattingWorkBufferShaders.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.d.ts +16 -1
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js +232 -25
- package/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.d.ts +52 -2
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js +108 -7
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.d.ts +37 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js +69 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityHostResolver.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityReferences.d.ts +44 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityReferences.js +51 -0
- package/glTF/2.0/Extensions/KHR_interactivity/interactivityReferences.js.map +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.d.ts +1 -0
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js +143 -12
- package/glTF/2.0/Extensions/KHR_interactivity.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js +6 -0
- package/glTF/2.0/Extensions/KHR_node_hoverability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js +4 -0
- package/glTF/2.0/Extensions/KHR_node_selectability.pure.js.map +1 -1
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js +11 -0
- package/glTF/2.0/Extensions/KHR_node_visibility.pure.js.map +1 -1
- package/glTF/2.0/Extensions/babylonScenePathToObjectConverter.d.ts +126 -0
- package/glTF/2.0/Extensions/babylonScenePathToObjectConverter.js +251 -0
- package/glTF/2.0/Extensions/babylonScenePathToObjectConverter.js.map +1 -0
- package/glTF/2.0/Extensions/compositePathToObjectConverter.d.ts +51 -0
- package/glTF/2.0/Extensions/compositePathToObjectConverter.js +51 -0
- package/glTF/2.0/Extensions/compositePathToObjectConverter.js.map +1 -0
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js +69 -7
- package/glTF/2.0/Extensions/gltfPathToObjectConverter.js.map +1 -1
- package/glTF/2.0/Extensions/interactivityAssetPathToObjectConverter.d.ts +41 -0
- package/glTF/2.0/Extensions/interactivityAssetPathToObjectConverter.js +108 -0
- package/glTF/2.0/Extensions/interactivityAssetPathToObjectConverter.js.map +1 -0
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.d.ts +28 -0
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js +71 -0
- package/glTF/2.0/Extensions/interactivityRefPathToObjectConverter.js.map +1 -0
- package/glTF/2.0/Extensions/objectModelMapping.d.ts +118 -30
- package/glTF/2.0/Extensions/objectModelMapping.js +472 -70
- package/glTF/2.0/Extensions/objectModelMapping.js.map +1 -1
- package/glTF/2.0/glTFLoader.pure.js +2 -1
- package/glTF/2.0/glTFLoader.pure.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MultiRenderTarget } from "@babylonjs/core/Materials/Textures/multiRenderTarget.js";
|
|
1
2
|
import { type Texture } from "@babylonjs/core/Materials/Textures/texture.js";
|
|
2
3
|
import { type Scene } from "@babylonjs/core/scene.js";
|
|
3
4
|
import { type Nullable } from "@babylonjs/core/types.js";
|
|
@@ -6,7 +7,7 @@ import { type ISogTexturePack } from "./splatDefs.js";
|
|
|
6
7
|
* A unified, GPU-decoded Gaussian Splatting work buffer.
|
|
7
8
|
*
|
|
8
9
|
* Holds a square MRT texture set (centers / covA / covB / colors) sized to a fixed splat capacity
|
|
9
|
-
* (
|
|
10
|
+
* (`ceil(sqrt(capacity))`). Each streamed SOG file is decoded directly on the GPU
|
|
10
11
|
* (no CPU readback) into its allocated pixel range. The decoded textures are consumed unchanged by the
|
|
11
12
|
* standard (non-SOG) Gaussian Splatting draw path.
|
|
12
13
|
*
|
|
@@ -14,16 +15,30 @@ import { type ISogTexturePack } from "./splatDefs.js";
|
|
|
14
15
|
*/
|
|
15
16
|
export declare class GaussianSplattingWorkBuffer {
|
|
16
17
|
private readonly _scene;
|
|
17
|
-
private
|
|
18
|
+
private _mrt;
|
|
18
19
|
private readonly _textureSize;
|
|
19
20
|
private readonly _shaderLanguage;
|
|
20
21
|
private readonly _material;
|
|
21
22
|
private readonly _quad;
|
|
23
|
+
private readonly _ownsMrt;
|
|
24
|
+
private _baseOffset;
|
|
25
|
+
private readonly _capacity;
|
|
22
26
|
private _copyMaterial;
|
|
23
27
|
private _relayoutMapData;
|
|
24
28
|
private _relayoutMapTexture;
|
|
29
|
+
private _backupMrt;
|
|
25
30
|
private _disposed;
|
|
26
31
|
private _readFbo;
|
|
32
|
+
private _shMrts;
|
|
33
|
+
private _ownsShMrts;
|
|
34
|
+
private _shMaterial;
|
|
35
|
+
private _shCopyMaterial;
|
|
36
|
+
private _backupShMrts;
|
|
37
|
+
private _rotMrt;
|
|
38
|
+
private _ownsRotMrt;
|
|
39
|
+
private _rotMaterial;
|
|
40
|
+
private _rotCopyMaterial;
|
|
41
|
+
private _backupRotMrt;
|
|
27
42
|
/**
|
|
28
43
|
* True when the engine supports the non-blocking GPU readback used by {@link readCentersRangeAsync}:
|
|
29
44
|
* WebGL2 (PBO + fence) or WebGPU (copyTextureToBuffer + mapAsync). When false (e.g. WebGL1), callers must
|
|
@@ -38,12 +53,91 @@ export declare class GaussianSplattingWorkBuffer {
|
|
|
38
53
|
* The decoded work-buffer textures: [centers, covA, covB, colors].
|
|
39
54
|
*/
|
|
40
55
|
get textures(): Texture[];
|
|
56
|
+
/**
|
|
57
|
+
* The baked higher-order SH textures (packed-u32, one per `ceil(coeffs*3/16)`), consumed by the draw path's
|
|
58
|
+
* `computeSHWeighted`/`decompose` as `shTexture0..N`. Empty when SH decoding is not enabled.
|
|
59
|
+
*/
|
|
60
|
+
get shTextures(): Texture[];
|
|
61
|
+
/**
|
|
62
|
+
* The decoded rotation/scale textures ([rotationsA, rotationsB, rotationScale], half-float), consumed by the
|
|
63
|
+
* voxel-IBL path as `rotationsATexture`/`rotationsBTexture`/`rotationScaleTexture`. Empty when rotation decode
|
|
64
|
+
* is not enabled.
|
|
65
|
+
*/
|
|
66
|
+
get rotationTextures(): Texture[];
|
|
41
67
|
/**
|
|
42
68
|
* Creates a work buffer sized to hold `capacity` splats.
|
|
69
|
+
*
|
|
70
|
+
* Standalone (default): the work buffer creates and owns a square MRT sized `ceil(sqrt(capacity))`, with
|
|
71
|
+
* decodes addressed from splat 0.
|
|
72
|
+
*
|
|
73
|
+
* Hosted (`externalAtlas` provided): the work buffer decodes/reads back into an externally-owned MRT (a
|
|
74
|
+
* compound mesh's shared atlas) instead of creating its own. Decodes are placed at `externalAtlas.baseOffset`
|
|
75
|
+
* (the reserved region's first splat) and addressed over `externalAtlas.width` (the wide atlas width), so the
|
|
76
|
+
* streamed splats land in the compound's atlas and sort/draw together with the static parts.
|
|
43
77
|
* @param scene hosting scene
|
|
44
78
|
* @param capacity total number of splats the work buffer must address
|
|
79
|
+
* @param externalAtlas optional external atlas to decode into instead of creating an owned square MRT
|
|
80
|
+
* @param sh optional higher-order SH decode configuration. `textureCount = ceil(coeffs*3/16)` for the max SH
|
|
81
|
+
* degree across the streamed files. Standalone: the work buffer creates that many owned single-attachment
|
|
82
|
+
* integer render targets. Hosted: `externalMrts` are the compound's shared SH atlas targets (borrowed).
|
|
83
|
+
* @param rotationScale optional rotation/scale decode configuration (for voxel-IBL shadows). When present the
|
|
84
|
+
* work buffer decodes each splat's rotation matrix + scale into a 3-attachment half-float target. Standalone:
|
|
85
|
+
* the work buffer creates and owns that target. Hosted: `externalMrt` is the compound's shared rotation atlas.
|
|
86
|
+
*/
|
|
87
|
+
constructor(scene: Scene, capacity: number, externalAtlas?: {
|
|
88
|
+
mrt: MultiRenderTarget;
|
|
89
|
+
width: number;
|
|
90
|
+
baseOffset: number;
|
|
91
|
+
}, sh?: {
|
|
92
|
+
textureCount: number;
|
|
93
|
+
externalMrts?: MultiRenderTarget[];
|
|
94
|
+
}, rotationScale?: {
|
|
95
|
+
externalMrt?: MultiRenderTarget;
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Rebinds a hosted work buffer to a new atlas MRT (after the compound recreated it on a grow). No-op for a
|
|
99
|
+
* standalone work buffer, which owns its MRT.
|
|
100
|
+
* @param mrt the compound's new shared atlas
|
|
101
|
+
*/
|
|
102
|
+
rebindAtlas(mrt: MultiRenderTarget): void;
|
|
103
|
+
/**
|
|
104
|
+
* Rebinds a hosted work buffer to the compound's NEW shared SH atlas (after the compound recreated it on a
|
|
105
|
+
* grow/compaction). No-op when SH isn't in use or the work buffer owns its SH targets (standalone).
|
|
106
|
+
* @param shMrts the compound's new shared SH render targets (one per packed-u32 SH texture)
|
|
107
|
+
*/
|
|
108
|
+
rebindShAtlas(shMrts: Nullable<MultiRenderTarget[]>): void;
|
|
109
|
+
/**
|
|
110
|
+
* Rebinds a hosted work buffer to the compound's NEW shared rotation atlas (after the compound recreated it on a
|
|
111
|
+
* grow/compaction). No-op when rotation isn't in use or the work buffer owns its rotation target (standalone).
|
|
112
|
+
* @param rotMrt the compound's new shared rotation atlas
|
|
113
|
+
*/
|
|
114
|
+
rebindRotAtlas(rotMrt: Nullable<MultiRenderTarget>): void;
|
|
115
|
+
/**
|
|
116
|
+
* Relocates this hosted region to a new base splat offset in the shared atlas (used when the compound
|
|
117
|
+
* compacts its atlas and this region's rows move). Subsequent decode/render/readback and
|
|
118
|
+
* {@link restoreRegion} all address from the new base. Call between {@link backupRegion} (which read from
|
|
119
|
+
* the old base) and {@link restoreRegion} (which will write to the new base). No-op for a standalone
|
|
120
|
+
* work buffer, which owns its square MRT at base 0.
|
|
121
|
+
* @param baseOffset the region's new first splat index in the atlas
|
|
122
|
+
*/
|
|
123
|
+
setBaseOffset(baseOffset: number): void;
|
|
124
|
+
/**
|
|
125
|
+
* True once the backup/restore/relayout copy shaders are compiled, so {@link backupRegion} can preserve the
|
|
126
|
+
* region across an atlas rebuild. Callers that decode into a hosted region should await this before writing
|
|
127
|
+
* data, so a later grow/compaction can never race shader compilation and drop the region.
|
|
128
|
+
*/
|
|
129
|
+
get canBackup(): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Copies this hosted region's four decoded textures out of the shared atlas into an internal backup MRT so
|
|
132
|
+
* they survive the compound recreating the atlas on a grow. Call immediately before the atlas is recreated,
|
|
133
|
+
* then {@link rebindAtlas} + {@link restoreRegion} after.
|
|
45
134
|
*/
|
|
46
|
-
|
|
135
|
+
backupRegion(): void;
|
|
136
|
+
/**
|
|
137
|
+
* Restores the backed-up region into the (new) atlas, confined by a scissor to the region's rows so no other
|
|
138
|
+
* part is touched. Call {@link rebindAtlas} to the new atlas first. Frees the backup afterwards.
|
|
139
|
+
*/
|
|
140
|
+
restoreRegion(): void;
|
|
47
141
|
/**
|
|
48
142
|
* Creates a 4-attachment MRT (centers F32 / covA / covB / colors U8) sized to the work buffer. covA/covB
|
|
49
143
|
* use HALF_FLOAT when the engine can render to it, matching the precision the non-streamed
|
|
@@ -53,9 +147,33 @@ export declare class GaussianSplattingWorkBuffer {
|
|
|
53
147
|
* @param name MRT and attachment base name
|
|
54
148
|
* @param disableClear when true, clearing is suppressed so renders accumulate (the decode buffer); when
|
|
55
149
|
* false the MRT clears to zero on each render (the temporary relayout buffer, so gaps stay zeroed)
|
|
150
|
+
* @param width texture width (defaults to the work-buffer size; the region row width for a scoped relayout)
|
|
151
|
+
* @param height texture height (defaults to the work-buffer size; the region row count for a scoped relayout)
|
|
56
152
|
* @returns the created MRT
|
|
57
153
|
*/
|
|
58
154
|
private _createMrt;
|
|
155
|
+
/**
|
|
156
|
+
* Creates a single-attachment integer render target (RGBA_INTEGER / UNSIGNED_INTEGER) that holds one packed-u32
|
|
157
|
+
* baked-SH texture. One attachment per pass keeps within WebGPU's per-sample color-attachment byte budget and
|
|
158
|
+
* matches the format/type of the draw path's `shTexture0..N` samplers (`_GaussianSplattingBytesPerShTexel`).
|
|
159
|
+
* @param name attachment name
|
|
160
|
+
* @param disableClear when true, clearing is suppressed so SH decodes accumulate across files
|
|
161
|
+
* @param width texture width (defaults to the work-buffer size)
|
|
162
|
+
* @param height texture height (defaults to the work-buffer size)
|
|
163
|
+
* @returns the created single-attachment integer MRT
|
|
164
|
+
*/
|
|
165
|
+
private _createShMrt;
|
|
166
|
+
/**
|
|
167
|
+
* Creates a 3-attachment half-float MRT ([rotA, rotB, rotScale]) holding the per-splat rotation matrix + scale
|
|
168
|
+
* consumed by voxel-IBL shadowing. RGBA half-float when the engine can render to it (matching the covariance
|
|
169
|
+
* precision), else full float. 3 attachments = 24 B/sample, within WebGPU's per-sample budget (its own pass).
|
|
170
|
+
* @param name MRT and attachment base name
|
|
171
|
+
* @param disableClear when true, clearing is suppressed so decodes accumulate (the decode buffer)
|
|
172
|
+
* @param width texture width (defaults to the work-buffer size; the region row width for a scoped relayout)
|
|
173
|
+
* @param height texture height (defaults to the work-buffer size; the region row count for a scoped relayout)
|
|
174
|
+
* @returns the created MRT
|
|
175
|
+
*/
|
|
176
|
+
private _createRotMrt;
|
|
59
177
|
/**
|
|
60
178
|
* Decodes one SOG file into the work buffer at the given splat offset (accumulating; previously
|
|
61
179
|
* decoded files are preserved). Resolves once the GPU decode has been issued. The caller may
|
|
@@ -70,6 +188,11 @@ export declare class GaussianSplattingWorkBuffer {
|
|
|
70
188
|
* @returns true when {@link relayoutSync} can run this frame
|
|
71
189
|
*/
|
|
72
190
|
isRelayoutReady(): boolean;
|
|
191
|
+
/**
|
|
192
|
+
* Re-points the relayout/backup copy materials' samplers at the live atlas textures (valid, never freed), so a
|
|
193
|
+
* later {@link isRelayoutReady} check isn't tripped by a stale binding to a disposed temp/backup MRT.
|
|
194
|
+
*/
|
|
195
|
+
private _bindCopyMaterialsToAtlas;
|
|
73
196
|
/**
|
|
74
197
|
* Relayouts the decoded work-buffer textures to a new (defragmented) splat layout, keeping the same
|
|
75
198
|
* texture instances so the consuming mesh does not need to re-bind. `srcIndexByDst[d]` is the source splat
|
|
@@ -84,11 +207,43 @@ export declare class GaussianSplattingWorkBuffer {
|
|
|
84
207
|
* Renders one relayout copy pass into the target MRT, sampling the given source textures.
|
|
85
208
|
* @param target destination MRT
|
|
86
209
|
* @param sources the four source work-buffer textures
|
|
87
|
-
* @param mapTexture the R32F destination-to-source index map
|
|
210
|
+
* @param mapTexture the R32F destination-to-source index map (only sampled when `useMap` is 1; any bound texture otherwise)
|
|
88
211
|
* @param useMap 1 to read source indices from the map (gaps discarded), 0 for an identity copy
|
|
212
|
+
* @param dstWidth destination width used to linearize the destination texel (defaults to the work-buffer size)
|
|
213
|
+
* @param srcWidth source width used to convert a linear source index to a texel (defaults to the work-buffer size)
|
|
214
|
+
* @param srcBaseOffset added to each mapped source index so a region-local map reads the correct global atlas texel (hosted relayout)
|
|
215
|
+
* @param dstBaseRow subtracted from the destination row so an identity copy reads the region-local temp (hosted relayout)
|
|
89
216
|
*/
|
|
90
217
|
private _renderRelayoutPass;
|
|
91
218
|
private _createCopyMaterial;
|
|
219
|
+
/**
|
|
220
|
+
* Renders one INTEGER SH copy pass (one packed-u32 SH texture) into the target, sampling one integer source.
|
|
221
|
+
* Same index/map/base math as {@link _renderRelayoutPass} but for the integer SH format.
|
|
222
|
+
* @param target destination single-attachment integer MRT
|
|
223
|
+
* @param srcSh the integer SH source texture
|
|
224
|
+
* @param mapTexture the R32F destination-to-source index map (sampled only when `useMap` is 1)
|
|
225
|
+
* @param useMap 1 to read source indices from the map (gaps discarded), 0 for an identity copy
|
|
226
|
+
* @param dstWidth destination width used to linearize the destination texel
|
|
227
|
+
* @param srcWidth source width used to convert a linear source index to a texel
|
|
228
|
+
* @param srcBaseOffset added to each mapped source index (region-local map -> global atlas texel)
|
|
229
|
+
* @param dstBaseRow subtracted from the destination row for an identity copy of a region-local temp
|
|
230
|
+
*/
|
|
231
|
+
private _renderShCopyPass;
|
|
232
|
+
private _createShCopyMaterial;
|
|
233
|
+
/**
|
|
234
|
+
* Renders one rotation/scale copy pass (the three half-float rotation textures) into the target. Same
|
|
235
|
+
* index/map/base math as {@link _renderRelayoutPass} but with three attachments.
|
|
236
|
+
* @param target destination 3-attachment MRT
|
|
237
|
+
* @param sources the three source rotation textures ([rotA, rotB, rotScale])
|
|
238
|
+
* @param mapTexture the R32F destination-to-source index map (sampled only when `useMap` is 1)
|
|
239
|
+
* @param useMap 1 to read source indices from the map (gaps discarded), 0 for an identity copy
|
|
240
|
+
* @param dstWidth destination width used to linearize the destination texel
|
|
241
|
+
* @param srcWidth source width used to convert a linear source index to a texel
|
|
242
|
+
* @param srcBaseOffset added to each mapped source index (region-local map -> global atlas texel)
|
|
243
|
+
* @param dstBaseRow subtracted from the destination row for an identity copy of a region-local temp
|
|
244
|
+
*/
|
|
245
|
+
private _renderRotCopyPass;
|
|
246
|
+
private _createRotCopyMaterial;
|
|
92
247
|
/**
|
|
93
248
|
* Asynchronously reads back the decoded splat centers (stride-4 xyzw, w=1) for a contiguous splat range
|
|
94
249
|
* from the work buffer's centers texture, using a non-blocking GPU readback (WebGL2 PBO + fence, or WebGPU
|
|
@@ -108,4 +263,8 @@ export declare class GaussianSplattingWorkBuffer {
|
|
|
108
263
|
private _createQuad;
|
|
109
264
|
private _createMaterial;
|
|
110
265
|
private _applyPack;
|
|
266
|
+
private _createShMaterial;
|
|
267
|
+
private _applyShPack;
|
|
268
|
+
private _createRotMaterial;
|
|
269
|
+
private _applyRotPack;
|
|
111
270
|
}
|