Plasma Engine  2.0
Loading...
Searching...
No Matches
ParticleType.h
1#pragma once
2
3#include <Foundation/DataProcessing/Stream/ProcessingStreamProcessor.h>
4#include <Foundation/Reflection/Reflection.h>
5#include <ParticlePlugin/Module/ParticleModule.h>
6#include <ParticlePlugin/ParticlePluginDLL.h>
7
9
10enum plParticleTypeSortingKey
11{
12 Distortion, // samples the back-buffer, so doing this later would overwrite their result
13 Opaque,
14 BlendedBackground,
15 Additive,
16 BlendAdd,
17 Blended,
18 BlendedForeground,
19};
20
21class PL_PARTICLEPLUGIN_DLL plParticleTypeFactory : public plReflectedClass
22{
23 PL_ADD_DYNAMIC_REFLECTION(plParticleTypeFactory, plReflectedClass);
24
25public:
26 virtual const plRTTI* GetTypeType() const = 0;
27 virtual void CopyTypeProperties(plParticleType* pObject, bool bFirstTime) const = 0;
28
29 plParticleType* CreateType(plParticleSystemInstance* pOwner) const;
30
31 virtual void QueryFinalizerDependencies(plSet<const plRTTI*>& inout_finalizerDeps) const {}
32
33 virtual void Save(plStreamWriter& inout_stream) const = 0;
34 virtual void Load(plStreamReader& inout_stream) = 0;
35};
36
37class PL_PARTICLEPLUGIN_DLL plParticleType : public plParticleModule
38{
39 PL_ADD_DYNAMIC_REFLECTION(plParticleType, plParticleModule);
40
41 friend class plParticleSystemInstance;
42
43public:
44 virtual float GetMaxParticleRadius(float fParticleSize) const { return fParticleSize * 0.5f; }
45
46 virtual void ExtractTypeRenderData(plMsgExtractRenderData& ref_msg, const plTransform& instanceTransform) const = 0;
47
48protected:
50
51 virtual void InitializeElements(plUInt64 uiStartIndex, plUInt64 uiNumElements) override {}
52 virtual void StepParticleSystem(const plTime& tDiff, plUInt32 uiNumNewParticles) { m_TimeDiff = tDiff; }
53
54 static plUInt32 ComputeSortingKey(plParticleTypeRenderMode::Enum mode, plUInt32 uiTextureHash);
55
56 plTime m_TimeDiff;
57 mutable plUInt64 m_uiLastExtractedFrame;
58};
Definition ParticleModule.h:12
A particle system stores all data for one 'layer' of a running particle effect.
Definition ParticleSystemInstance.h:15
Definition ParticleType.h:22
Definition ParticleType.h:38
virtual void InitializeElements(plUInt64 uiStartIndex, plUInt64 uiNumElements) override
This method needs to be implemented in order to initialize new elements to specific values.
Definition ParticleType.h:51
This class holds information about reflected types. Each instance represents one type that is known t...
Definition RTTI.h:30
All classes that should be dynamically reflectable, need to be derived from this base class.
Definition DynamicRTTI.h:86
Definition Set.h:238
Interface for binary in (read) streams.
Definition Stream.h:22
Interface for binary out (write) streams.
Definition Stream.h:107
Definition RenderData.h:116
The time class encapsulates a double value storing the time in seconds.
Definition Time.h:12