source: OGRE/trunk/ogrenew/OgreMain/include/OgreBillboardParticleRenderer.h @ 692

Revision 692, 11.0 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]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 __BillboardParticleRenderer_H__
26#define __BillboardParticleRenderer_H__
27
28#include "OgrePrerequisites.h"
29#include "OgreParticleSystemRenderer.h"
30#include "OgreBillboardSet.h"
31
32namespace Ogre {
33
34    /** Specialisation of ParticleSystemRenderer to render particles using
35        a BillboardSet.
36    @remarks
37        This renderer has a few more options than the standard particle system,
38        which will be passed to it automatically when the particle system itself
39        does not understand them.
40    */
41    class _OgreExport BillboardParticleRenderer : public ParticleSystemRenderer
42    {
43    protected:
44        /// The billboard set that's doing the rendering
45        BillboardSet* mBillboardSet;
46    public:
47        BillboardParticleRenderer();
48        ~BillboardParticleRenderer();
49
50        /** Command object for billboard type (see ParamCommand).*/
51        class _OgrePrivate CmdBillboardType : public ParamCommand
52        {
53        public:
54            String doGet(const void* target) const;
55            void doSet(void* target, const String& val);
56        };
57        /** Command object for billboard origin (see ParamCommand).*/
58        class _OgrePrivate CmdBillboardOrigin : public ParamCommand
59        {
60        public:
61            String doGet(const void* target) const;
62            void doSet(void* target, const String& val);
63        };
64        /** Command object for billboard rotation type (see ParamCommand).*/
65        class _OgrePrivate CmdBillboardRotationType : public ParamCommand
66        {
67        public:
68            String doGet(const void* target) const;
69            void doSet(void* target, const String& val);
70        };
71        /** Command object for common direction (see ParamCommand).*/
72        class _OgrePrivate CmdCommonDirection : public ParamCommand
73        {
74        public:
75            String doGet(const void* target) const;
76            void doSet(void* target, const String& val);
77        };
78        /** Command object for common up-vector (see ParamCommand).*/
79        class _OgrePrivate CmdCommonUpVector : public ParamCommand
80        {
81        public:
82            String doGet(const void* target) const;
83            void doSet(void* target, const String& val);
84        };
85        /** Command object for point rendering (see ParamCommand).*/
86        class _OgrePrivate CmdPointRendering : public ParamCommand
87        {
88        public:
89            String doGet(const void* target) const;
90            void doSet(void* target, const String& val);
91        };
92                /** Command object for accurate facing(see ParamCommand).*/
93                class _OgrePrivate CmdAccurateFacing : public ParamCommand
94                {
95                public:
96                        String doGet(const void* target) const;
97                        void doSet(void* target, const String& val);
98                };
99
100        /** Sets the type of billboard to render.
101        @remarks
102            The default sort of billboard (BBT_POINT), always has both x and y axes parallel to
103            the camera's local axes. This is fine for 'point' style billboards (e.g. flares,
104            smoke, anything which is symmetrical about a central point) but does not look good for
105            billboards which have an orientation (e.g. an elongated raindrop). In this case, the
106            oriented billboards are more suitable (BBT_ORIENTED_COMMON or BBT_ORIENTED_SELF) since they retain an independant Y axis
107            and only the X axis is generated, perpendicular to both the local Y and the camera Z.
108        @param bbt The type of billboard to render
109        */
110        void setBillboardType(BillboardType bbt);
111
112        /** Returns the billboard type in use. */
113        BillboardType getBillboardType(void) const;
114
115                /// @copydoc BillboardSet::setUseAccurateFacing
116                void setUseAccurateFacing(bool acc);
117                /// @copydoc BillboardSet::getUseAccurateFacing
118                bool getUseAccurateFacing(void) const;
119
120        /** Sets the point which acts as the origin point for all billboards in this set.
121        @remarks
122        This setting controls the fine tuning of where a billboard appears in relation to it's
123        position. It could be that a billboard's position represents it's center (e.g. for fireballs),
124        it could mean the center of the bottom edge (e.g. a tree which is positioned on the ground),
125        the top-left corner (e.g. a cursor).
126        @par
127        The default setting is BBO_CENTER.
128        @param
129        origin A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
130        */
131        void setBillboardOrigin(BillboardOrigin origin) { mBillboardSet->setBillboardOrigin(origin); }
132
133        /** Gets the point which acts as the origin point for all billboards in this set.
134        @returns
135        A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
136        */
137        BillboardOrigin getBillboardOrigin(void) const { return mBillboardSet->getBillboardOrigin(); }
138
139        /** Sets billboard rotation type.
140            @remarks
141                This setting controls the billboard rotation type, you can deciding rotate the billboard's vertices
142                around their facing direction or rotate the billboard's texture coordinates.
143            @par
144                The default settings is BBR_TEXCOORD.
145            @param
146                rotationType A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
147        */
148        void setBillboardRotationType(BillboardRotationType rotationType);
149
150        /** Sets billboard rotation type.
151            @returns
152                A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
153        */
154        BillboardRotationType getBillboardRotationType(void) const;
155
156        /** Use this to specify the common direction given to billboards of type BBT_ORIENTED_COMMON.
157        @remarks
158            Use BBT_ORIENTED_COMMON when you want oriented billboards but you know they are always going to
159            be oriented the same way (e.g. rain in calm weather). It is faster for the system to calculate
160            the billboard vertices if they have a common direction.
161        @param vec The direction for all billboards.
162        */
163        void setCommonDirection(const Vector3& vec);
164
165        /** Gets the common direction for all billboards (BBT_ORIENTED_COMMON) */
166        const Vector3& getCommonDirection(void) const;
167
168        /** Use this to specify the common up-vector given to billboards of type BBT_PERPENDICULAR_SELF.
169        @remarks
170            Use BBT_PERPENDICULAR_SELF when you want oriented billboards perpendicular to their own
171            direction vector and doesn't face to camera. In this case, we need an additional vector
172            to determine the billboard X, Y axis. The generated X axis perpendicular to both the own
173            direction and up-vector, the Y axis will coplanar with both own direction and up-vector,
174            and perpendicular to own direction.
175        @param vec The up-vector for all billboards.
176        */
177        void setCommonUpVector(const Vector3& vec);
178
179        /** Gets the common up-vector for all billboards (BBT_PERPENDICULAR_SELF) */
180        const Vector3& getCommonUpVector(void) const;
181
182                /// @copydoc BillboardSet::setPointRenderingEnabled
183                void setPointRenderingEnabled(bool enabled);
184
185                /// @copydoc BillboardSet::isPointRenderingEnabled
186                bool isPointRenderingEnabled(void) const;
187
188
189
190        /// @copydoc ParticleSystemRenderer::getType
191        const String& getType(void) const;
192        /// @copydoc ParticleSystemRenderer::_updateRenderQueue
193        void _updateRenderQueue(RenderQueue* queue,
194            std::list<Particle*>& currentParticles, bool cullIndividually);
195        /// @copydoc ParticleSystemRenderer::_setMaterial
196        void _setMaterial(MaterialPtr& mat);
197        /// @copydoc ParticleSystemRenderer::_notifyCurrentCamera
198        void _notifyCurrentCamera(Camera* cam);
199        /// @copydoc ParticleSystemRenderer::_notifyParticleRotated
200        void _notifyParticleRotated(void);
201        /// @copydoc ParticleSystemRenderer::_notifyParticleResized
202        void _notifyParticleResized(void);
203        /// @copydoc ParticleSystemRenderer::_notifyParticleQuota
204        void _notifyParticleQuota(size_t quota);
205        /// @copydoc ParticleSystemRenderer::_notifyAttached
206        void _notifyAttached(Node* parent, bool isTagPoint = false);
207        /// @copydoc ParticleSystemRenderer::_notifyDefaultDimensions
208        void _notifyDefaultDimensions(Real width, Real height);
209                /// @copydoc ParticleSystemRenderer::setRenderQueueGroup
210                void setRenderQueueGroup(uint8 queueID);
211                /// @copydoc ParticleSystemRenderer::setKeepParticlesInLocalSpace
212                void setKeepParticlesInLocalSpace(bool keepLocal);
213        /// @copydoc ParticleSystemRenderer::_getSortMode
214        SortMode _getSortMode(void) const;
215
216                /// Access BillboardSet in use
217                BillboardSet* getBillboardSet(void) const { return mBillboardSet; }
218
219    protected:
220        static CmdBillboardType msBillboardTypeCmd;
221        static CmdBillboardOrigin msBillboardOriginCmd;
222        static CmdBillboardRotationType msBillboardRotationTypeCmd;
223        static CmdCommonDirection msCommonDirectionCmd;
224        static CmdCommonUpVector msCommonUpVectorCmd;
225        static CmdPointRendering msPointRenderingCmd;
226                static CmdAccurateFacing msAccurateFacingCmd;
227
228
229    };
230
231    /** Factory class for BillboardParticleRenderer */
232    class _OgreExport BillboardParticleRendererFactory : public ParticleSystemRendererFactory
233    {
234    public:
235        /// @copydoc FactoryObj::getType
236        const String& getType() const;
237        /// @copydoc FactoryObj::createInstance
238        ParticleSystemRenderer* createInstance( const String& name );   
239        /// @copydoc FactoryObj::destroyInstance
240        void destroyInstance( ParticleSystemRenderer* inst);   
241    };
242
243}
244
245#endif
246
Note: See TracBrowser for help on using the repository browser.