@babylonjs/core 8.15.1 → 8.16.1
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 +13 -1
- package/Animations/animationGroup.js +16 -3
- package/Animations/animationGroup.js.map +1 -1
- package/AudioV2/webAudio/components/webAudioParameterComponent.d.ts +8 -0
- package/AudioV2/webAudio/components/webAudioParameterComponent.js +36 -3
- package/AudioV2/webAudio/components/webAudioParameterComponent.js.map +1 -1
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js +10 -0
- package/AudioV2/webAudio/subNodes/spatialWebAudioSubNode.js.map +1 -1
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js +11 -0
- package/AudioV2/webAudio/subProperties/spatialWebAudioListener.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.d.ts +7 -0
- package/AudioV2/webAudio/webAudioEngine.js +45 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/Behaviors/Cameras/framingBehavior.js +3 -3
- package/Behaviors/Cameras/framingBehavior.js.map +1 -1
- package/Debug/directionalLightFrustumViewer.d.ts +6 -0
- package/Debug/directionalLightFrustumViewer.js +39 -1
- package/Debug/directionalLightFrustumViewer.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.alpha.d.ts +2 -1
- package/Engines/AbstractEngine/abstractEngine.alpha.js +9 -9
- package/Engines/AbstractEngine/abstractEngine.alpha.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.states.d.ts +4 -104
- package/Engines/AbstractEngine/abstractEngine.states.js +4 -70
- package/Engines/AbstractEngine/abstractEngine.states.js.map +1 -1
- package/Engines/AbstractEngine/abstractEngine.stencil.d.ts +147 -0
- package/Engines/AbstractEngine/abstractEngine.stencil.js +93 -0
- package/Engines/AbstractEngine/abstractEngine.stencil.js.map +1 -0
- package/Engines/AbstractEngine/index.d.ts +1 -0
- package/Engines/AbstractEngine/index.js +1 -0
- package/Engines/AbstractEngine/index.js.map +1 -1
- package/Engines/Extensions/engine.alpha.d.ts +2 -1
- package/Engines/Extensions/engine.alpha.js +7 -78
- package/Engines/Extensions/engine.alpha.js.map +1 -1
- package/Engines/WebGL/webGL2ShaderProcessors.js +8 -1
- package/Engines/WebGL/webGL2ShaderProcessors.js.map +1 -1
- package/Engines/WebGPU/Extensions/engine.alpha.d.ts +2 -1
- package/Engines/WebGPU/Extensions/engine.alpha.js +12 -82
- package/Engines/WebGPU/Extensions/engine.alpha.js.map +1 -1
- package/Engines/WebGPU/webgpuCacheRenderPipeline.d.ts +12 -5
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js +139 -72
- package/Engines/WebGPU/webgpuCacheRenderPipeline.js.map +1 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js +13 -1
- package/Engines/WebGPU/webgpuShaderProcessorsWGSL.js.map +1 -1
- package/Engines/WebGPU/webgpuStencilStateComposer.d.ts +8 -0
- package/Engines/WebGPU/webgpuStencilStateComposer.js +40 -0
- package/Engines/WebGPU/webgpuStencilStateComposer.js.map +1 -1
- package/Engines/abstractEngine.d.ts +7 -3
- package/Engines/abstractEngine.js +12 -5
- package/Engines/abstractEngine.js.map +1 -1
- package/Engines/constants.d.ts +30 -28
- package/Engines/constants.js +30 -28
- package/Engines/constants.js.map +1 -1
- package/Engines/engine.d.ts +10 -0
- package/Engines/engine.js +1 -0
- package/Engines/engine.js.map +1 -1
- package/Engines/engineCapabilities.d.ts +4 -0
- package/Engines/engineCapabilities.js.map +1 -1
- package/Engines/nativeEngine.d.ts +2 -1
- package/Engines/nativeEngine.js +6 -3
- package/Engines/nativeEngine.js.map +1 -1
- package/Engines/nullEngine.d.ts +2 -1
- package/Engines/nullEngine.js +7 -4
- package/Engines/nullEngine.js.map +1 -1
- package/Engines/thinEngine.js +16 -3
- package/Engines/thinEngine.js.map +1 -1
- package/Engines/webgpuEngine.d.ts +1 -0
- package/Engines/webgpuEngine.js +6 -4
- package/Engines/webgpuEngine.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.d.ts +1 -1
- package/FrameGraph/Tasks/PostProcesses/passTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.d.ts +8 -1
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js +14 -6
- package/FrameGraph/Tasks/Rendering/objectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js +3 -0
- package/FrameGraph/Tasks/Rendering/shadowGeneratorTask.js.map +1 -1
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js +6 -5
- package/FrameGraph/Tasks/Rendering/taaObjectRendererTask.js.map +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.d.ts +1 -1
- package/FrameGraph/Tasks/Texture/clearTextureTask.js +7 -5
- package/FrameGraph/Tasks/Texture/clearTextureTask.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +10 -0
- package/FrameGraph/frameGraph.js +15 -5
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphContext.d.ts +16 -0
- package/FrameGraph/frameGraphContext.js +23 -0
- package/FrameGraph/frameGraphContext.js.map +1 -1
- package/FrameGraph/frameGraphRenderContext.d.ts +9 -16
- package/FrameGraph/frameGraphRenderContext.js +15 -23
- package/FrameGraph/frameGraphRenderContext.js.map +1 -1
- package/FrameGraph/frameGraphUtils.d.ts +52 -0
- package/FrameGraph/frameGraphUtils.js +99 -0
- package/FrameGraph/frameGraphUtils.js.map +1 -0
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Loading/Plugins/babylonFileLoader.js +35 -2
- package/Loading/Plugins/babylonFileLoader.js.map +1 -1
- package/Materials/material.d.ts +32 -12
- package/Materials/material.js +49 -17
- package/Materials/material.js.map +1 -1
- package/Materials/materialStencilState.d.ts +24 -0
- package/Materials/materialStencilState.js +53 -1
- package/Materials/materialStencilState.js.map +1 -1
- package/Meshes/geometry.js +1 -1
- package/Meshes/geometry.js.map +1 -1
- package/Meshes/instancedMesh.d.ts +5 -0
- package/Meshes/instancedMesh.js +3 -3
- package/Meshes/instancedMesh.js.map +1 -1
- package/Meshes/mesh.d.ts +28 -5
- package/Meshes/mesh.js +127 -57
- package/Meshes/mesh.js.map +1 -1
- package/Meshes/thinInstanceMesh.js +4 -0
- package/Meshes/thinInstanceMesh.js.map +1 -1
- package/Misc/snapshotRenderingHelper.js +2 -1
- package/Misc/snapshotRenderingHelper.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +4 -0
- package/Particles/IParticleSystem.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js +32 -10
- package/PostProcesses/RenderPipeline/Pipelines/taaRenderingPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.d.ts +4 -0
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js +5 -0
- package/PostProcesses/RenderPipeline/postProcessRenderPipeline.js.map +1 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.d.ts +12 -3
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js +22 -1
- package/PostProcesses/RenderPipeline/postProcessRenderPipelineManager.js.map +1 -1
- package/PostProcesses/thinPassPostProcess.js +7 -3
- package/PostProcesses/thinPassPostProcess.js.map +1 -1
- package/Rendering/edgesRenderer.js +3 -2
- package/Rendering/edgesRenderer.js.map +1 -1
- package/Rendering/geometryBufferRenderer.js +1 -1
- package/Rendering/geometryBufferRenderer.js.map +1 -1
- package/Rendering/outlineRenderer.js +1 -1
- package/Rendering/outlineRenderer.js.map +1 -1
- package/Shaders/lod.fragment.js +2 -3
- package/Shaders/lod.fragment.js.map +1 -1
- package/ShadersWGSL/lod.fragment.js +2 -2
- package/ShadersWGSL/lod.fragment.js.map +1 -1
- package/Sprites/spriteManager.d.ts +1 -1
- package/Sprites/spriteManager.js.map +1 -1
- package/States/IStencilState.d.ts +6 -2
- package/States/IStencilState.js.map +1 -1
- package/States/alphaCullingState.d.ts +7 -5
- package/States/alphaCullingState.js +144 -33
- package/States/alphaCullingState.js.map +1 -1
- package/States/stencilState.d.ts +12 -0
- package/States/stencilState.js +29 -1
- package/States/stencilState.js.map +1 -1
- package/States/stencilStateComposer.d.ts +12 -0
- package/States/stencilStateComposer.js +48 -2
- package/States/stencilStateComposer.js.map +1 -1
- package/assetContainer.js +29 -8
- package/assetContainer.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +37 -1
- package/scene.js +56 -0
- package/scene.js.map +1 -1
|
@@ -313,5 +313,9 @@ Mesh.prototype._disposeThinInstanceSpecificData = function () {
|
|
|
313
313
|
this._thinInstanceDataStorage.matrixBuffer.dispose();
|
|
314
314
|
this._thinInstanceDataStorage.matrixBuffer = null;
|
|
315
315
|
}
|
|
316
|
+
if (this._thinInstanceDataStorage?.previousMatrixBuffer) {
|
|
317
|
+
this._thinInstanceDataStorage.previousMatrixBuffer.dispose();
|
|
318
|
+
this._thinInstanceDataStorage.previousMatrixBuffer = null;
|
|
319
|
+
}
|
|
316
320
|
};
|
|
317
321
|
//# sourceMappingURL=thinInstanceMesh.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"thinInstanceMesh.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,mCAAkC;AA0HzD,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG,UAAU,M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AC;YACJ,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;YAEpE,IAAI,CAAC,+BAA+B,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YACvD,IAAI,CAAC,+BAA+B,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC;YAC3D,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAErI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,CAAC,kCAAkC,GAAG;IAChD,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC;QACxC,IAAI,CAAC,+BAA+B,GAAG;YACnC,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;SACd,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,CAAC,gCAAgC,GAAG;IAC9C,IAAI,IAAI,CAAC,wBAAwB,EAAE,YAAY,EAAE,CAAC;QAC9C,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QACrD,IAAI,CAAC,wBAAwB,CAAC,YAAY,GAAG,IAAI,CAAC;IACtD,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { Nullable, DeepImmutableObject } from \"../types\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer\";\r\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\n\r\ndeclare module \"./mesh\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Mesh {\r\n /**\r\n * Gets or sets a boolean defining if we want picking to pick thin instances as well\r\n */\r\n thinInstanceEnablePicking: boolean;\r\n\r\n /**\r\n * Indicates that a buffer created as static should be recreated if the buffer is updated (by calling thinInstanceSetMatrixAt or thinInstanceSetAttributeAt, for eg.)\r\n * If this flag is false (the default behavior), a buffer created as \"static\" won't show any update done to it, and will stay the same as it was created.\r\n * Note however that recreating a buffer each time there's a change will have some performance cost, that's why it is set to false by default.\r\n * You should set this flag to true only if your static buffers should change infrequently. If they change frequently, you should create your buffers as \"dynamic\" instead.\r\n */\r\n thinInstanceAllowAutomaticStaticBufferRecreation: boolean;\r\n\r\n /**\r\n * Creates a new thin instance\r\n * @param matrix the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc\r\n */\r\n thinInstanceAdd(matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh?: boolean): number;\r\n\r\n /**\r\n * Adds the transformation (matrix) of the current mesh as a thin instance\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number\r\n */\r\n thinInstanceAddSelf(refresh?: boolean): number;\r\n\r\n /**\r\n * Registers a custom attribute to be used with thin instances\r\n * @param kind name of the attribute\r\n * @param stride size in floats of the attribute\r\n */\r\n thinInstanceRegisterAttribute(kind: string, stride: number): void;\r\n\r\n /**\r\n * Sets the matrix of a thin instance\r\n * @param index index of the thin instance\r\n * @param matrix matrix to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetMatrixAt(index: number, matrix: DeepImmutableObject<Matrix>, refresh?: boolean): void;\r\n\r\n /**\r\n * Sets the value of a custom attribute for a thin instance\r\n * @param kind name of the attribute\r\n * @param index index of the thin instance\r\n * @param value value to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetAttributeAt(kind: string, index: number, value: Array<number>, refresh?: boolean): void;\r\n\r\n /**\r\n * Gets / sets the number of thin instances to display. Note that you can't set a number higher than what the underlying buffer can handle.\r\n */\r\n thinInstanceCount: number;\r\n\r\n /**\r\n * Sets a buffer to be used with thin instances. This method is a faster way to setup multiple instances than calling thinInstanceAdd repeatedly\r\n * @param kind name of the attribute. Use \"matrix\" to setup the buffer of matrices\r\n * @param buffer buffer to set\r\n * @param stride size in floats of each value of the buffer\r\n * @param staticBuffer indicates that the buffer is static, so that you won't change it after it is set (better performances - true by default)\r\n */\r\n thinInstanceSetBuffer(kind: string, buffer: Nullable<Float32Array>, stride?: number, staticBuffer?: boolean): void;\r\n\r\n /**\r\n * Gets the list of world matrices\r\n * @returns an array containing all the world matrices from the thin instances\r\n */\r\n thinInstanceGetWorldMatrices(): Matrix[];\r\n\r\n /**\r\n * Synchronize the gpu buffers with a thin instance buffer. Call this method if you update later on the buffers passed to thinInstanceSetBuffer\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n */\r\n thinInstanceBufferUpdated(kind: string): void;\r\n\r\n /**\r\n * Applies a partial update to a buffer directly on the GPU\r\n * Note that the buffer located on the CPU is NOT updated! It's up to you to update it (or not) with the same data you pass to this method\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n * @param data the data to set in the GPU buffer\r\n * @param offset the offset in the GPU buffer where to update the data\r\n */\r\n thinInstancePartialBufferUpdate(kind: string, data: Float32Array, offset: number): void;\r\n\r\n /**\r\n * Refreshes the bounding info, taking into account all the thin instances defined\r\n * @param forceRefreshParentInfo true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\r\n */\r\n thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean): void;\r\n\r\n /** @internal */\r\n _thinInstanceInitializeUserStorage(): void;\r\n\r\n /** @internal */\r\n _thinInstanceUpdateBufferSize(kind: string, numInstances?: number): void;\r\n\r\n /** @internal */\r\n _thinInstanceCreateMatrixBuffer(kind: string, buffer: Nullable<Float32Array>, staticBuffer: boolean): Buffer;\r\n\r\n /** @internal */\r\n _thinInstanceRecreateBuffer(kind: string, staticBuffer?: boolean): void;\r\n\r\n /** @internal */\r\n _userThinInstanceBuffersStorage: {\r\n data: { [key: string]: Float32Array };\r\n sizes: { [key: string]: number };\r\n vertexBuffers: { [key: string]: Nullable<VertexBuffer> };\r\n strides: { [key: string]: number };\r\n };\r\n }\r\n}\r\n\r\nMesh.prototype.thinInstanceAdd = function (matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh: boolean = true): number {\r\n if (!this.getScene().getEngine().getCaps().instancedArrays) {\r\n Logger.Error(\"Thin Instances are not supported on this device as Instanced Array extension not supported\");\r\n return -1;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n\r\n const index = this._thinInstanceDataStorage.instancesCount;\r\n\r\n if (Array.isArray(matrix)) {\r\n for (let i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], i === matrix.length - 1 && refresh);\r\n }\r\n } else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nMesh.prototype.thinInstanceAddSelf = function (refresh: boolean = true): number {\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n};\r\n\r\nMesh.prototype.thinInstanceRegisterAttribute = function (kind: string, stride: number): void {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this.removeVerticesData(kind);\r\n\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userThinInstanceBuffersStorage.data[kind], kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n};\r\n\r\nMesh.prototype.thinInstanceSetMatrixAt = function (index: number, matrix: DeepImmutableObject<Matrix>, refresh: boolean = true): boolean {\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n matrix.copyToArray(matrixData, index * 16);\r\n\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix as Matrix;\r\n }\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n\r\n return true;\r\n};\r\n\r\nMesh.prototype.thinInstanceSetAttributeAt = function (kind: string, index: number, value: Array<number>, refresh: boolean = true): boolean {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n\r\n return true;\r\n};\r\n\r\nObject.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function (this: Mesh) {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (this: Mesh, value: number) {\r\n const matrixData = this._thinInstanceDataStorage.matrixData ?? this.source?._thinInstanceDataStorage.matrixData;\r\n const numMaxInstances = matrixData ? matrixData.length / 16 : 0;\r\n\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nMesh.prototype._thinInstanceCreateMatrixBuffer = function (kind: string, buffer: Float32Array, staticBuffer: boolean = true): Buffer {\r\n const matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, 16, false, true);\r\n\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n\r\n return matrixBuffer;\r\n};\r\n\r\nMesh.prototype.thinInstanceSetBuffer = function (kind: string, buffer: Nullable<Float32Array>, stride: number = 0, staticBuffer: boolean = true): void {\r\n stride = stride || 16;\r\n\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", buffer, staticBuffer);\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n } else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n } else if (kind === \"previousMatrix\") {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n this._thinInstanceDataStorage.previousMatrixData = buffer;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", buffer, staticBuffer);\r\n }\r\n } else {\r\n // color for instanced mesh is ColorInstanceKind and not ColorKind because of native that needs to do the differenciation\r\n // hot switching kind here to preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (buffer === null) {\r\n if (this._userThinInstanceBuffersStorage?.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n } else {\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstanceBufferUpdated = function (kind: string): void {\r\n if (kind === \"matrix\") {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && this._thinInstanceDataStorage.matrixBuffer && !this._thinInstanceDataStorage.matrixBuffer.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"previousMatrix\") {\r\n if (\r\n this.thinInstanceAllowAutomaticStaticBufferRecreation &&\r\n this._thinInstanceDataStorage.previousMatrixBuffer &&\r\n !this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()\r\n ) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && !this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstancePartialBufferUpdate = function (kind: string, data: Float32Array, offset: number): void {\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(data, offset);\r\n }\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(data, offset);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstanceGetWorldMatrices = function (): Matrix[] {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = [] as Matrix[];\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n};\r\n\r\nMesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo: boolean = false, applySkeleton: boolean = false, applyMorph: boolean = false) {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n\r\n const vectors = this._thinInstanceDataStorage.boundingVectors;\r\n\r\n if (forceRefreshParentInfo || !this.rawBoundingInfo) {\r\n vectors.length = 0;\r\n this.refreshBoundingInfo(applySkeleton, applyMorph);\r\n const boundingInfo = this.getBoundingInfo();\r\n this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n const boundingInfo = this.getBoundingInfo();\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (vectors.length === 0) {\r\n for (let v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n\r\n for (let v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n\r\n this._updateBoundingInfo();\r\n};\r\n\r\nMesh.prototype._thinInstanceRecreateBuffer = function (kind: string, staticBuffer: boolean = true) {\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", this._thinInstanceDataStorage.matrixData, staticBuffer);\r\n } else if (kind === \"previousMatrix\") {\r\n if (this._scene.needsPreviousWorldMatrices) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\r\n \"previousWorld\",\r\n this._thinInstanceDataStorage.previousMatrixData ?? this._thinInstanceDataStorage.matrixData,\r\n staticBuffer\r\n );\r\n }\r\n } else {\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n !staticBuffer,\r\n false,\r\n this._userThinInstanceBuffersStorage.strides[kind],\r\n true\r\n );\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n};\r\n\r\nMesh.prototype._thinInstanceUpdateBufferSize = function (kind: string, numInstances: number = 1) {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n const kindIsMatrix = kind === \"matrix\";\r\n\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n\r\n const stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n const currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n let data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n\r\n const bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n\r\n let newSize = currentSize;\r\n\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n } else {\r\n const newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n\r\n if (kindIsMatrix) {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", data, false);\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", data, false);\r\n }\r\n } else {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n};\r\n\r\nMesh.prototype._disposeThinInstanceSpecificData = function () {\r\n if (this._thinInstanceDataStorage?.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n};\r\n"]}
|
|
1
|
+
{"version":3,"file":"thinInstanceMesh.js","sourceRoot":"","sources":["../../../../dev/core/src/Meshes/thinInstanceMesh.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,mCAAkC;AA0HzD,IAAI,CAAC,SAAS,CAAC,eAAe,GAAG,UAAU,MAAwE,EAAE,UAAmB,IAAI;IACxI,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,CAAC,eAAe,EAAE,CAAC;QACzD,MAAM,CAAC,KAAK,CAAC,4FAA4F,CAAC,CAAC;QAC3G,OAAO,CAAC,CAAC,CAAC;IACd,CAAC;IAED,IAAI,CAAC,6BAA6B,CAAC,QAAQ,EAAE,K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,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,YAAY,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;YAErI,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,+BAA+B,CAAC,aAAa,CAAC,IAAI,CAAE,CAAC,CAAC;QACtF,CAAC;IACL,CAAC;AACL,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,CAAC,kCAAkC,GAAG;IAChD,IAAI,CAAC,IAAI,CAAC,+BAA+B,EAAE,CAAC;QACxC,IAAI,CAAC,+BAA+B,GAAG;YACnC,IAAI,EAAE,EAAE;YACR,KAAK,EAAE,EAAE;YACT,aAAa,EAAE,EAAE;YACjB,OAAO,EAAE,EAAE;SACd,CAAC;IACN,CAAC;AACL,CAAC,CAAC;AAEF,IAAI,CAAC,SAAS,CAAC,gCAAgC,GAAG;IAC9C,IAAI,IAAI,CAAC,wBAAwB,EAAE,YAAY,EAAE,CAAC;QAC9C,IAAI,CAAC,wBAAwB,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;QACrD,IAAI,CAAC,wBAAwB,CAAC,YAAY,GAAG,IAAI,CAAC;IACtD,CAAC;IACD,IAAI,IAAI,CAAC,wBAAwB,EAAE,oBAAoB,EAAE,CAAC;QACtD,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,CAAC,OAAO,EAAE,CAAC;QAC7D,IAAI,CAAC,wBAAwB,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAC9D,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type { Nullable, DeepImmutableObject } from \"../types\";\r\nimport { Mesh } from \"../Meshes/mesh\";\r\nimport { VertexBuffer, Buffer } from \"../Buffers/buffer\";\r\nimport { Matrix, Vector3, TmpVectors } from \"../Maths/math.vector\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { BoundingInfo } from \"core/Culling/boundingInfo\";\r\n\r\ndeclare module \"./mesh\" {\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n export interface Mesh {\r\n /**\r\n * Gets or sets a boolean defining if we want picking to pick thin instances as well\r\n */\r\n thinInstanceEnablePicking: boolean;\r\n\r\n /**\r\n * Indicates that a buffer created as static should be recreated if the buffer is updated (by calling thinInstanceSetMatrixAt or thinInstanceSetAttributeAt, for eg.)\r\n * If this flag is false (the default behavior), a buffer created as \"static\" won't show any update done to it, and will stay the same as it was created.\r\n * Note however that recreating a buffer each time there's a change will have some performance cost, that's why it is set to false by default.\r\n * You should set this flag to true only if your static buffers should change infrequently. If they change frequently, you should create your buffers as \"dynamic\" instead.\r\n */\r\n thinInstanceAllowAutomaticStaticBufferRecreation: boolean;\r\n\r\n /**\r\n * Creates a new thin instance\r\n * @param matrix the matrix or array of matrices (position, rotation, scale) of the thin instance(s) to create\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number. If you pass an array of matrices, other instance indexes are index+1, index+2, etc\r\n */\r\n thinInstanceAdd(matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh?: boolean): number;\r\n\r\n /**\r\n * Adds the transformation (matrix) of the current mesh as a thin instance\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n * @returns the thin instance index number\r\n */\r\n thinInstanceAddSelf(refresh?: boolean): number;\r\n\r\n /**\r\n * Registers a custom attribute to be used with thin instances\r\n * @param kind name of the attribute\r\n * @param stride size in floats of the attribute\r\n */\r\n thinInstanceRegisterAttribute(kind: string, stride: number): void;\r\n\r\n /**\r\n * Sets the matrix of a thin instance\r\n * @param index index of the thin instance\r\n * @param matrix matrix to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetMatrixAt(index: number, matrix: DeepImmutableObject<Matrix>, refresh?: boolean): void;\r\n\r\n /**\r\n * Sets the value of a custom attribute for a thin instance\r\n * @param kind name of the attribute\r\n * @param index index of the thin instance\r\n * @param value value to set\r\n * @param refresh true to refresh the underlying gpu buffer (default: true). If you do multiple calls to this method in a row, set refresh to true only for the last call to save performance\r\n */\r\n thinInstanceSetAttributeAt(kind: string, index: number, value: Array<number>, refresh?: boolean): void;\r\n\r\n /**\r\n * Gets / sets the number of thin instances to display. Note that you can't set a number higher than what the underlying buffer can handle.\r\n */\r\n thinInstanceCount: number;\r\n\r\n /**\r\n * Sets a buffer to be used with thin instances. This method is a faster way to setup multiple instances than calling thinInstanceAdd repeatedly\r\n * @param kind name of the attribute. Use \"matrix\" to setup the buffer of matrices\r\n * @param buffer buffer to set\r\n * @param stride size in floats of each value of the buffer\r\n * @param staticBuffer indicates that the buffer is static, so that you won't change it after it is set (better performances - true by default)\r\n */\r\n thinInstanceSetBuffer(kind: string, buffer: Nullable<Float32Array>, stride?: number, staticBuffer?: boolean): void;\r\n\r\n /**\r\n * Gets the list of world matrices\r\n * @returns an array containing all the world matrices from the thin instances\r\n */\r\n thinInstanceGetWorldMatrices(): Matrix[];\r\n\r\n /**\r\n * Synchronize the gpu buffers with a thin instance buffer. Call this method if you update later on the buffers passed to thinInstanceSetBuffer\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n */\r\n thinInstanceBufferUpdated(kind: string): void;\r\n\r\n /**\r\n * Applies a partial update to a buffer directly on the GPU\r\n * Note that the buffer located on the CPU is NOT updated! It's up to you to update it (or not) with the same data you pass to this method\r\n * @param kind name of the attribute to update. Use \"matrix\" to update the buffer of matrices\r\n * @param data the data to set in the GPU buffer\r\n * @param offset the offset in the GPU buffer where to update the data\r\n */\r\n thinInstancePartialBufferUpdate(kind: string, data: Float32Array, offset: number): void;\r\n\r\n /**\r\n * Refreshes the bounding info, taking into account all the thin instances defined\r\n * @param forceRefreshParentInfo true to force recomputing the mesh bounding info and use it to compute the aggregated bounding info\r\n * @param applySkeleton defines whether to apply the skeleton before computing the bounding info\r\n * @param applyMorph defines whether to apply the morph target before computing the bounding info\r\n */\r\n thinInstanceRefreshBoundingInfo(forceRefreshParentInfo?: boolean, applySkeleton?: boolean, applyMorph?: boolean): void;\r\n\r\n /** @internal */\r\n _thinInstanceInitializeUserStorage(): void;\r\n\r\n /** @internal */\r\n _thinInstanceUpdateBufferSize(kind: string, numInstances?: number): void;\r\n\r\n /** @internal */\r\n _thinInstanceCreateMatrixBuffer(kind: string, buffer: Nullable<Float32Array>, staticBuffer: boolean): Buffer;\r\n\r\n /** @internal */\r\n _thinInstanceRecreateBuffer(kind: string, staticBuffer?: boolean): void;\r\n\r\n /** @internal */\r\n _userThinInstanceBuffersStorage: {\r\n data: { [key: string]: Float32Array };\r\n sizes: { [key: string]: number };\r\n vertexBuffers: { [key: string]: Nullable<VertexBuffer> };\r\n strides: { [key: string]: number };\r\n };\r\n }\r\n}\r\n\r\nMesh.prototype.thinInstanceAdd = function (matrix: DeepImmutableObject<Matrix> | Array<DeepImmutableObject<Matrix>>, refresh: boolean = true): number {\r\n if (!this.getScene().getEngine().getCaps().instancedArrays) {\r\n Logger.Error(\"Thin Instances are not supported on this device as Instanced Array extension not supported\");\r\n return -1;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(\"matrix\", Array.isArray(matrix) ? matrix.length : 1);\r\n\r\n const index = this._thinInstanceDataStorage.instancesCount;\r\n\r\n if (Array.isArray(matrix)) {\r\n for (let i = 0; i < matrix.length; ++i) {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix[i], i === matrix.length - 1 && refresh);\r\n }\r\n } else {\r\n this.thinInstanceSetMatrixAt(this._thinInstanceDataStorage.instancesCount++, matrix, refresh);\r\n }\r\n\r\n return index;\r\n};\r\n\r\nMesh.prototype.thinInstanceAddSelf = function (refresh: boolean = true): number {\r\n return this.thinInstanceAdd(Matrix.IdentityReadOnly, refresh);\r\n};\r\n\r\nMesh.prototype.thinInstanceRegisterAttribute = function (kind: string, stride: number): void {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this.removeVerticesData(kind);\r\n\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = stride * Math.max(32, this._thinInstanceDataStorage.instancesCount); // Initial size\r\n this._userThinInstanceBuffersStorage.data[kind] = new Float32Array(this._userThinInstanceBuffersStorage.sizes[kind]);\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), this._userThinInstanceBuffersStorage.data[kind], kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n};\r\n\r\nMesh.prototype.thinInstanceSetMatrixAt = function (index: number, matrix: DeepImmutableObject<Matrix>, refresh: boolean = true): boolean {\r\n if (!this._thinInstanceDataStorage.matrixData || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n matrix.copyToArray(matrixData, index * 16);\r\n\r\n if (this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices[index] = matrix as Matrix;\r\n }\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(\"matrix\");\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n }\r\n\r\n return true;\r\n};\r\n\r\nMesh.prototype.thinInstanceSetAttributeAt = function (kind: string, index: number, value: Array<number>, refresh: boolean = true): boolean {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.data[kind] || index >= this._thinInstanceDataStorage.instancesCount) {\r\n return false;\r\n }\r\n\r\n this._thinInstanceUpdateBufferSize(kind, 0); // make sur the buffer for the kind attribute is big enough\r\n\r\n this._userThinInstanceBuffersStorage.data[kind].set(value, index * this._userThinInstanceBuffersStorage.strides[kind]);\r\n\r\n if (refresh) {\r\n this.thinInstanceBufferUpdated(kind);\r\n }\r\n\r\n return true;\r\n};\r\n\r\nObject.defineProperty(Mesh.prototype, \"thinInstanceCount\", {\r\n get: function (this: Mesh) {\r\n return this._thinInstanceDataStorage.instancesCount;\r\n },\r\n set: function (this: Mesh, value: number) {\r\n const matrixData = this._thinInstanceDataStorage.matrixData ?? this.source?._thinInstanceDataStorage.matrixData;\r\n const numMaxInstances = matrixData ? matrixData.length / 16 : 0;\r\n\r\n if (value <= numMaxInstances) {\r\n this._thinInstanceDataStorage.instancesCount = value;\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true,\r\n});\r\n\r\nMesh.prototype._thinInstanceCreateMatrixBuffer = function (kind: string, buffer: Float32Array, staticBuffer: boolean = true): Buffer {\r\n const matrixBuffer = new Buffer(this.getEngine(), buffer, !staticBuffer, 16, false, true);\r\n\r\n for (let i = 0; i < 4; i++) {\r\n this.setVerticesBuffer(matrixBuffer.createVertexBuffer(kind + i, i * 4, 4));\r\n }\r\n\r\n return matrixBuffer;\r\n};\r\n\r\nMesh.prototype.thinInstanceSetBuffer = function (kind: string, buffer: Nullable<Float32Array>, stride: number = 0, staticBuffer: boolean = true): void {\r\n stride = stride || 16;\r\n\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n this._thinInstanceDataStorage.matrixBufferSize = buffer ? buffer.length : 32 * stride;\r\n this._thinInstanceDataStorage.matrixData = buffer;\r\n this._thinInstanceDataStorage.worldMatrices = null;\r\n\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.instancesCount = buffer.length / stride;\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", buffer, staticBuffer);\r\n\r\n if (!this.doNotSyncBoundingInfo) {\r\n this.thinInstanceRefreshBoundingInfo(false);\r\n }\r\n } else {\r\n this._thinInstanceDataStorage.instancesCount = 0;\r\n if (!this.doNotSyncBoundingInfo) {\r\n // mesh has no more thin instances, so need to recompute the bounding box because it's the regular mesh that will now be displayed\r\n this.refreshBoundingInfo();\r\n }\r\n }\r\n } else if (kind === \"previousMatrix\") {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n this._thinInstanceDataStorage.previousMatrixData = buffer;\r\n if (buffer !== null) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", buffer, staticBuffer);\r\n }\r\n } else {\r\n // color for instanced mesh is ColorInstanceKind and not ColorKind because of native that needs to do the differenciation\r\n // hot switching kind here to preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (buffer === null) {\r\n if (this._userThinInstanceBuffersStorage?.data[kind]) {\r\n this.removeVerticesData(kind);\r\n delete this._userThinInstanceBuffersStorage.data[kind];\r\n delete this._userThinInstanceBuffersStorage.strides[kind];\r\n delete this._userThinInstanceBuffersStorage.sizes[kind];\r\n delete this._userThinInstanceBuffersStorage.vertexBuffers[kind];\r\n }\r\n } else {\r\n this._thinInstanceInitializeUserStorage();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = buffer;\r\n this._userThinInstanceBuffersStorage.strides[kind] = stride;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = buffer.length;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), buffer, kind, !staticBuffer, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstanceBufferUpdated = function (kind: string): void {\r\n if (kind === \"matrix\") {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && this._thinInstanceDataStorage.matrixBuffer && !this._thinInstanceDataStorage.matrixBuffer.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.matrixBuffer?.updateDirectly(this._thinInstanceDataStorage.matrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else if (kind === \"previousMatrix\") {\r\n if (\r\n this.thinInstanceAllowAutomaticStaticBufferRecreation &&\r\n this._thinInstanceDataStorage.previousMatrixBuffer &&\r\n !this._thinInstanceDataStorage.previousMatrixBuffer.isUpdatable()\r\n ) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.updateDirectly(this._thinInstanceDataStorage.previousMatrixData!, 0, this._thinInstanceDataStorage.instancesCount);\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n if (this.thinInstanceAllowAutomaticStaticBufferRecreation && !this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.isUpdatable()) {\r\n this._thinInstanceRecreateBuffer(kind);\r\n }\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(this._userThinInstanceBuffersStorage.data[kind], 0);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstancePartialBufferUpdate = function (kind: string, data: Float32Array, offset: number): void {\r\n if (kind === \"matrix\") {\r\n if (this._thinInstanceDataStorage.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.updateDirectly(data, offset);\r\n }\r\n } else {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n if (this._userThinInstanceBuffersStorage?.vertexBuffers[kind]) {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]!.updateDirectly(data, offset);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype.thinInstanceGetWorldMatrices = function (): Matrix[] {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return [];\r\n }\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (!this._thinInstanceDataStorage.worldMatrices) {\r\n this._thinInstanceDataStorage.worldMatrices = [] as Matrix[];\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n this._thinInstanceDataStorage.worldMatrices[i] = Matrix.FromArray(matrixData, i * 16);\r\n }\r\n }\r\n\r\n return this._thinInstanceDataStorage.worldMatrices;\r\n};\r\n\r\nMesh.prototype.thinInstanceRefreshBoundingInfo = function (forceRefreshParentInfo: boolean = false, applySkeleton: boolean = false, applyMorph: boolean = false) {\r\n if (!this._thinInstanceDataStorage.matrixData || !this._thinInstanceDataStorage.matrixBuffer) {\r\n return;\r\n }\r\n\r\n const vectors = this._thinInstanceDataStorage.boundingVectors;\r\n\r\n if (forceRefreshParentInfo || !this.rawBoundingInfo) {\r\n vectors.length = 0;\r\n this.refreshBoundingInfo(applySkeleton, applyMorph);\r\n const boundingInfo = this.getBoundingInfo();\r\n this.rawBoundingInfo = new BoundingInfo(boundingInfo.minimum, boundingInfo.maximum);\r\n }\r\n\r\n const boundingInfo = this.getBoundingInfo();\r\n const matrixData = this._thinInstanceDataStorage.matrixData;\r\n\r\n if (vectors.length === 0) {\r\n for (let v = 0; v < boundingInfo.boundingBox.vectors.length; ++v) {\r\n vectors.push(boundingInfo.boundingBox.vectors[v].clone());\r\n }\r\n }\r\n\r\n TmpVectors.Vector3[0].setAll(Number.POSITIVE_INFINITY); // min\r\n TmpVectors.Vector3[1].setAll(Number.NEGATIVE_INFINITY); // max\r\n\r\n for (let i = 0; i < this._thinInstanceDataStorage.instancesCount; ++i) {\r\n Matrix.FromArrayToRef(matrixData, i * 16, TmpVectors.Matrix[0]);\r\n\r\n for (let v = 0; v < vectors.length; ++v) {\r\n Vector3.TransformCoordinatesToRef(vectors[v], TmpVectors.Matrix[0], TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[0].minimizeInPlace(TmpVectors.Vector3[2]);\r\n TmpVectors.Vector3[1].maximizeInPlace(TmpVectors.Vector3[2]);\r\n }\r\n }\r\n\r\n boundingInfo.reConstruct(TmpVectors.Vector3[0], TmpVectors.Vector3[1]);\r\n\r\n this._updateBoundingInfo();\r\n};\r\n\r\nMesh.prototype._thinInstanceRecreateBuffer = function (kind: string, staticBuffer: boolean = true) {\r\n if (kind === \"matrix\") {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", this._thinInstanceDataStorage.matrixData, staticBuffer);\r\n } else if (kind === \"previousMatrix\") {\r\n if (this._scene.needsPreviousWorldMatrices) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\r\n \"previousWorld\",\r\n this._thinInstanceDataStorage.previousMatrixData ?? this._thinInstanceDataStorage.matrixData,\r\n staticBuffer\r\n );\r\n }\r\n } else {\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(\r\n this.getEngine(),\r\n this._userThinInstanceBuffersStorage.data[kind],\r\n kind,\r\n !staticBuffer,\r\n false,\r\n this._userThinInstanceBuffersStorage.strides[kind],\r\n true\r\n );\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n};\r\n\r\nMesh.prototype._thinInstanceUpdateBufferSize = function (kind: string, numInstances: number = 1) {\r\n // preserve backward compatibility\r\n if (kind === VertexBuffer.ColorKind) {\r\n kind = VertexBuffer.ColorInstanceKind;\r\n }\r\n\r\n const kindIsMatrix = kind === \"matrix\";\r\n\r\n if (!kindIsMatrix && (!this._userThinInstanceBuffersStorage || !this._userThinInstanceBuffersStorage.strides[kind])) {\r\n return;\r\n }\r\n\r\n const stride = kindIsMatrix ? 16 : this._userThinInstanceBuffersStorage.strides[kind];\r\n const currentSize = kindIsMatrix ? this._thinInstanceDataStorage.matrixBufferSize : this._userThinInstanceBuffersStorage.sizes[kind];\r\n let data = kindIsMatrix ? this._thinInstanceDataStorage.matrixData : this._userThinInstanceBuffersStorage.data[kind];\r\n\r\n const bufferSize = (this._thinInstanceDataStorage.instancesCount + numInstances) * stride;\r\n\r\n let newSize = currentSize;\r\n\r\n while (newSize < bufferSize) {\r\n newSize *= 2;\r\n }\r\n\r\n if (!data || currentSize != newSize) {\r\n if (!data) {\r\n data = new Float32Array(newSize);\r\n } else {\r\n const newData = new Float32Array(newSize);\r\n newData.set(data, 0);\r\n data = newData;\r\n }\r\n\r\n if (kindIsMatrix) {\r\n this._thinInstanceDataStorage.matrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = this._thinInstanceCreateMatrixBuffer(\"world\", data, false);\r\n this._thinInstanceDataStorage.matrixData = data;\r\n this._thinInstanceDataStorage.matrixBufferSize = newSize;\r\n if (this._scene.needsPreviousWorldMatrices && !this._thinInstanceDataStorage.previousMatrixData) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer?.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = this._thinInstanceCreateMatrixBuffer(\"previousWorld\", data, false);\r\n }\r\n } else {\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind]?.dispose();\r\n\r\n this._userThinInstanceBuffersStorage.data[kind] = data;\r\n this._userThinInstanceBuffersStorage.sizes[kind] = newSize;\r\n this._userThinInstanceBuffersStorage.vertexBuffers[kind] = new VertexBuffer(this.getEngine(), data, kind, true, false, stride, true);\r\n\r\n this.setVerticesBuffer(this._userThinInstanceBuffersStorage.vertexBuffers[kind]!);\r\n }\r\n }\r\n};\r\n\r\nMesh.prototype._thinInstanceInitializeUserStorage = function () {\r\n if (!this._userThinInstanceBuffersStorage) {\r\n this._userThinInstanceBuffersStorage = {\r\n data: {},\r\n sizes: {},\r\n vertexBuffers: {},\r\n strides: {},\r\n };\r\n }\r\n};\r\n\r\nMesh.prototype._disposeThinInstanceSpecificData = function () {\r\n if (this._thinInstanceDataStorage?.matrixBuffer) {\r\n this._thinInstanceDataStorage.matrixBuffer.dispose();\r\n this._thinInstanceDataStorage.matrixBuffer = null;\r\n }\r\n if (this._thinInstanceDataStorage?.previousMatrixBuffer) {\r\n this._thinInstanceDataStorage.previousMatrixBuffer.dispose();\r\n this._thinInstanceDataStorage.previousMatrixBuffer = null;\r\n }\r\n};\r\n"]}
|
|
@@ -207,7 +207,8 @@ export class SnapshotRenderingHelper {
|
|
|
207
207
|
if (mesh.subMeshes) {
|
|
208
208
|
const sourceMesh = mesh;
|
|
209
209
|
for (const subMesh of sourceMesh.subMeshes) {
|
|
210
|
-
|
|
210
|
+
const batch = sourceMesh._getInstancesRenderList(subMesh._id);
|
|
211
|
+
sourceMesh._updateInstancedBuffers(subMesh, batch, batch.parent.instancesBufferSize, this._engine);
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
return true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snapshotRenderingHelper.js","sourceRoot":"","sources":["../../../../dev/core/src/Misc/snapshotRenderingHelper.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,yBAAyB,EAAE,iDAAgD;AAEpF,OAAO,EAAE,MAAM,EAAE,oBAAyB;AAiB1C;;GAEG;AACH,MAAM,OAAO,uBAAuB;IAmBhC;;;;;;OAMG;IACH,YAAY,KAAY,EAAE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G,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} 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\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 // Animate skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\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 }\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 sourceMesh._updateInstancedBuffers(subMesh, sourceMesh._getInstancesRenderList(subMesh._id), sourceMesh._instanceDataStorage.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 effectLayer The effect layer\r\n * @param autoUpdate If true, the helper will automatically update the effect layer meshes 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(effectLayer: EffectLayer, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = effectLayer.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 = 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 _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":"AAcA,OAAO,EAAE,SAAS,EAAE,gCAA+B;AACnD,OAAO,EAAE,yBAAyB,EAAE,iDAAgD;AAEpF,OAAO,EAAE,MAAM,EAAE,oBAAyB;AAiB1C;;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,k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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} 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\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 // Animate skeletons\r\n for (const skeleton of scene.skeletons) {\r\n skeleton.prepare(true);\r\n }\r\n\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 }\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 effectLayer The effect layer\r\n * @param autoUpdate If true, the helper will automatically update the effect layer meshes 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(effectLayer: EffectLayer, autoUpdate = true) {\r\n if (!this._engine.isWebGPU) {\r\n return;\r\n }\r\n\r\n const renderPassId = effectLayer.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 = 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 _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"]}
|
|
@@ -17,6 +17,10 @@ import type { AbstractMesh } from "../Meshes/abstractMesh.js";
|
|
|
17
17
|
* A particle system represents a way to manage particles from their emission to their animation and rendering.
|
|
18
18
|
*/
|
|
19
19
|
export interface IParticleSystem {
|
|
20
|
+
/**
|
|
21
|
+
* Gets or sets the unique id of the particle system.
|
|
22
|
+
*/
|
|
23
|
+
uniqueId: number;
|
|
20
24
|
/**
|
|
21
25
|
* List of animations used by the particle system.
|
|
22
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Returns true if the particle system was generated by a node particle system set\r\n */\r\n isNodeGenerated: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is started\r\n */\r\n onStartedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"IParticleSystem.js","sourceRoot":"","sources":["../../../../dev/core/src/Particles/IParticleSystem.ts"],"names":[],"mappings":"","sourcesContent":["import type { Immutable, Nullable } from \"../types\";\r\nimport type { Vector2, Vector3, Matrix } from \"../Maths/math.vector\";\r\nimport type { Color3, Color4 } from \"../Maths/math.color\";\r\nimport type { BaseTexture } from \"../Materials/Textures/baseTexture\";\r\nimport type {\r\n BoxParticleEmitter,\r\n IParticleEmitterType,\r\n PointParticleEmitter,\r\n HemisphericParticleEmitter,\r\n SphereParticleEmitter,\r\n SphereDirectedParticleEmitter,\r\n CylinderParticleEmitter,\r\n CylinderDirectedParticleEmitter,\r\n ConeParticleEmitter,\r\n ConeDirectedParticleEmitter,\r\n} from \"../Particles/EmitterTypes/index\";\r\nimport type { Scene } from \"../scene\";\r\nimport type { ColorGradient, FactorGradient, Color3Gradient } from \"../Misc/gradients\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport type { Observable } from \"../Misc/observable\";\r\nimport type { VertexBuffer } from \"../Buffers/buffer\";\r\nimport type { DataBuffer } from \"../Buffers/dataBuffer\";\r\n\r\nimport type { Animation } from \"../Animations/animation\";\r\nimport type { AbstractMesh } from \"../Meshes/abstractMesh\";\r\n\r\n/**\r\n * Interface representing a particle system in Babylon.js.\r\n * This groups the common functionalities that needs to be implemented in order to create a particle system.\r\n * A particle system represents a way to manage particles from their emission to their animation and rendering.\r\n */\r\nexport interface IParticleSystem {\r\n /**\r\n * Gets or sets the unique id of the particle system.\r\n */\r\n uniqueId: number;\r\n\r\n /**\r\n * List of animations used by the particle system.\r\n */\r\n animations: Animation[];\r\n /**\r\n * The id of the Particle system.\r\n */\r\n id: string;\r\n /**\r\n * The name of the Particle system.\r\n */\r\n name: string;\r\n /**\r\n * The emitter represents the Mesh or position we are attaching the particle system to.\r\n */\r\n emitter: Nullable<AbstractMesh | Vector3>;\r\n /**\r\n * Gets or sets a boolean indicating if the particles must be rendered as billboard or aligned with the direction\r\n */\r\n isBillboardBased: boolean;\r\n /**\r\n * The rendering group used by the Particle system to chose when to render.\r\n */\r\n renderingGroupId: number;\r\n /**\r\n * The layer mask we are rendering the particles through.\r\n */\r\n layerMask: number;\r\n\r\n /**\r\n * The overall motion speed (0.01 is default update speed, faster updates = faster animation)\r\n */\r\n updateSpeed: number;\r\n\r\n /**\r\n * The amount of time the particle system is running (depends of the overall update speed).\r\n */\r\n targetStopDuration: number;\r\n\r\n /**\r\n * The texture used to render each particle. (this can be a spritesheet)\r\n */\r\n particleTexture: Nullable<BaseTexture>;\r\n\r\n /**\r\n * Blend mode use to render the particle. It can be any of the ParticleSystem.BLENDMODE_* constants\r\n */\r\n blendMode: number;\r\n\r\n /**\r\n * Minimum life time of emitting particles.\r\n */\r\n minLifeTime: number;\r\n /**\r\n * Maximum life time of emitting particles.\r\n */\r\n maxLifeTime: number;\r\n\r\n /**\r\n * Minimum Size of emitting particles.\r\n */\r\n minSize: number;\r\n /**\r\n * Maximum Size of emitting particles.\r\n */\r\n maxSize: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on X axis.\r\n */\r\n minScaleX: number;\r\n /**\r\n * Maximum scale of emitting particles on X axis.\r\n */\r\n maxScaleX: number;\r\n\r\n /**\r\n * Minimum scale of emitting particles on Y axis.\r\n */\r\n minScaleY: number;\r\n /**\r\n * Maximum scale of emitting particles on Y axis.\r\n */\r\n maxScaleY: number;\r\n\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color1: Color4;\r\n /**\r\n * Random color of each particle after it has been emitted, between color1 and color2 vectors.\r\n */\r\n color2: Color4;\r\n\r\n /**\r\n * Color the particle will have at the end of its lifetime.\r\n */\r\n colorDead: Color4;\r\n\r\n /**\r\n * The maximum number of particles to emit per frame until we reach the activeParticleCount value\r\n */\r\n emitRate: number;\r\n\r\n /**\r\n * You can use gravity if you want to give an orientation to your particles.\r\n */\r\n gravity: Vector3;\r\n\r\n /**\r\n * Minimum power of emitting particles.\r\n */\r\n minEmitPower: number;\r\n /**\r\n * Maximum power of emitting particles.\r\n */\r\n maxEmitPower: number;\r\n /**\r\n * Minimum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n minAngularSpeed: number;\r\n /**\r\n * Maximum angular speed of emitting particles (Z-axis rotation for each particle).\r\n */\r\n maxAngularSpeed: number;\r\n /**\r\n * Gets or sets the minimal initial rotation in radians.\r\n */\r\n minInitialRotation: number;\r\n /**\r\n * Gets or sets the maximal initial rotation in radians.\r\n */\r\n maxInitialRotation: number;\r\n /**\r\n * The particle emitter type defines the emitter used by the particle system.\r\n * It can be for example box, sphere, or cone...\r\n */\r\n particleEmitterType: Nullable<IParticleEmitterType>;\r\n /**\r\n * Defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n startDelay: number;\r\n /**\r\n * Gets or sets a value indicating how many cycles (or frames) must be executed before first rendering (this value has to be set before starting the system). Default is 0\r\n */\r\n preWarmCycles: number;\r\n /**\r\n * Gets or sets a value indicating the time step multiplier to use in pre-warm mode (default is 1)\r\n */\r\n preWarmStepOffset: number;\r\n\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the speed of the sprite loop (default is 1 meaning the animation will play once during the entire particle lifetime)\r\n */\r\n spriteCellChangeSpeed: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the first sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n startSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled) defines the last sprite cell to display\r\n */\r\n // eslint-disable-next-line @typescript-eslint/naming-convention\r\n endSpriteCellID: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines whether the sprite animation is looping\r\n */\r\n spriteCellLoop: boolean;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell width to use\r\n */\r\n spriteCellWidth: number;\r\n /**\r\n * If using a spritesheet (isAnimationSheetEnabled), defines the sprite cell height to use\r\n */\r\n spriteCellHeight: number;\r\n /**\r\n * This allows the system to random pick the start cell ID between startSpriteCellID and endSpriteCellID\r\n */\r\n spriteRandomStartCell: boolean;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if a spritesheet is used to animate the particles texture\r\n */\r\n isAnimationSheetEnabled: boolean;\r\n\r\n /** Gets or sets a Vector2 used to move the pivot (by default (0,0)) */\r\n translationPivot: Vector2;\r\n\r\n /**\r\n * Gets or sets a texture used to add random noise to particle positions\r\n */\r\n noiseTexture: Nullable<BaseTexture>;\r\n\r\n /** Gets or sets the strength to apply to the noise value (default is (10, 10, 10)) */\r\n noiseStrength: Vector3;\r\n\r\n /**\r\n * Gets or sets the billboard mode to use when isBillboardBased = true.\r\n * Value can be: ParticleSystem.BILLBOARDMODE_ALL, ParticleSystem.BILLBOARDMODE_Y, ParticleSystem.BILLBOARDMODE_STRETCHED\r\n */\r\n billboardMode: number;\r\n\r\n /**\r\n * Gets or sets a boolean enabling the use of logarithmic depth buffers, which is good for wide depth buffers.\r\n */\r\n useLogarithmicDepth: boolean;\r\n\r\n /** Gets or sets a value indicating the damping to apply if the limit velocity factor is reached */\r\n limitVelocityDamping: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that hosted animations (in the system.animations array) must be started when system.start() is called\r\n */\r\n beginAnimationOnStart: boolean;\r\n\r\n /**\r\n * Gets or sets the frame to start the animation from when beginAnimationOnStart is true\r\n */\r\n beginAnimationFrom: number;\r\n\r\n /**\r\n * Gets or sets the frame to end the animation on when beginAnimationOnStart is true\r\n */\r\n beginAnimationTo: number;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if animations must loop when beginAnimationOnStart is true\r\n */\r\n beginAnimationLoop: boolean;\r\n\r\n /**\r\n * Specifies whether the particle system will be disposed once it reaches the end of the animation.\r\n */\r\n disposeOnStop: boolean;\r\n\r\n /**\r\n * If you want to launch only a few particles at once, that can be done, as well.\r\n */\r\n manualEmitCount: number;\r\n\r\n /**\r\n * Specifies if the particles are updated in emitter local space or world space\r\n */\r\n isLocal: boolean;\r\n\r\n /** Snippet ID if the particle system was created from the snippet server */\r\n snippetId: string;\r\n\r\n /** Gets or sets a matrix to use to compute projection */\r\n defaultProjectionMatrix: Matrix;\r\n\r\n /** Indicates that the update of particles is done in the animate function (and not in render) */\r\n updateInAnimate: boolean;\r\n\r\n /** @internal */\r\n _wasDispatched: boolean;\r\n\r\n /**\r\n * Returns true if the particle system was generated by a node particle system set\r\n */\r\n isNodeGenerated: boolean;\r\n\r\n /**\r\n * Gets the maximum number of particles active at the same time.\r\n * @returns The max number of active particles.\r\n */\r\n getCapacity(): number;\r\n\r\n /**\r\n * Gets the number of particles active at the same time.\r\n * @returns The number of active particles.\r\n */\r\n getActiveCount(): number;\r\n\r\n /**\r\n * Gets if the system has been started. (Note: this will still be true after stop is called)\r\n * @returns True if it has been started, otherwise false.\r\n */\r\n isStarted(): boolean;\r\n\r\n /**\r\n * Animates the particle system for this frame.\r\n */\r\n animate(): void;\r\n /**\r\n * Renders the particle system in its current state.\r\n * @returns the current number of particles\r\n */\r\n render(): number;\r\n /**\r\n * Dispose the particle system and frees its associated resources.\r\n * @param disposeTexture defines if the particle texture must be disposed as well (true by default)\r\n * @param disposeAttachedSubEmitters defines if the attached sub-emitters must be disposed as well (false by default)\r\n * @param disposeEndSubEmitters defines if the end type sub-emitters must be disposed as well (false by default)\r\n */\r\n dispose(disposeTexture?: boolean, disposeAttachedSubEmitters?: boolean, disposeEndSubEmitters?: boolean): void;\r\n /**\r\n * An event triggered when the system is disposed\r\n */\r\n onDisposeObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is stopped\r\n */\r\n onStoppedObservable: Observable<IParticleSystem>;\r\n /**\r\n * An event triggered when the system is started\r\n */\r\n onStartedObservable: Observable<IParticleSystem>;\r\n /**\r\n * Clones the particle system.\r\n * @param name The name of the cloned object\r\n * @param newEmitter The new emitter to use\r\n * @returns the cloned particle system\r\n */\r\n clone(name: string, newEmitter: any): Nullable<IParticleSystem>;\r\n /**\r\n * Serializes the particle system to a JSON object\r\n * @param serializeTexture defines if the texture must be serialized as well\r\n * @returns the JSON object\r\n */\r\n serialize(serializeTexture: boolean): any;\r\n /**\r\n * Rebuild the particle system\r\n */\r\n rebuild(): void;\r\n\r\n /** Force the system to rebuild all gradients that need to be resync */\r\n forceRefreshGradients(): void;\r\n\r\n /**\r\n * Starts the particle system and begins to emit\r\n * @param delay defines the delay in milliseconds before starting the system (0 by default)\r\n */\r\n start(delay?: number): void;\r\n\r\n /**\r\n * Stops the particle system.\r\n */\r\n stop(): void;\r\n\r\n /**\r\n * Remove all active particles\r\n */\r\n reset(): void;\r\n\r\n /**\r\n * Gets a boolean indicating that the system is stopping\r\n * @returns true if the system is currently stopping\r\n */\r\n isStopping(): boolean;\r\n\r\n /**\r\n * Is this system ready to be used/rendered\r\n * @returns true if the system is ready\r\n */\r\n isReady(): boolean;\r\n /**\r\n * Returns the string \"ParticleSystem\"\r\n * @returns a string containing the class name\r\n */\r\n getClassName(): string;\r\n /**\r\n * Gets the custom effect used to render the particles\r\n * @param blendMode Blend mode for which the effect should be retrieved\r\n * @returns The effect\r\n */\r\n getCustomEffect(blendMode: number): Nullable<Effect>;\r\n /**\r\n * Sets the custom effect used to render the particles\r\n * @param effect The effect to set\r\n * @param blendMode Blend mode for which the effect should be set\r\n */\r\n setCustomEffect(effect: Nullable<Effect>, blendMode: number): void;\r\n\r\n /**\r\n * Fill the defines array according to the current settings of the particle system\r\n * @param defines Array to be updated\r\n * @param blendMode blend mode to take into account when updating the array\r\n * @param fillImageProcessing fills the image processing defines\r\n */\r\n fillDefines(defines: Array<string>, blendMode: number, fillImageProcessing?: boolean): void;\r\n /**\r\n * Fill the uniforms, attributes and samplers arrays according to the current settings of the particle system\r\n * @param uniforms Uniforms array to fill\r\n * @param attributes Attributes array to fill\r\n * @param samplers Samplers array to fill\r\n */\r\n fillUniformsAttributesAndSamplerNames(uniforms: Array<string>, attributes: Array<string>, samplers: Array<string>): void;\r\n /**\r\n * Observable that will be called just before the particles are drawn\r\n */\r\n onBeforeDrawParticlesObservable: Observable<Nullable<Effect>>;\r\n /**\r\n * Gets the name of the particle vertex shader\r\n */\r\n vertexShaderName: string;\r\n\r\n /**\r\n * Gets the vertex buffers used by the particle system\r\n */\r\n vertexBuffers: Immutable<{ [key: string]: VertexBuffer }>;\r\n /**\r\n * Gets the index buffer used by the particle system (or null if no index buffer is used)\r\n */\r\n indexBuffer: Nullable<DataBuffer>;\r\n\r\n /**\r\n * Adds a new color gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color1 defines the color to affect to the specified gradient\r\n * @param color2 defines an additional color used to define a range ([color, color2]) with main color to pick the final color from\r\n * @returns the current particle system\r\n */\r\n addColorGradient(gradient: number, color1: Color4, color2?: Color4): IParticleSystem;\r\n /**\r\n * Remove a specific color gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeColorGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new size gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the size factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n /**\r\n * Gets the current list of size gradients.\r\n * You must use addSizeGradient and removeSizeGradient to update this list\r\n * @returns the list of size gradients\r\n */\r\n getSizeGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Gets the current list of angular speed gradients.\r\n * You must use addAngularSpeedGradient and removeAngularSpeedGradient to update this list\r\n * @returns the list of angular speed gradients\r\n */\r\n getAngularSpeedGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new angular speed gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the angular speed to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addAngularSpeedGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific angular speed gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeAngularSpeedGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of velocity gradients.\r\n * You must use addVelocityGradient and removeVelocityGradient to update this list\r\n * @returns the list of velocity gradients\r\n */\r\n getVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of limit velocity gradients.\r\n * You must use addLimitVelocityGradient and removeLimitVelocityGradient to update this list\r\n * @returns the list of limit velocity gradients\r\n */\r\n getLimitVelocityGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new limit velocity gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the limit velocity to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLimitVelocityGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific limit velocity gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLimitVelocityGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Adds a new drag gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the drag to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addDragGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific drag gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeDragGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of drag gradients.\r\n * You must use addDragGradient and removeDragGradient to update this list\r\n * @returns the list of drag gradients\r\n */\r\n getDragGradients(): Nullable<Array<FactorGradient>>;\r\n /**\r\n * Adds a new emit rate gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the emit rate to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addEmitRateGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific emit rate gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeEmitRateGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of emit rate gradients.\r\n * You must use addEmitRateGradient and removeEmitRateGradient to update this list\r\n * @returns the list of emit rate gradients\r\n */\r\n getEmitRateGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new start size gradient (please note that this will only work if you set the targetStopDuration property)\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the start size to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addStartSizeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific start size gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeStartSizeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of start size gradients.\r\n * You must use addStartSizeGradient and removeStartSizeGradient to update this list\r\n * @returns the list of start size gradients\r\n */\r\n getStartSizeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new life time gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param factor defines the life time factor to affect to the specified gradient\r\n * @param factor2 defines an additional factor used to define a range ([factor, factor2]) with main value to pick the final value from\r\n * @returns the current particle system\r\n */\r\n addLifeTimeGradient(gradient: number, factor: number, factor2?: number): IParticleSystem;\r\n /**\r\n * Remove a specific life time gradient\r\n * @param gradient defines the gradient to remove\r\n * @returns the current particle system\r\n */\r\n removeLifeTimeGradient(gradient: number): IParticleSystem;\r\n /**\r\n * Gets the current list of life time gradients.\r\n * You must use addLifeTimeGradient and removeLifeTimeGradient to update this list\r\n * @returns the list of life time gradients\r\n */\r\n getLifeTimeGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Gets the current list of color gradients.\r\n * You must use addColorGradient and removeColorGradient to update this list\r\n * @returns the list of color gradients\r\n */\r\n getColorGradients(): Nullable<Array<ColorGradient>>;\r\n\r\n /**\r\n * Adds a new ramp gradient used to remap particle colors\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param color defines the color to affect to the specified gradient\r\n * @returns the current particle system\r\n */\r\n addRampGradient(gradient: number, color: Color3): IParticleSystem;\r\n /**\r\n * Gets the current list of ramp gradients.\r\n * You must use addRampGradient and removeRampGradient to update this list\r\n * @returns the list of ramp gradients\r\n */\r\n getRampGradients(): Nullable<Array<Color3Gradient>>;\r\n\r\n /** Gets or sets a boolean indicating that ramp gradients must be used\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/particles/particle_system/ramps_and_blends\r\n */\r\n useRampGradients: boolean;\r\n\r\n /**\r\n * Adds a new color remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the color remap minimal range\r\n * @param max defines the color remap maximal range\r\n * @returns the current particle system\r\n */\r\n addColorRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of color remap gradients.\r\n * You must use addColorRemapGradient and removeColorRemapGradient to update this list\r\n * @returns the list of color remap gradients\r\n */\r\n getColorRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Adds a new alpha remap gradient\r\n * @param gradient defines the gradient to use (between 0 and 1)\r\n * @param min defines the alpha remap minimal range\r\n * @param max defines the alpha remap maximal range\r\n * @returns the current particle system\r\n */\r\n addAlphaRemapGradient(gradient: number, min: number, max: number): IParticleSystem;\r\n /**\r\n * Gets the current list of alpha remap gradients.\r\n * You must use addAlphaRemapGradient and removeAlphaRemapGradient to update this list\r\n * @returns the list of alpha remap gradients\r\n */\r\n getAlphaRemapGradients(): Nullable<Array<FactorGradient>>;\r\n\r\n /**\r\n * Creates a Point Emitter for the particle system (emits directly from the emitter position)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @returns the emitter\r\n */\r\n createPointEmitter(direction1: Vector3, direction2: Vector3): PointParticleEmitter;\r\n\r\n /**\r\n * Creates a Hemisphere Emitter for the particle system (emits along the hemisphere radius)\r\n * @param radius The radius of the hemisphere to emit from\r\n * @param radiusRange The range of the hemisphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createHemisphericEmitter(radius: number, radiusRange: number): HemisphericParticleEmitter;\r\n\r\n /**\r\n * Creates a Sphere Emitter for the particle system (emits along the sphere radius)\r\n * @param radius The radius of the sphere to emit from\r\n * @param radiusRange The range of the sphere to emit from [0-1] 0 Surface Only, 1 Entire Radius\r\n * @returns the emitter\r\n */\r\n createSphereEmitter(radius: number, radiusRange: number): SphereParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Sphere Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the sphere to emit from\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the sphere\r\n * @returns the emitter\r\n */\r\n createDirectedSphereEmitter(radius: number, direction1: Vector3, direction2: Vector3): SphereDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cylinder Emitter for the particle system (emits from the cylinder to the particle position)\r\n * @param radius The radius of the emission cylinder\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange The range of emission [0-1] 0 Surface only, 1 Entire Radius\r\n * @param directionRandomizer How much to randomize the particle direction [0-1]\r\n * @returns the emitter\r\n */\r\n createCylinderEmitter(radius: number, height: number, radiusRange: number, directionRandomizer: number): CylinderParticleEmitter;\r\n\r\n /**\r\n * Creates a Directed Cylinder Emitter for the particle system (emits between direction1 and direction2)\r\n * @param radius The radius of the cylinder to emit from\r\n * @param height The height of the emission cylinder\r\n * @param radiusRange the range of the emission cylinder [0-1] 0 Surface only, 1 Entire Radius (1 by default)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the cylinder\r\n * @returns the emitter\r\n */\r\n createDirectedCylinderEmitter(radius: number, height: number, radiusRange: number, direction1: Vector3, direction2: Vector3): CylinderDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Cone Emitter for the particle system (emits from the cone to the particle position)\r\n * @param radius The radius of the cone to emit from\r\n * @param angle The base angle of the cone\r\n * @returns the emitter\r\n */\r\n createConeEmitter(radius: number, angle: number): ConeParticleEmitter;\r\n\r\n createDirectedConeEmitter(radius: number, angle: number, direction1: Vector3, direction2: Vector3): ConeDirectedParticleEmitter;\r\n\r\n /**\r\n * Creates a Box Emitter for the particle system. (emits between direction1 and direction2 from withing the box defined by minEmitBox and maxEmitBox)\r\n * @param direction1 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param direction2 Particles are emitted between the direction1 and direction2 from within the box\r\n * @param minEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @param maxEmitBox Particles are emitted from the box between minEmitBox and maxEmitBox\r\n * @returns the emitter\r\n */\r\n createBoxEmitter(direction1: Vector3, direction2: Vector3, minEmitBox: Vector3, maxEmitBox: Vector3): BoxParticleEmitter;\r\n\r\n /**\r\n * Get hosting scene\r\n * @returns the scene\r\n */\r\n getScene(): Nullable<Scene>;\r\n}\r\n"]}
|
|
@@ -101,6 +101,7 @@ export declare class TAARenderingPipeline extends PostProcessRenderPipeline {
|
|
|
101
101
|
*/
|
|
102
102
|
dispose(): void;
|
|
103
103
|
private _createPingPongTextures;
|
|
104
|
+
private _updateReprojection;
|
|
104
105
|
private _buildPipeline;
|
|
105
106
|
private _disposePostProcesses;
|
|
106
107
|
private _createTAAPostProcess;
|