// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Content/BinaryAsset.h" #include "Graph/CPU/ParticleEmitterGraph.CPU.h" #if COMPILE_WITH_PARTICLE_GPU_GRAPH #include "Graph/GPU/ParticleEmitterGraph.GPU.h" #endif /// /// Particle function graph asset that contains reusable part of the particle emitter graph. /// API_CLASS(NoSpawn) class FLAXENGINE_API ParticleEmitterFunction : public BinaryAsset { DECLARE_BINARY_ASSET_HEADER(ParticleEmitterFunction, 1); public: /// /// The loaded CPU particle function graph. /// ParticleEmitterGraphCPU Graph; /// /// The input nodes (indices). /// Array> Inputs; /// /// The output nodes (indices). /// Array> Outputs; #if COMPILE_WITH_PARTICLE_GPU_GRAPH /// /// The loaded GPU particle function graph. /// ParticleEmitterGraphGPU GraphGPU; #endif /// /// Tries to load surface graph from the asset. /// /// The graph to load. /// True if failed, otherwise false. bool LoadSurface(ParticleEmitterGraphCPU& graph); #if USE_EDITOR /// /// Tries to load surface graph from the asset. /// /// The output surface data, or empty if failed to load. API_FUNCTION() BytesContainer LoadSurface(); #if COMPILE_WITH_PARTICLE_GPU_GRAPH /// /// Tries to load surface graph from the asset. /// /// The graph to load. /// True if failed, otherwise false. bool LoadSurface(ParticleEmitterGraphGPU& graph); #endif // Gets the function signature for Visject Surface editor. API_FUNCTION() void GetSignature(API_PARAM(Out) Array>& types, API_PARAM(Out) Array>& names); /// /// Updates the particle graph surface (save new one, discards cached data, reloads asset). /// /// The surface graph data. /// True if cannot save it, otherwise false. API_FUNCTION() bool SaveSurface(BytesContainer& data); #endif protected: // [BinaryAsset] LoadResult load() override; void unload(bool isReloading) override; AssetChunksFlag getChunksToPreload() const override; };