@babylonjs/core 9.13.0 → 9.15.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/Animations/animationGroup.d.ts +0 -1
- package/Animations/animationGroup.js +0 -1
- package/Animations/animationGroup.js.map +1 -1
- package/Animations/animationGroup.pure.js +2 -0
- package/Animations/animationGroup.pure.js.map +1 -1
- package/Animations/runtimeAnimation.js +11 -0
- package/Animations/runtimeAnimation.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSound.d.ts +2 -1
- package/AudioV2/abstractAudio/abstractSound.js +3 -2
- package/AudioV2/abstractAudio/abstractSound.js.map +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.d.ts +1 -1
- package/AudioV2/abstractAudio/abstractSoundInstance.js.map +1 -1
- package/AudioV2/abstractAudio/staticSound.d.ts +6 -0
- package/AudioV2/abstractAudio/staticSound.js +9 -1
- package/AudioV2/abstractAudio/staticSound.js.map +1 -1
- package/AudioV2/abstractAudio/streamingSound.d.ts +6 -0
- package/AudioV2/abstractAudio/streamingSound.js +9 -1
- package/AudioV2/abstractAudio/streamingSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +6 -3
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.d.ts +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +7 -4
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/Inputs/BaseCameraPointersInput.d.ts +2 -1
- package/Cameras/Inputs/BaseCameraPointersInput.js +3 -2
- package/Cameras/Inputs/BaseCameraPointersInput.js.map +1 -1
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.d.ts +3 -0
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js +37 -10
- package/Cameras/Inputs/arcRotateCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/flyCameraKeyboardInput.js +19 -9
- package/Cameras/Inputs/flyCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js +21 -18
- package/Cameras/Inputs/freeCameraKeyboardMoveInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraKeyboardInput.d.ts +2 -0
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js +31 -12
- package/Cameras/Inputs/geospatialCameraKeyboardInput.js.map +1 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.d.ts +11 -1
- package/Cameras/Inputs/geospatialCameraPointersInput.js +18 -2
- package/Cameras/Inputs/geospatialCameraPointersInput.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.d.ts +0 -2
- package/Cameras/VR/vrExperienceHelper.js +0 -2
- package/Cameras/VR/vrExperienceHelper.js.map +1 -1
- package/Cameras/VR/vrExperienceHelper.pure.js +5 -0
- package/Cameras/VR/vrExperienceHelper.pure.js.map +1 -1
- package/Cameras/arcRotateCamera.pure.js +9 -3
- package/Cameras/arcRotateCamera.pure.js.map +1 -1
- package/Cameras/targetCamera.pure.js +18 -18
- package/Cameras/targetCamera.pure.js.map +1 -1
- package/Collisions/gpuPicker.js +23 -13
- package/Collisions/gpuPicker.js.map +1 -1
- package/Engines/Native/nativeInterfaces.d.ts +3 -2
- package/Engines/Native/nativeInterfaces.js.map +1 -1
- package/Engines/Native/nativeRenderTargetWrapper.d.ts +3 -0
- package/Engines/Native/nativeRenderTargetWrapper.js +24 -1
- package/Engines/Native/nativeRenderTargetWrapper.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js +16 -3
- package/Engines/WebGPU/Extensions/engine.videoTexture.pure.js.map +1 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js +7 -1
- package/Engines/WebGPU/webgpuClearQuad.pure.js.map +1 -1
- package/Engines/abstractEngine.pure.d.ts +8 -1
- package/Engines/abstractEngine.pure.js +4 -3
- package/Engines/abstractEngine.pure.js.map +1 -1
- package/Engines/engine.d.ts +113 -0
- package/Engines/thinNativeEngine.pure.d.ts +2 -0
- package/Engines/thinNativeEngine.pure.js +115 -9
- package/Engines/thinNativeEngine.pure.js.map +1 -1
- package/FlowGraph/flowGraph.js +9 -0
- package/FlowGraph/flowGraph.js.map +1 -1
- package/FlowGraph/flowGraphDataConnection.pure.d.ts +14 -0
- package/FlowGraph/flowGraphDataConnection.pure.js +38 -1
- package/FlowGraph/flowGraphDataConnection.pure.js.map +1 -1
- package/FlowGraph/serialization.d.ts +11 -0
- package/FlowGraph/serialization.js +11 -1
- package/FlowGraph/serialization.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.d.ts +2 -2
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js +43 -51
- package/FrameGraph/Tasks/Rendering/iblShadows/iblShadowsAccumulationTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.d.ts +0 -1
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js +66 -35
- package/FrameGraph/Tasks/Rendering/iblShadowsRendererTask.pure.js.map +1 -1
- package/Helpers/environmentHelper.js +2 -2
- package/Helpers/environmentHelper.js.map +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.d.ts +1 -1
- package/Lights/Clustered/clusteredLightContainer.pure.js +15 -2
- package/Lights/Clustered/clusteredLightContainer.pure.js.map +1 -1
- package/Lights/areaLight.pure.js +5 -0
- package/Lights/areaLight.pure.js.map +1 -1
- package/Lights/light.d.ts +4 -2
- package/Lights/light.js +10 -4
- package/Lights/light.js.map +1 -1
- package/Lights/rectAreaLight.pure.d.ts +17 -0
- package/Lights/rectAreaLight.pure.js +67 -0
- package/Lights/rectAreaLight.pure.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.pure.js +4 -4
- package/Loading/Plugins/babylonFileLoader.pure.js.map +1 -1
- package/Materials/Background/backgroundMaterial.pure.js +3 -1
- package/Materials/Background/backgroundMaterial.pure.js.map +1 -1
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js +2 -2
- package/Materials/Node/Blocks/Dual/reflectionTextureBaseBlock.pure.js.map +1 -1
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js +2 -2
- package/Materials/Node/Blocks/PBR/refractionBlock.pure.js.map +1 -1
- package/Materials/Node/nodeMaterial.pure.js +3 -0
- package/Materials/Node/nodeMaterial.pure.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +3 -3
- package/Materials/PBR/openpbrMaterial.pure.js +3 -1
- package/Materials/PBR/openpbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMaterial.pure.js +3 -0
- package/Materials/PBR/pbrMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js +3 -0
- package/Materials/PBR/pbrMetallicRoughnessMaterial.pure.js.map +1 -1
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js +3 -0
- package/Materials/PBR/pbrSpecularGlossinessMaterial.pure.js.map +1 -1
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.d.ts +43 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js +64 -0
- package/Materials/Textures/HTML/htmlInCanvasPolyfill.js.map +1 -0
- package/Materials/Textures/HTML/htmlInteractionManager.d.ts +69 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js +130 -0
- package/Materials/Textures/HTML/htmlInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.d.ts +84 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js +246 -0
- package/Materials/Textures/HTML/htmlRaycastInteractionManager.js.map +1 -0
- package/Materials/Textures/HTML/htmlTexture.d.ts +148 -0
- package/Materials/Textures/HTML/htmlTexture.js +455 -0
- package/Materials/Textures/HTML/htmlTexture.js.map +1 -0
- package/Materials/Textures/HTML/index.d.ts +4 -0
- package/Materials/Textures/HTML/index.js +5 -0
- package/Materials/Textures/HTML/index.js.map +1 -0
- package/Materials/Textures/HTML/pure.d.ts +5 -0
- package/Materials/Textures/HTML/pure.js +6 -0
- package/Materials/Textures/HTML/pure.js.map +1 -0
- package/Materials/Textures/cubeTexture.d.ts +0 -1
- package/Materials/Textures/cubeTexture.js +0 -1
- package/Materials/Textures/cubeTexture.js.map +1 -1
- package/Materials/Textures/cubeTexture.pure.js +2 -0
- package/Materials/Textures/cubeTexture.pure.js.map +1 -1
- package/Materials/Textures/dynamicTexture.d.ts +0 -1
- package/Materials/Textures/dynamicTexture.js +0 -1
- package/Materials/Textures/dynamicTexture.js.map +1 -1
- package/Materials/Textures/dynamicTexture.pure.js +2 -0
- package/Materials/Textures/dynamicTexture.pure.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.d.ts +0 -2
- package/Materials/Textures/htmlElementTexture.js +0 -2
- package/Materials/Textures/htmlElementTexture.js.map +1 -1
- package/Materials/Textures/htmlElementTexture.pure.js +4 -0
- package/Materials/Textures/htmlElementTexture.pure.js.map +1 -1
- package/Materials/Textures/index.d.ts +1 -0
- package/Materials/Textures/index.js +1 -1
- package/Materials/Textures/index.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.d.ts +0 -1
- package/Materials/Textures/multiRenderTarget.js +0 -1
- package/Materials/Textures/multiRenderTarget.js.map +1 -1
- package/Materials/Textures/multiRenderTarget.pure.js +2 -0
- package/Materials/Textures/multiRenderTarget.pure.js.map +1 -1
- package/Materials/Textures/pure.d.ts +1 -0
- package/Materials/Textures/pure.js +1 -0
- package/Materials/Textures/pure.js.map +1 -1
- package/Materials/Textures/videoTexture.pure.d.ts +3 -0
- package/Materials/Textures/videoTexture.pure.js +30 -0
- package/Materials/Textures/videoTexture.pure.js.map +1 -1
- package/Materials/standardMaterial.pure.js +3 -1
- package/Materials/standardMaterial.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.d.ts +9 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js +12 -0
- package/Meshes/GaussianSplatting/gaussianSplattingMeshBase.pure.js.map +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.d.ts +1 -1
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js +20 -6
- package/Meshes/GaussianSplatting/gaussianSplattingSortWorker.js.map +1 -1
- package/Misc/decorators.functions.d.ts +7 -0
- package/Misc/decorators.functions.js +86 -35
- package/Misc/decorators.functions.js.map +1 -1
- package/Misc/snapshotRenderingHelper.d.ts +4 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Misc/symbolMetadataPolyfill.d.ts +11 -0
- package/Misc/symbolMetadataPolyfill.js +22 -0
- package/Misc/symbolMetadataPolyfill.js.map +1 -0
- package/Misc/tools.pure.js +1 -1
- package/Misc/tools.pure.js.map +1 -1
- package/Particles/gpuParticleSystem.d.ts +0 -1
- package/Particles/gpuParticleSystem.js +0 -1
- package/Particles/gpuParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.d.ts +0 -1
- package/Particles/thinParticleSystem.js +0 -1
- package/Particles/thinParticleSystem.js.map +1 -1
- package/Particles/thinParticleSystem.pure.js +2 -0
- package/Particles/thinParticleSystem.pure.js.map +1 -1
- package/Particles/webgl2ParticleSystem.pure.js +2 -0
- package/Particles/webgl2ParticleSystem.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/lensRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js +7 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.pure.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.d.ts +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js +0 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssaoRenderingPipeline.js.map +1 -1
- package/PostProcesses/postProcess.pure.js +5 -0
- package/PostProcesses/postProcess.pure.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.d.ts +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js +0 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.js.map +1 -1
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js +2 -0
- package/PostProcesses/vrMultiviewToSingleviewPostProcess.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.d.ts +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js +0 -2
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js +5 -0
- package/Rendering/IBLShadows/iblShadowsRenderPipeline.pure.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.d.ts +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +0 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.d.ts +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js +34 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.pure.js.map +1 -1
- package/Rendering/prePassRenderer.d.ts +0 -2
- package/Rendering/prePassRenderer.js +0 -2
- package/Rendering/prePassRenderer.js.map +1 -1
- package/Rendering/prePassRenderer.pure.js +2 -0
- package/Rendering/prePassRenderer.pure.js.map +1 -1
- package/Rendering/thinDepthPeelingRenderer.d.ts +0 -1
- package/Rendering/thinDepthPeelingRenderer.js +0 -1
- package/Rendering/thinDepthPeelingRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +35 -5
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/helperFunctions.js +2 -2
- package/ShadersWGSL/ShadersInclude/helperFunctions.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +39 -7
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js +4 -3
- package/ShadersWGSL/ShadersInclude/openpbrIblFunctions.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +1 -0
- package/index.js.map +1 -1
- package/package.json +3 -11
|
@@ -32,7 +32,7 @@ export declare const GaussianSplattingSortWorkerCommand: {
|
|
|
32
32
|
* - `partIndices` set compound-mesh per-splat rig node indices.
|
|
33
33
|
* - `intervals` set active source-splat ranges (flat [start0, count0, ...]); persisted across sorts.
|
|
34
34
|
* - `sort` sort the active splats for `{ worldMatrix, cameraForward, cameraPosition, depthMix,
|
|
35
|
-
* cameraId, sortRequestId }` and post back a `sorted` result.
|
|
35
|
+
* cameraId, sortRequestId, rightHanded }` and post back a `sorted` result.
|
|
36
36
|
*
|
|
37
37
|
* @param self - the worker global scope
|
|
38
38
|
*/
|
|
@@ -32,7 +32,7 @@ export const GaussianSplattingSortWorkerCommand = {
|
|
|
32
32
|
* - `partIndices` set compound-mesh per-splat rig node indices.
|
|
33
33
|
* - `intervals` set active source-splat ranges (flat [start0, count0, ...]); persisted across sorts.
|
|
34
34
|
* - `sort` sort the active splats for `{ worldMatrix, cameraForward, cameraPosition, depthMix,
|
|
35
|
-
* cameraId, sortRequestId }` and post back a `sorted` result.
|
|
35
|
+
* cameraId, sortRequestId, rightHanded }` and post back a `sorted` result.
|
|
36
36
|
*
|
|
37
37
|
* @param self - the worker global scope
|
|
38
38
|
*/
|
|
@@ -91,6 +91,13 @@ export const GaussianSplattingSortWorker = function (self) {
|
|
|
91
91
|
// true; set it false to fall back to the legacy comparison sort.
|
|
92
92
|
const useCountingSort = e.data.useCountingSort !== false;
|
|
93
93
|
const logSortPerformance = !!e.data.logSortPerformance;
|
|
94
|
+
// `cameraForward` is the view matrix's third row [m[2], m[6], m[10]], which points into the scene
|
|
95
|
+
// in a left-handed scene but back toward the viewer in a right-handed one. As a result the signed
|
|
96
|
+
// `depth = dot(cameraForward, worldPos - cameraPos)` increases with distance in left-handed scenes
|
|
97
|
+
// but decreases with distance in right-handed ones. The counting sort below relies on "larger depth
|
|
98
|
+
// = farther", so negate the depth in right-handed scenes to keep that invariant and preserve correct
|
|
99
|
+
// back-to-front ordering. (The legacy comparison sort handles either sign naturally and is untouched.)
|
|
100
|
+
const depthSign = e.data.rightHanded ? -1 : 1;
|
|
94
101
|
// Resolve the active interval set. The main thread always sends an `intervals` message,
|
|
95
102
|
// but fall back to "all source splats" if a sort somehow arrives before it.
|
|
96
103
|
const activeIntervals = intervals;
|
|
@@ -140,15 +147,22 @@ export const GaussianSplattingSortWorker = function (self) {
|
|
|
140
147
|
let c = 0;
|
|
141
148
|
let d = 0;
|
|
142
149
|
if (compound) {
|
|
143
|
-
depthCoeffs = partMatrices.map((m) =>
|
|
150
|
+
depthCoeffs = partMatrices.map((m) => {
|
|
151
|
+
const co = computeDepthCoeffs(m);
|
|
152
|
+
co[0] *= depthSign;
|
|
153
|
+
co[1] *= depthSign;
|
|
154
|
+
co[2] *= depthSign;
|
|
155
|
+
co[3] *= depthSign;
|
|
156
|
+
return co;
|
|
157
|
+
});
|
|
144
158
|
partLen = partIndices.length;
|
|
145
159
|
}
|
|
146
160
|
else {
|
|
147
161
|
const coeff = computeDepthCoeffs(globalWorldMatrix);
|
|
148
|
-
a = coeff[0];
|
|
149
|
-
b = coeff[1];
|
|
150
|
-
c = coeff[2];
|
|
151
|
-
d = coeff[3];
|
|
162
|
+
a = coeff[0] * depthSign;
|
|
163
|
+
b = coeff[1] * depthSign;
|
|
164
|
+
c = coeff[2] * depthSign;
|
|
165
|
+
d = coeff[3] * depthSign;
|
|
152
166
|
}
|
|
153
167
|
// Pass 1: gather the active source indices, compute each splat's view-space depth (signed
|
|
154
168
|
// distance from the camera along the forward axis), and track the depth range. The compound
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gaussianSplattingSortWorker.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingSortWorker.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D;;;GAGG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAC9C,wEAAwE;IACxE,SAAS,EAAE,WAAW;IACtB,kGAAkG;IAClG,gBAAgB,EAAE,iBAAiB;IACnC,+DAA+D;IAC/D,aAAa,EAAE,cAAc;IAC7B,wEAAwE;IACxE,YAAY,EAAE,aAAa;IAC3B,uFAAuF;IACvF,SAAS,EAAE,WAAW;IACtB,gEAAgE;IAChE,IAAI,EAAE,MAAM;IACZ,+CAA+C;IAC/C,MAAM,EAAE,QAAQ;CACV,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,IAAY;IAC7D,IAAI,SAAuB,CAAC;IAC5B,IAAI,QAAuB,CAAC;IAC5B,IAAI,WAAuB,CAAC;IAC5B,IAAI,YAA4B,CAAC;IACjC,iGAAiG;IACjG,8EAA8E;IAC9E,IAAI,SAAS,GAA0B,IAAI,CAAC;IAC5C,wFAAwF;IACxF,IAAI,iBAA8B,CAAC,CAAC,kDAAkD;IACtF,IAAI,UAAwB,CAAC,CAAC,yCAAyC;IACvE,IAAI,QAAqB,CAAC,CAAC,yDAAyD;IACpF,IAAI,UAAuB,CAAC,CAAC,iDAAiD;IAE9E,IAAI,CAAC,SAAS,GAAG,CAAC,CAAM,EAAE,EAAE;QACxB,yFAAyF;QACzF,2FAA2F;QAC3F,uDAAuD;QACvD,MAAM,OAAO,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,IAAI,IAAI,EAAE,CAAC;gBAC7B,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,uBAAuB,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,UAAU,gBAAgB,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/J,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAChH,CAAC;IACL,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"core/types\";\r\n\r\n/**\r\n * Message commands exchanged with the Gaussian Splatting depth-sort worker. Every message carries a\r\n * `command` field naming the intended work, instead of inferring it from which payload is present.\r\n */\r\nexport const GaussianSplattingSortWorkerCommand = {\r\n /** Main -> worker: set the source splat centers (stride 4: xyz + 1). */\r\n POSITIONS: \"positions\",\r\n /** Main -> worker: patch a contiguous sub-range of the existing source splat centers in place. */\r\n POSITIONS_UPDATE: \"positionsUpdate\",\r\n /** Main -> worker: set the compound-mesh rig node matrices. */\r\n PART_MATRICES: \"partMatrices\",\r\n /** Main -> worker: set the compound-mesh per-splat rig node indices. */\r\n PART_INDICES: \"partIndices\",\r\n /** Main -> worker: set the active source-splat ranges (flat [start0, count0, ...]). */\r\n INTERVALS: \"intervals\",\r\n /** Main -> worker: sort the active splats for a camera view. */\r\n SORT: \"sort\",\r\n /** Worker -> main: a completed sort result. */\r\n SORTED: \"sorted\",\r\n} as const;\r\n\r\n/**\r\n * Depth-sort web worker body for Gaussian Splatting meshes.\r\n *\r\n * The function is self-contained: it is serialized with `Function.prototype.toString()` and run\r\n * inside a `Blob`-backed `Worker`, so it must not reference anything from its enclosing module\r\n * (including {@link GaussianSplattingSortWorkerCommand} — the command literals are duplicated here).\r\n *\r\n * The intended work for each message is selected explicitly via its `command` field:\r\n * - `positions` set source splat centers (stride 4: xyz + 1).\r\n * - `partMatrices` set compound-mesh rig node matrices.\r\n * - `partIndices` set compound-mesh per-splat rig node indices.\r\n * - `intervals` set active source-splat ranges (flat [start0, count0, ...]); persisted across sorts.\r\n * - `sort` sort the active splats for `{ worldMatrix, cameraForward, cameraPosition, depthMix,\r\n * cameraId, sortRequestId }` and post back a `sorted` result.\r\n *\r\n * @param self - the worker global scope\r\n */\r\nexport const GaussianSplattingSortWorker = function (self: Worker) {\r\n let positions: Float32Array;\r\n let depthMix: BigInt64Array;\r\n let partIndices: Uint8Array;\r\n let partMatrices: Float32Array[];\r\n // Active source-splat intervals as flat [start0, count0, start1, count1, ...]. Persisted between\r\n // sort requests and refreshed by the main thread via the `intervals` message.\r\n let intervals: Nullable<Uint32Array> = null;\r\n // Reusable counting-sort scratch buffers (grown on demand, never per-sort allocations).\r\n let sortSourceIndices: Uint32Array; // active source splat index for each compact slot\r\n let sortDepths: Float32Array; // view-space depth for each compact slot\r\n let sortKeys: Uint32Array; // depth-derived integer bucket key for each compact slot\r\n let sortCounts: Uint32Array; // counting-sort histogram (one entry per bucket)\r\n\r\n self.onmessage = (e: any) => {\r\n // The intended work is selected explicitly via the message `command` field. These string\r\n // literals must match GaussianSplattingSortWorkerCommand above (this body is serialized in\r\n // isolation and cannot reference the shared constant).\r\n const command = e.data.command;\r\n if (command === \"positions\") {\r\n positions = e.data.positions;\r\n } else if (command === \"positionsUpdate\") {\r\n // Patch only the changed sub-range in place, avoiding a full re-copy/transfer of the entire\r\n // (potentially hundreds-of-MB) position buffer on every streamed LOD decode.\r\n if (positions && e.data.data) {\r\n positions.set(e.data.data, e.data.offset);\r\n }\r\n } else if (command === \"partMatrices\") {\r\n partMatrices = e.data.partMatrices;\r\n } else if (command === \"partIndices\") {\r\n partIndices = e.data.partIndices;\r\n } else if (command === \"intervals\") {\r\n intervals = e.data.intervals;\r\n } else if (command === \"sort\") {\r\n const cameraId = e.data.cameraId;\r\n const sortRequestId = e.data.sortRequestId;\r\n const rangeVersion = e.data.rangeVersion;\r\n const globalWorldMatrix = e.data.worldMatrix;\r\n const cameraForward = e.data.cameraForward;\r\n const cameraPosition = e.data.cameraPosition;\r\n\r\n depthMix = e.data.depthMix;\r\n\r\n if (!positions || !cameraForward) {\r\n // Sort request arrived before positions were initialized — return the buffer unchanged so the main thread can unlock _canPostToWorker.\r\n self.postMessage({ command: \"sorted\", depthMix, cameraId, sortRequestId, rangeVersion }, [depthMix.buffer]);\r\n return;\r\n }\r\n\r\n // Feature flags are forwarded by the main thread on each sort request (the worker body is\r\n // serialized in isolation and cannot read shared statics directly). useCountingSort defaults to\r\n // true; set it false to fall back to the legacy comparison sort.\r\n const useCountingSort = e.data.useCountingSort !== false;\r\n const logSortPerformance = !!e.data.logSortPerformance;\r\n\r\n // Resolve the active interval set. The main thread always sends an `intervals` message,\r\n // but fall back to \"all source splats\" if a sort somehow arrives before it.\r\n const activeIntervals = intervals;\r\n const totalSplats = positions.length / 4;\r\n let renderSplatCount = totalSplats;\r\n if (activeIntervals) {\r\n renderSplatCount = 0;\r\n for (let rangeIndex = 1; rangeIndex < activeIntervals.length; rangeIndex += 2) {\r\n renderSplatCount += activeIntervals[rangeIndex];\r\n }\r\n }\r\n const vertexCountPadded = Math.max((renderSplatCount + 15) & ~0xf, 16);\r\n\r\n // depth = dot(cameraForward, worldPos - cameraPos)\r\n const camDot = cameraForward[0] * cameraPosition[0] + cameraForward[1] * cameraPosition[1] + cameraForward[2] * cameraPosition[2];\r\n\r\n const computeDepthCoeffs = (m: Float32Array): number[] => {\r\n return [\r\n cameraForward[0] * m[0] + cameraForward[1] * m[1] + cameraForward[2] * m[2],\r\n cameraForward[0] * m[4] + cameraForward[1] * m[5] + cameraForward[2] * m[6],\r\n cameraForward[0] * m[8] + cameraForward[1] * m[9] + cameraForward[2] * m[10],\r\n cameraForward[0] * m[12] + cameraForward[1] * m[13] + cameraForward[2] * m[14] - camDot,\r\n ];\r\n };\r\n\r\n // Optional, flag-gated sort timing (a simple wall-clock delta logged to the worker console).\r\n const perf = (globalThis as { performance?: { now(): number } }).performance;\r\n const sortStart = logSortPerformance && perf ? perf.now() : 0;\r\n\r\n try {\r\n if (useCountingSort) {\r\n // ===== Fast O(n) counting (radix) sort =====\r\n // Output view: the even 32-bit words of the depthMix buffer hold the sorted source indices\r\n // (the main thread reads indexMix[2*j]); the odd words are left unused.\r\n const outIndices = new Uint32Array(depthMix.buffer);\r\n\r\n // Grow the reusable scratch buffers when the active count increases (kept across sorts).\r\n if (!sortSourceIndices || sortSourceIndices.length < renderSplatCount) {\r\n const capacity = Math.max(renderSplatCount, 16);\r\n sortSourceIndices = new Uint32Array(capacity);\r\n sortDepths = new Float32Array(capacity);\r\n sortKeys = new Uint32Array(capacity);\r\n }\r\n\r\n // Compound (rig) meshes give each splat its own world transform via its part: depth uses the\r\n // splat's part coefficients. Single meshes use the one global world matrix. Both produce\r\n // depths in the same camera-forward space, so all active splats sort together correctly.\r\n const compound = !!(partMatrices && partIndices);\r\n let depthCoeffs: number[][] = [];\r\n let partLen = 0;\r\n let a = 0;\r\n let b = 0;\r\n let c = 0;\r\n let d = 0;\r\n if (compound) {\r\n depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));\r\n partLen = partIndices.length;\r\n } else {\r\n const coeff = computeDepthCoeffs(globalWorldMatrix);\r\n a = coeff[0];\r\n b = coeff[1];\r\n c = coeff[2];\r\n d = coeff[3];\r\n }\r\n\r\n // Pass 1: gather the active source indices, compute each splat's view-space depth (signed\r\n // distance from the camera along the forward axis), and track the depth range. The compound\r\n // branch is hoisted out of the inner loop so the hot path stays straight-line.\r\n let writeIndex = 0;\r\n let minDepth = Infinity;\r\n let maxDepth = -Infinity;\r\n const rangeWords = activeIntervals ? activeIntervals.length : 2;\r\n for (let r = 0; r < rangeWords; r += 2) {\r\n const start = activeIntervals ? activeIntervals[r] : 0;\r\n const end = start + (activeIntervals ? activeIntervals[r + 1] : totalSplats);\r\n if (compound) {\r\n for (let sourceIndex = start; sourceIndex < end; sourceIndex++) {\r\n const o = 4 * sourceIndex;\r\n const coeff = depthCoeffs[partIndices[sourceIndex < partLen ? sourceIndex : partLen - 1]];\r\n const depth = coeff[0] * positions[o] + coeff[1] * positions[o + 1] + coeff[2] * positions[o + 2] + coeff[3];\r\n sortSourceIndices[writeIndex] = sourceIndex;\r\n sortDepths[writeIndex] = depth;\r\n writeIndex++;\r\n if (depth < minDepth) {\r\n minDepth = depth;\r\n }\r\n if (depth > maxDepth) {\r\n maxDepth = depth;\r\n }\r\n }\r\n } else {\r\n for (let sourceIndex = start; sourceIndex < end; sourceIndex++) {\r\n const o = 4 * sourceIndex;\r\n const depth = a * positions[o] + b * positions[o + 1] + c * positions[o + 2] + d;\r\n sortSourceIndices[writeIndex] = sourceIndex;\r\n sortDepths[writeIndex] = depth;\r\n writeIndex++;\r\n if (depth < minDepth) {\r\n minDepth = depth;\r\n }\r\n if (depth > maxDepth) {\r\n maxDepth = depth;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Counting (radix) sort by a depth-derived integer key — O(n) vs the legacy comparison sort.\r\n // Bucket bit depth follows PlayCanvas: round(log2(n/4)) clamped to [10, 20]. The farthest splat\r\n // gets key 0 so the ascending counting sort yields back-to-front order for alpha blending.\r\n const compareBits = Math.max(10, Math.min(20, Math.round(Math.log2(Math.max(1, renderSplatCount) / 4))));\r\n const bucketCount = 2 ** compareBits + 1;\r\n if (!sortCounts || sortCounts.length !== bucketCount) {\r\n sortCounts = new Uint32Array(bucketCount);\r\n } else {\r\n sortCounts.fill(0);\r\n }\r\n\r\n const range = maxDepth - minDepth;\r\n if (!(range > 1e-12)) {\r\n // All active splats share a depth (or none are active): identity order, single bucket.\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n sortKeys[k] = 0;\r\n }\r\n sortCounts[0] = renderSplatCount;\r\n } else {\r\n const scale = (bucketCount - 1) / range;\r\n const maxKey = bucketCount - 1;\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n // maxDepth -> 0 (rendered first), minDepth -> bucketCount-1 (rendered last). Clamp\r\n // against float rounding (a tiny `range` makes `scale` huge), which could otherwise\r\n // produce key >= bucketCount and corrupt the histogram with out-of-bounds writes.\r\n let key = ((maxDepth - sortDepths[k]) * scale) >>> 0;\r\n if (key > maxKey) {\r\n key = maxKey;\r\n }\r\n sortKeys[k] = key;\r\n sortCounts[key]++;\r\n }\r\n }\r\n\r\n // Prefix-sum the histogram into bucket end offsets, then scatter source indices into place.\r\n for (let i = 1; i < bucketCount; i++) {\r\n sortCounts[i] += sortCounts[i - 1];\r\n }\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n const dest = --sortCounts[sortKeys[k]];\r\n outIndices[2 * dest] = sortSourceIndices[k];\r\n }\r\n\r\n // Pad the remainder up to the 16-multiple with the reserved (invisible) splat index 0.\r\n for (let dest = renderSplatCount; dest < vertexCountPadded; dest++) {\r\n outIndices[2 * dest] = 0;\r\n }\r\n } else {\r\n // ===== Legacy comparison sort: pack (index, ~depthBits) into each 64-bit lane and sort it =====\r\n const indices = new Uint32Array(depthMix.buffer);\r\n const floatMix = new Float32Array(depthMix.buffer);\r\n\r\n // Build the compact list of source-splat indices to sort.\r\n if (activeIntervals) {\r\n let writeIndex = 0;\r\n for (let rangeIndex = 0; rangeIndex < activeIntervals.length; rangeIndex += 2) {\r\n const start = activeIntervals[rangeIndex];\r\n const count = activeIntervals[rangeIndex + 1];\r\n for (let sourceIndex = start; sourceIndex < start + count; sourceIndex++) {\r\n indices[2 * writeIndex++] = sourceIndex;\r\n }\r\n }\r\n // Pad up to a multiple of 16 with the reserved (invisible) splat index 0.\r\n for (; writeIndex < vertexCountPadded; writeIndex++) {\r\n indices[2 * writeIndex] = 0;\r\n }\r\n } else {\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n indices[2 * j] = j;\r\n }\r\n }\r\n\r\n if (partMatrices && partIndices) {\r\n // Precompute depth coefficients for each rig node.\r\n const depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));\r\n // NB: For performance reasons, we assume that part indices are valid.\r\n const length = partIndices.length;\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n const sourceIndex = indices[2 * j];\r\n // NB: We need this 'min' because the vertex array is padded, not partIndices.\r\n const partIndex = partIndices[Math.min(sourceIndex, length - 1)];\r\n const coeff = depthCoeffs[partIndex];\r\n floatMix[2 * j + 1] =\r\n coeff[0] * positions[4 * sourceIndex + 0] + coeff[1] * positions[4 * sourceIndex + 1] + coeff[2] * positions[4 * sourceIndex + 2] + coeff[3];\r\n // Invert the depth bits (bitwise not) so the ascending sort renders back to front.\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n } else {\r\n const [a, b, c, d] = computeDepthCoeffs(globalWorldMatrix);\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n const sourceIndex = indices[2 * j];\r\n floatMix[2 * j + 1] = a * positions[4 * sourceIndex + 0] + b * positions[4 * sourceIndex + 1] + c * positions[4 * sourceIndex + 2] + d;\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n }\r\n\r\n depthMix.sort();\r\n }\r\n } catch (sortError) {\r\n // Transient data inconsistency (e.g. partIndices/partMatrices mismatch during addPart/removePart rebuild).\r\n // Return the buffer unsorted so the main thread can unlock _canPostToWorker and retry next frame.\r\n // Logger is unavailable inside the worker — console is the only option.\r\n // eslint-disable-next-line no-console\r\n console.error(\"Gaussian splat sort worker encountered an error (will retry next frame):\", sortError);\r\n }\r\n\r\n if (logSortPerformance && perf) {\r\n // eslint-disable-next-line no-console\r\n console.log(`[GaussianSplatting] ${useCountingSort ? \"counting\" : \"legacy\"} sort: ${renderSplatCount} splats in ${(perf.now() - sortStart).toFixed(2)}ms`);\r\n }\r\n\r\n self.postMessage({ command: \"sorted\", depthMix, cameraId, sortRequestId, rangeVersion }, [depthMix.buffer]);\r\n }\r\n };\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"gaussianSplattingSortWorker.js","sourceRoot":"","sources":["../../../../../dev/core/src/Meshes/GaussianSplatting/gaussianSplattingSortWorker.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAI7D;;;GAGG;AACH,MAAM,CAAC,MAAM,kCAAkC,GAAG;IAC9C,wEAAwE;IACxE,SAAS,EAAE,WAAW;IACtB,kGAAkG;IAClG,gBAAgB,EAAE,iBAAiB;IACnC,+DAA+D;IAC/D,aAAa,EAAE,cAAc;IAC7B,wEAAwE;IACxE,YAAY,EAAE,aAAa;IAC3B,uFAAuF;IACvF,SAAS,EAAE,WAAW;IACtB,gEAAgE;IAChE,IAAI,EAAE,MAAM;IACZ,+CAA+C;IAC/C,MAAM,EAAE,QAAQ;CACV,CAAC;AAEX;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,UAAU,IAAY;IAC7D,IAAI,SAAuB,CAAC;IAC5B,IAAI,QAAuB,CAAC;IAC5B,IAAI,WAAuB,CAAC;IAC5B,IAAI,YAA4B,CAAC;IACjC,iGAAiG;IACjG,8EAA8E;IAC9E,IAAI,SAAS,GAA0B,IAAI,CAAC;IAC5C,wFAAwF;IACxF,IAAI,iBAA8B,CAAC,CAAC,kDAAkD;IACtF,IAAI,UAAwB,CAAC,CAAC,yCAAyC;IACvE,IAAI,QAAqB,CAAC,CAAC,yDAAyD;IACpF,IAAI,UAAuB,CAAC,CAAC,iDAAiD;IAE9E,IAAI,CAAC,SAAS,GAAG,CAAC,CAAM,EAAE,EAAE;QACxB,yFAAyF;QACzF,2FAA2F;QAC3F,uDAAuD;QACvD,MAAM,OAAO,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QAC/B,IAAI,OAAO,KAAK,WAAW,EAAE,CAAC;YAC1B,SAAS,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC;QACjC,CAAC;aAAM,IAAI,OAAO,K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AAG,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;wBAC7C,CAAC;oBACL,CAAC;oBAED,QAAQ,CAAC,IAAI,EAAE,CAAC;gBACpB,CAAC;YACL,CAAC;YAAC,OAAO,SAAS,EAAE,CAAC;gBACjB,2GAA2G;gBAC3G,kGAAkG;gBAClG,wEAAwE;gBACxE,sCAAsC;gBACtC,OAAO,CAAC,KAAK,CAAC,0EAA0E,EAAE,SAAS,CAAC,CAAC;YACzG,CAAC;YAED,IAAI,kBAAkB,IAAI,IAAI,EAAE,CAAC;gBAC7B,sCAAsC;gBACtC,OAAO,CAAC,GAAG,CAAC,uBAAuB,eAAe,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,UAAU,gBAAgB,cAAc,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;YAC/J,CAAC;YAED,IAAI,CAAC,WAAW,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;QAChH,CAAC;IACL,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["/** This file must only contain pure code and pure imports */\r\n\r\nimport { type Nullable } from \"core/types\";\r\n\r\n/**\r\n * Message commands exchanged with the Gaussian Splatting depth-sort worker. Every message carries a\r\n * `command` field naming the intended work, instead of inferring it from which payload is present.\r\n */\r\nexport const GaussianSplattingSortWorkerCommand = {\r\n /** Main -> worker: set the source splat centers (stride 4: xyz + 1). */\r\n POSITIONS: \"positions\",\r\n /** Main -> worker: patch a contiguous sub-range of the existing source splat centers in place. */\r\n POSITIONS_UPDATE: \"positionsUpdate\",\r\n /** Main -> worker: set the compound-mesh rig node matrices. */\r\n PART_MATRICES: \"partMatrices\",\r\n /** Main -> worker: set the compound-mesh per-splat rig node indices. */\r\n PART_INDICES: \"partIndices\",\r\n /** Main -> worker: set the active source-splat ranges (flat [start0, count0, ...]). */\r\n INTERVALS: \"intervals\",\r\n /** Main -> worker: sort the active splats for a camera view. */\r\n SORT: \"sort\",\r\n /** Worker -> main: a completed sort result. */\r\n SORTED: \"sorted\",\r\n} as const;\r\n\r\n/**\r\n * Depth-sort web worker body for Gaussian Splatting meshes.\r\n *\r\n * The function is self-contained: it is serialized with `Function.prototype.toString()` and run\r\n * inside a `Blob`-backed `Worker`, so it must not reference anything from its enclosing module\r\n * (including {@link GaussianSplattingSortWorkerCommand} — the command literals are duplicated here).\r\n *\r\n * The intended work for each message is selected explicitly via its `command` field:\r\n * - `positions` set source splat centers (stride 4: xyz + 1).\r\n * - `partMatrices` set compound-mesh rig node matrices.\r\n * - `partIndices` set compound-mesh per-splat rig node indices.\r\n * - `intervals` set active source-splat ranges (flat [start0, count0, ...]); persisted across sorts.\r\n * - `sort` sort the active splats for `{ worldMatrix, cameraForward, cameraPosition, depthMix,\r\n * cameraId, sortRequestId, rightHanded }` and post back a `sorted` result.\r\n *\r\n * @param self - the worker global scope\r\n */\r\nexport const GaussianSplattingSortWorker = function (self: Worker) {\r\n let positions: Float32Array;\r\n let depthMix: BigInt64Array;\r\n let partIndices: Uint8Array;\r\n let partMatrices: Float32Array[];\r\n // Active source-splat intervals as flat [start0, count0, start1, count1, ...]. Persisted between\r\n // sort requests and refreshed by the main thread via the `intervals` message.\r\n let intervals: Nullable<Uint32Array> = null;\r\n // Reusable counting-sort scratch buffers (grown on demand, never per-sort allocations).\r\n let sortSourceIndices: Uint32Array; // active source splat index for each compact slot\r\n let sortDepths: Float32Array; // view-space depth for each compact slot\r\n let sortKeys: Uint32Array; // depth-derived integer bucket key for each compact slot\r\n let sortCounts: Uint32Array; // counting-sort histogram (one entry per bucket)\r\n\r\n self.onmessage = (e: any) => {\r\n // The intended work is selected explicitly via the message `command` field. These string\r\n // literals must match GaussianSplattingSortWorkerCommand above (this body is serialized in\r\n // isolation and cannot reference the shared constant).\r\n const command = e.data.command;\r\n if (command === \"positions\") {\r\n positions = e.data.positions;\r\n } else if (command === \"positionsUpdate\") {\r\n // Patch only the changed sub-range in place, avoiding a full re-copy/transfer of the entire\r\n // (potentially hundreds-of-MB) position buffer on every streamed LOD decode.\r\n if (positions && e.data.data) {\r\n positions.set(e.data.data, e.data.offset);\r\n }\r\n } else if (command === \"partMatrices\") {\r\n partMatrices = e.data.partMatrices;\r\n } else if (command === \"partIndices\") {\r\n partIndices = e.data.partIndices;\r\n } else if (command === \"intervals\") {\r\n intervals = e.data.intervals;\r\n } else if (command === \"sort\") {\r\n const cameraId = e.data.cameraId;\r\n const sortRequestId = e.data.sortRequestId;\r\n const rangeVersion = e.data.rangeVersion;\r\n const globalWorldMatrix = e.data.worldMatrix;\r\n const cameraForward = e.data.cameraForward;\r\n const cameraPosition = e.data.cameraPosition;\r\n\r\n depthMix = e.data.depthMix;\r\n\r\n if (!positions || !cameraForward) {\r\n // Sort request arrived before positions were initialized — return the buffer unchanged so the main thread can unlock _canPostToWorker.\r\n self.postMessage({ command: \"sorted\", depthMix, cameraId, sortRequestId, rangeVersion }, [depthMix.buffer]);\r\n return;\r\n }\r\n\r\n // Feature flags are forwarded by the main thread on each sort request (the worker body is\r\n // serialized in isolation and cannot read shared statics directly). useCountingSort defaults to\r\n // true; set it false to fall back to the legacy comparison sort.\r\n const useCountingSort = e.data.useCountingSort !== false;\r\n const logSortPerformance = !!e.data.logSortPerformance;\r\n\r\n // `cameraForward` is the view matrix's third row [m[2], m[6], m[10]], which points into the scene\r\n // in a left-handed scene but back toward the viewer in a right-handed one. As a result the signed\r\n // `depth = dot(cameraForward, worldPos - cameraPos)` increases with distance in left-handed scenes\r\n // but decreases with distance in right-handed ones. The counting sort below relies on \"larger depth\r\n // = farther\", so negate the depth in right-handed scenes to keep that invariant and preserve correct\r\n // back-to-front ordering. (The legacy comparison sort handles either sign naturally and is untouched.)\r\n const depthSign = e.data.rightHanded ? -1 : 1;\r\n\r\n // Resolve the active interval set. The main thread always sends an `intervals` message,\r\n // but fall back to \"all source splats\" if a sort somehow arrives before it.\r\n const activeIntervals = intervals;\r\n const totalSplats = positions.length / 4;\r\n let renderSplatCount = totalSplats;\r\n if (activeIntervals) {\r\n renderSplatCount = 0;\r\n for (let rangeIndex = 1; rangeIndex < activeIntervals.length; rangeIndex += 2) {\r\n renderSplatCount += activeIntervals[rangeIndex];\r\n }\r\n }\r\n const vertexCountPadded = Math.max((renderSplatCount + 15) & ~0xf, 16);\r\n\r\n // depth = dot(cameraForward, worldPos - cameraPos)\r\n const camDot = cameraForward[0] * cameraPosition[0] + cameraForward[1] * cameraPosition[1] + cameraForward[2] * cameraPosition[2];\r\n\r\n const computeDepthCoeffs = (m: Float32Array): number[] => {\r\n return [\r\n cameraForward[0] * m[0] + cameraForward[1] * m[1] + cameraForward[2] * m[2],\r\n cameraForward[0] * m[4] + cameraForward[1] * m[5] + cameraForward[2] * m[6],\r\n cameraForward[0] * m[8] + cameraForward[1] * m[9] + cameraForward[2] * m[10],\r\n cameraForward[0] * m[12] + cameraForward[1] * m[13] + cameraForward[2] * m[14] - camDot,\r\n ];\r\n };\r\n\r\n // Optional, flag-gated sort timing (a simple wall-clock delta logged to the worker console).\r\n const perf = (globalThis as { performance?: { now(): number } }).performance;\r\n const sortStart = logSortPerformance && perf ? perf.now() : 0;\r\n\r\n try {\r\n if (useCountingSort) {\r\n // ===== Fast O(n) counting (radix) sort =====\r\n // Output view: the even 32-bit words of the depthMix buffer hold the sorted source indices\r\n // (the main thread reads indexMix[2*j]); the odd words are left unused.\r\n const outIndices = new Uint32Array(depthMix.buffer);\r\n\r\n // Grow the reusable scratch buffers when the active count increases (kept across sorts).\r\n if (!sortSourceIndices || sortSourceIndices.length < renderSplatCount) {\r\n const capacity = Math.max(renderSplatCount, 16);\r\n sortSourceIndices = new Uint32Array(capacity);\r\n sortDepths = new Float32Array(capacity);\r\n sortKeys = new Uint32Array(capacity);\r\n }\r\n\r\n // Compound (rig) meshes give each splat its own world transform via its part: depth uses the\r\n // splat's part coefficients. Single meshes use the one global world matrix. Both produce\r\n // depths in the same camera-forward space, so all active splats sort together correctly.\r\n const compound = !!(partMatrices && partIndices);\r\n let depthCoeffs: number[][] = [];\r\n let partLen = 0;\r\n let a = 0;\r\n let b = 0;\r\n let c = 0;\r\n let d = 0;\r\n if (compound) {\r\n depthCoeffs = partMatrices.map((m) => {\r\n const co = computeDepthCoeffs(m);\r\n co[0] *= depthSign;\r\n co[1] *= depthSign;\r\n co[2] *= depthSign;\r\n co[3] *= depthSign;\r\n return co;\r\n });\r\n partLen = partIndices.length;\r\n } else {\r\n const coeff = computeDepthCoeffs(globalWorldMatrix);\r\n a = coeff[0] * depthSign;\r\n b = coeff[1] * depthSign;\r\n c = coeff[2] * depthSign;\r\n d = coeff[3] * depthSign;\r\n }\r\n\r\n // Pass 1: gather the active source indices, compute each splat's view-space depth (signed\r\n // distance from the camera along the forward axis), and track the depth range. The compound\r\n // branch is hoisted out of the inner loop so the hot path stays straight-line.\r\n let writeIndex = 0;\r\n let minDepth = Infinity;\r\n let maxDepth = -Infinity;\r\n const rangeWords = activeIntervals ? activeIntervals.length : 2;\r\n for (let r = 0; r < rangeWords; r += 2) {\r\n const start = activeIntervals ? activeIntervals[r] : 0;\r\n const end = start + (activeIntervals ? activeIntervals[r + 1] : totalSplats);\r\n if (compound) {\r\n for (let sourceIndex = start; sourceIndex < end; sourceIndex++) {\r\n const o = 4 * sourceIndex;\r\n const coeff = depthCoeffs[partIndices[sourceIndex < partLen ? sourceIndex : partLen - 1]];\r\n const depth = coeff[0] * positions[o] + coeff[1] * positions[o + 1] + coeff[2] * positions[o + 2] + coeff[3];\r\n sortSourceIndices[writeIndex] = sourceIndex;\r\n sortDepths[writeIndex] = depth;\r\n writeIndex++;\r\n if (depth < minDepth) {\r\n minDepth = depth;\r\n }\r\n if (depth > maxDepth) {\r\n maxDepth = depth;\r\n }\r\n }\r\n } else {\r\n for (let sourceIndex = start; sourceIndex < end; sourceIndex++) {\r\n const o = 4 * sourceIndex;\r\n const depth = a * positions[o] + b * positions[o + 1] + c * positions[o + 2] + d;\r\n sortSourceIndices[writeIndex] = sourceIndex;\r\n sortDepths[writeIndex] = depth;\r\n writeIndex++;\r\n if (depth < minDepth) {\r\n minDepth = depth;\r\n }\r\n if (depth > maxDepth) {\r\n maxDepth = depth;\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Counting (radix) sort by a depth-derived integer key — O(n) vs the legacy comparison sort.\r\n // Bucket bit depth follows PlayCanvas: round(log2(n/4)) clamped to [10, 20]. The farthest splat\r\n // gets key 0 so the ascending counting sort yields back-to-front order for alpha blending.\r\n const compareBits = Math.max(10, Math.min(20, Math.round(Math.log2(Math.max(1, renderSplatCount) / 4))));\r\n const bucketCount = 2 ** compareBits + 1;\r\n if (!sortCounts || sortCounts.length !== bucketCount) {\r\n sortCounts = new Uint32Array(bucketCount);\r\n } else {\r\n sortCounts.fill(0);\r\n }\r\n\r\n const range = maxDepth - minDepth;\r\n if (!(range > 1e-12)) {\r\n // All active splats share a depth (or none are active): identity order, single bucket.\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n sortKeys[k] = 0;\r\n }\r\n sortCounts[0] = renderSplatCount;\r\n } else {\r\n const scale = (bucketCount - 1) / range;\r\n const maxKey = bucketCount - 1;\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n // maxDepth -> 0 (rendered first), minDepth -> bucketCount-1 (rendered last). Clamp\r\n // against float rounding (a tiny `range` makes `scale` huge), which could otherwise\r\n // produce key >= bucketCount and corrupt the histogram with out-of-bounds writes.\r\n let key = ((maxDepth - sortDepths[k]) * scale) >>> 0;\r\n if (key > maxKey) {\r\n key = maxKey;\r\n }\r\n sortKeys[k] = key;\r\n sortCounts[key]++;\r\n }\r\n }\r\n\r\n // Prefix-sum the histogram into bucket end offsets, then scatter source indices into place.\r\n for (let i = 1; i < bucketCount; i++) {\r\n sortCounts[i] += sortCounts[i - 1];\r\n }\r\n for (let k = 0; k < renderSplatCount; k++) {\r\n const dest = --sortCounts[sortKeys[k]];\r\n outIndices[2 * dest] = sortSourceIndices[k];\r\n }\r\n\r\n // Pad the remainder up to the 16-multiple with the reserved (invisible) splat index 0.\r\n for (let dest = renderSplatCount; dest < vertexCountPadded; dest++) {\r\n outIndices[2 * dest] = 0;\r\n }\r\n } else {\r\n // ===== Legacy comparison sort: pack (index, ~depthBits) into each 64-bit lane and sort it =====\r\n const indices = new Uint32Array(depthMix.buffer);\r\n const floatMix = new Float32Array(depthMix.buffer);\r\n\r\n // Build the compact list of source-splat indices to sort.\r\n if (activeIntervals) {\r\n let writeIndex = 0;\r\n for (let rangeIndex = 0; rangeIndex < activeIntervals.length; rangeIndex += 2) {\r\n const start = activeIntervals[rangeIndex];\r\n const count = activeIntervals[rangeIndex + 1];\r\n for (let sourceIndex = start; sourceIndex < start + count; sourceIndex++) {\r\n indices[2 * writeIndex++] = sourceIndex;\r\n }\r\n }\r\n // Pad up to a multiple of 16 with the reserved (invisible) splat index 0.\r\n for (; writeIndex < vertexCountPadded; writeIndex++) {\r\n indices[2 * writeIndex] = 0;\r\n }\r\n } else {\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n indices[2 * j] = j;\r\n }\r\n }\r\n\r\n if (partMatrices && partIndices) {\r\n // Precompute depth coefficients for each rig node.\r\n const depthCoeffs = partMatrices.map((m) => computeDepthCoeffs(m));\r\n // NB: For performance reasons, we assume that part indices are valid.\r\n const length = partIndices.length;\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n const sourceIndex = indices[2 * j];\r\n // NB: We need this 'min' because the vertex array is padded, not partIndices.\r\n const partIndex = partIndices[Math.min(sourceIndex, length - 1)];\r\n const coeff = depthCoeffs[partIndex];\r\n floatMix[2 * j + 1] =\r\n coeff[0] * positions[4 * sourceIndex + 0] + coeff[1] * positions[4 * sourceIndex + 1] + coeff[2] * positions[4 * sourceIndex + 2] + coeff[3];\r\n // Invert the depth bits (bitwise not) so the ascending sort renders back to front.\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n } else {\r\n const [a, b, c, d] = computeDepthCoeffs(globalWorldMatrix);\r\n for (let j = 0; j < vertexCountPadded; j++) {\r\n const sourceIndex = indices[2 * j];\r\n floatMix[2 * j + 1] = a * positions[4 * sourceIndex + 0] + b * positions[4 * sourceIndex + 1] + c * positions[4 * sourceIndex + 2] + d;\r\n indices[2 * j + 1] = ~indices[2 * j + 1];\r\n }\r\n }\r\n\r\n depthMix.sort();\r\n }\r\n } catch (sortError) {\r\n // Transient data inconsistency (e.g. partIndices/partMatrices mismatch during addPart/removePart rebuild).\r\n // Return the buffer unsorted so the main thread can unlock _canPostToWorker and retry next frame.\r\n // Logger is unavailable inside the worker — console is the only option.\r\n // eslint-disable-next-line no-console\r\n console.error(\"Gaussian splat sort worker encountered an error (will retry next frame):\", sortError);\r\n }\r\n\r\n if (logSortPerformance && perf) {\r\n // eslint-disable-next-line no-console\r\n console.log(`[GaussianSplatting] ${useCountingSort ? \"counting\" : \"legacy\"} sort: ${renderSplatCount} splats in ${(perf.now() - sortStart).toFixed(2)}ms`);\r\n }\r\n\r\n self.postMessage({ command: \"sorted\", depthMix, cameraId, sortRequestId, rangeVersion }, [depthMix.buffer]);\r\n }\r\n };\r\n};\r\n"]}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal helpers for reading and writing decorator metadata used by serialization.
|
|
3
|
+
*
|
|
4
|
+
* The serialization store is attached to each class constructor via `Symbol.metadata`. The polyfill
|
|
5
|
+
* required for `Symbol.metadata` lives in `symbolMetadataPolyfill.ts` and is applied at package
|
|
6
|
+
* entry points.
|
|
7
|
+
*/
|
|
1
8
|
/** @internal */
|
|
2
9
|
export declare function GetDirectStore(target: any): any;
|
|
3
10
|
/**
|
|
@@ -1,50 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Internal helpers for reading and writing decorator metadata used by serialization.
|
|
3
|
+
*
|
|
4
|
+
* The serialization store is attached to each class constructor via `Symbol.metadata`. The polyfill
|
|
5
|
+
* required for `Symbol.metadata` lives in `symbolMetadataPolyfill.ts` and is applied at package
|
|
6
|
+
* entry points.
|
|
7
|
+
*/
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
9
|
+
const __bjsSerializableKey = "__bjs_serializable__";
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
11
|
+
const _mergedStoreCache = new WeakMap();
|
|
12
|
+
// Universal `Object.hasOwn` equivalent. We intentionally avoid the native `Object.hasOwn` (ES2022)
|
|
13
|
+
// because TypeScript does not down-level runtime APIs and some Babylon Native engines (e.g. ChakraCore)
|
|
14
|
+
// do not provide it. `Object.prototype.hasOwnProperty` exists on every engine, and routing through it
|
|
15
|
+
// here also stays safe for the null-prototype metadata objects created below.
|
|
16
|
+
function HasOwn(target, key) {
|
|
17
|
+
return Object.prototype.hasOwnProperty.call(target, key);
|
|
18
|
+
}
|
|
19
|
+
function GetMetadataSymbol() {
|
|
20
|
+
let metadataSymbol = Symbol.metadata;
|
|
21
|
+
if (!metadataSymbol) {
|
|
22
|
+
// Defensive idempotent fallback for runtimes (or import orders) where the entry-point polyfill
|
|
23
|
+
// has not yet run. Matches symbolMetadataPolyfill.ts.
|
|
24
|
+
metadataSymbol = Symbol("Symbol.metadata");
|
|
25
|
+
Object.defineProperty(Symbol, "metadata", {
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true,
|
|
28
|
+
value: metadataSymbol,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return metadataSymbol;
|
|
32
|
+
}
|
|
33
|
+
// Returns the constructor for the provided decorator/serialization target.
|
|
34
|
+
// Experimental decorators pass a prototype; serialization passes an instance or a constructor.
|
|
35
|
+
function GetConstructor(target) {
|
|
36
|
+
return typeof target === "function" ? target : target?.constructor;
|
|
37
|
+
}
|
|
38
|
+
// Returns (creating if necessary) the metadata object owned by the given constructor.
|
|
39
|
+
// The metadata's prototype mirrors the class hierarchy so merged lookups can walk it.
|
|
40
|
+
function GetOwnMetadata(ctor) {
|
|
41
|
+
if (!ctor) {
|
|
42
|
+
return undefined;
|
|
43
|
+
}
|
|
44
|
+
if (!HasOwn(ctor, GetMetadataSymbol())) {
|
|
45
|
+
const parent = Object.getPrototypeOf(ctor);
|
|
46
|
+
const parentMetadata = parent ? parent[GetMetadataSymbol()] : null;
|
|
47
|
+
Object.defineProperty(ctor, GetMetadataSymbol(), {
|
|
48
|
+
value: Object.create(parentMetadata ?? null),
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
enumerable: false,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
return ctor[GetMetadataSymbol()];
|
|
55
|
+
}
|
|
3
56
|
/** @internal */
|
|
4
57
|
export function GetDirectStore(target) {
|
|
5
|
-
const
|
|
6
|
-
if (!
|
|
7
|
-
|
|
58
|
+
const metadata = GetOwnMetadata(GetConstructor(target));
|
|
59
|
+
if (!metadata) {
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
if (!HasOwn(metadata, __bjsSerializableKey)) {
|
|
63
|
+
metadata[__bjsSerializableKey] = {};
|
|
8
64
|
}
|
|
9
|
-
return
|
|
65
|
+
return metadata[__bjsSerializableKey];
|
|
10
66
|
}
|
|
11
67
|
/**
|
|
12
68
|
* @returns the list of properties flagged as serializable
|
|
13
69
|
* @param target host object
|
|
14
70
|
*/
|
|
15
71
|
export function GetMergedStore(target) {
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
72
|
+
const ctor = GetConstructor(target);
|
|
73
|
+
const metadata = ctor ? ctor[GetMetadataSymbol()] : undefined;
|
|
74
|
+
if (!metadata) {
|
|
75
|
+
return {};
|
|
76
|
+
}
|
|
77
|
+
const cached = _mergedStoreCache.get(metadata);
|
|
78
|
+
if (cached) {
|
|
79
|
+
return cached;
|
|
80
|
+
}
|
|
81
|
+
const store = {};
|
|
82
|
+
// Walk the metadata prototype chain (most derived first); parents overwrite children to match the
|
|
83
|
+
// original class-name-keyed merge order.
|
|
84
|
+
const chain = [];
|
|
85
|
+
let current = metadata;
|
|
86
|
+
while (current) {
|
|
87
|
+
chain.push(current);
|
|
88
|
+
current = Object.getPrototypeOf(current);
|
|
89
|
+
}
|
|
90
|
+
for (const meta of chain) {
|
|
91
|
+
if (HasOwn(meta, __bjsSerializableKey)) {
|
|
92
|
+
const initialStore = meta[__bjsSerializableKey];
|
|
93
|
+
for (const property in initialStore) {
|
|
94
|
+
store[property] = initialStore[property];
|
|
39
95
|
}
|
|
40
|
-
currentTarget = parent;
|
|
41
|
-
} while (parent);
|
|
42
|
-
if (done) {
|
|
43
|
-
break;
|
|
44
96
|
}
|
|
45
|
-
currentKey = parent.getClassName();
|
|
46
|
-
currentTarget = parent;
|
|
47
97
|
}
|
|
98
|
+
_mergedStoreCache.set(metadata, store);
|
|
48
99
|
return store;
|
|
49
100
|
}
|
|
50
101
|
//# sourceMappingURL=decorators.functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.functions.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"decorators.functions.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/decorators.functions.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,gEAAgE;AAChE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC;AAEpD,gEAAgE;AAChE,MAAM,iB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AC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpB,OAAO,GAAG,MAAM,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;IACD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACvB,IAAI,MAAM,CAAC,IAAI,EAAE,oBAAoB,CAAC,EAAE,CAAC;YACrC,MAAM,YAAY,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAChD,KAAK,MAAM,QAAQ,IAAI,YAAY,EAAE,CAAC;gBAClC,KAAK,CAAC,QAAQ,CAAC,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;YAC7C,CAAC;QACL,CAAC;IACL,CAAC;IAED,iBAAiB,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;IACvC,OAAO,KAAK,CAAC;AACjB,CAAC","sourcesContent":["/**\n * Internal helpers for reading and writing decorator metadata used by serialization.\n *\n * The serialization store is attached to each class constructor via `Symbol.metadata`. The polyfill\n * required for `Symbol.metadata` lives in `symbolMetadataPolyfill.ts` and is applied at package\n * entry points.\n */\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst __bjsSerializableKey = \"__bjs_serializable__\";\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\nconst _mergedStoreCache = new WeakMap<object, any>();\n\n// Universal `Object.hasOwn` equivalent. We intentionally avoid the native `Object.hasOwn` (ES2022)\n// because TypeScript does not down-level runtime APIs and some Babylon Native engines (e.g. ChakraCore)\n// do not provide it. `Object.prototype.hasOwnProperty` exists on every engine, and routing through it\n// here also stays safe for the null-prototype metadata objects created below.\nfunction HasOwn(target: object, key: PropertyKey): boolean {\n return Object.prototype.hasOwnProperty.call(target, key);\n}\n\nfunction GetMetadataSymbol(): symbol {\n let metadataSymbol = (Symbol as any).metadata as symbol | undefined;\n if (!metadataSymbol) {\n // Defensive idempotent fallback for runtimes (or import orders) where the entry-point polyfill\n // has not yet run. Matches symbolMetadataPolyfill.ts.\n metadataSymbol = Symbol(\"Symbol.metadata\");\n Object.defineProperty(Symbol, \"metadata\", {\n configurable: true,\n writable: true,\n value: metadataSymbol,\n });\n }\n return metadataSymbol;\n}\n\n// Returns the constructor for the provided decorator/serialization target.\n// Experimental decorators pass a prototype; serialization passes an instance or a constructor.\nfunction GetConstructor(target: any): any {\n return typeof target === \"function\" ? target : target?.constructor;\n}\n\n// Returns (creating if necessary) the metadata object owned by the given constructor.\n// The metadata's prototype mirrors the class hierarchy so merged lookups can walk it.\nfunction GetOwnMetadata(ctor: any): any {\n if (!ctor) {\n return undefined;\n }\n if (!HasOwn(ctor, GetMetadataSymbol())) {\n const parent = Object.getPrototypeOf(ctor);\n const parentMetadata = parent ? parent[GetMetadataSymbol()] : null;\n Object.defineProperty(ctor, GetMetadataSymbol(), {\n value: Object.create(parentMetadata ?? null),\n configurable: true,\n writable: true,\n enumerable: false,\n });\n }\n return ctor[GetMetadataSymbol()];\n}\n\n/** @internal */\nexport function GetDirectStore(target: any): any {\n const metadata = GetOwnMetadata(GetConstructor(target));\n if (!metadata) {\n return {};\n }\n if (!HasOwn(metadata, __bjsSerializableKey)) {\n metadata[__bjsSerializableKey] = {};\n }\n return metadata[__bjsSerializableKey];\n}\n\n/**\n * @returns the list of properties flagged as serializable\n * @param target host object\n */\nexport function GetMergedStore(target: any): any {\n const ctor = GetConstructor(target);\n const metadata = ctor ? ctor[GetMetadataSymbol()] : undefined;\n if (!metadata) {\n return {};\n }\n\n const cached = _mergedStoreCache.get(metadata);\n if (cached) {\n return cached;\n }\n\n const store: any = {};\n // Walk the metadata prototype chain (most derived first); parents overwrite children to match the\n // original class-name-keyed merge order.\n const chain: any[] = [];\n let current: any = metadata;\n while (current) {\n chain.push(current);\n current = Object.getPrototypeOf(current);\n }\n for (const meta of chain) {\n if (HasOwn(meta, __bjsSerializableKey)) {\n const initialStore = meta[__bjsSerializableKey];\n for (const property in initialStore) {\n store[property] = initialStore[property];\n }\n }\n }\n\n _mergedStoreCache.set(metadata, store);\n return store;\n}\n"]}
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import { type AbstractMesh
|
|
1
|
+
import { type AbstractMesh } from "../Meshes/abstractMesh.pure.js";
|
|
2
|
+
import { type EffectLayer } from "../Layers/effectLayer.js";
|
|
3
|
+
import { type Scene } from "../scene.pure.js";
|
|
4
|
+
import { type IParticleSystem } from "../Particles/IParticleSystem.js";
|
|
2
5
|
import { FrameGraphBaseLayerTask } from "../FrameGraph/Tasks/Layers/baseLayerTask.js";
|
|
3
6
|
/**
|
|
4
7
|
* Options for the snapshot rendering helper
|