8479795c2632d466c407304b6fd0ddef19fa84d730a9f9b4c5b4804fcc2417e4.json 13 KB

1
  1. {"ast":null,"code":"import { Vector3 } from \"../Maths/math.vector.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\n/**\n * Type of sub emitter\n */\nexport var SubEmitterType;\n(function (SubEmitterType) {\n /**\n * Attached to the particle over it's lifetime\n */\n SubEmitterType[SubEmitterType[\"ATTACHED\"] = 0] = \"ATTACHED\";\n /**\n * Created when the particle dies\n */\n SubEmitterType[SubEmitterType[\"END\"] = 1] = \"END\";\n})(SubEmitterType || (SubEmitterType = {}));\n/**\n * Sub emitter class used to emit particles from an existing particle\n */\nexport class SubEmitter {\n /**\n * Creates a sub emitter\n * @param particleSystem the particle system to be used by the sub emitter\n */\n constructor(\n /**\n * the particle system to be used by the sub emitter\n */\n particleSystem) {\n this.particleSystem = particleSystem;\n /**\n * Type of the submitter (Default: END)\n */\n this.type = 1 /* SubEmitterType.END */;\n /**\n * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)\n * Note: This only is supported when using an emitter of type Mesh\n */\n this.inheritDirection = false;\n /**\n * How much of the attached particles speed should be added to the sub emitted particle (default: 0)\n */\n this.inheritedVelocityAmount = 0;\n // Create mesh as emitter to support rotation\n if (!particleSystem.emitter || !particleSystem.emitter.dispose) {\n const internalClass = GetClass(\"BABYLON.AbstractMesh\");\n particleSystem.emitter = new internalClass(\"SubemitterSystemEmitter\", particleSystem.getScene());\n particleSystem._disposeEmitterOnDispose = true;\n }\n }\n /**\n * Clones the sub emitter\n * @returns the cloned sub emitter\n */\n clone() {\n // Clone particle system\n let emitter = this.particleSystem.emitter;\n if (!emitter) {\n emitter = new Vector3();\n } else if (emitter instanceof Vector3) {\n emitter = emitter.clone();\n } else if (emitter.getClassName().indexOf(\"Mesh\") !== -1) {\n const internalClass = GetClass(\"BABYLON.Mesh\");\n emitter = new internalClass(\"\", emitter.getScene());\n emitter.isVisible = false;\n }\n const clone = new SubEmitter(this.particleSystem.clone(this.particleSystem.name, emitter));\n // Clone properties\n clone.particleSystem.name += \"Clone\";\n clone.type = this.type;\n clone.inheritDirection = this.inheritDirection;\n clone.inheritedVelocityAmount = this.inheritedVelocityAmount;\n clone.particleSystem._disposeEmitterOnDispose = true;\n clone.particleSystem.disposeOnStop = true;\n return clone;\n }\n /**\n * Serialize current object to a JSON object\n * @param serializeTexture defines if the texture must be serialized as well\n * @returns the serialized object\n */\n serialize(serializeTexture = false) {\n const serializationObject = {};\n serializationObject.type = this.type;\n serializationObject.inheritDirection = this.inheritDirection;\n serializationObject.inheritedVelocityAmount = this.inheritedVelocityAmount;\n serializationObject.particleSystem = this.particleSystem.serialize(serializeTexture);\n return serializationObject;\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _ParseParticleSystem(system, sceneOrEngine, rootUrl, doNotStart = false) {\n throw _WarnImport(\"ParseParticle\");\n }\n /**\n * Creates a new SubEmitter from a serialized JSON version\n * @param serializationObject defines the JSON object to read from\n * @param sceneOrEngine defines the hosting scene or the hosting engine\n * @param rootUrl defines the rootUrl for data loading\n * @returns a new SubEmitter\n */\n static Parse(serializationObject, sceneOrEngine, rootUrl) {\n const system = serializationObject.particleSystem;\n const subEmitter = new SubEmitter(SubEmitter._ParseParticleSystem(system, sceneOrEngine, rootUrl, true));\n subEmitter.type = serializationObject.type;\n subEmitter.inheritDirection = serializationObject.inheritDirection;\n subEmitter.inheritedVelocityAmount = serializationObject.inheritedVelocityAmount;\n subEmitter.particleSystem._isSubEmitter = true;\n return subEmitter;\n }\n /** Release associated resources */\n dispose() {\n this.particleSystem.dispose();\n }\n}","map":{"version":3,"names":["Vector3","_WarnImport","GetClass","SubEmitterType","SubEmitter","constructor","particleSystem","type","inheritDirection","inheritedVelocityAmount","emitter","dispose","internalClass","getScene","_disposeEmitterOnDispose","clone","getClassName","indexOf","isVisible","name","disposeOnStop","serialize","serializeTexture","serializationObject","_ParseParticleSystem","system","sceneOrEngine","rootUrl","doNotStart","Parse","subEmitter","_isSubEmitter"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Particles/subEmitter.js"],"sourcesContent":["import { Vector3 } from \"../Maths/math.vector.js\";\nimport { _WarnImport } from \"../Misc/devTools.js\";\nimport { GetClass } from \"../Misc/typeStore.js\";\n/**\n * Type of sub emitter\n */\nexport var SubEmitterType;\n(function (SubEmitterType) {\n /**\n * Attached to the particle over it's lifetime\n */\n SubEmitterType[SubEmitterType[\"ATTACHED\"] = 0] = \"ATTACHED\";\n /**\n * Created when the particle dies\n */\n SubEmitterType[SubEmitterType[\"END\"] = 1] = \"END\";\n})(SubEmitterType || (SubEmitterType = {}));\n/**\n * Sub emitter class used to emit particles from an existing particle\n */\nexport class SubEmitter {\n /**\n * Creates a sub emitter\n * @param particleSystem the particle system to be used by the sub emitter\n */\n constructor(\n /**\n * the particle system to be used by the sub emitter\n */\n particleSystem) {\n this.particleSystem = particleSystem;\n /**\n * Type of the submitter (Default: END)\n */\n this.type = 1 /* SubEmitterType.END */;\n /**\n * If the particle should inherit the direction from the particle it's attached to. (+Y will face the direction the particle is moving) (Default: false)\n * Note: This only is supported when using an emitter of type Mesh\n */\n this.inheritDirection = false;\n /**\n * How much of the attached particles speed should be added to the sub emitted particle (default: 0)\n */\n this.inheritedVelocityAmount = 0;\n // Create mesh as emitter to support rotation\n if (!particleSystem.emitter || !particleSystem.emitter.dispose) {\n const internalClass = GetClass(\"BABYLON.AbstractMesh\");\n particleSystem.emitter = new internalClass(\"SubemitterSystemEmitter\", particleSystem.getScene());\n particleSystem._disposeEmitterOnDispose = true;\n }\n }\n /**\n * Clones the sub emitter\n * @returns the cloned sub emitter\n */\n clone() {\n // Clone particle system\n let emitter = this.particleSystem.emitter;\n if (!emitter) {\n emitter = new Vector3();\n }\n else if (emitter instanceof Vector3) {\n emitter = emitter.clone();\n }\n else if (emitter.getClassName().indexOf(\"Mesh\") !== -1) {\n const internalClass = GetClass(\"BABYLON.Mesh\");\n emitter = new internalClass(\"\", emitter.getScene());\n emitter.isVisible = false;\n }\n const clone = new SubEmitter(this.particleSystem.clone(this.particleSystem.name, emitter));\n // Clone properties\n clone.particleSystem.name += \"Clone\";\n clone.type = this.type;\n clone.inheritDirection = this.inheritDirection;\n clone.inheritedVelocityAmount = this.inheritedVelocityAmount;\n clone.particleSystem._disposeEmitterOnDispose = true;\n clone.particleSystem.disposeOnStop = true;\n return clone;\n }\n /**\n * Serialize current object to a JSON object\n * @param serializeTexture defines if the texture must be serialized as well\n * @returns the serialized object\n */\n serialize(serializeTexture = false) {\n const serializationObject = {};\n serializationObject.type = this.type;\n serializationObject.inheritDirection = this.inheritDirection;\n serializationObject.inheritedVelocityAmount = this.inheritedVelocityAmount;\n serializationObject.particleSystem = this.particleSystem.serialize(serializeTexture);\n return serializationObject;\n }\n /**\n * @internal\n */\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n static _ParseParticleSystem(system, sceneOrEngine, rootUrl, doNotStart = false) {\n throw _WarnImport(\"ParseParticle\");\n }\n /**\n * Creates a new SubEmitter from a serialized JSON version\n * @param serializationObject defines the JSON object to read from\n * @param sceneOrEngine defines the hosting scene or the hosting engine\n * @param rootUrl defines the rootUrl for data loading\n * @returns a new SubEmitter\n */\n static Parse(serializationObject, sceneOrEngine, rootUrl) {\n const system = serializationObject.particleSystem;\n const subEmitter = new SubEmitter(SubEmitter._ParseParticleSystem(system, sceneOrEngine, rootUrl, true));\n subEmitter.type = serializationObject.type;\n subEmitter.inheritDirection = serializationObject.inheritDirection;\n subEmitter.inheritedVelocityAmount = serializationObject.inheritedVelocityAmount;\n subEmitter.particleSystem._isSubEmitter = true;\n return subEmitter;\n }\n /** Release associated resources */\n dispose() {\n this.particleSystem.dispose();\n }\n}\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,yBAAyB;AACjD,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,QAAQ,QAAQ,sB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,aAAa,EAAEC,OAAO,EAAEC,UAAU,GAAG,KAAK,EAAE;IAC5E,MAAM3B,WAAW,CAAC,eAAe,CAAC;EACtC;EACA;AACJ;AACA;AACA;AACA;AACA;AACA;EACI,OAAO4B,KAAKA,CAACN,mBAAmB,EAAEG,aAAa,EAAEC,OAAO,EAAE;IACtD,MAAMF,MAAM,GAAGF,mBAAmB,CAACjB,cAAc;IACjD,MAAMwB,UAAU,GAAG,IAAI1B,UAAU,CAACA,UAAU,CAACoB,oBAAoB,CAACC,MAAM,EAAEC,aAAa,EAAEC,OAAO,EAAE,IAAI,CAAC,CAAC;IACxGG,UAAU,CAACvB,IAAI,GAAGgB,mBAAmB,CAAChB,IAAI;IAC1CuB,UAAU,CAACtB,gBAAgB,GAAGe,mBAAmB,CAACf,gBAAgB;IAClEsB,UAAU,CAACrB,uBAAuB,GAAGc,mBAAmB,CAACd,uBAAuB;IAChFqB,UAAU,CAACxB,cAAc,CAACyB,aAAa,GAAG,IAAI;IAC9C,OAAOD,UAAU;EACrB;EACA;EACAnB,OAAOA,CAAA,EAAG;IACN,IAAI,CAACL,cAAc,CAACK,OAAO,CAAC,CAAC;EACjC;AACJ","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}