@onerjs/core 8.30.3 → 8.30.5
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/Audio/audioSceneComponent.d.ts +9 -5
- package/Audio/audioSceneComponent.js +1 -0
- package/Audio/audioSceneComponent.js.map +1 -1
- package/AudioV2/abstractAudio/audioEngineV2.d.ts +8 -0
- package/AudioV2/abstractAudio/audioEngineV2.js +19 -0
- package/AudioV2/abstractAudio/audioEngineV2.js.map +1 -1
- package/AudioV2/webAudio/webAudioEngine.d.ts +5 -0
- package/AudioV2/webAudio/webAudioEngine.js +8 -0
- package/AudioV2/webAudio/webAudioEngine.js.map +1 -1
- package/AudioV2/webAudio/webAudioStaticSound.js +2 -2
- package/AudioV2/webAudio/webAudioStaticSound.js.map +1 -1
- package/AudioV2/webAudio/webAudioStreamingSound.js +5 -2
- package/AudioV2/webAudio/webAudioStreamingSound.js.map +1 -1
- package/Cameras/camera.d.ts +4 -0
- package/Cameras/camera.js +18 -9
- package/Cameras/camera.js.map +1 -1
- package/Engines/WebGPU/webgpuDrawContext.d.ts +8 -0
- package/Engines/WebGPU/webgpuDrawContext.js +8 -0
- package/Engines/WebGPU/webgpuDrawContext.js.map +1 -1
- package/Engines/abstractEngine.js +2 -2
- package/Engines/abstractEngine.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/bloomPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js +1 -1
- package/FrameGraph/Node/Blocks/PostProcesses/chromaticAberrationPostProcessBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/computeShaderBlock.d.ts +42 -0
- package/FrameGraph/Node/Blocks/computeShaderBlock.js +74 -0
- package/FrameGraph/Node/Blocks/computeShaderBlock.js.map +1 -0
- package/FrameGraph/Node/Blocks/executeBlock.d.ts +11 -1
- package/FrameGraph/Node/Blocks/executeBlock.js +18 -0
- package/FrameGraph/Node/Blocks/executeBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/index.d.ts +1 -0
- package/FrameGraph/Node/Blocks/index.js +1 -0
- package/FrameGraph/Node/Blocks/index.js.map +1 -1
- package/FrameGraph/Node/Blocks/inputBlock.js +2 -0
- package/FrameGraph/Node/Blocks/inputBlock.js.map +1 -1
- package/FrameGraph/Node/Blocks/outputBlock.js +1 -0
- package/FrameGraph/Node/Blocks/outputBlock.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraph.d.ts +1 -1
- package/FrameGraph/Node/nodeRenderGraph.js +7 -3
- package/FrameGraph/Node/nodeRenderGraph.js.map +1 -1
- package/FrameGraph/Node/nodeRenderGraphBlock.js +7 -0
- package/FrameGraph/Node/nodeRenderGraphBlock.js.map +1 -1
- package/FrameGraph/Passes/pass.d.ts +11 -1
- package/FrameGraph/Passes/pass.js +11 -1
- package/FrameGraph/Passes/pass.js.map +1 -1
- package/FrameGraph/Tasks/Misc/computeShaderTask.d.ts +115 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js +174 -0
- package/FrameGraph/Tasks/Misc/computeShaderTask.js.map +1 -0
- package/FrameGraph/Tasks/Misc/executeTask.d.ts +5 -0
- package/FrameGraph/Tasks/Misc/executeTask.js +3 -0
- package/FrameGraph/Tasks/Misc/executeTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.d.ts +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js +1 -1
- package/FrameGraph/Tasks/PostProcesses/bloomTask.js.map +1 -1
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.d.ts +1 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js +7 -0
- package/FrameGraph/Tasks/PostProcesses/ssao2Task.js.map +1 -1
- package/FrameGraph/frameGraph.d.ts +1 -1
- package/FrameGraph/frameGraph.js +3 -6
- package/FrameGraph/frameGraph.js.map +1 -1
- package/FrameGraph/frameGraphTask.d.ts +3 -2
- package/FrameGraph/frameGraphTask.js +5 -2
- package/FrameGraph/frameGraphTask.js.map +1 -1
- package/FrameGraph/frameGraphTextureManager.js +2 -2
- package/FrameGraph/frameGraphTextureManager.js.map +1 -1
- package/FrameGraph/index.d.ts +1 -0
- package/FrameGraph/index.js +1 -0
- package/FrameGraph/index.js.map +1 -1
- package/Lights/directionalLight.js +1 -4
- package/Lights/directionalLight.js.map +1 -1
- package/Lights/pointLight.js +2 -5
- package/Lights/pointLight.js.map +1 -1
- package/Materials/Background/backgroundMaterial.js +9 -5
- package/Materials/Background/backgroundMaterial.js.map +1 -1
- package/Materials/PBR/openpbrMaterial.d.ts +14 -0
- package/Materials/PBR/openpbrMaterial.js +16 -0
- package/Materials/PBR/openpbrMaterial.js.map +1 -1
- package/Materials/materialHelper.functions.d.ts +8 -0
- package/Materials/materialHelper.functions.js +31 -0
- package/Materials/materialHelper.functions.js.map +1 -1
- package/Materials/shaderMaterial.js +20 -0
- package/Materials/shaderMaterial.js.map +1 -1
- package/Maths/math.vector.functions.d.ts +26 -13
- package/Maths/math.vector.functions.js +29 -8
- package/Maths/math.vector.functions.js.map +1 -1
- package/Meshes/mesh.js +1 -1
- package/Meshes/mesh.js.map +1 -1
- package/Misc/decorators.d.ts +1 -1
- package/Misc/decorators.js.map +1 -1
- package/Misc/dumpTools.d.ts +20 -0
- package/Misc/dumpTools.js +60 -49
- package/Misc/dumpTools.js.map +1 -1
- package/Misc/index.d.ts +1 -2
- package/Misc/index.js +1 -2
- package/Misc/index.js.map +1 -1
- package/Misc/sceneSerializer.js +4 -1
- package/Misc/sceneSerializer.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/boxShapeBlock.js.map +1 -1
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.d.ts +57 -0
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js +163 -0
- package/Particles/Node/Blocks/Emitters/coneShapeBlock.js.map +1 -0
- package/Particles/Node/Blocks/Emitters/index.d.ts +5 -4
- package/Particles/Node/Blocks/Emitters/index.js +5 -4
- package/Particles/Node/Blocks/Emitters/index.js.map +1 -1
- package/Particles/Node/Blocks/particleInputBlock.js +2 -0
- package/Particles/Node/Blocks/particleInputBlock.js.map +1 -1
- package/Particles/Node/Blocks/systemBlock.d.ts +4 -0
- package/Particles/Node/Blocks/systemBlock.js +8 -0
- package/Particles/Node/Blocks/systemBlock.js.map +1 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.d.ts +5 -1
- package/Particles/Node/Enums/nodeParticleContextualSources.js +4 -0
- package/Particles/Node/Enums/nodeParticleContextualSources.js.map +1 -1
- package/Particles/Node/nodeParticleBuildState.js +5 -0
- package/Particles/Node/nodeParticleBuildState.js.map +1 -1
- package/Particles/Node/nodeParticleSystemSet.helper.d.ts +4 -3
- package/Particles/Node/nodeParticleSystemSet.helper.js +182 -115
- package/Particles/Node/nodeParticleSystemSet.helper.js.map +1 -1
- package/Physics/physicsRaycastResult.d.ts +3 -0
- package/Physics/physicsRaycastResult.js.map +1 -1
- package/Physics/v2/Plugins/havokPlugin.js +1 -1
- package/Physics/v2/Plugins/havokPlugin.js.map +1 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.d.ts +1 -0
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js +9 -1
- package/PostProcesses/RenderPipeline/Pipelines/ssao2RenderingPipeline.js.map +1 -1
- package/PostProcesses/postProcess.d.ts +4 -0
- package/PostProcesses/postProcess.js +4 -0
- package/PostProcesses/postProcess.js.map +1 -1
- package/PostProcesses/thinSSAO2PostProcess.d.ts +1 -0
- package/PostProcesses/thinSSAO2PostProcess.js +18 -6
- package/PostProcesses/thinSSAO2PostProcess.js.map +1 -1
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js +1 -0
- package/Rendering/IBLShadows/iblShadowsVoxelRenderer.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrCoatLayerData.js +4 -0
- package/Shaders/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrDirectLighting.js +5 -2
- package/Shaders/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
- package/Shaders/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js +1 -1
- package/Shaders/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js +1 -1
- package/Shaders/ShadersInclude/pbrBRDFFunctions.js.map +1 -1
- package/Shaders/particles.vertex.js +1 -1
- package/Shaders/particles.vertex.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js +2 -2
- package/ShadersWGSL/ShadersInclude/bonesDeclaration.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js +4 -0
- package/ShadersWGSL/ShadersInclude/openpbrCoatLayerData.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js +5 -2
- package/ShadersWGSL/ShadersInclude/openpbrDirectLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js +2 -2
- package/ShadersWGSL/ShadersInclude/openpbrEnvironmentLighting.js.map +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js +1 -1
- package/ShadersWGSL/ShadersInclude/openpbrFuzzLayerData.js.map +1 -1
- package/ShadersWGSL/iblVoxelGrid.vertex.js +77 -3
- package/ShadersWGSL/iblVoxelGrid.vertex.js.map +1 -1
- package/ShadersWGSL/particles.vertex.js +1 -1
- package/ShadersWGSL/particles.vertex.js.map +1 -1
- package/package.json +1 -1
- package/scene.d.ts +2 -0
- package/scene.js +9 -1
- package/scene.js.map +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.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C;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)\r\n */\r\n public get isEmitterTransformNode() {\r\n if (!this.systemContext) {\r\n return false;\r\n }\r\n\r\n if ((<AbstractMesh>this.systemContext.emitter).position) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (this.isEmitterTransformNode) {\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n return this.systemContext.emitter as Vector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n if (this.isEmitterTransformNode) {\r\n const emitterMesh = <AbstractMesh>this.systemContext.emitter;\r\n return emitterMesh.absolutePosition;\r\n } else {\r\n return this.systemContext.emitter;\r\n }\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleBuildState.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleBuildState.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,6BAA6B,EAAE,MAAM,uCAAuC,CAAC;AAGtF,OAAO,EAAE,qCAAqC,EAAE,MAAM,+CAA+C,CAAC;AACtG,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mCAA+B;AAE1D,OAAO,EAAE,MAAM,EAAE,kCAA8B;AAC/C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAG9E;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAAnC;QAcI,8DAA8D;QACvD,kCAA6B,GAAkC,EAAE,CAAC;QAKzE;;WAEG;QACI,oBAAe,GAAuB,IAAI,CAAC;QAElD;;WAEG;QACI,kBAAa,GAAiC,IAAI,CAAC;QAE1D;;WAEG;QACI,kBAAa,GAAW,CAAC,CAAC;QACjC;;WAEG;QACI,sBAAiB,GAAW,CAAC,CAAC;IAmLzC,CAAC;IA7KG;;OAEG;IACI,UAAU;QACb,IAAI,YAAY,GAAG,EAAE,CAAC;QAEtB,KAAK,MAAM,iBAAiB,IAAI,IAAI,CAAC,6BAA6B,EAAE,CAAC;YACjE,YAAY,IAAI,SAAS,iBAAiB,CAAC,IAAI,eAC3C,iBAAiB,CAAC,UAAU,CAAC,IACjC,IAAI,iBAAiB,CAAC,UAAU,CAAC,YAAY,EAAE,2CAA2C,CAAC;QAC/F,CAAC;QAED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AC,aAAa,EAAE,CAAC;YAC/C,OAAO,IAAI,CAAC;QAChB,CAAC;QAED,QAAQ,MAAM,EAAE,CAAC;YACb,KAAK,yBAAyB,CAAC,IAAI;gBAC/B,OAAO,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC;YAC3C,KAAK,yBAAyB,CAAC,KAAK;gBAChC,OAAO,IAAI,CAAC,aAAa,CAAC,kBAAkB,CAAC;YACjD,KAAK,yBAAyB,CAAC,OAAO;gBAClC,IAAI,IAAI,CAAC,sBAAsB,EAAE,CAAC;oBAC9B,MAAM,WAAW,GAAiB,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;oBAC7D,OAAO,WAAW,CAAC,gBAAgB,CAAC;gBACxC,CAAC;qBAAM,CAAC;oBACJ,OAAO,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC;gBACtC,CAAC;YACL,KAAK,yBAAyB,CAAC,cAAc;gBACzC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,cAAc,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACzE,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ","sourcesContent":["import type { Scene } from \"core/scene\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport type { Particle } from \"../particle\";\r\nimport type { Nullable } from \"core/types\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"./Enums/nodeParticleBlockConnectionPointTypes\";\r\nimport { Vector2, Vector3 } from \"core/Maths/math.vector\";\r\nimport type { ThinParticleSystem } from \"../thinParticleSystem\";\r\nimport { Color4 } from \"core/Maths/math.color\";\r\nimport { NodeParticleSystemSources } from \"./Enums/nodeParticleSystemSources\";\r\nimport type { AbstractMesh } from \"core/Meshes/abstractMesh\";\r\n\r\n/**\r\n * Class used to store node based geometry build state\r\n */\r\nexport class NodeParticleBuildState {\r\n /**\r\n * Gets the capactity of the particle system to build\r\n */\r\n public capacity: number;\r\n\r\n /**\r\n * Gets the scene where the particle system is built\r\n */\r\n public scene: Scene;\r\n\r\n /** Gets or sets the build identifier */\r\n public buildId: number;\r\n\r\n /** Gets or sets the list of non connected mandatory inputs */\r\n public notConnectedNonOptionalInputs: NodeParticleConnectionPoint[] = [];\r\n\r\n /** Gets or sets a boolean indicating that verbose mode is on */\r\n public verbose: boolean;\r\n\r\n /**\r\n * Gets or sets the particle context for contextual data\r\n */\r\n public particleContext: Nullable<Particle> = null;\r\n\r\n /**\r\n * Gets or sets the system context for contextual data\r\n */\r\n public systemContext: Nullable<ThinParticleSystem> = null;\r\n\r\n /**\r\n * Gets or sets the index of the gradient to use\r\n */\r\n public gradientIndex: number = 0;\r\n /**\r\n * Gets or sets next gradient in line\r\n */\r\n public nextGradientIndex: number = 0;\r\n /**\r\n * Gets or sets the next gradient value\r\n */\r\n public nextGradientValue: any;\r\n\r\n /**\r\n * Emits errors if any\r\n */\r\n public emitErrors() {\r\n let errorMessage = \"\";\r\n\r\n for (const notConnectedInput of this.notConnectedNonOptionalInputs) {\r\n errorMessage += `input ${notConnectedInput.name} from block ${\r\n notConnectedInput.ownerBlock.name\r\n }[${notConnectedInput.ownerBlock.getClassName()}] is not connected and is not optional.\\n`;\r\n }\r\n\r\n if (errorMessage) {\r\n // eslint-disable-next-line no-throw-literal\r\n throw \"Build of Node Particle System Set failed:\\n\" + errorMessage;\r\n }\r\n }\r\n\r\n /**\r\n * Adapt a value to a target type\r\n * @param source defines the value to adapt\r\n * @param targetType defines the target type\r\n * @returns the adapted value\r\n */\r\n adapt(source: NodeParticleConnectionPoint, targetType: NodeParticleBlockConnectionPointTypes) {\r\n const value = source.getConnectedValue(this) || 0;\r\n\r\n if (source.type === targetType) {\r\n return value;\r\n }\r\n\r\n switch (targetType) {\r\n case NodeParticleBlockConnectionPointTypes.Vector2:\r\n return new Vector2(value, value);\r\n case NodeParticleBlockConnectionPointTypes.Vector3:\r\n return new Vector3(value, value, value);\r\n case NodeParticleBlockConnectionPointTypes.Color4:\r\n return new Color4(value, value, value, value);\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a contextual source\r\n * @param source Source of the contextual value\r\n * @returns the value associated with the source\r\n */\r\n public getContextualValue(source: NodeParticleContextualSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleContextualSources.Position:\r\n return this.particleContext.position;\r\n case NodeParticleContextualSources.Direction:\r\n return this.particleContext.direction;\r\n case NodeParticleContextualSources.ScaledDirection:\r\n this.particleContext.direction.scaleToRef(this.systemContext._directionScale, this.systemContext._scaledDirection);\r\n return this.systemContext._scaledDirection;\r\n case NodeParticleContextualSources.Color:\r\n return this.particleContext.color;\r\n case NodeParticleContextualSources.InitialColor:\r\n return this.particleContext.initialColor;\r\n case NodeParticleContextualSources.ColorDead:\r\n return this.particleContext.colorDead;\r\n case NodeParticleContextualSources.Age:\r\n return this.particleContext.age;\r\n case NodeParticleContextualSources.Lifetime:\r\n return this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.Angle:\r\n return this.particleContext.angle;\r\n case NodeParticleContextualSources.Scale:\r\n return this.particleContext.scale;\r\n case NodeParticleContextualSources.AgeGradient:\r\n return this.particleContext.age / this.particleContext.lifeTime;\r\n case NodeParticleContextualSources.SpriteCellEnd:\r\n return this.systemContext.endSpriteCellID;\r\n case NodeParticleContextualSources.SpriteCellIndex:\r\n return this.particleContext.cellIndex;\r\n case NodeParticleContextualSources.SpriteCellStart:\r\n return this.systemContext.startSpriteCellID;\r\n case NodeParticleContextualSources.InitialDirection:\r\n return this.particleContext._initialDirection;\r\n case NodeParticleContextualSources.ColorStep:\r\n return this.particleContext.colorStep;\r\n case NodeParticleContextualSources.ScaledColorStep:\r\n this.particleContext.colorStep.scaleToRef(this.systemContext._scaledUpdateSpeed, this.systemContext._scaledColorStep);\r\n return this.systemContext._scaledColorStep;\r\n }\r\n\r\n return null;\r\n }\r\n\r\n /**\r\n * Gets a boolean indicating if the emitter is a transform node (or a simple vector3)\r\n */\r\n public get isEmitterTransformNode() {\r\n if (!this.systemContext) {\r\n return false;\r\n }\r\n\r\n if ((<AbstractMesh>this.systemContext.emitter).position) {\r\n return true;\r\n }\r\n\r\n return false;\r\n }\r\n\r\n /**\r\n * Gets the emitter world matrix\r\n */\r\n public get emitterWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter inverse world matrix\r\n */\r\n public get emitterInverseWorldMatrix() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n return this.systemContext._emitterInverseWorldMatrix;\r\n }\r\n\r\n /**\r\n * Gets the emitter position\r\n */\r\n public get emitterPosition() {\r\n if (!this.systemContext) {\r\n return null;\r\n }\r\n\r\n if (this.isEmitterTransformNode) {\r\n return (<AbstractMesh>this.systemContext.emitter).absolutePosition;\r\n }\r\n\r\n return this.systemContext.emitter as Vector3;\r\n }\r\n\r\n /**\r\n * Gets the value associated with a system source\r\n * @param source Source of the system value\r\n * @returns the value associated with the source\r\n */\r\n public getSystemValue(source: NodeParticleSystemSources) {\r\n if (!this.particleContext || !this.systemContext) {\r\n return null;\r\n }\r\n\r\n switch (source) {\r\n case NodeParticleSystemSources.Time:\r\n return this.systemContext._actualFrame;\r\n case NodeParticleSystemSources.Delta:\r\n return this.systemContext._scaledUpdateSpeed;\r\n case NodeParticleSystemSources.Emitter:\r\n if (this.isEmitterTransformNode) {\r\n const emitterMesh = <AbstractMesh>this.systemContext.emitter;\r\n return emitterMesh.absolutePosition;\r\n } else {\r\n return this.systemContext.emitter;\r\n }\r\n case NodeParticleSystemSources.CameraPosition:\r\n return this.scene.activeCamera?.globalPosition || Vector3.Zero();\r\n }\r\n\r\n return null;\r\n }\r\n}\r\n"]}
|
|
@@ -4,8 +4,9 @@ import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
6
6
|
* @param name The name of the node particle system set.
|
|
7
|
-
* @param
|
|
7
|
+
* @param particleSystemsList The particle systems to convert.
|
|
8
8
|
* @returns The converted node particle system set or null if conversion failed.
|
|
9
|
-
* #0K3AQ2#
|
|
9
|
+
* #0K3AQ2#3672
|
|
10
|
+
* #7J0NXA#4
|
|
10
11
|
*/
|
|
11
|
-
export declare function ConvertToNodeParticleSystemSetAsync(name: string,
|
|
12
|
+
export declare function ConvertToNodeParticleSystemSetAsync(name: string, particleSystemsList: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>>;
|
|
@@ -1,147 +1,214 @@
|
|
|
1
|
+
import { NodeParticleBlockConnectionPointTypes } from "./Enums/nodeParticleBlockConnectionPointTypes.js";
|
|
1
2
|
import { NodeParticleSystemSet } from "./nodeParticleSystemSet.js";
|
|
3
|
+
import { NodeParticleContextualSources } from "./Enums/nodeParticleContextualSources.js";
|
|
4
|
+
import { ParticleConverterBlock } from "./Blocks/particleConverterBlock.js";
|
|
5
|
+
import { ParticleInputBlock } from "./Blocks/particleInputBlock.js";
|
|
6
|
+
import { ParticleMathBlock, ParticleMathBlockOperations } from "./Blocks/particleMathBlock.js";
|
|
7
|
+
import { ParticleRandomBlock } from "./Blocks/particleRandomBlock.js";
|
|
8
|
+
import { ParticleTextureSourceBlock } from "./Blocks/particleSourceTextureBlock.js";
|
|
2
9
|
import { SystemBlock } from "./Blocks/systemBlock.js";
|
|
3
10
|
import { CreateParticleBlock } from "./Blocks/Emitters/createParticleBlock.js";
|
|
4
11
|
import { BoxShapeBlock } from "./Blocks/Emitters/boxShapeBlock.js";
|
|
5
|
-
import {
|
|
6
|
-
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
7
|
-
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
12
|
+
import { ConeShapeBlock } from "./Blocks/Emitters/coneShapeBlock.js";
|
|
8
13
|
import { CylinderShapeBlock } from "./Blocks/Emitters/cylinderShapeBlock.js";
|
|
9
14
|
import { MeshShapeBlock } from "./Blocks/Emitters/meshShapeBlock.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
import { PointShapeBlock } from "./Blocks/Emitters/pointShapeBlock.js";
|
|
16
|
+
import { SphereShapeBlock } from "./Blocks/Emitters/sphereShapeBlock.js";
|
|
17
|
+
import { UpdateColorBlock } from "./Blocks/Update/updateColorBlock.js";
|
|
18
|
+
import { UpdatePositionBlock } from "./Blocks/Update/updatePositionBlock.js";
|
|
19
|
+
/**
|
|
20
|
+
* Converts a ParticleSystem to a NodeParticleSystemSet.
|
|
21
|
+
* @param name The name of the node particle system set.
|
|
22
|
+
* @param particleSystemsList The particle systems to convert.
|
|
23
|
+
* @returns The converted node particle system set or null if conversion failed.
|
|
24
|
+
* #0K3AQ2#3672
|
|
25
|
+
* #7J0NXA#4
|
|
26
|
+
*/
|
|
27
|
+
export async function ConvertToNodeParticleSystemSetAsync(name, particleSystemsList) {
|
|
28
|
+
if (!particleSystemsList || !particleSystemsList.length) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const nodeParticleSystemSet = new NodeParticleSystemSet(name);
|
|
32
|
+
const promises = [];
|
|
33
|
+
for (const particleSystem of particleSystemsList) {
|
|
34
|
+
promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));
|
|
35
|
+
}
|
|
36
|
+
await Promise.all(promises);
|
|
37
|
+
return nodeParticleSystemSet;
|
|
38
|
+
}
|
|
39
|
+
async function _ExtractDatafromParticleSystemAsync(newSet, oldSystem) {
|
|
40
|
+
// System block
|
|
41
|
+
const newSystem = _CreateSystemBlock(oldSystem);
|
|
42
|
+
// Shape block
|
|
43
|
+
const shapeBlock = _CreateShapeBlock(oldSystem);
|
|
44
|
+
// CreateParticle block
|
|
45
|
+
const createParticleBlock = _CreateCreateParticleBlock(oldSystem);
|
|
46
|
+
createParticleBlock.particle.connectTo(shapeBlock.particle);
|
|
47
|
+
// Texture
|
|
48
|
+
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
49
|
+
const url = oldSystem.particleTexture.url || "";
|
|
50
|
+
if (url) {
|
|
51
|
+
textureBlock.url = url;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
textureBlock.sourceTexture = oldSystem.particleTexture;
|
|
55
|
+
}
|
|
56
|
+
textureBlock.texture.connectTo(newSystem.texture);
|
|
57
|
+
// Default position update
|
|
58
|
+
const positionUpdateblock = new UpdatePositionBlock("Position update");
|
|
59
|
+
shapeBlock.output.connectTo(positionUpdateblock.particle);
|
|
60
|
+
const addPositionBlock = new ParticleMathBlock("Add Position");
|
|
61
|
+
addPositionBlock.operation = ParticleMathBlockOperations.Add;
|
|
62
|
+
_CreateAndConnectContextual("Position", NodeParticleContextualSources.Position, addPositionBlock.left);
|
|
63
|
+
_CreateAndConnectContextual("Scaled Direction", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);
|
|
64
|
+
addPositionBlock.output.connectTo(positionUpdateblock.position);
|
|
65
|
+
// Default color update
|
|
66
|
+
const colorUpdateblock = new UpdateColorBlock("Color update");
|
|
67
|
+
positionUpdateblock.output.connectTo(colorUpdateblock.particle);
|
|
68
|
+
const addColorBlock = new ParticleMathBlock("Add Color");
|
|
69
|
+
addColorBlock.operation = ParticleMathBlockOperations.Add;
|
|
70
|
+
_CreateAndConnectContextual("Color", NodeParticleContextualSources.Color, addColorBlock.left);
|
|
71
|
+
_CreateAndConnectContextual("Scaled Color Step", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);
|
|
72
|
+
addColorBlock.output.connectTo(colorUpdateblock.color);
|
|
73
|
+
const decomposeColorBlock = new ParticleConverterBlock("Decompose Color");
|
|
74
|
+
addColorBlock.output.connectTo(decomposeColorBlock.colorIn);
|
|
75
|
+
// Clamp alpha to be >= 0
|
|
76
|
+
const maxAlphaBlock = new ParticleMathBlock("Alpha >= 0");
|
|
77
|
+
maxAlphaBlock.operation = ParticleMathBlockOperations.Max;
|
|
78
|
+
decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);
|
|
79
|
+
_CreateAndConnectInput("Zero", 0, maxAlphaBlock.right);
|
|
80
|
+
const composeColorBlock = new ParticleConverterBlock("Compose Color");
|
|
81
|
+
decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);
|
|
82
|
+
maxAlphaBlock.output.connectTo(composeColorBlock.wIn);
|
|
83
|
+
composeColorBlock.colorOut.connectTo(colorUpdateblock.color);
|
|
84
|
+
colorUpdateblock.output.connectTo(newSystem.particle);
|
|
85
|
+
// Register
|
|
86
|
+
newSet.systemBlocks.push(newSystem);
|
|
87
|
+
}
|
|
88
|
+
function _CreateSystemBlock(oldSystem) {
|
|
89
|
+
const newSystem = new SystemBlock(oldSystem.name);
|
|
90
|
+
newSystem.blendMode = oldSystem.blendMode;
|
|
91
|
+
newSystem.capacity = oldSystem.getCapacity();
|
|
92
|
+
newSystem.emitRate = oldSystem.emitRate;
|
|
93
|
+
newSystem.targetStopDuration = oldSystem.targetStopDuration;
|
|
94
|
+
newSystem.startDelay = oldSystem.startDelay;
|
|
95
|
+
newSystem.updateSpeed = oldSystem.updateSpeed;
|
|
96
|
+
return newSystem;
|
|
18
97
|
}
|
|
19
|
-
|
|
20
|
-
// Main system
|
|
21
|
-
const system = new SystemBlock(particleSystem.name);
|
|
22
|
-
system.capacity = particleSystem.getCapacity();
|
|
23
|
-
system.emitRate = particleSystem.emitRate;
|
|
98
|
+
function _CreateCreateParticleBlock(oldSystem) {
|
|
24
99
|
// Create particle
|
|
25
|
-
const createParticleBlock = new CreateParticleBlock("Create
|
|
26
|
-
//
|
|
100
|
+
const createParticleBlock = new CreateParticleBlock("Create Particle");
|
|
101
|
+
// Color
|
|
102
|
+
const randomColorBlock = new ParticleRandomBlock("Random Color");
|
|
103
|
+
_CreateAndConnectInput("Color 1", oldSystem.color1, randomColorBlock.min);
|
|
104
|
+
_CreateAndConnectInput("Color 2", oldSystem.color2, randomColorBlock.max);
|
|
105
|
+
randomColorBlock.output.connectTo(createParticleBlock.color);
|
|
106
|
+
// Dead color
|
|
107
|
+
_CreateAndConnectInput("Dead Color", oldSystem.colorDead, createParticleBlock.colorDead);
|
|
108
|
+
// Emit power
|
|
109
|
+
const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
|
|
110
|
+
_CreateAndConnectInput("Min Emit Power", oldSystem.minEmitPower, randomEmitPowerBlock.min);
|
|
111
|
+
_CreateAndConnectInput("Max Emit Power", oldSystem.maxEmitPower, randomEmitPowerBlock.max);
|
|
112
|
+
randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
|
|
113
|
+
// Scale
|
|
114
|
+
const randomScaleBlock = new ParticleRandomBlock("Random Scale");
|
|
115
|
+
_CreateAndConnectInput("Min Scale", oldSystem.minSize, randomScaleBlock.min);
|
|
116
|
+
_CreateAndConnectInput("Max Scale", oldSystem.maxSize, randomScaleBlock.max);
|
|
117
|
+
randomScaleBlock.output.connectTo(createParticleBlock.scale);
|
|
118
|
+
// Lifetime
|
|
119
|
+
const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
|
|
120
|
+
_CreateAndConnectInput("Min Lifetime", oldSystem.minLifeTime, randomLifetimeBlock.min);
|
|
121
|
+
_CreateAndConnectInput("Max Lifetime", oldSystem.maxLifeTime, randomLifetimeBlock.max);
|
|
122
|
+
randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
|
|
123
|
+
return createParticleBlock;
|
|
124
|
+
}
|
|
125
|
+
function _CreateShapeBlock(oldSystem) {
|
|
126
|
+
const emitter = oldSystem.particleEmitterType;
|
|
127
|
+
if (!emitter) {
|
|
128
|
+
throw new Error("Particle system has no emitter type.");
|
|
129
|
+
}
|
|
27
130
|
let shapeBlock = null;
|
|
28
|
-
switch (
|
|
131
|
+
switch (emitter.getClassName()) {
|
|
29
132
|
case "BoxParticleEmitter": {
|
|
30
|
-
const source =
|
|
31
|
-
shapeBlock = new BoxShapeBlock("Box
|
|
133
|
+
const source = emitter;
|
|
134
|
+
shapeBlock = new BoxShapeBlock("Box Shape");
|
|
32
135
|
const target = shapeBlock;
|
|
33
|
-
_CreateAndConnectInput(
|
|
34
|
-
_CreateAndConnectInput(
|
|
35
|
-
_CreateAndConnectInput(
|
|
36
|
-
_CreateAndConnectInput(
|
|
136
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
137
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
138
|
+
_CreateAndConnectInput("Min Emit Box", source.minEmitBox, target.minEmitBox);
|
|
139
|
+
_CreateAndConnectInput("Max Emit Box", source.maxEmitBox, target.maxEmitBox);
|
|
37
140
|
break;
|
|
38
141
|
}
|
|
39
|
-
case "
|
|
40
|
-
const source =
|
|
41
|
-
shapeBlock = new
|
|
142
|
+
case "ConeParticleEmitter": {
|
|
143
|
+
const source = emitter;
|
|
144
|
+
shapeBlock = new ConeShapeBlock("Cone Shape");
|
|
42
145
|
const target = shapeBlock;
|
|
43
|
-
_CreateAndConnectInput(
|
|
44
|
-
_CreateAndConnectInput(
|
|
146
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
147
|
+
_CreateAndConnectInput("Angle", source.angle, target.angle);
|
|
148
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
149
|
+
_CreateAndConnectInput("Height Range", source.heightRange, target.heightRange);
|
|
150
|
+
_CreateAndConnectInput("Emit From Spawn Point Only", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);
|
|
151
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
45
152
|
break;
|
|
46
153
|
}
|
|
47
|
-
case "
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const target = shapeBlock;
|
|
51
|
-
_CreateAndConnectInput(target.radius, "Radius", source.radius);
|
|
52
|
-
_CreateAndConnectInput(target.radiusRange, "Radius Range", source.radiusRange);
|
|
53
|
-
_CreateAndConnectInput(target.directionRandomizer, "Direction Randomizer", source.directionRandomizer);
|
|
54
|
-
break;
|
|
154
|
+
case "CustomParticleEmitter": {
|
|
155
|
+
// Custom emitter is not supported in nodes yet
|
|
156
|
+
throw new Error("CustomParticleEmitter is not supported in Node Particle System.");
|
|
55
157
|
}
|
|
56
158
|
case "CylinderParticleEmitter": {
|
|
57
|
-
const source =
|
|
58
|
-
shapeBlock = new CylinderShapeBlock("Cylinder
|
|
159
|
+
const source = emitter;
|
|
160
|
+
shapeBlock = new CylinderShapeBlock("Cylinder Shape");
|
|
59
161
|
const target = shapeBlock;
|
|
60
|
-
_CreateAndConnectInput(
|
|
61
|
-
_CreateAndConnectInput(
|
|
62
|
-
_CreateAndConnectInput(
|
|
63
|
-
_CreateAndConnectInput(
|
|
162
|
+
_CreateAndConnectInput("Height", source.height, target.height);
|
|
163
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
164
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
165
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
64
166
|
break;
|
|
65
167
|
}
|
|
168
|
+
case "HemisphericParticleEmitter": {
|
|
169
|
+
// Hemispheric emitter is not supported in nodes yet
|
|
170
|
+
throw new Error("HemisphericParticleEmitter is not supported in Node Particle System.");
|
|
171
|
+
}
|
|
66
172
|
case "MeshParticleEmitter": {
|
|
67
|
-
const source =
|
|
68
|
-
shapeBlock = new MeshShapeBlock("Mesh
|
|
173
|
+
const source = emitter;
|
|
174
|
+
shapeBlock = new MeshShapeBlock("Mesh Shape");
|
|
69
175
|
const target = shapeBlock;
|
|
70
|
-
_CreateAndConnectInput(
|
|
71
|
-
_CreateAndConnectInput(
|
|
176
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
177
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
72
178
|
target.mesh = source.mesh;
|
|
73
179
|
break;
|
|
74
180
|
}
|
|
181
|
+
case "PointParticleEmitter": {
|
|
182
|
+
const source = emitter;
|
|
183
|
+
shapeBlock = new PointShapeBlock("Point Shape");
|
|
184
|
+
const target = shapeBlock;
|
|
185
|
+
_CreateAndConnectInput("Direction 1", source.direction1, target.direction1);
|
|
186
|
+
_CreateAndConnectInput("Direction 2", source.direction2, target.direction2);
|
|
187
|
+
break;
|
|
188
|
+
}
|
|
189
|
+
case "SphereParticleEmitter": {
|
|
190
|
+
const source = emitter;
|
|
191
|
+
shapeBlock = new SphereShapeBlock("Sphere Shape");
|
|
192
|
+
const target = shapeBlock;
|
|
193
|
+
_CreateAndConnectInput("Radius", source.radius, target.radius);
|
|
194
|
+
_CreateAndConnectInput("Radius Range", source.radiusRange, target.radiusRange);
|
|
195
|
+
_CreateAndConnectInput("Direction Randomizer", source.directionRandomizer, target.directionRandomizer);
|
|
196
|
+
break;
|
|
197
|
+
}
|
|
75
198
|
}
|
|
76
199
|
if (!shapeBlock) {
|
|
77
|
-
throw new Error(`Unsupported particle emitter type: ${
|
|
78
|
-
}
|
|
79
|
-
createParticleBlock.particle.connectTo(shapeBlock.particle);
|
|
80
|
-
createParticleBlock.colorDead.value = particleSystem.colorDead;
|
|
81
|
-
// Color
|
|
82
|
-
const color0Block = new ParticleInputBlock("Color0");
|
|
83
|
-
color0Block.value = particleSystem.color1;
|
|
84
|
-
const color1Block = new ParticleInputBlock("Color1");
|
|
85
|
-
color1Block.value = particleSystem.color2;
|
|
86
|
-
const randomColorBlock = new ParticleRandomBlock("Random Color");
|
|
87
|
-
color0Block.output.connectTo(randomColorBlock.min);
|
|
88
|
-
color1Block.output.connectTo(randomColorBlock.max);
|
|
89
|
-
randomColorBlock.output.connectTo(createParticleBlock.color);
|
|
90
|
-
// Emit power
|
|
91
|
-
const minEmitPowerBlock = new ParticleInputBlock("Min Emit Power");
|
|
92
|
-
minEmitPowerBlock.value = particleSystem.minEmitPower;
|
|
93
|
-
const maxEmitPowerBlock = new ParticleInputBlock("Max Emit Power");
|
|
94
|
-
maxEmitPowerBlock.value = particleSystem.maxEmitPower;
|
|
95
|
-
const randomEmitPowerBlock = new ParticleRandomBlock("Random Emit Power");
|
|
96
|
-
minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);
|
|
97
|
-
maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);
|
|
98
|
-
randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);
|
|
99
|
-
// Lifetime
|
|
100
|
-
const minLifetimeBlock = new ParticleInputBlock("Min Lifetime");
|
|
101
|
-
minLifetimeBlock.value = particleSystem.minLifeTime;
|
|
102
|
-
const maxLifetimeBlock = new ParticleInputBlock("Max Lifetime");
|
|
103
|
-
maxLifetimeBlock.value = particleSystem.maxLifeTime;
|
|
104
|
-
const randomLifetimeBlock = new ParticleRandomBlock("Random Lifetime");
|
|
105
|
-
minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);
|
|
106
|
-
maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);
|
|
107
|
-
randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);
|
|
108
|
-
// Texture
|
|
109
|
-
const textureBlock = new ParticleTextureSourceBlock("Texture");
|
|
110
|
-
const url = particleSystem.particleTexture.url || "";
|
|
111
|
-
if (url) {
|
|
112
|
-
textureBlock.url = url;
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
textureBlock.sourceTexture = particleSystem.particleTexture;
|
|
200
|
+
throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);
|
|
116
201
|
}
|
|
117
|
-
|
|
118
|
-
// Default position update
|
|
119
|
-
const basicPositionUpdateBlock = new BasicPositionUpdateBlock("Position update");
|
|
120
|
-
shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);
|
|
121
|
-
// Default color update
|
|
122
|
-
const basicColorUpdateBlock = new BasicColorUpdateBlock("Color update");
|
|
123
|
-
basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);
|
|
124
|
-
basicColorUpdateBlock.output.connectTo(system.particle);
|
|
125
|
-
// Register
|
|
126
|
-
target.systemBlocks.push(system);
|
|
202
|
+
return shapeBlock;
|
|
127
203
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
const nodeParticleSystemSet = new NodeParticleSystemSet(name);
|
|
140
|
-
const promises = [];
|
|
141
|
-
for (const particleSystem of particleSystems) {
|
|
142
|
-
promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));
|
|
143
|
-
}
|
|
144
|
-
await Promise.all(promises);
|
|
145
|
-
return nodeParticleSystemSet;
|
|
204
|
+
function _CreateAndConnectInput(inputBlockName, value, targetToConnectTo, inputType) {
|
|
205
|
+
const input = new ParticleInputBlock(inputBlockName, inputType);
|
|
206
|
+
input.value = value;
|
|
207
|
+
input.output.connectTo(targetToConnectTo);
|
|
208
|
+
}
|
|
209
|
+
function _CreateAndConnectContextual(contextualBlockName, contextValue, targetToConnectTo) {
|
|
210
|
+
const input = new ParticleInputBlock(contextualBlockName);
|
|
211
|
+
input.contextualValue = contextValue;
|
|
212
|
+
input.output.connectTo(targetToConnectTo);
|
|
146
213
|
}
|
|
147
214
|
//# sourceMappingURL=nodeParticleSystemSet.helper.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nodeParticleSystemSet.helper.js","sourceRoot":"","sources":["../../../../../dev/core/src/Particles/Node/nodeParticleSystemSet.helper.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CA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C,iBAAiB,CAAC,CAAC;IACjF,UAAU,CAAC,MAAM,CAAC,SAAS,CAAC,wBAAwB,CAAC,QAAQ,CAAC,CAAC;IAE/D,uBAAuB;IACvB,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,cAAc,CAAC,CAAC;IACxE,wBAAwB,CAAC,MAAM,CAAC,SAAS,CAAC,qBAAqB,CAAC,QAAQ,CAAC,CAAC;IAC1E,qBAAqB,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAExD,WAAW;IACX,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;AACrC,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,mCAAmC,CAAC,IAAY,EAAE,eAAiC;IACrG,IAAI,CAAC,eAAe,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,CAAC;QAC9C,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAoB,EAAE,CAAC;IAErC,KAAK,MAAM,cAAc,IAAI,eAAe,EAAE,CAAC;QAC3C,QAAQ,CAAC,IAAI,CAAC,mCAAmC,CAAC,cAAc,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC9F,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC5B,OAAO,qBAAqB,CAAC;AACjC,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { ParticleSystem } from \"../particleSystem\";\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport type { IShapeBlock } from \"./Blocks/Emitters/IShapeBlock\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { NodeParticleConnectionPoint } from \"./nodeParticleBlockConnectionPoint\";\r\nimport type { BoxParticleEmitter } from \"../EmitterTypes/boxParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"../EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"../EmitterTypes/sphereParticleEmitter\";\r\nimport type { CylinderParticleEmitter, MeshParticleEmitter } from \"../EmitterTypes\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport type { Texture } from \"../../Materials/Textures/texture\";\r\nimport { BasicPositionUpdateBlock } from \"./Blocks/Update/basicPositionUpdateBlock\";\r\nimport { BasicColorUpdateBlock } from \"./Blocks/Update/basicColorUpdateBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\n\r\nfunction _CreateAndConnectInput(connectionPoint: NodeParticleConnectionPoint, name: string, defaultValue: Vector3 | number) {\r\n const input = new ParticleInputBlock(name);\r\n input.value = defaultValue;\r\n input.output.connectTo(connectionPoint);\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(particleSystem: ParticleSystem, target: NodeParticleSystemSet) {\r\n // Main system\r\n const system = new SystemBlock(particleSystem.name);\r\n system.capacity = particleSystem.getCapacity();\r\n system.emitRate = particleSystem.emitRate;\r\n\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create particle\");\r\n\r\n // Shape\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (particleSystem.particleEmitterType.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n _CreateAndConnectInput(target.minEmitBox, \"Min Emit Box\", source.minEmitBox);\r\n _CreateAndConnectInput(target.maxEmitBox, \"Max Emit Box\", source.maxEmitBox);\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(target.height, \"Height\", source.height);\r\n _CreateAndConnectInput(target.radius, \"Radius\", source.radius);\r\n _CreateAndConnectInput(target.radiusRange, \"Radius Range\", source.radiusRange);\r\n _CreateAndConnectInput(target.directionRandomizer, \"Direction Randomizer\", source.directionRandomizer);\r\n break;\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = particleSystem.particleEmitterType as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(target.direction1, \"Direction 1\", source.direction1);\r\n _CreateAndConnectInput(target.direction2, \"Direction 2\", source.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${particleSystem.particleEmitterType.getClassName()}`);\r\n }\r\n\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n createParticleBlock.colorDead.value = particleSystem.colorDead;\r\n\r\n // Color\r\n const color0Block = new ParticleInputBlock(\"Color0\");\r\n color0Block.value = particleSystem.color1;\r\n\r\n const color1Block = new ParticleInputBlock(\"Color1\");\r\n color1Block.value = particleSystem.color2;\r\n\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color\");\r\n color0Block.output.connectTo(randomColorBlock.min);\r\n color1Block.output.connectTo(randomColorBlock.max);\r\n\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Emit power\r\n const minEmitPowerBlock = new ParticleInputBlock(\"Min Emit Power\");\r\n minEmitPowerBlock.value = particleSystem.minEmitPower;\r\n\r\n const maxEmitPowerBlock = new ParticleInputBlock(\"Max Emit Power\");\r\n maxEmitPowerBlock.value = particleSystem.maxEmitPower;\r\n\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n minEmitPowerBlock.output.connectTo(randomEmitPowerBlock.min);\r\n maxEmitPowerBlock.output.connectTo(randomEmitPowerBlock.max);\r\n\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Lifetime\r\n const minLifetimeBlock = new ParticleInputBlock(\"Min Lifetime\");\r\n minLifetimeBlock.value = particleSystem.minLifeTime;\r\n\r\n const maxLifetimeBlock = new ParticleInputBlock(\"Max Lifetime\");\r\n maxLifetimeBlock.value = particleSystem.maxLifeTime;\r\n\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n minLifetimeBlock.output.connectTo(randomLifetimeBlock.min);\r\n maxLifetimeBlock.output.connectTo(randomLifetimeBlock.max);\r\n\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (particleSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = particleSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(system.texture);\r\n\r\n // Default position update\r\n const basicPositionUpdateBlock = new BasicPositionUpdateBlock(\"Position update\");\r\n shapeBlock.output.connectTo(basicPositionUpdateBlock.particle);\r\n\r\n // Default color update\r\n const basicColorUpdateBlock = new BasicColorUpdateBlock(\"Color update\");\r\n basicPositionUpdateBlock.output.connectTo(basicColorUpdateBlock.particle);\r\n basicColorUpdateBlock.output.connectTo(system.particle);\r\n\r\n // Register\r\n target.systemBlocks.push(system);\r\n}\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystems The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3627\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystems: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystems || !particleSystems.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystems) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(particleSystem, nodeParticleSystemSet));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n"]}
|
|
1
|
+
{"version":3,"file":"nodeParticleSystemS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,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;YAC/E,sBAAsB,CAAC,sBAAsB,EAAE,MAAM,CAAC,mBAAmB,EAAE,MAAM,CAAC,mBAAmB,CAAC,CAAC;YACvG,MAAM;QACV,CAAC;IACL,CAAC;IAED,IAAI,CAAC,UAAU,EAAE,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,sCAAsC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IACpF,CAAC;IAED,OAAO,UAAU,CAAC;AACtB,CAAC;AAED,SAAS,sBAAsB,CAC3B,cAAsB,EACtB,KAAgC,EAChC,iBAA8C,EAC9C,SAAiD;IAEjD,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;IAChE,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;IACpB,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC;AAED,SAAS,2BAA2B,CAAC,mBAA2B,EAAE,YAA2C,EAAE,iBAA8C;IACzJ,MAAM,KAAK,GAAG,IAAI,kBAAkB,CAAC,mBAAmB,CAAC,CAAC;IAC1D,KAAK,CAAC,eAAe,GAAG,YAAY,CAAC;IACrC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type { Nullable } from \"core/types\";\r\nimport type { Color4 } from \"core/Maths/math.color\";\r\nimport type { Vector3 } from \"core/Maths/math.vector\";\r\nimport type { Texture } from \"core/Materials/Textures/texture\";\r\nimport type { Mesh } from \"core/Meshes/mesh\";\r\nimport type { ParticleSystem } from \"core/Particles/particleSystem\";\r\nimport type { IParticleSystem } from \"core/Particles/IParticleSystem\";\r\nimport type { BoxParticleEmitter } from \"core/Particles/EmitterTypes/boxParticleEmitter\";\r\nimport type { ConeParticleEmitter } from \"core/Particles/EmitterTypes/coneParticleEmitter\";\r\nimport type { CylinderParticleEmitter } from \"core/Particles/EmitterTypes/cylinderParticleEmitter\";\r\nimport type { MeshParticleEmitter } from \"core/Particles/EmitterTypes/meshParticleEmitter\";\r\nimport type { PointParticleEmitter } from \"core/Particles/EmitterTypes/pointParticleEmitter\";\r\nimport type { SphereParticleEmitter } from \"core/Particles/EmitterTypes/sphereParticleEmitter\";\r\nimport type { NodeParticleConnectionPoint } from \"core/Particles/Node/nodeParticleBlockConnectionPoint\";\r\nimport type { IShapeBlock } from \"core/Particles/Node/Blocks/Emitters/IShapeBlock\";\r\nimport { NodeParticleBlockConnectionPointTypes } from \"core/Particles/Node/Enums/nodeParticleBlockConnectionPointTypes\";\r\n\r\nimport { NodeParticleSystemSet } from \"./nodeParticleSystemSet\";\r\nimport { NodeParticleContextualSources } from \"./Enums/nodeParticleContextualSources\";\r\nimport { ParticleConverterBlock } from \"./Blocks/particleConverterBlock\";\r\nimport { ParticleInputBlock } from \"./Blocks/particleInputBlock\";\r\nimport { ParticleMathBlock, ParticleMathBlockOperations } from \"./Blocks/particleMathBlock\";\r\nimport { ParticleRandomBlock } from \"./Blocks/particleRandomBlock\";\r\nimport { ParticleTextureSourceBlock } from \"./Blocks/particleSourceTextureBlock\";\r\nimport { SystemBlock } from \"./Blocks/systemBlock\";\r\nimport { CreateParticleBlock } from \"./Blocks/Emitters/createParticleBlock\";\r\nimport { BoxShapeBlock } from \"./Blocks/Emitters/boxShapeBlock\";\r\nimport { ConeShapeBlock } from \"./Blocks/Emitters/coneShapeBlock\";\r\nimport { CylinderShapeBlock } from \"./Blocks/Emitters/cylinderShapeBlock\";\r\nimport { MeshShapeBlock } from \"./Blocks/Emitters/meshShapeBlock\";\r\nimport { PointShapeBlock } from \"./Blocks/Emitters/pointShapeBlock\";\r\nimport { SphereShapeBlock } from \"./Blocks/Emitters/sphereShapeBlock\";\r\nimport { UpdateColorBlock } from \"./Blocks/Update/updateColorBlock\";\r\nimport { UpdatePositionBlock } from \"./Blocks/Update/updatePositionBlock\";\r\n\r\n/**\r\n * Converts a ParticleSystem to a NodeParticleSystemSet.\r\n * @param name The name of the node particle system set.\r\n * @param particleSystemsList The particle systems to convert.\r\n * @returns The converted node particle system set or null if conversion failed.\r\n * #0K3AQ2#3672\r\n * #7J0NXA#4\r\n */\r\nexport async function ConvertToNodeParticleSystemSetAsync(name: string, particleSystemsList: ParticleSystem[]): Promise<Nullable<NodeParticleSystemSet>> {\r\n if (!particleSystemsList || !particleSystemsList.length) {\r\n return null;\r\n }\r\n\r\n const nodeParticleSystemSet = new NodeParticleSystemSet(name);\r\n const promises: Promise<void>[] = [];\r\n\r\n for (const particleSystem of particleSystemsList) {\r\n promises.push(_ExtractDatafromParticleSystemAsync(nodeParticleSystemSet, particleSystem));\r\n }\r\n\r\n await Promise.all(promises);\r\n return nodeParticleSystemSet;\r\n}\r\n\r\nasync function _ExtractDatafromParticleSystemAsync(newSet: NodeParticleSystemSet, oldSystem: ParticleSystem): Promise<void> {\r\n // System block\r\n const newSystem = _CreateSystemBlock(oldSystem);\r\n\r\n // Shape block\r\n const shapeBlock = _CreateShapeBlock(oldSystem);\r\n\r\n // CreateParticle block\r\n const createParticleBlock = _CreateCreateParticleBlock(oldSystem);\r\n createParticleBlock.particle.connectTo(shapeBlock.particle);\r\n\r\n // Texture\r\n const textureBlock = new ParticleTextureSourceBlock(\"Texture\");\r\n const url = (oldSystem.particleTexture as Texture).url || \"\";\r\n if (url) {\r\n textureBlock.url = url;\r\n } else {\r\n textureBlock.sourceTexture = oldSystem.particleTexture;\r\n }\r\n textureBlock.texture.connectTo(newSystem.texture);\r\n\r\n // Default position update\r\n const positionUpdateblock = new UpdatePositionBlock(\"Position update\");\r\n shapeBlock.output.connectTo(positionUpdateblock.particle);\r\n\r\n const addPositionBlock = new ParticleMathBlock(\"Add Position\");\r\n addPositionBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Position\", NodeParticleContextualSources.Position, addPositionBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Direction\", NodeParticleContextualSources.ScaledDirection, addPositionBlock.right);\r\n addPositionBlock.output.connectTo(positionUpdateblock.position);\r\n\r\n // Default color update\r\n const colorUpdateblock = new UpdateColorBlock(\"Color update\");\r\n positionUpdateblock.output.connectTo(colorUpdateblock.particle);\r\n\r\n const addColorBlock = new ParticleMathBlock(\"Add Color\");\r\n addColorBlock.operation = ParticleMathBlockOperations.Add;\r\n _CreateAndConnectContextual(\"Color\", NodeParticleContextualSources.Color, addColorBlock.left);\r\n _CreateAndConnectContextual(\"Scaled Color Step\", NodeParticleContextualSources.ScaledColorStep, addColorBlock.right);\r\n addColorBlock.output.connectTo(colorUpdateblock.color);\r\n\r\n const decomposeColorBlock = new ParticleConverterBlock(\"Decompose Color\");\r\n addColorBlock.output.connectTo(decomposeColorBlock.colorIn);\r\n\r\n // Clamp alpha to be >= 0\r\n const maxAlphaBlock = new ParticleMathBlock(\"Alpha >= 0\");\r\n maxAlphaBlock.operation = ParticleMathBlockOperations.Max;\r\n decomposeColorBlock.wOut.connectTo(maxAlphaBlock.left);\r\n _CreateAndConnectInput(\"Zero\", 0, maxAlphaBlock.right);\r\n\r\n const composeColorBlock = new ParticleConverterBlock(\"Compose Color\");\r\n decomposeColorBlock.xyzOut.connectTo(composeColorBlock.xyzIn);\r\n maxAlphaBlock.output.connectTo(composeColorBlock.wIn);\r\n composeColorBlock.colorOut.connectTo(colorUpdateblock.color);\r\n\r\n colorUpdateblock.output.connectTo(newSystem.particle);\r\n\r\n // Register\r\n newSet.systemBlocks.push(newSystem);\r\n}\r\n\r\nfunction _CreateSystemBlock(oldSystem: IParticleSystem): SystemBlock {\r\n const newSystem = new SystemBlock(oldSystem.name);\r\n\r\n newSystem.blendMode = oldSystem.blendMode;\r\n newSystem.capacity = oldSystem.getCapacity();\r\n newSystem.emitRate = oldSystem.emitRate;\r\n newSystem.targetStopDuration = oldSystem.targetStopDuration;\r\n newSystem.startDelay = oldSystem.startDelay;\r\n newSystem.updateSpeed = oldSystem.updateSpeed;\r\n\r\n return newSystem;\r\n}\r\n\r\nfunction _CreateCreateParticleBlock(oldSystem: IParticleSystem): CreateParticleBlock {\r\n // Create particle\r\n const createParticleBlock = new CreateParticleBlock(\"Create Particle\");\r\n\r\n // Color\r\n const randomColorBlock = new ParticleRandomBlock(\"Random Color\");\r\n _CreateAndConnectInput(\"Color 1\", oldSystem.color1, randomColorBlock.min);\r\n _CreateAndConnectInput(\"Color 2\", oldSystem.color2, randomColorBlock.max);\r\n randomColorBlock.output.connectTo(createParticleBlock.color);\r\n\r\n // Dead color\r\n _CreateAndConnectInput(\"Dead Color\", oldSystem.colorDead, createParticleBlock.colorDead);\r\n\r\n // Emit power\r\n const randomEmitPowerBlock = new ParticleRandomBlock(\"Random Emit Power\");\r\n _CreateAndConnectInput(\"Min Emit Power\", oldSystem.minEmitPower, randomEmitPowerBlock.min);\r\n _CreateAndConnectInput(\"Max Emit Power\", oldSystem.maxEmitPower, randomEmitPowerBlock.max);\r\n randomEmitPowerBlock.output.connectTo(createParticleBlock.emitPower);\r\n\r\n // Scale\r\n const randomScaleBlock = new ParticleRandomBlock(\"Random Scale\");\r\n _CreateAndConnectInput(\"Min Scale\", oldSystem.minSize, randomScaleBlock.min);\r\n _CreateAndConnectInput(\"Max Scale\", oldSystem.maxSize, randomScaleBlock.max);\r\n randomScaleBlock.output.connectTo(createParticleBlock.scale);\r\n\r\n // Lifetime\r\n const randomLifetimeBlock = new ParticleRandomBlock(\"Random Lifetime\");\r\n _CreateAndConnectInput(\"Min Lifetime\", oldSystem.minLifeTime, randomLifetimeBlock.min);\r\n _CreateAndConnectInput(\"Max Lifetime\", oldSystem.maxLifeTime, randomLifetimeBlock.max);\r\n randomLifetimeBlock.output.connectTo(createParticleBlock.lifeTime);\r\n\r\n return createParticleBlock;\r\n}\r\n\r\nfunction _CreateShapeBlock(oldSystem: IParticleSystem): IShapeBlock {\r\n const emitter = oldSystem.particleEmitterType;\r\n if (!emitter) {\r\n throw new Error(\"Particle system has no emitter type.\");\r\n }\r\n\r\n let shapeBlock: Nullable<IShapeBlock> = null;\r\n switch (emitter.getClassName()) {\r\n case \"BoxParticleEmitter\": {\r\n const source = emitter as BoxParticleEmitter;\r\n shapeBlock = new BoxShapeBlock(\"Box Shape\");\r\n\r\n const target = shapeBlock as BoxShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n _CreateAndConnectInput(\"Min Emit Box\", source.minEmitBox, target.minEmitBox);\r\n _CreateAndConnectInput(\"Max Emit Box\", source.maxEmitBox, target.maxEmitBox);\r\n break;\r\n }\r\n case \"ConeParticleEmitter\": {\r\n const source = emitter as ConeParticleEmitter;\r\n shapeBlock = new ConeShapeBlock(\"Cone Shape\");\r\n\r\n const target = shapeBlock as ConeShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Angle\", source.angle, target.angle);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Height Range\", source.heightRange, target.heightRange);\r\n _CreateAndConnectInput(\"Emit From Spawn Point Only\", source.emitFromSpawnPointOnly ? 1 : 0, target.emitFromSpawnPointOnly, NodeParticleBlockConnectionPointTypes.Int);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"CustomParticleEmitter\": {\r\n // Custom emitter is not supported in nodes yet\r\n throw new Error(\"CustomParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"CylinderParticleEmitter\": {\r\n const source = emitter as CylinderParticleEmitter;\r\n shapeBlock = new CylinderShapeBlock(\"Cylinder Shape\");\r\n\r\n const target = shapeBlock as CylinderShapeBlock;\r\n _CreateAndConnectInput(\"Height\", source.height, target.height);\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n case \"HemisphericParticleEmitter\": {\r\n // Hemispheric emitter is not supported in nodes yet\r\n throw new Error(\"HemisphericParticleEmitter is not supported in Node Particle System.\");\r\n }\r\n case \"MeshParticleEmitter\": {\r\n const source = emitter as MeshParticleEmitter;\r\n shapeBlock = new MeshShapeBlock(\"Mesh Shape\");\r\n\r\n const target = shapeBlock as MeshShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n\r\n target.mesh = source.mesh as Mesh;\r\n break;\r\n }\r\n case \"PointParticleEmitter\": {\r\n const source = emitter as PointParticleEmitter;\r\n shapeBlock = new PointShapeBlock(\"Point Shape\");\r\n\r\n const target = shapeBlock as PointShapeBlock;\r\n _CreateAndConnectInput(\"Direction 1\", source.direction1, target.direction1);\r\n _CreateAndConnectInput(\"Direction 2\", source.direction2, target.direction2);\r\n break;\r\n }\r\n case \"SphereParticleEmitter\": {\r\n const source = emitter as SphereParticleEmitter;\r\n shapeBlock = new SphereShapeBlock(\"Sphere Shape\");\r\n\r\n const target = shapeBlock as SphereShapeBlock;\r\n _CreateAndConnectInput(\"Radius\", source.radius, target.radius);\r\n _CreateAndConnectInput(\"Radius Range\", source.radiusRange, target.radiusRange);\r\n _CreateAndConnectInput(\"Direction Randomizer\", source.directionRandomizer, target.directionRandomizer);\r\n break;\r\n }\r\n }\r\n\r\n if (!shapeBlock) {\r\n throw new Error(`Unsupported particle emitter type: ${emitter.getClassName()}`);\r\n }\r\n\r\n return shapeBlock;\r\n}\r\n\r\nfunction _CreateAndConnectInput(\r\n inputBlockName: string,\r\n value: number | Vector3 | Color4,\r\n targetToConnectTo: NodeParticleConnectionPoint,\r\n inputType?: NodeParticleBlockConnectionPointTypes\r\n): void {\r\n const input = new ParticleInputBlock(inputBlockName, inputType);\r\n input.value = value;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n\r\nfunction _CreateAndConnectContextual(contextualBlockName: string, contextValue: NodeParticleContextualSources, targetToConnectTo: NodeParticleConnectionPoint): void {\r\n const input = new ParticleInputBlock(contextualBlockName);\r\n input.contextualValue = contextValue;\r\n input.output.connectTo(targetToConnectTo);\r\n}\r\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Vector3 } from "../Maths/math.vector.js";
|
|
2
2
|
import { CastingResult } from "./castingResult.js";
|
|
3
|
+
import type { PhysicsBody } from "./v2/physicsBody.js";
|
|
3
4
|
/**
|
|
4
5
|
* Interface for query parameters in the raycast function.
|
|
5
6
|
* @see the "Collision Filtering" section in https://github.com/eoineoineoin/glTF/tree/MSFT_RigidBodies/extensions/2.0/Vendor/MSFT_collision_primitives
|
|
@@ -11,6 +12,8 @@ export interface IRaycastQuery {
|
|
|
11
12
|
collideWith?: number;
|
|
12
13
|
/** Should trigger collisions be considered in the query? */
|
|
13
14
|
shouldHitTriggers?: boolean;
|
|
15
|
+
/** Ignores the body passed if it is in the query */
|
|
16
|
+
ignoreBody?: PhysicsBody;
|
|
14
17
|
}
|
|
15
18
|
/**
|
|
16
19
|
* Holds the data for the raycast result
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"physicsRaycastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsRaycastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"physicsRaycastResult.js","sourceRoot":"","sources":["../../../../dev/core/src/Physics/physicsRaycastResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAkBhD;;;GAGG;AACH,MAAM,OAAO,oBAAqB,SAAQ,aAAa;IAAvD;;QACY,iBAAY,GAAW,CAAC,CAAC;QACzB,kBAAa,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;QACxC,gBAAW,GAAY,OAAO,CAAC,IAAI,EAAE,CAAC;IAgElD,CAAC;IA9DG;;OAEG;IACH,IAAI,WAAW;QACX,OAAO,IAAI,CAAC,YAAY,CAAC;IAC7B,CAAC;IAED;;OAEG;IACH,IAAI,cAAc;QACd,OAAO,IAAI,CAAC,UAAU,CAAC;IAC3B,CAAC;IAED;;OAEG;IACH,IAAI,aAAa;QACb,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,YAAY;QACZ,OAAO,IAAI,CAAC,aAAa,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;;OAGG;IACI,cAAc,CAAC,QAAgB;QAClC,IAAI,CAAC,YAAY,GAAG,QAAQ,CAAC;IACjC,CAAC;IAED;;OAEG;IACI,oBAAoB;QACvB,IAAI,CAAC,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IAC7E,CAAC;IAED;;;;OAIG;IACa,KAAK,CAAC,OAAgB,OAAO,CAAC,IAAI,EAAE,EAAE,KAAc,OAAO,CAAC,IAAI,EAAE;QAC9E,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAClC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAE9B,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;IAC1B,CAAC;CACJ","sourcesContent":["import { Vector3 } from \"../Maths/math.vector\";\r\nimport { CastingResult } from \"./castingResult\";\r\nimport type { PhysicsBody } from \"./v2/physicsBody\";\r\n\r\n/**\r\n * Interface for query parameters in the raycast function.\r\n * @see the \"Collision Filtering\" section in https://github.com/eoineoineoin/glTF/tree/MSFT_RigidBodies/extensions/2.0/Vendor/MSFT_collision_primitives\r\n */\r\nexport interface IRaycastQuery {\r\n /** Membership mask */\r\n membership?: number;\r\n /** CollideWith mask */\r\n collideWith?: number;\r\n /** Should trigger collisions be considered in the query? */\r\n shouldHitTriggers?: boolean;\r\n /** Ignores the body passed if it is in the query */\r\n ignoreBody?: PhysicsBody;\r\n}\r\n\r\n/**\r\n * Holds the data for the raycast result\r\n * @see https://doc.babylonjs.com/features/featuresDeepDive/physics/usingPhysicsEngine\r\n */\r\nexport class PhysicsRaycastResult extends CastingResult {\r\n private _hitDistance: number = 0;\r\n private _rayFromWorld: Vector3 = Vector3.Zero();\r\n private _rayToWorld: Vector3 = Vector3.Zero();\r\n\r\n /**\r\n * Gets the distance from the hit\r\n */\r\n get hitDistance(): number {\r\n return this._hitDistance;\r\n }\r\n\r\n /**\r\n * Gets the hit normal/direction in the world\r\n */\r\n get hitNormalWorld(): Vector3 {\r\n return this._hitNormal;\r\n }\r\n\r\n /**\r\n * Gets the hit point in the world\r\n */\r\n get hitPointWorld(): Vector3 {\r\n return this._hitPoint;\r\n }\r\n\r\n /**\r\n * Gets the ray \"start point\" of the ray in the world\r\n */\r\n get rayFromWorld(): Vector3 {\r\n return this._rayFromWorld;\r\n }\r\n\r\n /**\r\n * Gets the ray \"end point\" of the ray in the world\r\n */\r\n get rayToWorld(): Vector3 {\r\n return this._rayToWorld;\r\n }\r\n\r\n /**\r\n * Sets the distance from the start point to the hit point\r\n * @param distance defines the distance to set\r\n */\r\n public setHitDistance(distance: number) {\r\n this._hitDistance = distance;\r\n }\r\n\r\n /**\r\n * Calculates the distance manually\r\n */\r\n public calculateHitDistance() {\r\n this._hitDistance = Vector3.Distance(this._rayFromWorld, this._hitPoint);\r\n }\r\n\r\n /**\r\n * Resets all the values to default\r\n * @param from The from point on world space\r\n * @param to The to point on world space\r\n */\r\n public override reset(from: Vector3 = Vector3.Zero(), to: Vector3 = Vector3.Zero()) {\r\n super.reset();\r\n this._rayFromWorld.copyFrom(from);\r\n this._rayToWorld.copyFrom(to);\r\n\r\n this._hitDistance = 0;\r\n }\r\n}\r\n"]}
|
|
@@ -1881,7 +1881,7 @@ export class HavokPlugin {
|
|
|
1881
1881
|
const queryCollideWith = query?.collideWith ?? ~0;
|
|
1882
1882
|
const shouldHitTriggers = query?.shouldHitTriggers ?? false;
|
|
1883
1883
|
result.reset(from, to);
|
|
1884
|
-
const bodyToIgnore = [BigInt(0)];
|
|
1884
|
+
const bodyToIgnore = query?.ignoreBody ? [BigInt(query.ignoreBody._pluginData.hpBodyId[0])] : [BigInt(0)];
|
|
1885
1885
|
const hkQuery = [this._bVecToV3(from), this._bVecToV3(to), [queryMembership, queryCollideWith], shouldHitTriggers, bodyToIgnore];
|
|
1886
1886
|
this._hknp.HP_World_CastRayWithCollector(this.world, this._queryCollector, hkQuery);
|
|
1887
1887
|
if (this._hknp.HP_QueryCollector_GetNumHits(this._queryCollector)[1] > 0) {
|