OgreBillboard.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 
00030 #ifndef __Billboard_H__
00031 #define __Billboard_H__
00032 
00033 #include "OgrePrerequisites.h"
00034 
00035 #include "OgreVector3.h"
00036 #include "OgreColourValue.h"
00037 #include "OgreCommon.h"
00038 
00039 namespace Ogre {
00040 
00061     class _OgreExport Billboard : public FXAlloc
00062     {
00063         friend class BillboardSet;
00064         friend class BillboardParticleRenderer;
00065     protected:
00066         bool mOwnDimensions;
00067         bool mUseTexcoordRect;
00068         uint16 mTexcoordIndex;      // index into the BillboardSet array of texture coordinates
00069         FloatRect mTexcoordRect;    // individual texture coordinates
00070         Real mWidth;
00071         Real mHeight;
00072     public:
00073         // Note the intentional public access to main internal variables used at runtime
00074         // Forcing access via get/set would be too costly for 000's of billboards
00075         Vector3 mPosition;
00076         // Normalised direction vector
00077         Vector3 mDirection;
00078         BillboardSet* mParentSet;
00079         ColourValue mColour;
00080         Radian mRotation;
00081 
00084         Billboard();
00085 
00088         ~Billboard();
00089 
00092         Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour = ColourValue::White);
00093 
00098         const Radian& getRotation(void) const { return mRotation; }
00099 
00104         void setRotation(const Radian& rotation);
00105 
00111         void setPosition(const Vector3& position);
00112 
00118         void setPosition(Real x, Real y, Real z);
00119 
00125         const Vector3& getPosition(void) const;
00126 
00134         void setDimensions(Real width, Real height);
00135 
00137         void resetDimensions(void) { mOwnDimensions = false; }
00144         void setColour(const ColourValue& colour);
00145 
00148         const ColourValue& getColour(void) const;
00149 
00155         bool hasOwnDimensions(void) const;
00156 
00158         Real getOwnWidth(void) const;
00159 
00161         Real getOwnHeight(void) const;
00162 
00165         void _notifyOwner(BillboardSet* owner);
00166 
00176         bool isUseTexcoordRect(void) const { return mUseTexcoordRect; }
00177 
00185         void setTexcoordIndex(uint16 texcoordIndex);
00186 
00192         uint16 getTexcoordIndex(void) const { return mTexcoordIndex; }
00193 
00199         void setTexcoordRect(const FloatRect& texcoordRect);
00200 
00206         void setTexcoordRect(Real u0, Real v0, Real u1, Real v1);
00207 
00212         const FloatRect& getTexcoordRect(void) const { return mTexcoordRect; }
00213     };
00214 
00215 }
00216 
00217 #endif

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:22 2009