OgreParticle.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE 
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under 
00011 the terms of the GNU Lesser General Public License as published by the Free Software 
00012 Foundation; either version 2 of the License, or (at your option) any later 
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT 
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with 
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 
00024 You may alternatively use this source under the terms of a specific version of
00025 the OGRE Unrestricted License provided you have obtained such a license from
00026 Torus Knot Software Ltd.
00027 -----------------------------------------------------------------------------
00028 */
00029 #ifndef __Particle_H__
00030 #define __Particle_H__
00031 
00032 #include "OgrePrerequisites.h"
00033 #include "OgreBillboard.h"
00034 
00035 namespace Ogre {
00036 
00046     class _OgreExport ParticleVisualData : public FXAlloc
00047     {
00048     public:
00049         ParticleVisualData() {}
00050         virtual ~ParticleVisualData() {}
00051 
00052     };
00053 
00055     class _OgreExport Particle : public FXAlloc
00056     {
00057     protected:
00059         ParticleSystem* mParentSystem;
00061         ParticleVisualData* mVisual;
00062     public:
00064         enum ParticleType
00065         {
00066             Visual,
00067             Emitter
00068         };
00069 
00071         bool mOwnDimensions;
00073         Real mWidth;
00075         Real mHeight;
00077         Radian rotation;
00078         // Note the intentional public access to internal variables
00079         // Accessing via get/set would be too costly for 000's of particles
00081         Vector3 position;
00083         Vector3 direction;
00085         ColourValue colour;
00087         Real timeToLive;
00089         Real totalTimeToLive;
00091         Radian rotationSpeed;
00093         ParticleType particleType;
00094 
00095         Particle()
00096             : mParentSystem(0), mVisual(0), mOwnDimensions(false), rotation(0), 
00097             position(Vector3::ZERO), direction(Vector3::ZERO), 
00098             colour(ColourValue::White), timeToLive(10), totalTimeToLive(10), 
00099             rotationSpeed(0), particleType(Visual)
00100         {
00101         }
00102 
00110         void setDimensions(Real width, Real height); 
00111 
00117         bool hasOwnDimensions(void) const { return mOwnDimensions; }
00118 
00120         Real getOwnWidth(void) const { return mWidth; }
00121 
00123         Real getOwnHeight(void) const { return mHeight; }
00124         
00126         void setRotation(const Radian& rad);
00127 
00128         const Radian& getRotation(void) const { return rotation; }
00129 
00132         void _notifyOwner(ParticleSystem* owner);
00133 
00136         void _notifyVisualData(ParticleVisualData* vis) { mVisual = vis; }
00137 
00139         ParticleVisualData* getVisualData(void) const { return mVisual; }
00140 
00142         void resetDimensions(void);
00143     };
00144 }
00145 
00146 #endif
00147 

Copyright © 2008 Torus Knot Software Ltd
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Sep 27 22:02:24 2009