# 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-2009 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028
    00029 #ifndef __Billboard_H__
    00030 #define __Billboard_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreVector3.h"
    00035 #include "OgreColourValue.h"
    00036 #include "OgreCommon.h"
    00037
    00038 namespace Ogre {
    00066     class _OgreExport Billboard : public FXAlloc
    00067     {
    00068         friend class BillboardSet;
    00069         friend class BillboardParticleRenderer;
    00070     protected:
    00071         bool mOwnDimensions;
    00072         bool mUseTexcoordRect;
    00073         uint16 mTexcoordIndex;      // index into the BillboardSet array of texture coordinates
    00074         FloatRect mTexcoordRect;    // individual texture coordinates
    00075         Real mWidth;
    00076         Real mHeight;
    00077     public:
    00078         // Note the intentional public access to main internal variables used at runtime
    00079         // Forcing access via get/set would be too costly for 000's of billboards
    00080         Vector3 mPosition;
    00081         // Normalised direction vector
    00082         Vector3 mDirection;
    00083         BillboardSet* mParentSet;
    00084         ColourValue mColour;
    00085         Radian mRotation;
    00086
    00089         Billboard();
    00090
    00093         ~Billboard();
    00094
    00097         Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour = ColourValue::White);
    00098
    00103         const Radian& getRotation(void) const { return mRotation; }
    00104
    00109         void setRotation(const Radian& rotation);
    00110
    00116         void setPosition(const Vector3& position);
    00117
    00123         void setPosition(Real x, Real y, Real z);
    00124
    00130         const Vector3& getPosition(void) const;
    00131
    00139         void setDimensions(Real width, Real height);
    00140
    00142         void resetDimensions(void) { mOwnDimensions = false; }
    00149         void setColour(const ColourValue& colour);
    00150
    00153         const ColourValue& getColour(void) const;
    00154
    00160         bool hasOwnDimensions(void) const;
    00161
    00163         Real getOwnWidth(void) const;
    00164
    00166         Real getOwnHeight(void) const;
    00167
    00170         void _notifyOwner(BillboardSet* owner);
    00171
    00181         bool isUseTexcoordRect(void) const { return mUseTexcoordRect; }
    00182
    00190         void setTexcoordIndex(uint16 texcoordIndex);
    00191
    00197         uint16 getTexcoordIndex(void) const { return mTexcoordIndex; }
    00198
    00204         void setTexcoordRect(const FloatRect& texcoordRect);
    00205
    00211         void setTexcoordRect(Real u0, Real v0, Real u1, Real v1);
    00212
    00217         const FloatRect& getTexcoordRect(void) const { return mTexcoordRect; }
    00218     };
    00219
    00223 }
    00224
    00225 #endif

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Wed Nov 3 2010 19:24:51