Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
OgreShaderParticleRenderer.h
Go to the documentation of this file.
1#pragma once
2#ifndef __OGRE_SHADER_PARTICLE_RENDERER_H__
3#define __OGRE_SHADER_PARTICLE_RENDERER_H__
4
5
6#include <OgreParticleSystemRenderer.h>
7#include <OgreVector2.h>
8
9namespace Ogre {
10
13
16
24 class ShaderParticleRenderer : public ParticleSystemRenderer, public Renderable
25 {
26 protected:
28 MaterialPtr mMaterial;
29 VertexData* mVertexData;
30 IndexData* mIndexData;
32
51 Vector2 mTexCoordTable[4];
52
56 SortMode mSortMode;
57 mutable LightList mLightList;
58 mutable ulong mLightListUpdated;
59 Real mRadius;
62
63 public:
66
70 class _OgrePrivate CmdVertexFormatColour : public ParamCommand
71 {
72 public:
73 String doGet(const void* target) const;
74 void doSet(void* target, const String& val);
75 };
76
78 class _OgrePrivate CmdVertexFormatTexture : public ParamCommand
79 {
80 public:
81 String doGet(const void* target) const;
82 void doSet(void* target, const String& val);
83 };
84
86 class _OgrePrivate CmdVertexFormatSize : public ParamCommand
87 {
88 public:
89 String doGet(const void* target) const;
90 void doSet(void* target, const String& val);
91 };
92
94 class _OgrePrivate CmdVertexFormatRotation : public ParamCommand
95 {
96 public:
97 String doGet(const void* target) const;
98 void doSet(void* target, const String& val);
99 };
100
102 class _OgrePrivate CmdVertexFormatRotationSpeed : public ParamCommand
103 {
104 public:
105 String doGet(const void* target) const;
106 void doSet(void* target, const String& val);
107 };
108
110 class _OgrePrivate CmdVertexFormatDirection : public ParamCommand
111 {
112 public:
113 String doGet(const void* target) const;
114 void doSet(void* target, const String& val);
115 };
116
118 class _OgrePrivate CmdVertexFormatTTL : public ParamCommand
119 {
120 public:
121 String doGet(const void* target) const;
122 void doSet(void* target, const String& val);
123 };
124
126 class _OgrePrivate CmdVertexFormatTotalTTL : public ParamCommand
127 {
128 public:
129 String doGet(const void* target) const;
130 void doSet(void* target, const String& val);
131 };
132
134 class _OgrePrivate CmdVertexFormatTimeFrag : public ParamCommand
135 {
136 public:
137 String doGet(const void* target) const;
138 void doSet(void* target, const String& val);
139 };
140
142 class _OgrePrivate CmdVertexFormatTimeFragInv : public ParamCommand
143 {
144 public:
145 String doGet(const void* target) const;
146 void doSet(void* target, const String& val);
147 };
148
150 // getters / setters
151 void setVertexFormatColour(bool bUse) { mVertexFormatColour = bUse; }
153
156
157 void setVertexFormatSize(bool bUse) { mVertexFormatSize = bUse; }
158 bool getVertexFormatSize() const { return mVertexFormatSize; }
159
162
165
168
169 void setVertexFormatTTL(bool bUse) { mVertexFormatTTL = bUse; }
170 bool getVertexFormatTTL() const { return mVertexFormatTTL; }
171
174
177
180
184 virtual const String& getType(void) const override;
185 virtual void _updateRenderQueue(RenderQueue* queue, Ogre::list<Particle*>::type& currentParticles, bool cullIndividually) override;
186 virtual void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables = false) override;
187 virtual void _setMaterial(MaterialPtr& mat) override;
188 virtual void _notifyCurrentCamera(Camera* cam) override;
189 virtual void _notifyParticleRotated(void) override;
190 virtual void _notifyParticleResized(void) override;
191 virtual void _notifyParticleQuota(size_t quota) override;
192 virtual void _notifyAttached(Node* parent, bool isTagPoint = false) override;
193 virtual void _notifyDefaultDimensions(Real width, Real height) override;
194 virtual ParticleVisualData* _createVisualData(void) override;
195 virtual void _destroyVisualData(ParticleVisualData* vis) override;
196 virtual void setRenderQueueGroup(uint8 queueID) override;
197 virtual void setKeepParticlesInLocalSpace(bool keepLocal) override;
198 virtual SortMode _getSortMode(void) const override;
200
204 virtual const MaterialPtr& getMaterial(void) const override;
205 virtual void getRenderOperation(RenderOperation& op) override;
206 virtual void getWorldTransforms(Matrix4* xform) const override;
207 virtual Real getSquaredViewDepth(const Camera* cam) const override;
208 virtual const LightList& getLights(void) const override;
210
211 private:
212 const String rendererTypeName = "shader";
213
215 bool allocateBuffers(size_t iNumParticles);
216
218 void addParticle(uint8* pDataVB, const Particle& particle) const;
219 void setRenderQueueGroupAndPriority(Ogre::uint8,Ogre::ushort);
220 protected:
231 };
232
234 class ShaderParticleRendererFactory : public ParticleSystemRendererFactory
235 {
236 public:
237 const String& getType() const override;
238 ParticleSystemRenderer* createInstance( const String& name ) override;
239 void destroyInstance( ParticleSystemRenderer* inst) override;
240 private:
241 const String rendererTypeName = "shader";
242 };
243
246
247} // namespace Ogre
248
249#endif // __OGRE_SHADER_PARTICLE_RENDERER_H__
Command objects for defining vertex format (see ParamCommand).
Factory class for ShaderParticleRenderer.
ParticleSystemRenderer * createInstance(const String &name) override
void destroyInstance(ParticleSystemRenderer *inst) override
Specialisation of ParticleSystemRenderer to render particles using a custom shaders.
bool mVertexFormatColour
vertex format for particles
virtual void _destroyVisualData(ParticleVisualData *vis) override
virtual void visitRenderables(Renderable::Visitor *visitor, bool debugRenderables=false) override
static CmdVertexFormatTimeFrag msVertexFmtTimeFrag
bool mVertexFormatTTL
particle ttl (float1)
static CmdVertexFormatRotation msVertexFmtRotation
bool mVertexFormatSize
particle size (width and height - float2)
virtual void setKeepParticlesInLocalSpace(bool keepLocal) override
Real mRadius
maximum distance between particles and parent node
static CmdVertexFormatTexture msVertexFmtTexture
static CmdVertexFormatSize msVertexFmtSize
static CmdVertexFormatTotalTTL msVertexFmtTotalTTL
bool mParentIsTagPoint
true if parent node is tag point
bool mVertexFormatRotationSpeed
particle rotation speed (radians/s - float1)
virtual const LightList & getLights(void) const override
bool mKeepInLocalSpace
control transformation matrix for particles
virtual const String & getType(void) const override
bool mVertexFormatDirection
particle direction (float3)
virtual void _notifyParticleRotated(void) override
bool mVertexFormatTotalTTL
particle total ttl (float1)
virtual void _notifyCurrentCamera(Camera *cam) override
virtual void getWorldTransforms(Matrix4 *xform) const override
static CmdVertexFormatRotationSpeed msVertexFmtRotationSpeed
bool mVertexFormatRotation
particle rotation (radians - float1)
bool mVertexFormatTimeFragmentInv
particle inverse time fragment (1.0f - ttl / total ttl) (float1) (value 0.0f - 1.0f)
virtual void _notifyAttached(Node *parent, bool isTagPoint=false) override
static CmdVertexFormatTimeFragInv msVertexFmtTimeFragInv
static CmdVertexFormatDirection msVertexFmtDirection
void addParticle(uint8 *pDataVB, const Particle &particle) const
add particle to vertex buffer
virtual void _notifyDefaultDimensions(Real width, Real height) override
virtual void _notifyParticleQuota(size_t quota) override
static CmdVertexFormatTTL msVertexFmtTTL
Vector2 mTexCoordTable[4]
default texture coordinates
virtual ParticleVisualData * _createVisualData(void) override
virtual Real getSquaredViewDepth(const Camera *cam) const override
virtual void _notifyParticleResized(void) override
virtual void _updateRenderQueue(RenderQueue *queue, Ogre::list< Particle * >::type &currentParticles, bool cullIndividually) override
static CmdVertexFormatColour msVertexFmtColour
virtual void setRenderQueueGroup(uint8 queueID) override
Node * mParentNode
parent node for particle system - used for world transformation
virtual const MaterialPtr & getMaterial(void) const override
bool mVertexFormatTimeFragment
particle time fragment (ttl / total ttl) (float1) (value 0.0f - 1.0f)
bool mVertexFormatTexture
true if particles use texture (float2)
virtual void getRenderOperation(RenderOperation &op) override
bool allocateBuffers(size_t iNumParticles)
allocate hardware buffers and prepare them for filling particles
virtual void _setMaterial(MaterialPtr &mat) override
LightList mLightList
light list for renderable
ulong mLightListUpdated
indicator if we need update light list
virtual SortMode _getSortMode(void) const override
void setRenderQueueGroupAndPriority(Ogre::uint8, Ogre::ushort)
Vector2 mDefaultParticleSize
other informations