@babylonjs/core 8.12.0 → 8.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BakedVertexAnimation/vertexAnimationBaker.d.ts +10 -2
- package/BakedVertexAnimation/vertexAnimationBaker.js +51 -2
- package/BakedVertexAnimation/vertexAnimationBaker.js.map +1 -1
- package/Cameras/camera.d.ts +6 -0
- package/Cameras/camera.js +8 -0
- package/Cameras/camera.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.d.ts +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js +27 -18
- package/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.d.ts +55 -3
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js +83 -2
- package/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphMeshPickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphReceiveCustomEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Event/flowGraphSceneTickEventBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/Animation/flowGraphPlayAnimationBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/ControlFlow/flowGraphSetDelayBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.d.ts +1 -0
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js +23 -2
- package/FlowGraph/Blocks/Execution/flowGraphSetPropertyBlock.js.map +1 -1
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js +5 -5
- package/FlowGraph/Blocks/Execution/flowGraphSetVariableBlock.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockFactory.js +10 -0
- package/FlowGraph/Blocks/flowGraphBlockFactory.js.map +1 -1
- package/FlowGraph/Blocks/flowGraphBlockNames.d.ts +5 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js +5 -0
- package/FlowGraph/Blocks/flowGraphBlockNames.js.map +1 -1
- package/FlowGraph/flowGraphRichTypes.js +10 -8
- package/FlowGraph/flowGraphRichTypes.js.map +1 -1
- package/FlowGraph/utils.d.ts +3 -3
- package/FlowGraph/utils.js +5 -4
- package/FlowGraph/utils.js.map +1 -1
- package/Instrumentation/engineInstrumentation.d.ts +2 -2
- package/Instrumentation/engineInstrumentation.js +5 -0
- package/Instrumentation/engineInstrumentation.js.map +1 -1
- package/Instrumentation/sceneInstrumentation.d.ts +1 -0
- package/Instrumentation/sceneInstrumentation.js +5 -0
- package/Instrumentation/sceneInstrumentation.js.map +1 -1
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.d.ts +2 -5
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js +8 -71
- package/Materials/Node/Blocks/Dual/smartFilterTextureBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.d.ts +2 -0
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js +7 -8
- package/Materials/Node/Blocks/Fragment/fragmentOutputBlock.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/index.d.ts +1 -0
- package/Materials/Node/Blocks/Fragment/index.js +1 -0
- package/Materials/Node/Blocks/Fragment/index.js.map +1 -1
- package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.d.ts +29 -0
- package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js +100 -0
- package/Materials/Node/Blocks/Fragment/smartFilterFragmentOutputBlock.js.map +1 -0
- package/Materials/Node/nodeMaterial.js +1 -1
- package/Materials/Node/nodeMaterial.js.map +1 -1
- package/Materials/Node/nodeMaterialBuildState.d.ts +0 -2
- package/Materials/Node/nodeMaterialBuildState.js +0 -2
- package/Materials/Node/nodeMaterialBuildState.js.map +1 -1
- package/Materials/Node/nodeMaterialDefault.js +2 -1
- package/Materials/Node/nodeMaterialDefault.js.map +1 -1
- package/Maths/math.vector.d.ts +14 -0
- package/Maths/math.vector.functions.d.ts +25 -1
- package/Maths/math.vector.functions.js +35 -0
- package/Maths/math.vector.functions.js.map +1 -1
- package/Maths/math.vector.js +28 -0
- package/Maths/math.vector.js.map +1 -1
- package/Meshes/csg2.js +1 -1
- package/Meshes/csg2.js.map +1 -1
- package/Meshes/linesMesh.d.ts +2 -1
- package/Meshes/linesMesh.js +5 -0
- package/Meshes/linesMesh.js.map +1 -1
- package/Misc/environmentTextureTools.d.ts +4 -1
- package/Misc/environmentTextureTools.js +9 -2
- package/Misc/environmentTextureTools.js.map +1 -1
- package/Misc/observable.d.ts +1 -1
- package/Misc/observable.js.map +1 -1
- package/Morph/morphTargetManager.d.ts +5 -0
- package/Morph/morphTargetManager.js +8 -0
- package/Morph/morphTargetManager.js.map +1 -1
- package/Particles/IParticleSystem.d.ts +4 -0
- package/Particles/IParticleSystem.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.d.ts +2 -1
- package/Particles/Node/nodeParticleSystemSet.js +2 -1
- package/Particles/Node/nodeParticleSystemSet.js.map +1 -1
- package/Particles/baseParticleSystem.d.ts +4 -0
- package/Particles/baseParticleSystem.js +6 -0
- package/Particles/baseParticleSystem.js.map +1 -1
- package/Particles/particleSystem.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"morphTargetManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Morph/morphTargetManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO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D,CAAC;gBACD,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;YACjC,CAAC;YAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAChC,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YACrC,CAAC;QACL,CAAC;IACL,CAAC;IAED,UAAU;IAEV;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,mBAAwB,EAAE,KAAY;QACtD,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAE7C,KAAK,MAAM,UAAU,IAAI,mBAAmB,CAAC,OAAO,EAAE,CAAC;YACnD,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;;AA7pBD,wFAAwF;AAC1E,uCAAoB,GAAG,IAAI,AAAP,CAAQ;AAE1C,qHAAqH;AACvG,6DAA0C,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { MorphTarget } from \"./morphTarget\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RawTexture2DArray } from \"../Materials/Textures/rawTexture2DArray\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets\r\n */\r\nexport class MorphTargetManager implements IDisposable {\r\n /** Enable storing morph target data into textures when set to true (true by default) */\r\n public static EnableTextureStorage = true;\r\n\r\n /** Maximum number of active morph targets supported in the \"vertex attribute\" mode (i.e., not the \"texture\" mode) */\r\n public static MaxActiveMorphTargetsInVertexAttributeMode = 8;\r\n\r\n private _targets = new Array<MorphTarget>();\r\n private _targetInfluenceChangedObservers = new Array<Nullable<Observer<boolean>>>();\r\n private _targetDataLayoutChangedObservers = new Array<Nullable<Observer<void>>>();\r\n private _activeTargets = new SmartArray<MorphTarget>(16);\r\n private _scene: Nullable<Scene>;\r\n private _influences: Float32Array;\r\n private _supportsPositions = false;\r\n private _supportsNormals = false;\r\n private _supportsTangents = false;\r\n private _supportsUVs = false;\r\n private _supportsUV2s = false;\r\n private _supportsColors = false;\r\n private _vertexCount = 0;\r\n private _uniqueId = 0;\r\n private _tempInfluences = new Array<number>();\r\n private _canUseTextureForTargets = false;\r\n private _blockCounter = 0;\r\n private _mustSynchronize = true;\r\n private _forceUpdateWhenUnfrozen = false;\r\n\r\n /** @internal */\r\n public _textureVertexStride = 0;\r\n\r\n /** @internal */\r\n public _textureWidth = 0;\r\n\r\n /** @internal */\r\n public _textureHeight = 1;\r\n\r\n /** @internal */\r\n public _morphTargetTextureIndices: Float32Array;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n /** @internal */\r\n public _targetStoreTexture: Nullable<RawTexture2DArray>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if influencers must be optimized (eg. recompiling the shader if less influencers are used)\r\n */\r\n public optimizeInfluencers = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if positions must be morphed\r\n */\r\n public enablePositionMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n public enableNormalMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n public enableTangentMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n public enableUVMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if UV2 must be morphed\r\n */\r\n public enableUV2Morphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if colors must be morphed\r\n */\r\n public enableColorMorphing = true;\r\n\r\n /**\r\n * Sets a boolean indicating that adding new target or updating an existing target will not update the underlying data buffers\r\n */\r\n public set areUpdatesFrozen(block: boolean) {\r\n if (block) {\r\n this._blockCounter++;\r\n } else {\r\n this._blockCounter--;\r\n if (this._blockCounter <= 0) {\r\n this._blockCounter = 0;\r\n\r\n this._syncActiveTargets(this._forceUpdateWhenUnfrozen);\r\n this._forceUpdateWhenUnfrozen = false;\r\n }\r\n }\r\n }\r\n\r\n public get areUpdatesFrozen() {\r\n return this._blockCounter > 0;\r\n }\r\n\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n public constructor(scene: Nullable<Scene> = null) {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n this._scene = scene;\r\n\r\n if (this._scene) {\r\n this._scene.addMorphTargetManager(this);\r\n\r\n this._uniqueId = this._scene.getUniqueId();\r\n\r\n const engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForTargets =\r\n engineCaps.canUseGLVertexID && engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0 && engineCaps.texture2DArrayMaxLayerCount > 1;\r\n }\r\n }\r\n\r\n private _numMaxInfluencers = 0;\r\n\r\n /**\r\n * Gets or sets the maximum number of influencers (targets) (default value: 0).\r\n * Setting a value for this property can lead to a smoother experience, as only one shader will be compiled, which will use this value as the maximum number of influencers.\r\n * If you leave the value at 0 (default), a new shader will be compiled every time the number of active influencers changes. This can cause problems, as compiling a shader takes time.\r\n * If you assign a non-zero value to this property, you need to ensure that this value is greater than the maximum number of (active) influencers you'll need for this morph manager.\r\n * Otherwise, the number of active influencers will be truncated at the value you set for this property, which can lead to unexpected results.\r\n * Note that this property has no effect if \"useTextureToStoreTargets\" is false.\r\n */\r\n public get numMaxInfluencers(): number {\r\n return this._numMaxInfluencers;\r\n }\r\n\r\n public set numMaxInfluencers(value: number) {\r\n if (this._numMaxInfluencers === value) {\r\n return;\r\n }\r\n\r\n this._numMaxInfluencers = value;\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n public get uniqueId(): number {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n public get vertexCount(): number {\r\n return this._vertexCount;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of positions\r\n */\r\n public get supportsPositions(): boolean {\r\n return this._supportsPositions && this.enablePositionMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n public get supportsNormals(): boolean {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n public get supportsTangents(): boolean {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n public get supportsUVs(): boolean {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates 2\r\n */\r\n public get supportsUV2s(): boolean {\r\n return this._supportsUV2s && this.enableUV2Morphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of colors\r\n */\r\n public get supportsColors(): boolean {\r\n return this._supportsColors && this.enableColorMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing positions\r\n */\r\n public get hasPositions(): boolean {\r\n return this._supportsPositions;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing normals\r\n */\r\n public get hasNormals(): boolean {\r\n return this._supportsNormals;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing tangents\r\n */\r\n public get hasTangents(): boolean {\r\n return this._supportsTangents;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing texture coordinates\r\n */\r\n public get hasUVs(): boolean {\r\n return this._supportsUVs;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing texture coordinates 2\r\n */\r\n public get hasUV2s(): boolean {\r\n return this._supportsUV2s;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing colors\r\n */\r\n public get hasColors(): boolean {\r\n return this._supportsColors;\r\n }\r\n\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n public get numTargets(): number {\r\n return this._targets.length;\r\n }\r\n\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n public get numInfluencers(): number {\r\n return this._activeTargets.length;\r\n }\r\n\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n public get influences(): Float32Array {\r\n return this._influences;\r\n }\r\n\r\n private _useTextureToStoreTargets = true;\r\n /**\r\n * Gets or sets a boolean indicating that targets should be stored as a texture instead of using vertex attributes (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n public get useTextureToStoreTargets(): boolean {\r\n return this._useTextureToStoreTargets;\r\n }\r\n\r\n public set useTextureToStoreTargets(value: boolean) {\r\n if (this._useTextureToStoreTargets === value) {\r\n return;\r\n }\r\n this._useTextureToStoreTargets = value;\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the targets are stored into a texture (instead of as attributes)\r\n */\r\n public get isUsingTextureForTargets() {\r\n return (\r\n MorphTargetManager.EnableTextureStorage &&\r\n this.useTextureToStoreTargets &&\r\n this._canUseTextureForTargets &&\r\n !this._scene?.getEngine().getCaps().disableMorphTargetTexture\r\n );\r\n }\r\n\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n public getActiveTarget(index: number): MorphTarget {\r\n return this._activeTargets.data[index];\r\n }\r\n\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n public getTarget(index: number): MorphTarget {\r\n return this._targets[index];\r\n }\r\n\r\n /**\r\n * Gets the first target with the specified name\r\n * @param name defines the name to check\r\n * @returns the requested target\r\n */\r\n public getTargetByName(name: string): Nullable<MorphTarget> {\r\n for (const target of this._targets) {\r\n if (target.name === name) {\r\n return target;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n public addTarget(target: MorphTarget): void {\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(\r\n target.onInfluenceChanged.add((needUpdate) => {\r\n if (this.areUpdatesFrozen && needUpdate) {\r\n this._forceUpdateWhenUnfrozen = true;\r\n }\r\n this._syncActiveTargets(needUpdate);\r\n })\r\n );\r\n this._targetDataLayoutChangedObservers.push(\r\n target._onDataLayoutChanged.add(() => {\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n })\r\n );\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n public removeTarget(target: MorphTarget): void {\r\n const index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n if (this._scene) {\r\n this._scene.stopAnimation(target);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(effect: Effect) {\r\n effect.setFloat3(\"morphTargetTextureInfo\", this._textureVertexStride, this._textureWidth, this._textureHeight);\r\n effect.setFloatArray(\"morphTargetTextureIndices\", this._morphTargetTextureIndices);\r\n effect.setTexture(\"morphTargets\", this._targetStoreTexture);\r\n effect.setInt(\"morphTargetCount\", this.numInfluencers);\r\n }\r\n\r\n /**\r\n * Clone the current manager\r\n * @returns a new MorphTargetManager\r\n */\r\n public clone(): MorphTargetManager {\r\n const copy = new MorphTargetManager(this._scene);\r\n\r\n for (const target of this._targets) {\r\n copy.addTarget(target.clone());\r\n }\r\n\r\n copy.enablePositionMorphing = this.enablePositionMorphing;\r\n copy.enableNormalMorphing = this.enableNormalMorphing;\r\n copy.enableTangentMorphing = this.enableTangentMorphing;\r\n copy.enableUVMorphing = this.enableUVMorphing;\r\n copy.enableUV2Morphing = this.enableUV2Morphing;\r\n copy.enableColorMorphing = this.enableColorMorphing;\r\n\r\n return copy;\r\n }\r\n\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.uniqueId;\r\n\r\n serializationObject.targets = [];\r\n for (const target of this._targets) {\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _syncActiveTargets(needUpdate = false): void {\r\n if (this.areUpdatesFrozen) {\r\n return;\r\n }\r\n\r\n const wasUsingTextureForTargets = !!this._targetStoreTexture;\r\n const isUsingTextureForTargets = this.isUsingTextureForTargets;\r\n\r\n if (this._mustSynchronize || wasUsingTextureForTargets !== isUsingTextureForTargets) {\r\n this._mustSynchronize = false;\r\n this.synchronize();\r\n }\r\n\r\n let influenceCount = 0;\r\n this._activeTargets.reset();\r\n\r\n if (!this._morphTargetTextureIndices || this._morphTargetTextureIndices.length !== this._targets.length) {\r\n this._morphTargetTextureIndices = new Float32Array(this._targets.length);\r\n }\r\n\r\n let targetIndex = -1;\r\n for (const target of this._targets) {\r\n targetIndex++;\r\n if (target.influence === 0 && this.optimizeInfluencers) {\r\n continue;\r\n }\r\n\r\n if (this._activeTargets.length >= MorphTargetManager.MaxActiveMorphTargetsInVertexAttributeMode && !this.isUsingTextureForTargets) {\r\n break;\r\n }\r\n\r\n this._activeTargets.push(target);\r\n this._morphTargetTextureIndices[influenceCount] = targetIndex;\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n }\r\n\r\n if (this._morphTargetTextureIndices.length !== influenceCount) {\r\n this._morphTargetTextureIndices = this._morphTargetTextureIndices.slice(0, influenceCount);\r\n }\r\n\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n\r\n for (let index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n\r\n if (needUpdate && this._scene) {\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).morphTargetManager === this) {\r\n if (isUsingTextureForTargets) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n } else {\r\n (<Mesh>mesh)._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Synchronize the targets with all the meshes using this morph target manager\r\n */\r\n public synchronize(): void {\r\n if (!this._scene || this.areUpdatesFrozen) {\r\n return;\r\n }\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n this._supportsPositions = true;\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._supportsUV2s = true;\r\n this._supportsColors = true;\r\n this._vertexCount = 0;\r\n\r\n this._targetStoreTexture?.dispose();\r\n this._targetStoreTexture = null;\r\n\r\n if (this.isUsingTextureForTargets && this._targets.length > engine.getCaps().texture2DArrayMaxLayerCount) {\r\n this.useTextureToStoreTargets = false;\r\n }\r\n\r\n for (const target of this._targets) {\r\n this._supportsPositions = this._supportsPositions && target.hasPositions;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n this._supportsUV2s = this._supportsUV2s && target.hasUV2s;\r\n this._supportsColors = this._supportsColors && target.hasColors;\r\n\r\n const vertexCount = target.vertexCount;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n } else if (this._vertexCount !== vertexCount) {\r\n Logger.Error(\r\n `Incompatible target. Targets must all have the same vertices count. Current vertex count: ${this._vertexCount}, vertex count for target \"${target.name}\": ${vertexCount}`\r\n );\r\n return;\r\n }\r\n }\r\n\r\n if (this.isUsingTextureForTargets) {\r\n this._textureVertexStride = 0;\r\n\r\n this._supportsPositions && this._textureVertexStride++;\r\n this._supportsNormals && this._textureVertexStride++;\r\n this._supportsTangents && this._textureVertexStride++;\r\n this._supportsUVs && this._textureVertexStride++;\r\n this._supportsUV2s && this._textureVertexStride++;\r\n this._supportsColors && this._textureVertexStride++;\r\n\r\n this._textureWidth = this._vertexCount * this._textureVertexStride || 1;\r\n this._textureHeight = 1;\r\n\r\n const maxTextureSize = engine.getCaps().maxTextureSize;\r\n if (this._textureWidth > maxTextureSize) {\r\n this._textureHeight = Math.ceil(this._textureWidth / maxTextureSize);\r\n this._textureWidth = maxTextureSize;\r\n }\r\n\r\n const targetCount = this._targets.length;\r\n const data = new Float32Array(targetCount * this._textureWidth * this._textureHeight * 4);\r\n\r\n let offset = 0;\r\n for (let index = 0; index < targetCount; index++) {\r\n const target = this._targets[index];\r\n\r\n const positions = target.getPositions();\r\n const normals = target.getNormals();\r\n const uvs = target.getUVs();\r\n const tangents = target.getTangents();\r\n const uv2s = target.getUV2s();\r\n const colors = target.getColors();\r\n\r\n offset = index * this._textureWidth * this._textureHeight * 4;\r\n for (let vertex = 0; vertex < this._vertexCount; vertex++) {\r\n if (this._supportsPositions && positions) {\r\n data[offset] = positions[vertex * 3];\r\n data[offset + 1] = positions[vertex * 3 + 1];\r\n data[offset + 2] = positions[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsNormals && normals) {\r\n data[offset] = normals[vertex * 3];\r\n data[offset + 1] = normals[vertex * 3 + 1];\r\n data[offset + 2] = normals[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsUVs && uvs) {\r\n data[offset] = uvs[vertex * 2];\r\n data[offset + 1] = uvs[vertex * 2 + 1];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsTangents && tangents) {\r\n data[offset] = tangents[vertex * 3];\r\n data[offset + 1] = tangents[vertex * 3 + 1];\r\n data[offset + 2] = tangents[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsUV2s && uv2s) {\r\n data[offset] = uv2s[vertex * 2];\r\n data[offset + 1] = uv2s[vertex * 2 + 1];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsColors && colors) {\r\n data[offset] = colors[vertex * 4];\r\n data[offset + 1] = colors[vertex * 4 + 1];\r\n data[offset + 2] = colors[vertex * 4 + 2];\r\n data[offset + 3] = colors[vertex * 4 + 3];\r\n offset += 4;\r\n }\r\n }\r\n }\r\n\r\n this._targetStoreTexture = RawTexture2DArray.CreateRGBATexture(\r\n data,\r\n this._textureWidth,\r\n this._textureHeight,\r\n targetCount,\r\n this._scene,\r\n false,\r\n false,\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n Constants.TEXTURETYPE_FLOAT\r\n );\r\n this._targetStoreTexture.name = `Morph texture_${this.uniqueId}`;\r\n }\r\n\r\n // Flag meshes as dirty to resync with the active targets\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).morphTargetManager === this) {\r\n (<Mesh>mesh)._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose() {\r\n if (this._targetStoreTexture) {\r\n this._targetStoreTexture.dispose();\r\n }\r\n\r\n this._targetStoreTexture = null;\r\n\r\n // Remove from scene\r\n if (this._scene) {\r\n this._scene.removeMorphTargetManager(this);\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.morphTargetManagers.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.morphTargetManagers.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n for (const morph of this._targets) {\r\n this._scene.stopAnimation(morph);\r\n }\r\n }\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n public static Parse(serializationObject: any, scene: Scene): MorphTargetManager {\r\n const result = new MorphTargetManager(scene);\r\n\r\n for (const targetData of serializationObject.targets) {\r\n result.addTarget(MorphTarget.Parse(targetData, scene));\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"morphTargetManager.js","sourceRoot":"","sources":["../../../../dev/core/src/Morph/morphTargetManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAGxC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAC;AAE5E;;;GAGG;AACH,MAAM,OAAO,kBAAkB;IAqF3B;;OAEG;IACH,IAAW,gBAAgB,CAAC,KAAc;QACtC,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,aAAa,EAAE,CAAC;QACzB,CAAC;aAAM,CAAC;YACJ,IAAI,CAAC,aAAa,EAAE,CAAC;YACrB,IAAI,IAAI,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,aAAa,GAAG,CAAC,CAAC;gBAEvB,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;gBACvD,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;YAC1C,CAAC;QACL,CAAC;I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OAAO,EAAE,CAAC;YACnD,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC;QAC3D,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;;AAtqBD,wFAAwF;AAC1E,uCAAoB,GAAG,IAAI,AAAP,CAAQ;AAE1C,qHAAqH;AACvG,6DAA0C,GAAG,CAAC,AAAJ,CAAK;AAE7D;;GAEG;AACW,oDAAiC,GAAG,CAAC,AAAJ,CAAK","sourcesContent":["import type { Observer } from \"../Misc/observable\";\r\nimport { SmartArray } from \"../Misc/smartArray\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport type { Nullable } from \"../types\";\r\nimport type { IDisposable, Scene } from \"../scene\";\r\nimport { EngineStore } from \"../Engines/engineStore\";\r\nimport type { Mesh } from \"../Meshes/mesh\";\r\nimport { MorphTarget } from \"./morphTarget\";\r\nimport { Constants } from \"../Engines/constants\";\r\nimport type { Effect } from \"../Materials/effect\";\r\nimport { RawTexture2DArray } from \"../Materials/Textures/rawTexture2DArray\";\r\nimport type { IAssetContainer } from \"core/IAssetContainer\";\r\n/**\r\n * This class is used to deform meshes using morphing between different targets\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/mesh/morphTargets\r\n */\r\nexport class MorphTargetManager implements IDisposable {\r\n /** Enable storing morph target data into textures when set to true (true by default) */\r\n public static EnableTextureStorage = true;\r\n\r\n /** Maximum number of active morph targets supported in the \"vertex attribute\" mode (i.e., not the \"texture\" mode) */\r\n public static MaxActiveMorphTargetsInVertexAttributeMode = 8;\r\n\r\n /**\r\n * When used in texture mode, if greather than 0, this will override the the morph manager numMaxInfluencers value.\r\n */\r\n public static ConstantTargetCountForTextureMode = 0;\r\n\r\n private _targets = new Array<MorphTarget>();\r\n private _targetInfluenceChangedObservers = new Array<Nullable<Observer<boolean>>>();\r\n private _targetDataLayoutChangedObservers = new Array<Nullable<Observer<void>>>();\r\n private _activeTargets = new SmartArray<MorphTarget>(16);\r\n private _scene: Nullable<Scene>;\r\n private _influences: Float32Array;\r\n private _supportsPositions = false;\r\n private _supportsNormals = false;\r\n private _supportsTangents = false;\r\n private _supportsUVs = false;\r\n private _supportsUV2s = false;\r\n private _supportsColors = false;\r\n private _vertexCount = 0;\r\n private _uniqueId = 0;\r\n private _tempInfluences = new Array<number>();\r\n private _canUseTextureForTargets = false;\r\n private _blockCounter = 0;\r\n private _mustSynchronize = true;\r\n private _forceUpdateWhenUnfrozen = false;\r\n\r\n /** @internal */\r\n public _textureVertexStride = 0;\r\n\r\n /** @internal */\r\n public _textureWidth = 0;\r\n\r\n /** @internal */\r\n public _textureHeight = 1;\r\n\r\n /** @internal */\r\n public _morphTargetTextureIndices: Float32Array;\r\n\r\n /** @internal */\r\n public _parentContainer: Nullable<IAssetContainer> = null;\r\n\r\n /** @internal */\r\n public _targetStoreTexture: Nullable<RawTexture2DArray>;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if influencers must be optimized (eg. recompiling the shader if less influencers are used)\r\n */\r\n public optimizeInfluencers = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if positions must be morphed\r\n */\r\n public enablePositionMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if normals must be morphed\r\n */\r\n public enableNormalMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if tangents must be morphed\r\n */\r\n public enableTangentMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if UV must be morphed\r\n */\r\n public enableUVMorphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if UV2 must be morphed\r\n */\r\n public enableUV2Morphing = true;\r\n\r\n /**\r\n * Gets or sets a boolean indicating if colors must be morphed\r\n */\r\n public enableColorMorphing = true;\r\n\r\n /**\r\n * Sets a boolean indicating that adding new target or updating an existing target will not update the underlying data buffers\r\n */\r\n public set areUpdatesFrozen(block: boolean) {\r\n if (block) {\r\n this._blockCounter++;\r\n } else {\r\n this._blockCounter--;\r\n if (this._blockCounter <= 0) {\r\n this._blockCounter = 0;\r\n\r\n this._syncActiveTargets(this._forceUpdateWhenUnfrozen);\r\n this._forceUpdateWhenUnfrozen = false;\r\n }\r\n }\r\n }\r\n\r\n public get areUpdatesFrozen() {\r\n return this._blockCounter > 0;\r\n }\r\n\r\n /**\r\n * Creates a new MorphTargetManager\r\n * @param scene defines the current scene\r\n */\r\n public constructor(scene: Nullable<Scene> = null) {\r\n if (!scene) {\r\n scene = EngineStore.LastCreatedScene;\r\n }\r\n\r\n this._scene = scene;\r\n\r\n if (this._scene) {\r\n this._scene.addMorphTargetManager(this);\r\n\r\n this._uniqueId = this._scene.getUniqueId();\r\n\r\n const engineCaps = this._scene.getEngine().getCaps();\r\n this._canUseTextureForTargets =\r\n engineCaps.canUseGLVertexID && engineCaps.textureFloat && engineCaps.maxVertexTextureImageUnits > 0 && engineCaps.texture2DArrayMaxLayerCount > 1;\r\n }\r\n }\r\n\r\n private _numMaxInfluencers = 0;\r\n\r\n /**\r\n * Gets or sets the maximum number of influencers (targets) (default value: 0).\r\n * Setting a value for this property can lead to a smoother experience, as only one shader will be compiled, which will use this value as the maximum number of influencers.\r\n * If you leave the value at 0 (default), a new shader will be compiled every time the number of active influencers changes. This can cause problems, as compiling a shader takes time.\r\n * If you assign a non-zero value to this property, you need to ensure that this value is greater than the maximum number of (active) influencers you'll need for this morph manager.\r\n * Otherwise, the number of active influencers will be truncated at the value you set for this property, which can lead to unexpected results.\r\n * Note that this property has no effect if \"useTextureToStoreTargets\" is false.\r\n * Note as well that if MorphTargetManager.ConstantTargetCountForTextureMode is greater than 0, this property will be ignored and the constant value will be used instead.\r\n */\r\n public get numMaxInfluencers(): number {\r\n if (MorphTargetManager.ConstantTargetCountForTextureMode > 0 && this.isUsingTextureForTargets) {\r\n return MorphTargetManager.ConstantTargetCountForTextureMode;\r\n }\r\n return this._numMaxInfluencers;\r\n }\r\n\r\n public set numMaxInfluencers(value: number) {\r\n if (this._numMaxInfluencers === value) {\r\n return;\r\n }\r\n\r\n this._numMaxInfluencers = value;\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Gets the unique ID of this manager\r\n */\r\n public get uniqueId(): number {\r\n return this._uniqueId;\r\n }\r\n\r\n /**\r\n * Gets the number of vertices handled by this manager\r\n */\r\n public get vertexCount(): number {\r\n return this._vertexCount;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of positions\r\n */\r\n public get supportsPositions(): boolean {\r\n return this._supportsPositions && this.enablePositionMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of normals\r\n */\r\n public get supportsNormals(): boolean {\r\n return this._supportsNormals && this.enableNormalMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of tangents\r\n */\r\n public get supportsTangents(): boolean {\r\n return this._supportsTangents && this.enableTangentMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates\r\n */\r\n public get supportsUVs(): boolean {\r\n return this._supportsUVs && this.enableUVMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of texture coordinates 2\r\n */\r\n public get supportsUV2s(): boolean {\r\n return this._supportsUV2s && this.enableUV2Morphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager supports morphing of colors\r\n */\r\n public get supportsColors(): boolean {\r\n return this._supportsColors && this.enableColorMorphing;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing positions\r\n */\r\n public get hasPositions(): boolean {\r\n return this._supportsPositions;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing normals\r\n */\r\n public get hasNormals(): boolean {\r\n return this._supportsNormals;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing tangents\r\n */\r\n public get hasTangents(): boolean {\r\n return this._supportsTangents;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing texture coordinates\r\n */\r\n public get hasUVs(): boolean {\r\n return this._supportsUVs;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing texture coordinates 2\r\n */\r\n public get hasUV2s(): boolean {\r\n return this._supportsUV2s;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if this manager has data for morphing colors\r\n */\r\n public get hasColors(): boolean {\r\n return this._supportsColors;\r\n }\r\n\r\n /**\r\n * Gets the number of targets stored in this manager\r\n */\r\n public get numTargets(): number {\r\n return this._targets.length;\r\n }\r\n\r\n /**\r\n * Gets the number of influencers (ie. the number of targets with influences > 0)\r\n */\r\n public get numInfluencers(): number {\r\n return this._activeTargets.length;\r\n }\r\n\r\n /**\r\n * Gets the list of influences (one per target)\r\n */\r\n public get influences(): Float32Array {\r\n return this._influences;\r\n }\r\n\r\n private _useTextureToStoreTargets = true;\r\n /**\r\n * Gets or sets a boolean indicating that targets should be stored as a texture instead of using vertex attributes (default is true).\r\n * Please note that this option is not available if the hardware does not support it\r\n */\r\n public get useTextureToStoreTargets(): boolean {\r\n return this._useTextureToStoreTargets;\r\n }\r\n\r\n public set useTextureToStoreTargets(value: boolean) {\r\n if (this._useTextureToStoreTargets === value) {\r\n return;\r\n }\r\n this._useTextureToStoreTargets = value;\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating that the targets are stored into a texture (instead of as attributes)\r\n */\r\n public get isUsingTextureForTargets() {\r\n return (\r\n MorphTargetManager.EnableTextureStorage &&\r\n this.useTextureToStoreTargets &&\r\n this._canUseTextureForTargets &&\r\n !this._scene?.getEngine().getCaps().disableMorphTargetTexture\r\n );\r\n }\r\n\r\n /**\r\n * Gets the active target at specified index. An active target is a target with an influence > 0\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n public getActiveTarget(index: number): MorphTarget {\r\n return this._activeTargets.data[index];\r\n }\r\n\r\n /**\r\n * Gets the target at specified index\r\n * @param index defines the index to check\r\n * @returns the requested target\r\n */\r\n public getTarget(index: number): MorphTarget {\r\n return this._targets[index];\r\n }\r\n\r\n /**\r\n * Gets the first target with the specified name\r\n * @param name defines the name to check\r\n * @returns the requested target\r\n */\r\n public getTargetByName(name: string): Nullable<MorphTarget> {\r\n for (const target of this._targets) {\r\n if (target.name === name) {\r\n return target;\r\n }\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Add a new target to this manager\r\n * @param target defines the target to add\r\n */\r\n public addTarget(target: MorphTarget): void {\r\n this._targets.push(target);\r\n this._targetInfluenceChangedObservers.push(\r\n target.onInfluenceChanged.add((needUpdate) => {\r\n if (this.areUpdatesFrozen && needUpdate) {\r\n this._forceUpdateWhenUnfrozen = true;\r\n }\r\n this._syncActiveTargets(needUpdate);\r\n })\r\n );\r\n this._targetDataLayoutChangedObservers.push(\r\n target._onDataLayoutChanged.add(() => {\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n })\r\n );\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n /**\r\n * Removes a target from the manager\r\n * @param target defines the target to remove\r\n */\r\n public removeTarget(target: MorphTarget): void {\r\n const index = this._targets.indexOf(target);\r\n if (index >= 0) {\r\n this._targets.splice(index, 1);\r\n\r\n target.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(index, 1)[0]);\r\n target._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(index, 1)[0]);\r\n this._mustSynchronize = true;\r\n this._syncActiveTargets();\r\n }\r\n\r\n if (this._scene) {\r\n this._scene.stopAnimation(target);\r\n }\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public _bind(effect: Effect) {\r\n effect.setFloat3(\"morphTargetTextureInfo\", this._textureVertexStride, this._textureWidth, this._textureHeight);\r\n effect.setFloatArray(\"morphTargetTextureIndices\", this._morphTargetTextureIndices);\r\n effect.setTexture(\"morphTargets\", this._targetStoreTexture);\r\n effect.setInt(\"morphTargetCount\", this.numInfluencers);\r\n }\r\n\r\n /**\r\n * Clone the current manager\r\n * @returns a new MorphTargetManager\r\n */\r\n public clone(): MorphTargetManager {\r\n const copy = new MorphTargetManager(this._scene);\r\n\r\n for (const target of this._targets) {\r\n copy.addTarget(target.clone());\r\n }\r\n\r\n copy.enablePositionMorphing = this.enablePositionMorphing;\r\n copy.enableNormalMorphing = this.enableNormalMorphing;\r\n copy.enableTangentMorphing = this.enableTangentMorphing;\r\n copy.enableUVMorphing = this.enableUVMorphing;\r\n copy.enableUV2Morphing = this.enableUV2Morphing;\r\n copy.enableColorMorphing = this.enableColorMorphing;\r\n\r\n return copy;\r\n }\r\n\r\n /**\r\n * Serializes the current manager into a Serialization object\r\n * @returns the serialized object\r\n */\r\n public serialize(): any {\r\n const serializationObject: any = {};\r\n\r\n serializationObject.id = this.uniqueId;\r\n\r\n serializationObject.targets = [];\r\n for (const target of this._targets) {\r\n serializationObject.targets.push(target.serialize());\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n private _syncActiveTargets(needUpdate = false): void {\r\n if (this.areUpdatesFrozen) {\r\n return;\r\n }\r\n\r\n const wasUsingTextureForTargets = !!this._targetStoreTexture;\r\n const isUsingTextureForTargets = this.isUsingTextureForTargets;\r\n\r\n if (this._mustSynchronize || wasUsingTextureForTargets !== isUsingTextureForTargets) {\r\n this._mustSynchronize = false;\r\n this.synchronize();\r\n }\r\n\r\n let influenceCount = 0;\r\n this._activeTargets.reset();\r\n\r\n if (!this._morphTargetTextureIndices || this._morphTargetTextureIndices.length !== this._targets.length) {\r\n this._morphTargetTextureIndices = new Float32Array(this._targets.length);\r\n }\r\n\r\n let targetIndex = -1;\r\n for (const target of this._targets) {\r\n targetIndex++;\r\n if (target.influence === 0 && this.optimizeInfluencers) {\r\n continue;\r\n }\r\n\r\n if (this._activeTargets.length >= MorphTargetManager.MaxActiveMorphTargetsInVertexAttributeMode && !this.isUsingTextureForTargets) {\r\n break;\r\n }\r\n\r\n this._activeTargets.push(target);\r\n this._morphTargetTextureIndices[influenceCount] = targetIndex;\r\n this._tempInfluences[influenceCount++] = target.influence;\r\n }\r\n\r\n if (this._morphTargetTextureIndices.length !== influenceCount) {\r\n this._morphTargetTextureIndices = this._morphTargetTextureIndices.slice(0, influenceCount);\r\n }\r\n\r\n if (!this._influences || this._influences.length !== influenceCount) {\r\n this._influences = new Float32Array(influenceCount);\r\n }\r\n\r\n for (let index = 0; index < influenceCount; index++) {\r\n this._influences[index] = this._tempInfluences[index];\r\n }\r\n\r\n if (needUpdate && this._scene) {\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).morphTargetManager === this) {\r\n if (isUsingTextureForTargets) {\r\n mesh._markSubMeshesAsAttributesDirty();\r\n } else {\r\n (<Mesh>mesh)._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Synchronize the targets with all the meshes using this morph target manager\r\n */\r\n public synchronize(): void {\r\n if (!this._scene || this.areUpdatesFrozen) {\r\n return;\r\n }\r\n\r\n const engine = this._scene.getEngine();\r\n\r\n this._supportsPositions = true;\r\n this._supportsNormals = true;\r\n this._supportsTangents = true;\r\n this._supportsUVs = true;\r\n this._supportsUV2s = true;\r\n this._supportsColors = true;\r\n this._vertexCount = 0;\r\n\r\n this._targetStoreTexture?.dispose();\r\n this._targetStoreTexture = null;\r\n\r\n if (this.isUsingTextureForTargets && this._targets.length > engine.getCaps().texture2DArrayMaxLayerCount) {\r\n this.useTextureToStoreTargets = false;\r\n }\r\n\r\n for (const target of this._targets) {\r\n this._supportsPositions = this._supportsPositions && target.hasPositions;\r\n this._supportsNormals = this._supportsNormals && target.hasNormals;\r\n this._supportsTangents = this._supportsTangents && target.hasTangents;\r\n this._supportsUVs = this._supportsUVs && target.hasUVs;\r\n this._supportsUV2s = this._supportsUV2s && target.hasUV2s;\r\n this._supportsColors = this._supportsColors && target.hasColors;\r\n\r\n const vertexCount = target.vertexCount;\r\n if (this._vertexCount === 0) {\r\n this._vertexCount = vertexCount;\r\n } else if (this._vertexCount !== vertexCount) {\r\n Logger.Error(\r\n `Incompatible target. Targets must all have the same vertices count. Current vertex count: ${this._vertexCount}, vertex count for target \"${target.name}\": ${vertexCount}`\r\n );\r\n return;\r\n }\r\n }\r\n\r\n if (this.isUsingTextureForTargets) {\r\n this._textureVertexStride = 0;\r\n\r\n this._supportsPositions && this._textureVertexStride++;\r\n this._supportsNormals && this._textureVertexStride++;\r\n this._supportsTangents && this._textureVertexStride++;\r\n this._supportsUVs && this._textureVertexStride++;\r\n this._supportsUV2s && this._textureVertexStride++;\r\n this._supportsColors && this._textureVertexStride++;\r\n\r\n this._textureWidth = this._vertexCount * this._textureVertexStride || 1;\r\n this._textureHeight = 1;\r\n\r\n const maxTextureSize = engine.getCaps().maxTextureSize;\r\n if (this._textureWidth > maxTextureSize) {\r\n this._textureHeight = Math.ceil(this._textureWidth / maxTextureSize);\r\n this._textureWidth = maxTextureSize;\r\n }\r\n\r\n const targetCount = this._targets.length;\r\n const data = new Float32Array(targetCount * this._textureWidth * this._textureHeight * 4);\r\n\r\n let offset = 0;\r\n for (let index = 0; index < targetCount; index++) {\r\n const target = this._targets[index];\r\n\r\n const positions = target.getPositions();\r\n const normals = target.getNormals();\r\n const uvs = target.getUVs();\r\n const tangents = target.getTangents();\r\n const uv2s = target.getUV2s();\r\n const colors = target.getColors();\r\n\r\n offset = index * this._textureWidth * this._textureHeight * 4;\r\n for (let vertex = 0; vertex < this._vertexCount; vertex++) {\r\n if (this._supportsPositions && positions) {\r\n data[offset] = positions[vertex * 3];\r\n data[offset + 1] = positions[vertex * 3 + 1];\r\n data[offset + 2] = positions[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsNormals && normals) {\r\n data[offset] = normals[vertex * 3];\r\n data[offset + 1] = normals[vertex * 3 + 1];\r\n data[offset + 2] = normals[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsUVs && uvs) {\r\n data[offset] = uvs[vertex * 2];\r\n data[offset + 1] = uvs[vertex * 2 + 1];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsTangents && tangents) {\r\n data[offset] = tangents[vertex * 3];\r\n data[offset + 1] = tangents[vertex * 3 + 1];\r\n data[offset + 2] = tangents[vertex * 3 + 2];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsUV2s && uv2s) {\r\n data[offset] = uv2s[vertex * 2];\r\n data[offset + 1] = uv2s[vertex * 2 + 1];\r\n offset += 4;\r\n }\r\n\r\n if (this._supportsColors && colors) {\r\n data[offset] = colors[vertex * 4];\r\n data[offset + 1] = colors[vertex * 4 + 1];\r\n data[offset + 2] = colors[vertex * 4 + 2];\r\n data[offset + 3] = colors[vertex * 4 + 3];\r\n offset += 4;\r\n }\r\n }\r\n }\r\n\r\n this._targetStoreTexture = RawTexture2DArray.CreateRGBATexture(\r\n data,\r\n this._textureWidth,\r\n this._textureHeight,\r\n targetCount,\r\n this._scene,\r\n false,\r\n false,\r\n Constants.TEXTURE_NEAREST_SAMPLINGMODE,\r\n Constants.TEXTURETYPE_FLOAT\r\n );\r\n this._targetStoreTexture.name = `Morph texture_${this.uniqueId}`;\r\n }\r\n\r\n // Flag meshes as dirty to resync with the active targets\r\n for (const mesh of this._scene.meshes) {\r\n if ((<any>mesh).morphTargetManager === this) {\r\n (<Mesh>mesh)._syncGeometryWithMorphTargetManager();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Release all resources\r\n */\r\n public dispose() {\r\n if (this._targetStoreTexture) {\r\n this._targetStoreTexture.dispose();\r\n }\r\n\r\n this._targetStoreTexture = null;\r\n\r\n // Remove from scene\r\n if (this._scene) {\r\n this._scene.removeMorphTargetManager(this);\r\n\r\n if (this._parentContainer) {\r\n const index = this._parentContainer.morphTargetManagers.indexOf(this);\r\n if (index > -1) {\r\n this._parentContainer.morphTargetManagers.splice(index, 1);\r\n }\r\n this._parentContainer = null;\r\n }\r\n\r\n for (const morph of this._targets) {\r\n this._scene.stopAnimation(morph);\r\n }\r\n }\r\n }\r\n\r\n // Statics\r\n\r\n /**\r\n * Creates a new MorphTargetManager from serialized data\r\n * @param serializationObject defines the serialized data\r\n * @param scene defines the hosting scene\r\n * @returns the new MorphTargetManager\r\n */\r\n public static Parse(serializationObject: any, scene: Scene): MorphTargetManager {\r\n const result = new MorphTargetManager(scene);\r\n\r\n for (const targetData of serializationObject.targets) {\r\n result.addTarget(MorphTarget.Parse(targetData, scene));\r\n }\r\n\r\n return result;\r\n }\r\n}\r\n"]}
|
|
@@ -241,6 +241,10 @@ export interface IParticleSystem {
|
|
|
241
241
|
updateInAnimate: boolean;
|
|
242
242
|
/** @internal */
|
|
243
243
|
_wasDispatched: boolean;
|
|
244
|
+
/**
|
|
245
|
+
* Returns true if the particle system was generated by a node particle system set
|
|
246
|
+
*/
|
|
247
|
+
isNodeGenerated: boolean;
|
|
244
248
|
/**
|
|
245
249
|
* Gets the maximum number of particles active at the same time.
|
|
246
250
|
* @returns The max number of active particles.
|
|
@@ -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 // eslint-disable-next-line import/no-internal-modules\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 * 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 // eslint-disable-next-line import/no-internal-modules\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"]}
|
|
@@ -7,7 +7,8 @@ import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
|
|
|
7
7
|
/**
|
|
8
8
|
* Defines a set of particle systems defined as a node graph.
|
|
9
9
|
* @experimental This API is experimental and may change in future releases.
|
|
10
|
-
* #K6F1ZB
|
|
10
|
+
* NPE: #K6F1ZB
|
|
11
|
+
* PG: #ZT509U
|
|
11
12
|
*/
|
|
12
13
|
export declare class NodeParticleSystemSet {
|
|
13
14
|
private _systemBlocks;
|
|
@@ -20,7 +20,8 @@ import { CreateParticleBlock } from "./Blocks/Emitters/createParticleBlock.js";
|
|
|
20
20
|
/**
|
|
21
21
|
* Defines a set of particle systems defined as a node graph.
|
|
22
22
|
* @experimental This API is experimental and may change in future releases.
|
|
23
|
-
* #K6F1ZB
|
|
23
|
+
* NPE: #K6F1ZB
|
|
24
|
+
* PG: #ZT509U
|
|
24
25
|
*/
|
|
25
26
|
export class NodeParticleSystemSet {
|
|
26
27
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleSystemSet.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,+CAA2C;AACzE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,gCAA4B;AAC/C,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,SAAS,EAAE,mCAA+B;AACnD,OAAO,EAAE,KAAK,EAAE,4BAAwB;AACxC,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AACtF,OAAO,E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AED,eAAe,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;wBAC3D,eAAe,CAAC,SAAS,GAAG,SAAS,CAAC;wBAEtC,IAAI,CAAC;4BACD,OAAO,CAAC,eAAe,CAAC,CAAC;wBAC7B,CAAC;wBAAC,OAAO,GAAG,EAAE,CAAC;4BACX,2EAA2E;4BAC3E,MAAM,CAAC,GAAG,CAAC,CAAC;wBAChB,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACJ,2EAA2E;wBAC3E,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;oBACtD,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAtbD,gDAAgD;AAClC,+BAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,gCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA2BzC;IADN,SAAS,EAAE;mDACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;sDACE","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { ParticleSystemSet } from \"../particleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport type { NodeParticleBlock } from \"./nodeParticleBlock\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport type { ParticleTeleportOutBlock } from \"./Blocks/Teleport/particleTeleportOutBlock\";\r\nimport type { ParticleTeleportInBlock } from \"./Blocks/Teleport/particleTeleportInBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\n\r\n/**\r\n * Defines a set of particle systems defined as a node graph.\r\n * @experimental This API is experimental and may change in future releases.\r\n * #K6F1ZB\r\n */\r\nexport class NodeParticleSystemSet {\r\n private _systemBlocks: SystemBlock[] = [];\r\n private _buildId: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeParticleEditor/babylon.nodeParticleEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeParticleBlock[] = [];\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://npe.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Observable raised when the particle set is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleSystemSet>();\r\n\r\n /**\r\n * The name of the set\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the set\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Gets the system blocks\r\n */\r\n public get systemBlocks(): SystemBlock[] {\r\n return this._systemBlocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public get inputBlocks() {\r\n const blocks: ParticleInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as ParticleInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Creates a new set\r\n * @param name defines the name of the set\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeParticleSystemSet\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeParticleSystemSet\";\r\n }\r\n\r\n private _initializeBlock(node: NodeParticleBlock, autoConfigure = true) {\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Builds the particle system set from the defined blocks.\r\n * @param scene defines the hosting scene\r\n * @param verbose defines whether to log detailed information during the build process (false by default)\r\n * @returns a promise that resolves to the built particle system set\r\n */\r\n public async buildAsync(scene: Scene, verbose = false): Promise<ParticleSystemSet> {\r\n return await new Promise<ParticleSystemSet>((resolve) => {\r\n const output = new ParticleSystemSet();\r\n\r\n // Initialize all blocks\r\n for (const block of this._systemBlocks) {\r\n this._initializeBlock(block);\r\n }\r\n\r\n // Build the blocks\r\n for (const block of this.systemBlocks) {\r\n const state = new NodeParticleBuildState();\r\n state.buildId = this._buildId++;\r\n state.scene = scene;\r\n state.verbose = verbose;\r\n\r\n const system = block.createSystem(state);\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n output.systems.push(system);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n resolve(output);\r\n });\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.attachedBlocks.length = 0;\r\n this._systemBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Clear the current set and restore it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Main system\r\n const system = new SystemBlock(\"Particle system\");\r\n\r\n // Update position\r\n const updatePositionBlock = new UpdatePositionBlock(\"Update position\");\r\n updatePositionBlock.output.connectTo(system.particle);\r\n\r\n // Contextual inputs\r\n const positionBlock = new ParticleInputBlock(\"Position\");\r\n positionBlock.contextualValue = NodeParticleContextualSources.Position;\r\n const directionBlock = new ParticleInputBlock(\"Scaled direction\");\r\n directionBlock.contextualValue = NodeParticleContextualSources.ScaledDirection;\r\n\r\n // Add\r\n const addBlock = new ParticleMathBlock(\"Add\");\r\n addBlock.operation = ParticleMathBlockOperations.Add;\r\n positionBlock.output.connectTo(addBlock.left);\r\n directionBlock.output.connectTo(addBlock.right);\r\n addBlock.output.connectTo(updatePositionBlock.position);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n const emitterShape = new BoxShapeBlock(\"Box shape\");\r\n createParticleBlock.particle.connectTo(emitterShape.particle);\r\n emitterShape.output.connectTo(updatePositionBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n textureBlock.texture.connectTo(system.texture);\r\n textureBlock.url = \"https://assets.babylonjs.com/textures/flare.png\";\r\n\r\n this._systemBlocks.push(system);\r\n }\r\n\r\n /**\r\n * Remove a block from the current system set\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeParticleBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block.isSystem) {\r\n const index = this._systemBlocks.indexOf(block as SystemBlock);\r\n if (index > -1) {\r\n this._systemBlocks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the particle set\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeParticleBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n\r\n if (block.isSystem) {\r\n this._systemBlocks.push(block as SystemBlock);\r\n }\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as ParticleTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as ParticleTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeParticleBlock, source: any, map: { [key: number]: NodeParticleBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeParticleBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeParticleBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeParticleSystemSet\";\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the resources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node particle set set to default basic configuration\r\n * @param name defines the name of the particle set\r\n * @returns a new NodeParticleSystemSet\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeParticleSet = new NodeParticleSystemSet(name);\r\n\r\n nodeParticleSet.setToDefault();\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from parsed data\r\n * @param source defines the JSON representation of the particle set\r\n * @returns a new node particle set\r\n */\r\n public static Parse(source: any): NodeParticleSystemSet {\r\n const nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(source.name), source, null);\r\n\r\n nodeParticleSet.parseSerializedObject(source);\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeParticleSystemSet.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeParticle);\r\n\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n nodeParticleSet.snippetId = snippetId;\r\n\r\n try {\r\n resolve(nodeParticleSet);\r\n } catch (err) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(err);\r\n }\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleSystemSet.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,iCAA6B;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,mBAAmB,EAAE,+CAA2C;AACzE,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,QAAQ,EAAE,gCAA4B;AAC/C,OAAO,EAAE,UAAU,EAAE,iCAA6B;AAClD,OAAO,EAAE,SAAS,EAAE,mCAA+B;AACnD,OAAO,EAAE,KAAK,EAAE,4BAAwB;AACxC,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,0BAA0B,EAAE,M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IAAI,qBAAqB,CAAC,SAAS,CAAC,EAAE,mBAAmB,EAAE,IAAI,CAAC,CAAC;wBACvH,CAAC;wBAED,eAAe,CAAC,qBAAqB,CAAC,mBAAmB,CAAC,CAAC;wBAC3D,eAAe,CAAC,SAAS,GAAG,SAAS,CAAC;wBAEtC,IAAI,CAAC;4BACD,OAAO,CAAC,eAAe,CAAC,CAAC;wBAC7B,CAAC;wBAAC,OAAO,GAAG,EAAE,CAAC;4BACX,2EAA2E;4BAC3E,MAAM,CAAC,GAAG,CAAC,CAAC;wBAChB,CAAC;oBACL,CAAC;yBAAM,CAAC;wBACJ,2EAA2E;wBAC3E,MAAM,CAAC,6BAA6B,GAAG,SAAS,CAAC,CAAC;oBACtD,CAAC;gBACL,CAAC;YACL,CAAC,CAAC,CAAC;YAEH,OAAO,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,UAAU,GAAG,GAAG,GAAG,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC;YAC1E,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,CAAC,CAAC;IACP,CAAC;;AAtbD,gDAAgD;AAClC,+BAAS,GAAG,GAAG,KAAK,CAAC,cAAc,KAAK,cAAc,CAAC,OAAO,mDAAmD,AAAxG,CAAyG;AAEhI,sCAAsC;AACxB,gCAAU,GAAG,SAAS,CAAC,UAAU,AAAvB,CAAwB;AA2BzC;IADN,SAAS,EAAE;mDACQ;AAMb;IADN,SAAS,CAAC,SAAS,CAAC;sDACE","sourcesContent":["import { serialize } from \"core/Misc/decorators\";\r\nimport { ParticleSystemSet } from \"../particleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport type { Scene } from \"core/scene\";\r\nimport { NodeParticleBuildState } from \"./nodeParticleBuildState\";\r\nimport type { NodeParticleBlock } from \"./nodeParticleBlock\";\r\nimport { SerializationHelper } from \"core/Misc/decorators.serialization\";\r\nimport { Observable } from \"core/Misc/observable\";\r\nimport { GetClass } from \"core/Misc/typeStore\";\r\nimport { WebRequest } from \"core/Misc/webRequest\";\r\nimport { Constants } from \"core/Engines/constants\";\r\nimport { Tools } from \"core/Misc/tools\";\r\nimport { AbstractEngine } from \"core/Engines/abstractEngine\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport type { ParticleTeleportOutBlock } from \"./Blocks/Teleport/particleTeleportOutBlock\";\r\nimport type { ParticleTeleportInBlock } from \"./Blocks/Teleport/particleTeleportInBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\n\r\n/**\r\n * Defines a set of particle systems defined as a node graph.\r\n * @experimental This API is experimental and may change in future releases.\r\n * NPE: #K6F1ZB\r\n * PG: #ZT509U\r\n */\r\nexport class NodeParticleSystemSet {\r\n private _systemBlocks: SystemBlock[] = [];\r\n private _buildId: number = 0;\r\n\r\n /** Define the Url to load node editor script */\r\n public static EditorURL = `${Tools._DefaultCdnUrl}/v${AbstractEngine.Version}/nodeParticleEditor/babylon.nodeParticleEditor.js`;\r\n\r\n /** Define the Url to load snippets */\r\n public static SnippetUrl = Constants.SnippetUrl;\r\n\r\n /**\r\n * Snippet ID if the material was created from the snippet server\r\n */\r\n public snippetId: string;\r\n\r\n /**\r\n * Gets an array of blocks that needs to be serialized even if they are not yet connected\r\n */\r\n public attachedBlocks: NodeParticleBlock[] = [];\r\n\r\n /**\r\n * Gets or sets data used by visual editor\r\n * @see https://npe.babylonjs.com\r\n */\r\n public editorData: any = null;\r\n\r\n /**\r\n * Observable raised when the particle set is built\r\n */\r\n public onBuildObservable = new Observable<NodeParticleSystemSet>();\r\n\r\n /**\r\n * The name of the set\r\n */\r\n @serialize()\r\n public name: string;\r\n\r\n /**\r\n * A free comment about the set\r\n */\r\n @serialize(\"comment\")\r\n public comment: string;\r\n\r\n /**\r\n * Gets the system blocks\r\n */\r\n public get systemBlocks(): SystemBlock[] {\r\n return this._systemBlocks;\r\n }\r\n\r\n /**\r\n * Gets the list of input blocks attached to this material\r\n * @returns an array of InputBlocks\r\n */\r\n public get inputBlocks() {\r\n const blocks: ParticleInputBlock[] = [];\r\n for (const block of this.attachedBlocks) {\r\n if (block.isInput) {\r\n blocks.push(block as ParticleInputBlock);\r\n }\r\n }\r\n\r\n return blocks;\r\n }\r\n\r\n /**\r\n * Creates a new set\r\n * @param name defines the name of the set\r\n */\r\n public constructor(name: string) {\r\n this.name = name;\r\n }\r\n\r\n /**\r\n * Gets the current class name of the geometry e.g. \"NodeParticleSystemSet\"\r\n * @returns the class name\r\n */\r\n public getClassName(): string {\r\n return \"NodeParticleSystemSet\";\r\n }\r\n\r\n private _initializeBlock(node: NodeParticleBlock, autoConfigure = true) {\r\n if (this.attachedBlocks.indexOf(node) === -1) {\r\n this.attachedBlocks.push(node);\r\n }\r\n\r\n for (const input of node.inputs) {\r\n const connectedPoint = input.connectedPoint;\r\n if (connectedPoint) {\r\n const block = connectedPoint.ownerBlock;\r\n if (block !== node) {\r\n this._initializeBlock(block, autoConfigure);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Builds the particle system set from the defined blocks.\r\n * @param scene defines the hosting scene\r\n * @param verbose defines whether to log detailed information during the build process (false by default)\r\n * @returns a promise that resolves to the built particle system set\r\n */\r\n public async buildAsync(scene: Scene, verbose = false): Promise<ParticleSystemSet> {\r\n return await new Promise<ParticleSystemSet>((resolve) => {\r\n const output = new ParticleSystemSet();\r\n\r\n // Initialize all blocks\r\n for (const block of this._systemBlocks) {\r\n this._initializeBlock(block);\r\n }\r\n\r\n // Build the blocks\r\n for (const block of this.systemBlocks) {\r\n const state = new NodeParticleBuildState();\r\n state.buildId = this._buildId++;\r\n state.scene = scene;\r\n state.verbose = verbose;\r\n\r\n const system = block.createSystem(state);\r\n\r\n // Errors\r\n state.emitErrors();\r\n\r\n output.systems.push(system);\r\n }\r\n\r\n this.onBuildObservable.notifyObservers(this);\r\n\r\n resolve(output);\r\n });\r\n }\r\n\r\n /**\r\n * Clear the current geometry\r\n */\r\n public clear() {\r\n this.attachedBlocks.length = 0;\r\n this._systemBlocks.length = 0;\r\n }\r\n\r\n /**\r\n * Clear the current set and restore it to a default state\r\n */\r\n public setToDefault() {\r\n this.clear();\r\n\r\n this.editorData = null;\r\n\r\n // Main system\r\n const system = new SystemBlock(\"Particle system\");\r\n\r\n // Update position\r\n const updatePositionBlock = new UpdatePositionBlock(\"Update position\");\r\n updatePositionBlock.output.connectTo(system.particle);\r\n\r\n // Contextual inputs\r\n const positionBlock = new ParticleInputBlock(\"Position\");\r\n positionBlock.contextualValue = NodeParticleContextualSources.Position;\r\n const directionBlock = new ParticleInputBlock(\"Scaled direction\");\r\n directionBlock.contextualValue = NodeParticleContextualSources.ScaledDirection;\r\n\r\n // Add\r\n const addBlock = new ParticleMathBlock(\"Add\");\r\n addBlock.operation = ParticleMathBlockOperations.Add;\r\n positionBlock.output.connectTo(addBlock.left);\r\n directionBlock.output.connectTo(addBlock.right);\r\n addBlock.output.connectTo(updatePositionBlock.position);\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n const emitterShape = new BoxShapeBlock(\"Box shape\");\r\n createParticleBlock.particle.connectTo(emitterShape.particle);\r\n emitterShape.output.connectTo(updatePositionBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n textureBlock.texture.connectTo(system.texture);\r\n textureBlock.url = \"https://assets.babylonjs.com/textures/flare.png\";\r\n\r\n this._systemBlocks.push(system);\r\n }\r\n\r\n /**\r\n * Remove a block from the current system set\r\n * @param block defines the block to remove\r\n */\r\n public removeBlock(block: NodeParticleBlock) {\r\n const attachedBlockIndex = this.attachedBlocks.indexOf(block);\r\n if (attachedBlockIndex > -1) {\r\n this.attachedBlocks.splice(attachedBlockIndex, 1);\r\n }\r\n\r\n if (block.isSystem) {\r\n const index = this._systemBlocks.indexOf(block as SystemBlock);\r\n if (index > -1) {\r\n this._systemBlocks.splice(index, 1);\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Clear the current graph and load a new one from a serialization object\r\n * @param source defines the JSON representation of the particle set\r\n * @param merge defines whether or not the source must be merged or replace the current content\r\n */\r\n public parseSerializedObject(source: any, merge = false) {\r\n if (!merge) {\r\n this.clear();\r\n }\r\n\r\n const map: { [key: number]: NodeParticleBlock } = {};\r\n\r\n // Create blocks\r\n for (const parsedBlock of source.blocks) {\r\n const blockType = GetClass(parsedBlock.customType);\r\n if (blockType) {\r\n const block: NodeParticleBlock = new blockType();\r\n block._deserialize(parsedBlock);\r\n map[parsedBlock.id] = block;\r\n\r\n this.attachedBlocks.push(block);\r\n\r\n if (block.isSystem) {\r\n this._systemBlocks.push(block as SystemBlock);\r\n }\r\n }\r\n }\r\n\r\n // Reconnect teleportation\r\n for (const block of this.attachedBlocks) {\r\n if (block.isTeleportOut) {\r\n const teleportOut = block as ParticleTeleportOutBlock;\r\n const id = teleportOut._tempEntryPointUniqueId;\r\n if (id) {\r\n const source = map[id] as ParticleTeleportInBlock;\r\n if (source) {\r\n source.attachToEndpoint(teleportOut);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Connections - Starts with input blocks only (except if in \"merge\" mode where we scan all blocks)\r\n for (let blockIndex = 0; blockIndex < source.blocks.length; blockIndex++) {\r\n const parsedBlock = source.blocks[blockIndex];\r\n const block = map[parsedBlock.id];\r\n\r\n if (!block) {\r\n continue;\r\n }\r\n\r\n if (block.inputs.length && parsedBlock.inputs.some((i: any) => i.targetConnectionName) && !merge) {\r\n continue;\r\n }\r\n this._restoreConnections(block, source, map);\r\n }\r\n\r\n // UI related info\r\n if (source.locations || (source.editorData && source.editorData.locations)) {\r\n const locations: {\r\n blockId: number;\r\n x: number;\r\n y: number;\r\n isCollapsed: boolean;\r\n }[] = source.locations || source.editorData.locations;\r\n\r\n for (const location of locations) {\r\n if (map[location.blockId]) {\r\n location.blockId = map[location.blockId].uniqueId;\r\n }\r\n }\r\n\r\n if (merge && this.editorData && this.editorData.locations) {\r\n locations.concat(this.editorData.locations);\r\n }\r\n\r\n if (source.locations) {\r\n this.editorData = {\r\n locations: locations,\r\n };\r\n } else {\r\n this.editorData = source.editorData;\r\n this.editorData.locations = locations;\r\n }\r\n\r\n const blockMap: number[] = [];\r\n\r\n for (const key in map) {\r\n blockMap[key] = map[key].uniqueId;\r\n }\r\n\r\n this.editorData.map = blockMap;\r\n }\r\n\r\n this.comment = source.comment;\r\n }\r\n\r\n private _restoreConnections(block: NodeParticleBlock, source: any, map: { [key: number]: NodeParticleBlock }) {\r\n for (const outputPoint of block.outputs) {\r\n for (const candidate of source.blocks) {\r\n const target = map[candidate.id];\r\n\r\n if (!target) {\r\n continue;\r\n }\r\n\r\n for (const input of candidate.inputs) {\r\n if (map[input.targetBlockId] === block && input.targetConnectionName === outputPoint.name) {\r\n const inputPoint = target.getInputByName(input.inputName);\r\n if (!inputPoint || inputPoint.isConnected) {\r\n continue;\r\n }\r\n\r\n outputPoint.connectTo(inputPoint, true);\r\n this._restoreConnections(target, source, map);\r\n continue;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Serializes this geometry in a JSON representation\r\n * @param selectedBlocks defines the list of blocks to save (if null the whole geometry will be saved)\r\n * @returns the serialized geometry object\r\n */\r\n public serialize(selectedBlocks?: NodeParticleBlock[]): any {\r\n const serializationObject = selectedBlocks ? {} : SerializationHelper.Serialize(this);\r\n serializationObject.editorData = JSON.parse(JSON.stringify(this.editorData)); // Copy\r\n\r\n let blocks: NodeParticleBlock[] = [];\r\n\r\n if (selectedBlocks) {\r\n blocks = selectedBlocks;\r\n } else {\r\n serializationObject.customType = \"BABYLON.NodeParticleSystemSet\";\r\n }\r\n\r\n // Blocks\r\n serializationObject.blocks = [];\r\n\r\n for (const block of blocks) {\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n\r\n if (!selectedBlocks) {\r\n for (const block of this.attachedBlocks) {\r\n if (blocks.indexOf(block) !== -1) {\r\n continue;\r\n }\r\n serializationObject.blocks.push(block.serialize());\r\n }\r\n }\r\n\r\n return serializationObject;\r\n }\r\n\r\n /**\r\n * Disposes the resources\r\n */\r\n public dispose(): void {\r\n for (const block of this.attachedBlocks) {\r\n block.dispose();\r\n }\r\n\r\n this.attachedBlocks.length = 0;\r\n this.onBuildObservable.clear();\r\n }\r\n\r\n /**\r\n * Creates a new node particle set set to default basic configuration\r\n * @param name defines the name of the particle set\r\n * @returns a new NodeParticleSystemSet\r\n */\r\n public static CreateDefault(name: string) {\r\n const nodeParticleSet = new NodeParticleSystemSet(name);\r\n\r\n nodeParticleSet.setToDefault();\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from parsed data\r\n * @param source defines the JSON representation of the particle set\r\n * @returns a new node particle set\r\n */\r\n public static Parse(source: any): NodeParticleSystemSet {\r\n const nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(source.name), source, null);\r\n\r\n nodeParticleSet.parseSerializedObject(source);\r\n\r\n return nodeParticleSet;\r\n }\r\n\r\n /**\r\n * Creates a node particle set from a snippet saved by the node geometry editor\r\n * @param snippetId defines the snippet to load\r\n * @param nodeParticleSet defines a node particle set to update (instead of creating a new one)\r\n * @returns a promise that will resolve to the new node geometry\r\n */\r\n // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n public static ParseFromSnippetAsync(snippetId: string, nodeParticleSet?: NodeParticleSystemSet): Promise<NodeParticleSystemSet> {\r\n if (snippetId === \"_BLANK\") {\r\n return Promise.resolve(NodeParticleSystemSet.CreateDefault(\"blank\"));\r\n }\r\n\r\n return new Promise((resolve, reject) => {\r\n const request = new WebRequest();\r\n request.addEventListener(\"readystatechange\", () => {\r\n if (request.readyState == 4) {\r\n if (request.status == 200) {\r\n const snippet = JSON.parse(JSON.parse(request.responseText).jsonPayload);\r\n const serializationObject = JSON.parse(snippet.nodeParticle);\r\n\r\n if (!nodeParticleSet) {\r\n nodeParticleSet = SerializationHelper.Parse(() => new NodeParticleSystemSet(snippetId), serializationObject, null);\r\n }\r\n\r\n nodeParticleSet.parseSerializedObject(serializationObject);\r\n nodeParticleSet.snippetId = snippetId;\r\n\r\n try {\r\n resolve(nodeParticleSet);\r\n } catch (err) {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(err);\r\n }\r\n } else {\r\n // eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\r\n reject(\"Unable to load the snippet \" + snippetId);\r\n }\r\n }\r\n });\r\n\r\n request.open(\"GET\", this.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\r\n request.send();\r\n });\r\n }\r\n}\r\n"]}
|
|
@@ -186,6 +186,10 @@ export declare class BaseParticleSystem implements IClipPlanesHolder {
|
|
|
186
186
|
_wasDispatched: boolean;
|
|
187
187
|
protected _rootUrl: string;
|
|
188
188
|
protected _noiseTexture: Nullable<ProceduralTexture>;
|
|
189
|
+
/**
|
|
190
|
+
* Returns true if the particle system was generated by a node particle system set
|
|
191
|
+
*/
|
|
192
|
+
get isNodeGenerated(): boolean;
|
|
189
193
|
/**
|
|
190
194
|
* Gets or sets a texture used to add random noise to particle positions
|
|
191
195
|
*/
|
|
@@ -23,6 +23,12 @@ export class BaseParticleSystem {
|
|
|
23
23
|
}
|
|
24
24
|
this._targetStopDuration = value;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Returns true if the particle system was generated by a node particle system set
|
|
28
|
+
*/
|
|
29
|
+
get isNodeGenerated() {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
26
32
|
/**
|
|
27
33
|
* Gets or sets a texture used to add random noise to particle positions
|
|
28
34
|
*/
|