@onerjs/core 8.32.8 → 8.32.9

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.
@@ -42,6 +42,16 @@ export class SnapshotRenderingHelper {
42
42
  this.disableSnapshotRendering();
43
43
  this.enableSnapshotRendering();
44
44
  }
45
+ else if (this._isEnabling) {
46
+ // We are in the process of enabling snapshot rendering, but the engine got resized before we could actually enable it:
47
+ // * cancel all "enable" pending callbacks
48
+ // * increase the ref count to balance the decrease that enableSnapshotRendering() will do
49
+ // * call enableSnapshotRendering() again to restart the enabling process
50
+ this._enableCancelFunctions.forEach((cancel) => cancel());
51
+ this._enableCancelFunctions.clear();
52
+ this._disableRenderingRefCount++;
53
+ this.enableSnapshotRendering();
54
+ }
45
55
  this._log("onResize", "end");
46
56
  });
47
57
  this._scene.onBeforeRenderObservable.add(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"snapshotRenderingHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/snapshotRenderingHelper.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,yBAAyB,EAAE,iDAAgD;AAEpF,OAAO,EAAE,MAAM,EAAE,oBAAyB;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBhE;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAmBhC;;;;;;OAMG;IACH,YAAY,KAAY,EAAE,OAAyC;QAnB3D,8BAAyB,GAAG,CAAC,CAAC;QAC9B,oCAA+B,uDAA+C;QAE9E,gBAAW,GAAG,KAAK,CAAC;QACpB,2BAAsB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,yEAAyE;QAC1I,4BAAuB,GAAgC,IAAI,GAAG,EAAE,CAAC,CAAC,gBAAgB;QAE1F;;WAEG;QACI,kBAAa,GAAG,KAAK,CAAC;Q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OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACnG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;IAEO,IAAI,CAAC,QAAgB,EAAE,OAAe;QAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,6BAA6B,QAAQ,MAAM,OAAO,EAAE,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type {\r\n AbstractEngine,\r\n AbstractMesh,\r\n EffectLayer,\r\n Mesh,\r\n Nullable,\r\n Observer,\r\n Scene,\r\n WebGPUDrawContext,\r\n WebGPUShaderProcessor,\r\n WebGPUPipelineContext,\r\n GaussianSplattingMesh,\r\n DrawWrapper,\r\n Camera,\r\n SpriteManager,\r\n} from \"core/index\";\r\n\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { BindMorphTargetParameters } from \"core/Materials/materialHelper.functions\";\r\nimport { ScenePerformancePriority } from \"core/scene\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { FrameGraphBaseLayerTask } from \"../FrameGraph/Tasks/Layers/baseLayerTask\";\r\nimport { FrameGraphUtils } from \"../FrameGraph/frameGraphUtils\";\r\n\r\n/**\r\n * Options for the snapshot rendering helper\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SnapshotRenderingHelpersOptions {\r\n /**\r\n * Maximum number of influences for morph target managers\r\n * In FAST snapshot mode, the number of influences must be fixed and cannot change from one frame to the next.\r\n * morphTargetsNumMaxInfluences is the maximum number of non-zero influences allowed in a morph target manager.\r\n * The final value defined for a morph target manager is: Math.min(morphTargetManager.numTargets, morphTargetsNumMaxInfluences)\r\n * Default: 20\r\n */\r\n morphTargetsNumMaxInfluences?: number;\r\n}\r\n\r\n/**\r\n * A helper class to simplify work with FAST snapshot mode (WebGPU only - can be used in WebGL too, but won't do anything).\r\n */\r\nexport class SnapshotRenderingHelper {\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _options: SnapshotRenderingHelpersOptions;\r\n private readonly _onBeforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _onBeforeRenderObserverUpdateLayer: Nullable<Observer<Scene>>;\r\n private readonly _onResizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _disableRenderingRefCount = 0;\r\n private _currentPerformancePriorityMode = ScenePerformancePriority.BackwardCompatible;\r\n private _pendingCurrentPerformancePriorityMode?: ScenePerformancePriority;\r\n private _isEnabling = false;\r\n private _enableCancelFunctions: Map<() => void, () => void> = new Map(); // first function is the callback, second function is the cancel function\r\n private _disableCancelFunctions: Map<() => void, () => void> = new Map(); // same as above\r\n\r\n /**\r\n * Indicates if debug logs should be displayed\r\n */\r\n public showDebugLogs = false;\r\n\r\n /**\r\n * Creates a new snapshot rendering helper\r\n * Note that creating an instance of the helper will set the snapshot rendering mode to SNAPSHOTRENDERING_FAST but will not enable snapshot rendering (engine.snapshotRendering is not updated).\r\n * Note also that fixMeshes() is called as part of the construction\r\n * @param scene The scene to use the helper in\r\n * @param options The options for the helper\r\n */\r\n constructor(scene: Scene, options?: SnapshotRenderingHelpersOptions) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._options = {\r\n morphTargetsNumMaxInfluences: 20,\r\n ...options,\r\n };\r\n\r\n this._engine.snapshotRenderingMode = Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n this.fixMeshes();\r\n\r\n this._onResizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._log(\"onResize\", \"start\");\r\n\r\n // enableSnapshotRendering() will delay the actual enabling of snapshot rendering by at least a frame, so these two lines are not redundant!\r\n if (this._fastSnapshotRenderingEnabled) {\r\n this.disableSnapshotRendering();\r\n this.enableSnapshotRendering();\r\n }\r\n\r\n this._log(\"onResize\", \"end\");\r\n });\r\n\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n // Animates skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\r\n // Handles meshes\r\n for (const mesh of scene.meshes) {\r\n if (mesh.infiniteDistance) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.skeleton) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.getClassName() === \"GaussianSplattingMesh\") {\r\n (mesh as GaussianSplattingMesh)._postToWorker();\r\n }\r\n\r\n if (mesh.morphTargetManager && mesh.subMeshes) {\r\n // Make sure morph target animations work\r\n for (const subMesh of mesh.subMeshes) {\r\n const dw = subMesh._drawWrapper;\r\n const effect = dw.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n mesh.morphTargetManager._bind(effect);\r\n BindMorphTargetParameters(mesh, effect);\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Handles sprite renderers\r\n let camera = scene.activeCamera;\r\n if (scene.frameGraph) {\r\n camera = FrameGraphUtils.FindMainCamera(scene.frameGraph) || camera;\r\n }\r\n if (scene.spriteManagers && camera) {\r\n for (const imanager of scene.spriteManagers) {\r\n const manager = imanager as SpriteManager;\r\n const renderer = manager.spriteRenderer;\r\n\r\n this._spriteRendererUpdateEffects(renderer._drawWrapperBase, renderer._drawWrapperDepth, camera);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the helper is in a steady state (not in the process of enabling snapshot rendering).\r\n */\r\n public get isReady() {\r\n return !this._isEnabling;\r\n }\r\n\r\n /**\r\n * Enable snapshot rendering\r\n * Use this method instead of engine.snapshotRendering=true, to make sure everything is ready before enabling snapshot rendering.\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n */\r\n public enableSnapshotRendering() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n if (--this._disableRenderingRefCount > 0) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", \"called\");\r\n if (this._disableCancelFunctions.size > 0) {\r\n this._log(\"enableSnapshotRendering\", `cancelling ${this._disableCancelFunctions.size} \"disable\" callbacks`);\r\n }\r\n\r\n this._disableCancelFunctions.forEach((cancel) => cancel());\r\n this._disableCancelFunctions.clear();\r\n\r\n this._isEnabling = true;\r\n this._disableRenderingRefCount = 0;\r\n\r\n this._currentPerformancePriorityMode = this._pendingCurrentPerformancePriorityMode ?? this._scene.performancePriority;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._enableCancelFunctions.delete(callbackWhenSceneReady);\r\n\r\n // Make sure a full frame is rendered before enabling snapshot rendering, so use \"+2\" instead of \"+1\"\r\n const targetFrameId = this._engine.frameId + 2;\r\n\r\n this._log(\"enableSnapshotRendering\", `scene ready, add callbacks for frames ${targetFrameId} and ${targetFrameId + 1}`);\r\n\r\n this._executeAtFrame(targetFrameId, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #1, enable snapshot rendering at the engine level`);\r\n this._engine.snapshotRendering = true;\r\n });\r\n\r\n // Render one frame with snapshot rendering enabled to make sure everything is ready\r\n this._executeAtFrame(targetFrameId + 1, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #2, signals that snapshot rendering helper is ready`);\r\n this._isEnabling = false;\r\n });\r\n };\r\n\r\n this._enableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n\r\n /**\r\n * Disable snapshot rendering\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n */\r\n public disableSnapshotRendering() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\"disableSnapshotRendering\", \"called\");\r\n\r\n if (this._disableRenderingRefCount === 0) {\r\n if (this._enableCancelFunctions.size > 0) {\r\n this._log(\"disableSnapshotRendering\", `cancelling ${this._enableCancelFunctions.size} \"enable\" callbacks`);\r\n }\r\n\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n\r\n this._isEnabling = false;\r\n\r\n // Snapshot rendering switches from enabled to disabled\r\n // We reset the performance priority mode to that which it was before enabling snapshot rendering, but first set it to “BackwardCompatible” to allow the system to regenerate resources that may have been optimized for snapshot rendering.\r\n // We'll then restore the original mode at the next frame.\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n if (this._currentPerformancePriorityMode !== ScenePerformancePriority.BackwardCompatible) {\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `makes sure that the scene is rendered once in BackwardCompatible mode (code: ${ScenePerformancePriority.BackwardCompatible}) before switching to mode ${this._currentPerformancePriorityMode}`\r\n );\r\n\r\n this._pendingCurrentPerformancePriorityMode = this._currentPerformancePriorityMode;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._log(\"disableSnapshotRendering\", `scene ready, add callback for frame ${this._engine.frameId + 2}`);\r\n\r\n this._executeAtFrame(\r\n this._engine.frameId + 2,\r\n () => {\r\n this._log(\"disableSnapshotRendering\", `switching to performance priority mode ${this._pendingCurrentPerformancePriorityMode}`);\r\n this._scene.performancePriority = this._pendingCurrentPerformancePriorityMode!;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n },\r\n \"whenDisabled\"\r\n );\r\n };\r\n\r\n this._disableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n }\r\n\r\n this._engine.snapshotRendering = false;\r\n this._disableRenderingRefCount++;\r\n }\r\n\r\n /**\r\n * Fix meshes for snapshot rendering.\r\n * This method will make sure that some features are disabled or fixed to make sure snapshot rendering works correctly.\r\n * @param meshes List of meshes to fix. If not provided, all meshes in the scene will be fixed.\r\n */\r\n public fixMeshes(meshes?: AbstractMesh[]) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n meshes = meshes || this._scene.meshes;\r\n\r\n for (const mesh of meshes) {\r\n (mesh as Mesh).ignoreCameraMaxZ = false;\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.numMaxInfluencers = Math.min(mesh.morphTargetManager.numTargets, this._options.morphTargetsNumMaxInfluences!);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call this method to update a mesh on the GPU after some properties have changed (position, rotation, scaling, visibility).\r\n * @param mesh The mesh to update. Can be a single mesh or an array of meshes to update.\r\n * @param updateInstancedMeshes If true, the method will also update instanced meshes. Default is true. If you know instanced meshes won't move (or you don't have instanced meshes), you can set this to false to save some CPU time.\r\n */\r\n public updateMesh(mesh: AbstractMesh | AbstractMesh[], updateInstancedMeshes = true) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(mesh)) {\r\n for (const m of mesh) {\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(m)) {\r\n m.transferToEffect(m.computeWorldMatrix());\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(mesh)) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix());\r\n }\r\n }\r\n\r\n private _updateInstancedMesh(mesh: AbstractMesh) {\r\n if (mesh.hasInstances) {\r\n if (mesh.subMeshes) {\r\n const sourceMesh = mesh as Mesh;\r\n for (const subMesh of sourceMesh.subMeshes) {\r\n const batch = sourceMesh._getInstancesRenderList(subMesh._id);\r\n sourceMesh._updateInstancedBuffers(subMesh, batch, batch.parent.instancesBufferSize, this._engine);\r\n }\r\n }\r\n return true;\r\n } else if (mesh.isAnInstance) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Update the meshes used in an effect layer to ensure that snapshot rendering works correctly for these meshes in this layer.\r\n * @param layer The effect layer or frame graph layer\r\n * @param autoUpdate If true, the helper will automatically update the meshes of the layer with each frame. If false, you'll need to call this method manually when the camera or layer meshes move or rotate.\r\n */\r\n public updateMeshesForEffectLayer(layer: EffectLayer | FrameGraphBaseLayerTask, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = layer instanceof FrameGraphBaseLayerTask ? layer.objectRendererForLayer.objectRenderer.renderPassId : layer.mainTexture.renderPassId;\r\n\r\n if (autoUpdate) {\r\n this._onBeforeRenderObserverUpdateLayer = this._scene.onBeforeRenderObservable.add(() => {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n });\r\n } else {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the helper\r\n */\r\n public dispose() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserverUpdateLayer);\r\n this._engine.onResizeObservable.remove(this._onResizeObserver);\r\n }\r\n\r\n private get _fastSnapshotRenderingEnabled() {\r\n return this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n }\r\n\r\n private _updateMeshMatricesForRenderPassId(renderPassId: number) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n const sceneTransformationMatrix =\r\n this._scene.objectRenderers.find((renderer) => renderer.renderPassId === renderPassId)?.activeCamera?.getTransformationMatrix() ?? this._scene.getTransformMatrix();\r\n\r\n for (let i = 0; i < this._scene.meshes.length; ++i) {\r\n const mesh = this._scene.meshes[i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < mesh.subMeshes.length; ++j) {\r\n const dw = mesh.subMeshes[j]._getDrawWrapper(renderPassId);\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"viewProjection\", sceneTransformationMatrix);\r\n effect.setMatrix(\"world\", mesh.computeWorldMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererDirectMatrixUpdate(dw: DrawWrapper, camera: Camera) {\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"view\", camera.getViewMatrix());\r\n effect.setMatrix(\"projection\", camera.getProjectionMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererUpdateEffects(drawWrapperBase: DrawWrapper, drawWrapperDepth: DrawWrapper, camera: Camera) {\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperBase, camera);\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperDepth, camera);\r\n }\r\n\r\n private _executeAtFrame(frameId: number, func: () => void, mode: \"whenEnabled\" | \"whenDisabled\" = \"whenEnabled\") {\r\n const callback = () => {\r\n if (this._engine.frameId >= frameId) {\r\n this._engine.onEndFrameObservable.remove(obs);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.delete(callback);\r\n } else {\r\n this._disableCancelFunctions.delete(callback);\r\n }\r\n func();\r\n }\r\n };\r\n\r\n const obs = this._engine.onEndFrameObservable.add(callback);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n } else {\r\n this._disableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n }\r\n }\r\n\r\n private _log(funcName: string, message: string) {\r\n if (this.showDebugLogs) {\r\n Logger.Log(`[Frame: ${this._engine.frameId}] SnapshotRenderingHelper:${funcName} - ${message}`);\r\n }\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"snapshotRenderingHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/snapshotRenderingHelper.ts"],"names":[],"mappings":"AAiBA,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,yBAAyB,EAAE,iDAAgD;AAEpF,OAAO,EAAE,MAAM,EAAE,oBAAyB;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAC;AACnF,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAiBhE;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAmBhC;;;;;;OAMG;IACH,YAAY,KAAY,EAAE,OAAyC;QAnB3D,8BAAyB,GAAG,CAAC,CAAC;QAC9B,oCAA+B,uDAA+C;QAE9E,gBAA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CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;gBAC9C,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;oBACzB,IAAI,CAAC,sBAAsB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjD,CAAC;qBAAM,CAAC;oBACJ,IAAI,CAAC,uBAAuB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;gBAClD,CAAC;gBACD,IAAI,EAAE,CAAC;YACX,CAAC;QACL,CAAC,CAAC;QAEF,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;QAC5D,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;YACzB,IAAI,CAAC,sBAAsB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACnG,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;IAEO,IAAI,CAAC,QAAgB,EAAE,OAAe;QAC1C,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,MAAM,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,OAAO,6BAA6B,QAAQ,MAAM,OAAO,EAAE,CAAC,CAAC;QACpG,CAAC;IACL,CAAC;CACJ","sourcesContent":["import type {\r\n AbstractEngine,\r\n AbstractMesh,\r\n EffectLayer,\r\n Mesh,\r\n Nullable,\r\n Observer,\r\n Scene,\r\n WebGPUDrawContext,\r\n WebGPUShaderProcessor,\r\n WebGPUPipelineContext,\r\n GaussianSplattingMesh,\r\n DrawWrapper,\r\n Camera,\r\n SpriteManager,\r\n} from \"core/index\";\r\n\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { BindMorphTargetParameters } from \"core/Materials/materialHelper.functions\";\r\nimport { ScenePerformancePriority } from \"core/scene\";\r\nimport { Logger } from \"core/Misc/logger\";\r\nimport { FrameGraphBaseLayerTask } from \"../FrameGraph/Tasks/Layers/baseLayerTask\";\r\nimport { FrameGraphUtils } from \"../FrameGraph/frameGraphUtils\";\r\n\r\n/**\r\n * Options for the snapshot rendering helper\r\n */\r\n// eslint-disable-next-line @typescript-eslint/naming-convention\r\nexport interface SnapshotRenderingHelpersOptions {\r\n /**\r\n * Maximum number of influences for morph target managers\r\n * In FAST snapshot mode, the number of influences must be fixed and cannot change from one frame to the next.\r\n * morphTargetsNumMaxInfluences is the maximum number of non-zero influences allowed in a morph target manager.\r\n * The final value defined for a morph target manager is: Math.min(morphTargetManager.numTargets, morphTargetsNumMaxInfluences)\r\n * Default: 20\r\n */\r\n morphTargetsNumMaxInfluences?: number;\r\n}\r\n\r\n/**\r\n * A helper class to simplify work with FAST snapshot mode (WebGPU only - can be used in WebGL too, but won't do anything).\r\n */\r\nexport class SnapshotRenderingHelper {\r\n private readonly _engine: AbstractEngine;\r\n private readonly _scene: Scene;\r\n private readonly _options: SnapshotRenderingHelpersOptions;\r\n private readonly _onBeforeRenderObserver: Nullable<Observer<Scene>>;\r\n private _onBeforeRenderObserverUpdateLayer: Nullable<Observer<Scene>>;\r\n private readonly _onResizeObserver: Nullable<Observer<AbstractEngine>>;\r\n private _disableRenderingRefCount = 0;\r\n private _currentPerformancePriorityMode = ScenePerformancePriority.BackwardCompatible;\r\n private _pendingCurrentPerformancePriorityMode?: ScenePerformancePriority;\r\n private _isEnabling = false;\r\n private _enableCancelFunctions: Map<() => void, () => void> = new Map(); // first function is the callback, second function is the cancel function\r\n private _disableCancelFunctions: Map<() => void, () => void> = new Map(); // same as above\r\n\r\n /**\r\n * Indicates if debug logs should be displayed\r\n */\r\n public showDebugLogs = false;\r\n\r\n /**\r\n * Creates a new snapshot rendering helper\r\n * Note that creating an instance of the helper will set the snapshot rendering mode to SNAPSHOTRENDERING_FAST but will not enable snapshot rendering (engine.snapshotRendering is not updated).\r\n * Note also that fixMeshes() is called as part of the construction\r\n * @param scene The scene to use the helper in\r\n * @param options The options for the helper\r\n */\r\n constructor(scene: Scene, options?: SnapshotRenderingHelpersOptions) {\r\n this._scene = scene;\r\n this._engine = scene.getEngine();\r\n\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._options = {\r\n morphTargetsNumMaxInfluences: 20,\r\n ...options,\r\n };\r\n\r\n this._engine.snapshotRenderingMode = Constants.SNAPSHOTRENDERING_FAST;\r\n\r\n this.fixMeshes();\r\n\r\n this._onResizeObserver = this._engine.onResizeObservable.add(() => {\r\n this._log(\"onResize\", \"start\");\r\n\r\n // enableSnapshotRendering() will delay the actual enabling of snapshot rendering by at least a frame, so these two lines are not redundant!\r\n if (this._fastSnapshotRenderingEnabled) {\r\n this.disableSnapshotRendering();\r\n this.enableSnapshotRendering();\r\n } else if (this._isEnabling) {\r\n // We are in the process of enabling snapshot rendering, but the engine got resized before we could actually enable it:\r\n // * cancel all \"enable\" pending callbacks\r\n // * increase the ref count to balance the decrease that enableSnapshotRendering() will do\r\n // * call enableSnapshotRendering() again to restart the enabling process\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n this._disableRenderingRefCount++;\r\n this.enableSnapshotRendering();\r\n }\r\n\r\n this._log(\"onResize\", \"end\");\r\n });\r\n\r\n this._scene.onBeforeRenderObservable.add(() => {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n // Animates skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\r\n // Handles meshes\r\n for (const mesh of scene.meshes) {\r\n if (mesh.infiniteDistance) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.skeleton) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix(true));\r\n }\r\n\r\n if (mesh.getClassName() === \"GaussianSplattingMesh\") {\r\n (mesh as GaussianSplattingMesh)._postToWorker();\r\n }\r\n\r\n if (mesh.morphTargetManager && mesh.subMeshes) {\r\n // Make sure morph target animations work\r\n for (const subMesh of mesh.subMeshes) {\r\n const dw = subMesh._drawWrapper;\r\n const effect = dw.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n mesh.morphTargetManager._bind(effect);\r\n BindMorphTargetParameters(mesh, effect);\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Handles sprite renderers\r\n let camera = scene.activeCamera;\r\n if (scene.frameGraph) {\r\n camera = FrameGraphUtils.FindMainCamera(scene.frameGraph) || camera;\r\n }\r\n if (scene.spriteManagers && camera) {\r\n for (const imanager of scene.spriteManagers) {\r\n const manager = imanager as SpriteManager;\r\n const renderer = manager.spriteRenderer;\r\n\r\n this._spriteRendererUpdateEffects(renderer._drawWrapperBase, renderer._drawWrapperDepth, camera);\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Gets a value indicating if the helper is in a steady state (not in the process of enabling snapshot rendering).\r\n */\r\n public get isReady() {\r\n return !this._isEnabling;\r\n }\r\n\r\n /**\r\n * Enable snapshot rendering\r\n * Use this method instead of engine.snapshotRendering=true, to make sure everything is ready before enabling snapshot rendering.\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n */\r\n public enableSnapshotRendering() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n if (--this._disableRenderingRefCount > 0) {\r\n return;\r\n }\r\n\r\n this._log(\"enableSnapshotRendering\", \"called\");\r\n if (this._disableCancelFunctions.size > 0) {\r\n this._log(\"enableSnapshotRendering\", `cancelling ${this._disableCancelFunctions.size} \"disable\" callbacks`);\r\n }\r\n\r\n this._disableCancelFunctions.forEach((cancel) => cancel());\r\n this._disableCancelFunctions.clear();\r\n\r\n this._isEnabling = true;\r\n this._disableRenderingRefCount = 0;\r\n\r\n this._currentPerformancePriorityMode = this._pendingCurrentPerformancePriorityMode ?? this._scene.performancePriority;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._enableCancelFunctions.delete(callbackWhenSceneReady);\r\n\r\n // Make sure a full frame is rendered before enabling snapshot rendering, so use \"+2\" instead of \"+1\"\r\n const targetFrameId = this._engine.frameId + 2;\r\n\r\n this._log(\"enableSnapshotRendering\", `scene ready, add callbacks for frames ${targetFrameId} and ${targetFrameId + 1}`);\r\n\r\n this._executeAtFrame(targetFrameId, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #1, enable snapshot rendering at the engine level`);\r\n this._engine.snapshotRendering = true;\r\n });\r\n\r\n // Render one frame with snapshot rendering enabled to make sure everything is ready\r\n this._executeAtFrame(targetFrameId + 1, () => {\r\n this._log(\"enableSnapshotRendering\", `callback #2, signals that snapshot rendering helper is ready`);\r\n this._isEnabling = false;\r\n });\r\n };\r\n\r\n this._enableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n\r\n /**\r\n * Disable snapshot rendering\r\n * Note that this method is ref-counted and works in pair with disableSnapshotRendering(): you should call enableSnapshotRendering() as many times as you call disableSnapshotRendering().\r\n */\r\n public disableSnapshotRendering() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._log(\"disableSnapshotRendering\", \"called\");\r\n\r\n if (this._disableRenderingRefCount === 0) {\r\n if (this._enableCancelFunctions.size > 0) {\r\n this._log(\"disableSnapshotRendering\", `cancelling ${this._enableCancelFunctions.size} \"enable\" callbacks`);\r\n }\r\n\r\n this._enableCancelFunctions.forEach((cancel) => cancel());\r\n this._enableCancelFunctions.clear();\r\n\r\n this._isEnabling = false;\r\n\r\n // Snapshot rendering switches from enabled to disabled\r\n // We reset the performance priority mode to that which it was before enabling snapshot rendering, but first set it to “BackwardCompatible” to allow the system to regenerate resources that may have been optimized for snapshot rendering.\r\n // We'll then restore the original mode at the next frame.\r\n this._scene.performancePriority = ScenePerformancePriority.BackwardCompatible;\r\n if (this._currentPerformancePriorityMode !== ScenePerformancePriority.BackwardCompatible) {\r\n this._log(\r\n \"disableSnapshotRendering\",\r\n `makes sure that the scene is rendered once in BackwardCompatible mode (code: ${ScenePerformancePriority.BackwardCompatible}) before switching to mode ${this._currentPerformancePriorityMode}`\r\n );\r\n\r\n this._pendingCurrentPerformancePriorityMode = this._currentPerformancePriorityMode;\r\n\r\n const callbackWhenSceneReady = () => {\r\n this._log(\"disableSnapshotRendering\", `scene ready, add callback for frame ${this._engine.frameId + 2}`);\r\n\r\n this._executeAtFrame(\r\n this._engine.frameId + 2,\r\n () => {\r\n this._log(\"disableSnapshotRendering\", `switching to performance priority mode ${this._pendingCurrentPerformancePriorityMode}`);\r\n this._scene.performancePriority = this._pendingCurrentPerformancePriorityMode!;\r\n this._pendingCurrentPerformancePriorityMode = undefined;\r\n },\r\n \"whenDisabled\"\r\n );\r\n };\r\n\r\n this._disableCancelFunctions.set(callbackWhenSceneReady, () => this._scene.onReadyObservable.removeCallback(callbackWhenSceneReady));\r\n\r\n this._scene.executeWhenReady(callbackWhenSceneReady);\r\n }\r\n }\r\n\r\n this._engine.snapshotRendering = false;\r\n this._disableRenderingRefCount++;\r\n }\r\n\r\n /**\r\n * Fix meshes for snapshot rendering.\r\n * This method will make sure that some features are disabled or fixed to make sure snapshot rendering works correctly.\r\n * @param meshes List of meshes to fix. If not provided, all meshes in the scene will be fixed.\r\n */\r\n public fixMeshes(meshes?: AbstractMesh[]) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n meshes = meshes || this._scene.meshes;\r\n\r\n for (const mesh of meshes) {\r\n (mesh as Mesh).ignoreCameraMaxZ = false;\r\n if (mesh.morphTargetManager) {\r\n mesh.morphTargetManager.numMaxInfluencers = Math.min(mesh.morphTargetManager.numTargets, this._options.morphTargetsNumMaxInfluences!);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Call this method to update a mesh on the GPU after some properties have changed (position, rotation, scaling, visibility).\r\n * @param mesh The mesh to update. Can be a single mesh or an array of meshes to update.\r\n * @param updateInstancedMeshes If true, the method will also update instanced meshes. Default is true. If you know instanced meshes won't move (or you don't have instanced meshes), you can set this to false to save some CPU time.\r\n */\r\n public updateMesh(mesh: AbstractMesh | AbstractMesh[], updateInstancedMeshes = true) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n if (Array.isArray(mesh)) {\r\n for (const m of mesh) {\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(m)) {\r\n m.transferToEffect(m.computeWorldMatrix());\r\n }\r\n }\r\n return;\r\n }\r\n\r\n if (!updateInstancedMeshes || !this._updateInstancedMesh(mesh)) {\r\n mesh.transferToEffect(mesh.computeWorldMatrix());\r\n }\r\n }\r\n\r\n private _updateInstancedMesh(mesh: AbstractMesh) {\r\n if (mesh.hasInstances) {\r\n if (mesh.subMeshes) {\r\n const sourceMesh = mesh as Mesh;\r\n for (const subMesh of sourceMesh.subMeshes) {\r\n const batch = sourceMesh._getInstancesRenderList(subMesh._id);\r\n sourceMesh._updateInstancedBuffers(subMesh, batch, batch.parent.instancesBufferSize, this._engine);\r\n }\r\n }\r\n return true;\r\n } else if (mesh.isAnInstance) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Update the meshes used in an effect layer to ensure that snapshot rendering works correctly for these meshes in this layer.\r\n * @param layer The effect layer or frame graph layer\r\n * @param autoUpdate If true, the helper will automatically update the meshes of the layer with each frame. If false, you'll need to call this method manually when the camera or layer meshes move or rotate.\r\n */\r\n public updateMeshesForEffectLayer(layer: EffectLayer | FrameGraphBaseLayerTask, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = layer instanceof FrameGraphBaseLayerTask ? layer.objectRendererForLayer.objectRenderer.renderPassId : layer.mainTexture.renderPassId;\r\n\r\n if (autoUpdate) {\r\n this._onBeforeRenderObserverUpdateLayer = this._scene.onBeforeRenderObservable.add(() => {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n });\r\n } else {\r\n this._updateMeshMatricesForRenderPassId(renderPassId);\r\n }\r\n }\r\n\r\n /**\r\n * Dispose the helper\r\n */\r\n public dispose() {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserver);\r\n this._scene.onBeforeRenderObservable.remove(this._onBeforeRenderObserverUpdateLayer);\r\n this._engine.onResizeObservable.remove(this._onResizeObserver);\r\n }\r\n\r\n private get _fastSnapshotRenderingEnabled() {\r\n return this._engine.snapshotRendering && this._engine.snapshotRenderingMode === Constants.SNAPSHOTRENDERING_FAST;\r\n }\r\n\r\n private _updateMeshMatricesForRenderPassId(renderPassId: number) {\r\n if (!this._fastSnapshotRenderingEnabled) {\r\n return;\r\n }\r\n\r\n const sceneTransformationMatrix =\r\n this._scene.objectRenderers.find((renderer) => renderer.renderPassId === renderPassId)?.activeCamera?.getTransformationMatrix() ?? this._scene.getTransformMatrix();\r\n\r\n for (let i = 0; i < this._scene.meshes.length; ++i) {\r\n const mesh = this._scene.meshes[i];\r\n if (!mesh.subMeshes) {\r\n continue;\r\n }\r\n\r\n for (let j = 0; j < mesh.subMeshes.length; ++j) {\r\n const dw = mesh.subMeshes[j]._getDrawWrapper(renderPassId);\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"viewProjection\", sceneTransformationMatrix);\r\n effect.setMatrix(\"world\", mesh.computeWorldMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererDirectMatrixUpdate(dw: DrawWrapper, camera: Camera) {\r\n const effect = dw?.effect;\r\n if (effect) {\r\n const dataBuffer = (dw.drawContext as WebGPUDrawContext).buffers[\"LeftOver\" satisfies (typeof WebGPUShaderProcessor)[\"LeftOvertUBOName\"]];\r\n const ubLeftOver = (effect._pipelineContext as WebGPUPipelineContext)?.uniformBuffer;\r\n if (dataBuffer && ubLeftOver && ubLeftOver.setDataBuffer(dataBuffer)) {\r\n effect.setMatrix(\"view\", camera.getViewMatrix());\r\n effect.setMatrix(\"projection\", camera.getProjectionMatrix());\r\n ubLeftOver.update();\r\n }\r\n }\r\n }\r\n\r\n private _spriteRendererUpdateEffects(drawWrapperBase: DrawWrapper, drawWrapperDepth: DrawWrapper, camera: Camera) {\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperBase, camera);\r\n this._spriteRendererDirectMatrixUpdate(drawWrapperDepth, camera);\r\n }\r\n\r\n private _executeAtFrame(frameId: number, func: () => void, mode: \"whenEnabled\" | \"whenDisabled\" = \"whenEnabled\") {\r\n const callback = () => {\r\n if (this._engine.frameId >= frameId) {\r\n this._engine.onEndFrameObservable.remove(obs);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.delete(callback);\r\n } else {\r\n this._disableCancelFunctions.delete(callback);\r\n }\r\n func();\r\n }\r\n };\r\n\r\n const obs = this._engine.onEndFrameObservable.add(callback);\r\n if (mode === \"whenEnabled\") {\r\n this._enableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n } else {\r\n this._disableCancelFunctions.set(callback, () => this._engine.onEndFrameObservable.remove(obs));\r\n }\r\n }\r\n\r\n private _log(funcName: string, message: string) {\r\n if (this.showDebugLogs) {\r\n Logger.Log(`[Frame: ${this._engine.frameId}] SnapshotRenderingHelper:${funcName} - ${message}`);\r\n }\r\n }\r\n}\r\n"]}
