1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __ParticleSystemRenderer_H__ |
---|
30 | #define __ParticleSystemRenderer_H__ |
---|
31 | |
---|
32 | #include "OgrePrerequisites.h" |
---|
33 | #include "OgreStringInterface.h" |
---|
34 | #include "OgreFactoryObj.h" |
---|
35 | #include "OgreRenderQueue.h" |
---|
36 | #include "OgreCommon.h" |
---|
37 | |
---|
38 | namespace Ogre { |
---|
39 | |
---|
40 | /** Abstract class defining the interface required to be implemented |
---|
41 | by classes which provide rendering capability to ParticleSystem instances. |
---|
42 | */ |
---|
43 | class _OgreExport ParticleSystemRenderer : public StringInterface |
---|
44 | { |
---|
45 | public: |
---|
46 | /// Constructor |
---|
47 | ParticleSystemRenderer() {} |
---|
48 | /// Destructor |
---|
49 | virtual ~ParticleSystemRenderer() {} |
---|
50 | |
---|
51 | /** Gets the type of this renderer - must be implemented by subclasses */ |
---|
52 | virtual const String& getType(void) const = 0; |
---|
53 | |
---|
54 | /** Delegated to by ParticleSystem::_updateRenderQueue |
---|
55 | @remarks |
---|
56 | The subclass must update the render queue using whichever Renderable |
---|
57 | instance(s) it wishes. |
---|
58 | */ |
---|
59 | virtual void _updateRenderQueue(RenderQueue* queue, |
---|
60 | std::list<Particle*>& currentParticles, bool cullIndividually) = 0; |
---|
61 | |
---|
62 | /** Sets the material this renderer must use; called by ParticleSystem. */ |
---|
63 | virtual void _setMaterial(MaterialPtr& mat) = 0; |
---|
64 | /** Delegated to by ParticleSystem::_notifyCurrentCamera */ |
---|
65 | virtual void _notifyCurrentCamera(Camera* cam) = 0; |
---|
66 | /** Delegated to by ParticleSystem::_notifyAttached */ |
---|
67 | virtual void _notifyAttached(Node* parent, bool isTagPoint = false) = 0; |
---|
68 | /** Optional callback notified when particles are rotated */ |
---|
69 | virtual void _notifyParticleRotated(void) {} |
---|
70 | /** Optional callback notified when particles are resized individually */ |
---|
71 | virtual void _notifyParticleResized(void) {} |
---|
72 | /** Tells the renderer that the particle quota has changed */ |
---|
73 | virtual void _notifyParticleQuota(size_t quota) = 0; |
---|
74 | /** Tells the renderer that the particle default size has changed */ |
---|
75 | virtual void _notifyDefaultDimensions(Real width, Real height) = 0; |
---|
76 | /** Optional callback notified when particle emitted */ |
---|
77 | virtual void _notifyParticleEmitted(Particle* particle) {} |
---|
78 | /** Optional callback notified when particle expired */ |
---|
79 | virtual void _notifyParticleExpired(Particle* particle) {} |
---|
80 | /** Optional callback notified when particles moved */ |
---|
81 | virtual void _notifyParticleMoved(std::list<Particle*>& currentParticles) {} |
---|
82 | /** Optional callback notified when particles cleared */ |
---|
83 | virtual void _notifyParticleCleared(std::list<Particle*>& currentParticles) {} |
---|
84 | /** Create a new ParticleVisualData instance for attachment to a particle. |
---|
85 | @remarks |
---|
86 | If this renderer needs additional data in each particle, then this should |
---|
87 | be held in an instance of a subclass of ParticleVisualData, and this method |
---|
88 | should be overridden to return a new instance of it. The default |
---|
89 | behaviour is to return null. |
---|
90 | */ |
---|
91 | virtual ParticleVisualData* _createVisualData(void) { return 0; } |
---|
92 | /** Destroy a ParticleVisualData instance. |
---|
93 | @remarks |
---|
94 | If this renderer needs additional data in each particle, then this should |
---|
95 | be held in an instance of a subclass of ParticleVisualData, and this method |
---|
96 | should be overridden to destroy an instance of it. The default |
---|
97 | behaviour is to do nothing. |
---|
98 | */ |
---|
99 | virtual void _destroyVisualData(ParticleVisualData* vis) { assert (vis == 0); } |
---|
100 | |
---|
101 | /** Sets which render queue group this renderer should target with it's |
---|
102 | output. |
---|
103 | */ |
---|
104 | virtual void setRenderQueueGroup(uint8 queueID) = 0; |
---|
105 | |
---|
106 | /** Setting carried over from ParticleSystem. |
---|
107 | */ |
---|
108 | virtual void setKeepParticlesInLocalSpace(bool keepLocal) = 0; |
---|
109 | |
---|
110 | /** Gets the desired particles sort mode of this renderer */ |
---|
111 | virtual SortMode _getSortMode(void) const = 0; |
---|
112 | |
---|
113 | }; |
---|
114 | |
---|
115 | /** Abstract class definition of a factory object for ParticleSystemRenderer. */ |
---|
116 | class _OgreExport ParticleSystemRendererFactory : public FactoryObj<ParticleSystemRenderer> |
---|
117 | { |
---|
118 | public: |
---|
119 | // No methods, must just override all methods inherited from FactoryObj |
---|
120 | }; |
---|
121 | |
---|
122 | } |
---|
123 | |
---|
124 | #endif |
---|