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 © 2000-2002 The OGRE Team 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 */ 00025 #include "OgreStableHeaders.h" 00026 00027 #include "OgreBillboard.h" 00028 00029 #include "OgreBillboardSet.h" 00030 00031 namespace Ogre { 00032 00033 //----------------------------------------------------------------------- 00034 Billboard::Billboard(): 00035 mOwnDimensions(false), 00036 mPosition(Vector3::ZERO), 00037 mDirection(Vector3::ZERO), 00038 mParentSet(0), 00039 mColour(ColourValue::White), 00040 mRotation(0) 00041 { 00042 } 00043 //----------------------------------------------------------------------- 00044 Billboard::~Billboard() 00045 { 00046 } 00047 //----------------------------------------------------------------------- 00048 Billboard::Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour) 00049 { 00050 mPosition = position; 00051 mOwnDimensions = false; 00052 mParentSet = owner; 00053 mColour = colour; 00054 } 00055 //----------------------------------------------------------------------- 00056 Real Billboard::getRotation(void) const 00057 { 00058 return mRotation * Math::fRad2Deg; 00059 } 00060 //----------------------------------------------------------------------- 00061 void Billboard::setRotation(Real rotation) 00062 { 00063 mRotation = rotation * Math::fDeg2Rad; 00064 if (mRotation != 0) 00065 mParentSet->_notifyBillboardTextureCoordsModified(); 00066 } 00067 //----------------------------------------------------------------------- 00068 void Billboard::setPosition(const Vector3& position) 00069 { 00070 mPosition = position; 00071 } 00072 //----------------------------------------------------------------------- 00073 void Billboard::setPosition(Real x, Real y, Real z) 00074 { 00075 mPosition.x = x; 00076 mPosition.y = y; 00077 mPosition.z = z; 00078 } 00079 //----------------------------------------------------------------------- 00080 const Vector3& Billboard::getPosition(void) const 00081 { 00082 return mPosition; 00083 } 00084 //----------------------------------------------------------------------- 00085 void Billboard::setDimensions(Real width, Real height) 00086 { 00087 mOwnDimensions = true; 00088 mWidth = width; 00089 mHeight = height; 00090 mParentSet->_notifyBillboardResized(); 00091 } 00092 //----------------------------------------------------------------------- 00093 bool Billboard::hasOwnDimensions(void) const 00094 { 00095 return mOwnDimensions; 00096 } 00097 //----------------------------------------------------------------------- 00098 void Billboard::_notifyOwner(BillboardSet* owner) 00099 { 00100 mParentSet = owner; 00101 } 00102 //----------------------------------------------------------------------- 00103 void Billboard::setColour(const ColourValue& colour) 00104 { 00105 mColour = colour; 00106 } 00107 //----------------------------------------------------------------------- 00108 const ColourValue& Billboard::getColour(void) const 00109 { 00110 return mColour; 00111 } 00112 //----------------------------------------------------------------------- 00113 Real Billboard::getOwnWidth(void) const 00114 { 00115 return mWidth; 00116 } 00117 //----------------------------------------------------------------------- 00118 Real Billboard::getOwnHeight(void) const 00119 { 00120 return mHeight; 00121 } 00122 00123 00124 00125 00126 } 00127
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:21:52 2004