1 |
- {"ast":null,"code":"import _asyncToGenerator from \"F:/workspace/202226701027/huinongbao-app/node_modules/@babel/runtime/helpers/esm/asyncToGenerator.js\";\nimport { Mesh } from \"../Meshes/mesh.js\";\nimport { GPUParticleSystem } from \"./gpuParticleSystem.js\";\nimport { ParticleSystem } from \"./particleSystem.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { AbstractEngine } from \"../Engines/abstractEngine.js\";\nimport { AddParser, AddIndividualParser, GetIndividualParser } from \"../Loading/Plugins/babylonFileParser.function.js\";\n// Adds the parsers to the scene parsers.\nAddParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedData, scene, container, rootUrl) => {\n const individualParser = GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);\n if (!individualParser) {\n return;\n }\n // Particles Systems\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\n for (let index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\n const parsedParticleSystem = parsedData.particleSystems[index];\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\n }\n }\n});\nAddIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedParticleSystem, scene, rootUrl) => {\n if (parsedParticleSystem.activeParticleCount) {\n const ps = GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\n return ps;\n } else {\n const ps = ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\n return ps;\n }\n});\nAbstractEngine.prototype.createEffectForParticles = function (fragmentName, uniformsNames = [], samplers = [], defines = \"\", fallbacks, onCompiled, onError, particleSystem, shaderLanguage = 0 /* ShaderLanguage.GLSL */) {\n var _particleSystem$verte;\n let attributesNamesOrOptions = [];\n let effectCreationOption = [];\n const allSamplers = [];\n if (particleSystem) {\n particleSystem.fillUniformsAttributesAndSamplerNames(effectCreationOption, attributesNamesOrOptions, allSamplers);\n } else {\n attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions();\n effectCreationOption = ParticleSystem._GetEffectCreationOptions();\n }\n if (defines.indexOf(\" BILLBOARD\") === -1) {\n defines += \"\\n#define BILLBOARD\\n\";\n }\n if (particleSystem !== null && particleSystem !== void 0 && particleSystem.isAnimationSheetEnabled) {\n if (defines.indexOf(\" ANIMATESHEET\") === -1) {\n defines += \"\\n#define ANIMATESHEET\\n\";\n }\n }\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\n samplers.push(\"diffuseSampler\");\n }\n return this.createEffect({\n vertex: (_particleSystem$verte = particleSystem === null || particleSystem === void 0 ? void 0 : particleSystem.vertexShaderName) !== null && _particleSystem$verte !== void 0 ? _particleSystem$verte : \"particles\",\n fragmentElement: fragmentName\n }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), allSamplers.concat(samplers), defines, fallbacks, onCompiled, onError, undefined, shaderLanguage, /*#__PURE__*/_asyncToGenerator(function* () {\n if (shaderLanguage === 0 /* ShaderLanguage.GLSL */) {\n yield import(\"../Shaders/particles.vertex.js\");\n } else {\n yield import(\"../ShadersWGSL/particles.vertex.js\");\n }\n }));\n};\nMesh.prototype.getEmittedParticleSystems = function () {\n const results = [];\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\n const particleSystem = this.getScene().particleSystems[index];\n if (particleSystem.emitter === this) {\n results.push(particleSystem);\n }\n }\n return results;\n};\nMesh.prototype.getHierarchyEmittedParticleSystems = function () {\n const results = [];\n const descendants = this.getDescendants();\n descendants.push(this);\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\n const particleSystem = this.getScene().particleSystems[index];\n const emitter = particleSystem.emitter;\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\n results.push(particleSystem);\n }\n }\n return results;\n};","map":{"version":3,"names":["Mesh","GPUParticleSystem","ParticleSystem","SceneComponentConstants","AbstractEngine","AddParser","AddIndividualParser","GetIndividualParser","NAME_PARTICLESYSTEM","parsedData","scene","container","rootUrl","individualParser","particleSystems","undefined","index","cache","length","parsedParticleSystem","push","activeParticleCount","ps","Parse","prototype","createEffectForParticles","fragmentName","uniformsNames","samplers","defines","fallbacks","onCompiled","onError","particleSystem","shaderLanguage","_particleSystem$verte","attributesNamesOrOptions","effectCreationOption","allSamplers","fillUniformsAttributesAndSamplerNames","_GetAttributeNamesOrOptions","_GetEffectCreationOptions","indexOf","isAnimationSheetEnabled","createEffect","vertex","vertexShaderName","fragmentElement","concat","_asyncToGenerator","getEmittedParticleSystems","results","getScene","emitter","getHierarchyEmittedParticleSystems","descendants","getDescendants","position"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Particles/particleSystemComponent.js"],"sourcesContent":["import { Mesh } from \"../Meshes/mesh.js\";\nimport { GPUParticleSystem } from \"./gpuParticleSystem.js\";\nimport { ParticleSystem } from \"./particleSystem.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { AbstractEngine } from \"../Engines/abstractEngine.js\";\nimport { AddParser, AddIndividualParser, GetIndividualParser } from \"../Loading/Plugins/babylonFileParser.function.js\";\n// Adds the parsers to the scene parsers.\nAddParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedData, scene, container, rootUrl) => {\n const individualParser = GetIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM);\n if (!individualParser) {\n return;\n }\n // Particles Systems\n if (parsedData.particleSystems !== undefined && parsedData.particleSystems !== null) {\n for (let index = 0, cache = parsedData.particleSystems.length; index < cache; index++) {\n const parsedParticleSystem = parsedData.particleSystems[index];\n container.particleSystems.push(individualParser(parsedParticleSystem, scene, rootUrl));\n }\n }\n});\nAddIndividualParser(SceneComponentConstants.NAME_PARTICLESYSTEM, (parsedParticleSystem, scene, rootUrl) => {\n if (parsedParticleSystem.activeParticleCount) {\n const ps = GPUParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\n return ps;\n }\n else {\n const ps = ParticleSystem.Parse(parsedParticleSystem, scene, rootUrl);\n return ps;\n }\n});\nAbstractEngine.prototype.createEffectForParticles = function (fragmentName, uniformsNames = [], samplers = [], defines = \"\", fallbacks, onCompiled, onError, particleSystem, shaderLanguage = 0 /* ShaderLanguage.GLSL */) {\n let attributesNamesOrOptions = [];\n let effectCreationOption = [];\n const allSamplers = [];\n if (particleSystem) {\n particleSystem.fillUniformsAttributesAndSamplerNames(effectCreationOption, attributesNamesOrOptions, allSamplers);\n }\n else {\n attributesNamesOrOptions = ParticleSystem._GetAttributeNamesOrOptions();\n effectCreationOption = ParticleSystem._GetEffectCreationOptions();\n }\n if (defines.indexOf(\" BILLBOARD\") === -1) {\n defines += \"\\n#define BILLBOARD\\n\";\n }\n if (particleSystem?.isAnimationSheetEnabled) {\n if (defines.indexOf(\" ANIMATESHEET\") === -1) {\n defines += \"\\n#define ANIMATESHEET\\n\";\n }\n }\n if (samplers.indexOf(\"diffuseSampler\") === -1) {\n samplers.push(\"diffuseSampler\");\n }\n return this.createEffect({\n vertex: particleSystem?.vertexShaderName ?? \"particles\",\n fragmentElement: fragmentName,\n }, attributesNamesOrOptions, effectCreationOption.concat(uniformsNames), allSamplers.concat(samplers), defines, fallbacks, onCompiled, onError, undefined, shaderLanguage, async () => {\n if (shaderLanguage === 0 /* ShaderLanguage.GLSL */) {\n await import(\"../Shaders/particles.vertex.js\");\n }\n else {\n await import(\"../ShadersWGSL/particles.vertex.js\");\n }\n });\n};\nMesh.prototype.getEmittedParticleSystems = function () {\n const results = [];\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\n const particleSystem = this.getScene().particleSystems[index];\n if (particleSystem.emitter === this) {\n results.push(particleSystem);\n }\n }\n return results;\n};\nMesh.prototype.getHierarchyEmittedParticleSystems = function () {\n const results = [];\n const descendants = this.getDescendants();\n descendants.push(this);\n for (let index = 0; index < this.getScene().particleSystems.length; index++) {\n const particleSystem = this.getScene().particleSystems[index];\n const emitter = particleSystem.emitter;\n if (emitter.position && descendants.indexOf(emitter) !== -1) {\n results.push(particleSystem);\n }\n }\n return results;\n};\n"],"mappings":";AAAA,SAASA,IAAI,QAAQ,mBAAmB;AACxC,SAASC,iBAA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