@@ -1,6 +1,7 @@
1
1
  import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
2
2
  import "./ShadersInclude/morphTargetsVertexDeclaration.js";
3
3
  import "./ShadersInclude/bonesVertex.js";
4
+ import "./ShadersInclude/bakedVertexAnimation.js";
4
5
  /** @internal */
5
6
  export declare const iblVoxelGridVertexShaderWGSL: {
6
7
  name: string;
@@ -3,6 +3,7 @@ import { ShaderStore } from "../Engines/shaderStore.js";
3
3
  import "./ShadersInclude/morphTargetsVertexGlobalDeclaration.js";
4
4
  import "./ShadersInclude/morphTargetsVertexDeclaration.js";
5
5
  import "./ShadersInclude/bonesVertex.js";
6
+ import "./ShadersInclude/bakedVertexAnimation.js";
6
7
  const name = "iblVoxelGridVertexShader";
7
8
  const shader = `#include <bakedVertexAnimationDeclaration>
8
9
  #include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)
@@ -26,9 +27,11 @@ let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24
26
27
  case 5121u: {
27
28
  let shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}
28
29
  case 5122u: {
29
- let shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u)/32767.0;}
30
+ let shift=(byteInWord & 0xFFFFFFFEu)*8u;
31
+ let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u);}
30
32
  case 5123u: {
31
- let shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(value)/65535.0;}
33
+ let shift=(byteInWord & 0xFFFFFFFEu)*8u;
34
+ let value=(word>>shift) & 0xFFFFu;return f32(value);}
32
35
  case 5126u: {
33
36
  return bitcast<f32>(word);}
34
37
  default: {return 0.0;}}}
@@ -39,7 +42,7 @@ readPositionValue(offset+componentSize,dataType),
39
42
  readPositionValue(offset+componentSize*2u,dataType)
40
43
  );}
41
44
  #if NUM_BONE_INFLUENCERS>0
42
- fn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndices[wordOffset]);return convertToFloat(word,byteInWord,dataType);}
45
+ fn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType);}
43
46
  fn readMatrixIndices(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(
44
47
  readMatrixIndexValue(offset,dataType),
45
48
  readMatrixIndexValue(offset+componentSize,dataType),
@@ -87,20 +90,24 @@ fn calculateTriangleNormal(v0
87
90
  : vec3<f32>)
88
91
  ->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}
89
92
  @vertex
90
- fn main(input : VertexInputs)->FragmentInputs {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);
93
+ fn main(input : VertexInputs)->FragmentInputs {
91
94
  #include <morphTargetsVertexGlobal>
95
+ var triPositions: array<vec3f,3>;var thisTriIndex : u32=input.vertexIndex;
96
+ for (var i: u32=0u; i<3u; i=i+1u) {var provokingVertNum : u32=input.vertexIndex/3*3;let vertIdx=readVertexIndex(provokingVertNum+i);if (provokingVertNum+i==input.vertexIndex) {thisTriIndex=i;}
97
+ var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);
98
+ #include <instancesVertex>
92
99
  let inputPosition: vec3f=positionUpdated;
93
100
  #include <morphTargetsVertex>(vertexInputs.position\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]
94
- #include <instancesVertex>
95
- #include <bakedVertexAnimation>
96
101
  #if NUM_BONE_INFLUENCERS>0
97
102
  let matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);
98
103
  #if NUM_BONE_INFLUENCERS>4
99
104
  let matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);
100
105
  #endif
101
106
  #endif
102
- #include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight)
103
- let worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum));var pos1=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}
107
+ #include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)
108
+ #include<bakedVertexAnimation>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)
109
+ triPositions[i]=(finalWorld*vec4(positionUpdated,1.0)).xyz;}
110
+ var N : vec3<f32>=calculateTriangleNormal(triPositions[0],triPositions[1],triPositions[2]);let worldPos=triPositions[thisTriIndex];vertexOutputs.position=uniforms.invWorldScale*vec4(worldPos,1.0);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}
104
111
  vertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =
105
112
  vertexOutputs.vNormalizedPosition.z; }
106
113
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"iblVoxelGrid.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/iblVoxelGrid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,8BAA8B,CAAC;AAEtC,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmGd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/bonesVertex\";\n\nconst name = \"iblVoxelGridVertexShader\";\nconst shader = `#include <bakedVertexAnimationDeclaration>\n#include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)\n#include <helperFunctions>\n#include <instancesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef VERTEX_PULLING_USE_INDEX_BUFFER\nvar<storage,read> indices : array<u32>;\n#endif\nvar<storage,read> position : array<f32>;\n#if NUM_BONE_INFLUENCERS>0\nvar<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info: vec3f;uniform vp_matricesWeights_info: vec3f;\n#if NUM_BONE_INFLUENCERS>4\nvar<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info: vec3f;uniform vp_matricesWeightsExtra_info: vec3f;\n#endif\n#endif\nuniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;uniform vp_position_info: vec3f; \nfn convertToFloat(word: u32,byteInWord: u32,dataType: u32)->f32 {switch (dataType) {case 5120u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24u)>>24u)/127.0; }\ncase 5121u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}\ncase 5122u: { \nlet shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u)/32767.0;}\ncase 5123u: { \nlet shift=(byteInWord/2u)*16u;let value=(word>>shift) & 0xFFFFu;return f32(value)/65535.0;}\ncase 5126u: { \nreturn bitcast<f32>(word);}\ndefault: {return 0.0;}}}\nfn readPositionValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(position[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readVertexPosition(info: vec3f,vertexIndex: u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f(\nreadPositionValue(offset,dataType),\nreadPositionValue(offset+componentSize,dataType),\nreadPositionValue(offset+componentSize*2u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>0\nfn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndices[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndices(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexValue(offset,dataType),\nreadMatrixIndexValue(offset+componentSize,dataType),\nreadMatrixIndexValue(offset+componentSize*2u,dataType),\nreadMatrixIndexValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixWeights(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightValue(offset,dataType),\nreadMatrixWeightValue(offset+componentSize,dataType),\nreadMatrixWeightValue(offset+componentSize*2u,dataType),\nreadMatrixWeightValue(offset+componentSize*3u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>4\nfn readMatrixIndexExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndicesExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexExtraValue(offset,dataType),\nreadMatrixIndexExtraValue(offset+componentSize,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*2u,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightExtraValue(offset,dataType),\nreadMatrixWeightExtraValue(offset+componentSize,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*2u,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*3u,dataType)\n);}\n#endif\n#endif\nfn readVertexIndex(index : u32)->u32 {\n#ifndef VERTEX_PULLING_USE_INDEX_BUFFER\nreturn index;\n#else\n#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS\nreturn indices[index];\n#else\nlet u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu;\n#endif\n#endif\n}\nfn calculateTriangleNormal(v0\n: vec3<f32>,v1\n: vec3<f32>,v2\n: vec3<f32>)\n->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {var vertIdx=readVertexIndex(input.vertexIndex);var positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);\n#include <morphTargetsVertexGlobal>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#include <instancesVertex>\n#include <bakedVertexAnimation>\n#if NUM_BONE_INFLUENCERS>0\nlet matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);\n#if NUM_BONE_INFLUENCERS>4\nlet matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);\n#endif\n#endif\n#include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight)\nlet worldPos=finalWorld*vec4f(positionUpdated,1.0);vertexOutputs.position=uniforms.invWorldScale*worldPos;var provokingVertNum : u32=input.vertexIndex/3*3;var pos0=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum));var pos1=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+1));var pos2=readVertexPosition(uniforms.vp_position_info,readVertexIndex(provokingVertNum+2));var N : vec3<f32>=calculateTriangleNormal(pos0,pos1,pos2);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}\nvertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =\nvertexOutputs.vNormalizedPosition.z; }\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const iblVoxelGridVertexShaderWGSL = { name, shader };\n"]}
1
+ {"version":3,"file":"iblVoxelGrid.vertex.js","sourceRoot":"","sources":["../../../../dev/core/src/ShadersWGSL/iblVoxelGrid.vertex.ts"],"names":[],"mappings":"AAAA,eAAe;AACf,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,sDAAsD,CAAC;AAC9D,OAAO,gDAAgD,CAAC;AACxD,OAAO,8BAA8B,CAAC;AACtC,OAAO,uCAAuC,CAAC;AAE/C,MAAM,IAAI,GAAG,0BAA0B,CAAC;AACxC,MAAM,MAAM,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyGd,CAAC;AACF,aAAa;AACb,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,EAAE,CAAC;IACtC,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC;AAChD,CAAC;AACD,gBAAgB;AAChB,MAAM,CAAC,MAAM,4BAA4B,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC","sourcesContent":["// Do not edit.\nimport { ShaderStore } from \"../Engines/shaderStore\";\nimport \"./ShadersInclude/morphTargetsVertexGlobalDeclaration\";\nimport \"./ShadersInclude/morphTargetsVertexDeclaration\";\nimport \"./ShadersInclude/bonesVertex\";\nimport \"./ShadersInclude/bakedVertexAnimation\";\n\nconst name = \"iblVoxelGridVertexShader\";\nconst shader = `#include <bakedVertexAnimationDeclaration>\n#include <bonesDeclaration>(attribute matricesIndices : vec4f;,,attribute matricesWeights : vec4f;,,attribute matricesIndicesExtra : vec4f;,,attribute matricesWeightsExtra : vec4f;,)\n#include <helperFunctions>\n#include <instancesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef VERTEX_PULLING_USE_INDEX_BUFFER\nvar<storage,read> indices : array<u32>;\n#endif\nvar<storage,read> position : array<f32>;\n#if NUM_BONE_INFLUENCERS>0\nvar<storage,read> matricesIndices : array<u32>;var<storage,read> matricesWeights : array<f32>;uniform vp_matricesIndices_info: vec3f;uniform vp_matricesWeights_info: vec3f;\n#if NUM_BONE_INFLUENCERS>4\nvar<storage,read> matricesIndicesExtra : array<u32>;var<storage,read> matricesWeightsExtra : array<f32>;uniform vp_matricesIndicesExtra_info: vec3f;uniform vp_matricesWeightsExtra_info: vec3f;\n#endif\n#endif\nuniform world : mat4x4f;uniform invWorldScale: mat4x4f;varying vNormalizedPosition : vec3f;flat varying f_swizzle: i32;uniform vp_position_info: vec3f; \nfn convertToFloat(word: u32,byteInWord: u32,dataType: u32)->f32 {switch (dataType) {case 5120u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(i32(value<<24u)>>24u)/127.0; }\ncase 5121u: { \nlet shift=byteInWord*8u;let value=(word>>shift) & 0xFFu;return f32(value)/255.0;}\ncase 5122u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;return f32(i32(value<<16u)>>16u);}\ncase 5123u: { \nlet shift=(byteInWord & 0xFFFFFFFEu)*8u; \nlet value=(word>>shift) & 0xFFFFu;return f32(value);}\ncase 5126u: { \nreturn bitcast<f32>(word);}\ndefault: {return 0.0;}}}\nfn readPositionValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(position[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readVertexPosition(info: vec3f,vertexIndex: u32)->vec3f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec3f(\nreadPositionValue(offset,dataType),\nreadPositionValue(offset+componentSize,dataType),\nreadPositionValue(offset+componentSize*2u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>0\nfn readMatrixIndexValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=matricesIndices[wordOffset];return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndices(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexValue(offset,dataType),\nreadMatrixIndexValue(offset+componentSize,dataType),\nreadMatrixIndexValue(offset+componentSize*2u,dataType),\nreadMatrixIndexValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeights[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixWeights(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightValue(offset,dataType),\nreadMatrixWeightValue(offset+componentSize,dataType),\nreadMatrixWeightValue(offset+componentSize*2u,dataType),\nreadMatrixWeightValue(offset+componentSize*3u,dataType)\n);}\n#if NUM_BONE_INFLUENCERS>4\nfn readMatrixIndexExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesIndicesExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixIndexExtraValue(offset,dataType),\nreadMatrixIndexExtraValue(offset+componentSize,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*2u,dataType),\nreadMatrixIndexExtraValue(offset+componentSize*3u,dataType)\n);}\nfn readMatrixWeightExtraValue(byteOffset: u32,dataType: u32)->f32 {let wordOffset=byteOffset/4u;let byteInWord=byteOffset % 4u;let word: u32=bitcast<u32>(matricesWeightsExtra[wordOffset]);return convertToFloat(word,byteInWord,dataType);}\nfn readMatrixIndicesExtra(info: vec3f,vertexIndex : u32)->vec4f {let baseOffset=u32(info.x);let stride=u32(info.y);let dataType=u32(info.z);let offset=baseOffset+vertexIndex*stride;let componentSize=select(select(2u,1u,dataType==5120u || dataType==5121u),4u,dataType==5126u);return vec4f(\nreadMatrixWeightExtraValue(offset,dataType),\nreadMatrixWeightExtraValue(offset+componentSize,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*2u,dataType),\nreadMatrixWeightExtraValue(offset+componentSize*3u,dataType)\n);}\n#endif\n#endif\nfn readVertexIndex(index : u32)->u32 {\n#ifndef VERTEX_PULLING_USE_INDEX_BUFFER\nreturn index;\n#else\n#ifdef VERTEX_PULLING_INDEX_BUFFER_32BITS\nreturn indices[index];\n#else\nlet u32_index=index/2u;let bit_offset=(index & 1u)*16u;return (indices[u32_index]>>bit_offset) & 0xFFFFu;\n#endif\n#endif\n}\nfn calculateTriangleNormal(v0\n: vec3<f32>,v1\n: vec3<f32>,v2\n: vec3<f32>)\n->vec3<f32> {let edge1=v1-v0;let edge2=v2-v0;let triangleNormal=cross(edge1,edge2);let normalizedTriangleNormal=normalize(triangleNormal);return normalizedTriangleNormal;}\n@vertex\nfn main(input : VertexInputs)->FragmentInputs {\n#include <morphTargetsVertexGlobal>\nvar triPositions: array<vec3f,3>;var thisTriIndex : u32=input.vertexIndex; \nfor (var i: u32=0u; i<3u; i=i+1u) {var provokingVertNum : u32=input.vertexIndex/3*3;let vertIdx=readVertexIndex(provokingVertNum+i);if (provokingVertNum+i==input.vertexIndex) {thisTriIndex=i;}\nvar positionUpdated=readVertexPosition(uniforms.vp_position_info,vertIdx);\n#include <instancesVertex>\nlet inputPosition: vec3f=positionUpdated;\n#include <morphTargetsVertex>(vertexInputs.position\\\\),inputPosition),vertexInputs.vertexIndex,vertIdx)[0..maxSimultaneousMorphTargets]\n#if NUM_BONE_INFLUENCERS>0\nlet matrixIndex=readMatrixIndices(uniforms.vp_matricesIndices_info,vertIdx);let matrixWeight=readMatrixWeights(uniforms.vp_matricesWeights_info,vertIdx);\n#if NUM_BONE_INFLUENCERS>4\nlet matrixIndexExtra=readMatrixIndicesExtra(uniforms.vp_matricesIndicesExtra_info,vertIdx);let matrixWeightExtra=readMatrixWeightsExtra(uniforms.vp_matricesWeightsExtra_info,vertIdx);\n#endif\n#endif\n#include<bonesVertex>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\n#include<bakedVertexAnimation>(vertexInputs.matricesIndices,matrixIndex,vertexInputs.matricesWeights,matrixWeight,vertexInputs.matricesIndicesExtra,matrixIndexExtra,vertexInputs.matricesWeightsExtra,matrixWeightExtra)\ntriPositions[i]=(finalWorld*vec4(positionUpdated,1.0)).xyz;}\nvar N : vec3<f32>=calculateTriangleNormal(triPositions[0],triPositions[1],triPositions[2]);let worldPos=triPositions[thisTriIndex];vertexOutputs.position=uniforms.invWorldScale*vec4(worldPos,1.0);N=abs(N);if (N.x>N.y && N.x>N.z) {vertexOutputs.f_swizzle=0;vertexOutputs.position=vec4f(vertexOutputs.position.yzx,1.0);} else if (N.y>N.z) {vertexOutputs.f_swizzle=1;vertexOutputs.position=vec4f(vertexOutputs.position.zxy,1.0);} else {vertexOutputs.f_swizzle=2;vertexOutputs.position=vec4f(vertexOutputs.position.xyz,1.0);}\nvertexOutputs.vNormalizedPosition=vertexOutputs.position.xyz*0.5+0.5;vertexOutputs.position.z =\nvertexOutputs.vNormalizedPosition.z; }\n`;\n// Sideeffect\nif (!ShaderStore.ShadersStoreWGSL[name]) {\n ShaderStore.ShadersStoreWGSL[name] = shader;\n}\n/** @internal */\nexport const iblVoxelGridVertexShaderWGSL = { name, shader };\n"]}
package/node.d.ts CHANGED
@@ -74,6 +74,8 @@ export declare class Node implements IBehaviorAware<Node> {
74
74
  * @see https://doc.babylonjs.com/toolsAndResources/inspector#extensibility
75
75
  */
76
76
  inspectableCustomProperties: IInspectable[];
77
+ /** @internal */
78
+ _internalEnabled: boolean;
77
79
  /**
78
80
  * Gets or sets the accessibility tag to describe the node for accessibility purpose.
79
81
  */
package/node.js CHANGED
@@ -228,6 +228,8 @@ export class Node {
228
228
  * For internal use only. Please do not use.
229
229
  */
230
230
  this.reservedDataStore = null;
231
+ /** @internal */
232
+ this._internalEnabled = true;
231
233
  this._accessibilityTag = null;
232
234
  /**
233
235
  * Observable fired when an accessibility tag is changed
@@ -475,6 +477,9 @@ export class Node {
475
477
  * @returns whether this node (and its parent) is enabled
476
478
  */
477
479
  isEnabled(checkAncestors = true) {
480
+ if (!this._internalEnabled) {
481
+ return false;
482
+ }
478
483
  if (checkAncestors === false) {
479
484
  return this._nodeDataStorage._isEnabled;
480
485
  }