source: GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemRenderer.h @ 1812

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