[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 | #include "OgreStableHeaders.h"
|
---|
| 26 |
|
---|
| 27 | #include "OgreBillboard.h"
|
---|
| 28 |
|
---|
| 29 | #include "OgreBillboardSet.h"
|
---|
| 30 |
|
---|
| 31 | namespace Ogre {
|
---|
| 32 |
|
---|
| 33 | //-----------------------------------------------------------------------
|
---|
| 34 | Billboard::Billboard():
|
---|
| 35 | mOwnDimensions(false),
|
---|
| 36 | mPosition(Vector3::ZERO),
|
---|
| 37 | mDirection(Vector3::ZERO),
|
---|
| 38 | mParentSet(0),
|
---|
| 39 | mColour(ColourValue::White),
|
---|
| 40 | mRotation(0)
|
---|
| 41 | {
|
---|
| 42 | }
|
---|
| 43 | //-----------------------------------------------------------------------
|
---|
| 44 | Billboard::~Billboard()
|
---|
| 45 | {
|
---|
| 46 | }
|
---|
| 47 | //-----------------------------------------------------------------------
|
---|
| 48 | Billboard::Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour)
|
---|
| 49 | {
|
---|
| 50 | mPosition = position;
|
---|
| 51 | mOwnDimensions = false;
|
---|
| 52 | mParentSet = owner;
|
---|
| 53 | mColour = colour;
|
---|
| 54 | }
|
---|
| 55 | //-----------------------------------------------------------------------
|
---|
| 56 | void Billboard::setRotation(const Radian& rotation)
|
---|
| 57 | {
|
---|
| 58 | mRotation = rotation;
|
---|
| 59 | if (mRotation != Radian(0))
|
---|
| 60 | mParentSet->_notifyBillboardTextureCoordsModified();
|
---|
| 61 | }
|
---|
| 62 | //-----------------------------------------------------------------------
|
---|
| 63 | void Billboard::setPosition(const Vector3& position)
|
---|
| 64 | {
|
---|
| 65 | mPosition = position;
|
---|
| 66 | }
|
---|
| 67 | //-----------------------------------------------------------------------
|
---|
| 68 | void Billboard::setPosition(Real x, Real y, Real z)
|
---|
| 69 | {
|
---|
| 70 | mPosition.x = x;
|
---|
| 71 | mPosition.y = y;
|
---|
| 72 | mPosition.z = z;
|
---|
| 73 | }
|
---|
| 74 | //-----------------------------------------------------------------------
|
---|
| 75 | const Vector3& Billboard::getPosition(void) const
|
---|
| 76 | {
|
---|
| 77 | return mPosition;
|
---|
| 78 | }
|
---|
| 79 | //-----------------------------------------------------------------------
|
---|
| 80 | void Billboard::setDimensions(Real width, Real height)
|
---|
| 81 | {
|
---|
| 82 | mOwnDimensions = true;
|
---|
| 83 | mWidth = width;
|
---|
| 84 | mHeight = height;
|
---|
| 85 | mParentSet->_notifyBillboardResized();
|
---|
| 86 | }
|
---|
| 87 | //-----------------------------------------------------------------------
|
---|
| 88 | bool Billboard::hasOwnDimensions(void) const
|
---|
| 89 | {
|
---|
| 90 | return mOwnDimensions;
|
---|
| 91 | }
|
---|
| 92 | //-----------------------------------------------------------------------
|
---|
| 93 | void Billboard::_notifyOwner(BillboardSet* owner)
|
---|
| 94 | {
|
---|
| 95 | mParentSet = owner;
|
---|
| 96 | }
|
---|
| 97 | //-----------------------------------------------------------------------
|
---|
| 98 | void Billboard::setColour(const ColourValue& colour)
|
---|
| 99 | {
|
---|
| 100 | mColour = colour;
|
---|
| 101 | }
|
---|
| 102 | //-----------------------------------------------------------------------
|
---|
| 103 | const ColourValue& Billboard::getColour(void) const
|
---|
| 104 | {
|
---|
| 105 | return mColour;
|
---|
| 106 | }
|
---|
| 107 | //-----------------------------------------------------------------------
|
---|
| 108 | Real Billboard::getOwnWidth(void) const
|
---|
| 109 | {
|
---|
| 110 | return mWidth;
|
---|
| 111 | }
|
---|
| 112 | //-----------------------------------------------------------------------
|
---|
| 113 | Real Billboard::getOwnHeight(void) const
|
---|
| 114 | {
|
---|
| 115 | return mHeight;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 |
|
---|
| 119 |
|
---|
| 120 |
|
---|
| 121 | }
|
---|
| 122 |
|
---|