[657] | 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-2005 The OGRE Team
|
---|
| 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 | */
|
---|
| 25 | #ifndef __BillboardParticleRenderer_H__
|
---|
| 26 | #define __BillboardParticleRenderer_H__
|
---|
| 27 |
|
---|
| 28 | #include "OgrePrerequisites.h"
|
---|
| 29 | #include "OgreParticleSystemRenderer.h"
|
---|
| 30 | #include "OgreBillboardSet.h"
|
---|
| 31 |
|
---|
| 32 | namespace 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 common direction (see ParamCommand).*/
|
---|
| 58 | class _OgrePrivate CmdCommonDirection : public ParamCommand
|
---|
| 59 | {
|
---|
| 60 | public:
|
---|
| 61 | String doGet(const void* target) const;
|
---|
| 62 | void doSet(void* target, const String& val);
|
---|
| 63 | };
|
---|
| 64 |
|
---|
| 65 | /** Sets the type of billboard to render.
|
---|
| 66 | @remarks
|
---|
| 67 | The default sort of billboard (BBT_POINT), always has both x and y axes parallel to
|
---|
| 68 | the camera's local axes. This is fine for 'point' style billboards (e.g. flares,
|
---|
| 69 | smoke, anything which is symmetrical about a central point) but does not look good for
|
---|
| 70 | billboards which have an orientation (e.g. an elongated raindrop). In this case, the
|
---|
| 71 | oriented billboards are more suitable (BBT_ORIENTED_COMMON or BBT_ORIENTED_SELF) since they retain an independant Y axis
|
---|
| 72 | and only the X axis is generated, perpendicular to both the local Y and the camera Z.
|
---|
| 73 | @param bbt The type of billboard to render
|
---|
| 74 | */
|
---|
| 75 | void setBillboardType(BillboardType bbt);
|
---|
| 76 |
|
---|
| 77 | /** Returns the billboard type in use. */
|
---|
| 78 | BillboardType getBillboardType(void) const;
|
---|
| 79 |
|
---|
| 80 | /** Sets the point which acts as the origin point for all billboards in this set.
|
---|
| 81 | @remarks
|
---|
| 82 | This setting controls the fine tuning of where a billboard appears in relation to it's
|
---|
| 83 | position. It could be that a billboard's position represents it's center (e.g. for fireballs),
|
---|
| 84 | it could mean the center of the bottom edge (e.g. a tree which is positioned on the ground),
|
---|
| 85 | the top-left corner (e.g. a cursor).
|
---|
| 86 | @par
|
---|
| 87 | The default setting is BBO_CENTER.
|
---|
| 88 | @param
|
---|
| 89 | origin A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
|
---|
| 90 | */
|
---|
| 91 | void setBillboardOrigin(BillboardOrigin origin) { mBillboardSet->setBillboardOrigin(origin); }
|
---|
| 92 |
|
---|
| 93 | /** Gets the point which acts as the origin point for all billboards in this set.
|
---|
| 94 | @returns
|
---|
| 95 | A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
|
---|
| 96 | */
|
---|
| 97 | BillboardOrigin getBillboardOrigin(void) const { return mBillboardSet->getBillboardOrigin(); }
|
---|
| 98 |
|
---|
| 99 | /** Use this to specify the common direction given to billboards of type BBT_ORIENTED_COMMON.
|
---|
| 100 | @remarks
|
---|
| 101 | Use BBT_ORIENTED_COMMON when you want oriented billboards but you know they are always going to
|
---|
| 102 | be oriented the same way (e.g. rain in calm weather). It is faster for the system to calculate
|
---|
| 103 | the billboard vertices if they have a common direction.
|
---|
| 104 | @param vec The direction for all billboards.
|
---|
| 105 | */
|
---|
| 106 | void setCommonDirection(const Vector3& vec);
|
---|
| 107 |
|
---|
| 108 | /** Gets the common direction for all billboards (BBT_ORIENTED_COMMON) */
|
---|
| 109 | const Vector3& getCommonDirection(void) const;
|
---|
| 110 |
|
---|
| 111 | /// @copydoc ParticleSystemRenderer::getType
|
---|
| 112 | const String& getType(void) const;
|
---|
| 113 | /// @copydoc ParticleSystemRenderer::_updateRenderQueue
|
---|
| 114 | void _updateRenderQueue(RenderQueue* queue,
|
---|
| 115 | std::list<Particle*>& currentParticles, bool cullIndividually);
|
---|
| 116 | /// @copydoc ParticleSystemRenderer::_setMaterial
|
---|
| 117 | void _setMaterial(MaterialPtr& mat);
|
---|
| 118 | /// @copydoc ParticleSystemRenderer::_notifyCurrentCamera
|
---|
| 119 | void _notifyCurrentCamera(Camera* cam);
|
---|
| 120 | /// @copydoc ParticleSystemRenderer::_notifyParticleRotated
|
---|
| 121 | void _notifyParticleRotated(void);
|
---|
| 122 | /// @copydoc ParticleSystemRenderer::_notifyParticleResized
|
---|
| 123 | void _notifyParticleResized(void);
|
---|
| 124 | /// @copydoc ParticleSystemRenderer::_notifyParticleQuota
|
---|
| 125 | void _notifyParticleQuota(size_t quota);
|
---|
| 126 | /// @copydoc ParticleSystemRenderer::_notifyAttached
|
---|
| 127 | void _notifyAttached(Node* parent, bool isTagPoint = false);
|
---|
| 128 | /// @copydoc ParticleSystemRenderer::_notifyDefaultDimensions
|
---|
| 129 | void _notifyDefaultDimensions(Real width, Real height);
|
---|
| 130 | /// @copydoc ParticleSystemRenderer::setRenderQueueGroup
|
---|
| 131 | void setRenderQueueGroup(RenderQueueGroupID queueID);
|
---|
| 132 |
|
---|
| 133 | protected:
|
---|
| 134 | static CmdBillboardType msBillboardTypeCmd;
|
---|
| 135 | static CmdCommonDirection msCommonDirectionCmd;
|
---|
| 136 |
|
---|
| 137 |
|
---|
| 138 | };
|
---|
| 139 |
|
---|
| 140 | /** Factory class for BillboardParticleRenderer */
|
---|
| 141 | class _OgreExport BillboardParticleRendererFactory : public ParticleSystemRendererFactory
|
---|
| 142 | {
|
---|
| 143 | public:
|
---|
| 144 | /// @copydoc FactoryObj::getType
|
---|
| 145 | const String& getType() const;
|
---|
| 146 | /// @copydoc FactoryObj::createInstance
|
---|
| 147 | ParticleSystemRenderer* createInstance( const String& name );
|
---|
| 148 | /// @copydoc FactoryObj::destroyInstance
|
---|
| 149 | void destroyInstance( ParticleSystemRenderer* inst);
|
---|
| 150 | };
|
---|
| 151 |
|
---|
| 152 | }
|
---|
| 153 |
|
---|
| 154 | #endif
|
---|
| 155 |
|
---|