source: OGRE/trunk/ogrenew/OgreMain/src/OgreBillboard.cpp @ 692

Revision 692, 4.9 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

RevLine 
[692]1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2005 The OGRE Team
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23-----------------------------------------------------------------------------
24*/
25#include "OgreStableHeaders.h"
26
27#include "OgreBillboard.h"
28
29#include "OgreBillboardSet.h"
30
31namespace Ogre {
32
33    //-----------------------------------------------------------------------
34    Billboard::Billboard():
35        mOwnDimensions(false),
36        mUseTexcoordRect(false),
37        mTexcoordIndex(0),
38                mPosition(Vector3::ZERO),
39        mDirection(Vector3::ZERO),       
40        mParentSet(0),
41        mColour(ColourValue::White),
42                mRotation(0)
43    {
44    }
45    //-----------------------------------------------------------------------
46    Billboard::~Billboard()
47    {
48    }
49    //-----------------------------------------------------------------------
50    Billboard::Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour)
51        : mOwnDimensions(false)
52        , mUseTexcoordRect(false)
53        , mTexcoordIndex(0)
54        , mPosition(position)
55        , mDirection(Vector3::ZERO)
56        , mParentSet(owner)
57        , mColour(colour)
58        , mRotation(0)
59    {
60    }
61    //-----------------------------------------------------------------------
62    void Billboard::setRotation(const Radian& rotation)
63    {
64        mRotation = rotation;
65        if (mRotation != Radian(0))
66            mParentSet->_notifyBillboardRotated();
67    }
68    //-----------------------------------------------------------------------
69    void Billboard::setPosition(const Vector3& position)
70    {
71        mPosition = position;
72    }
73    //-----------------------------------------------------------------------
74    void Billboard::setPosition(Real x, Real y, Real z)
75    {
76        mPosition.x = x;
77        mPosition.y = y;
78        mPosition.z = z;
79    }
80    //-----------------------------------------------------------------------
81    const Vector3& Billboard::getPosition(void) const
82    {
83        return mPosition;
84    }
85    //-----------------------------------------------------------------------
86    void Billboard::setDimensions(Real width, Real height)
87    {
88        mOwnDimensions = true;
89        mWidth = width;
90        mHeight = height;
91        mParentSet->_notifyBillboardResized();
92    }
93    //-----------------------------------------------------------------------
94    bool Billboard::hasOwnDimensions(void) const
95    {
96        return mOwnDimensions;
97    }
98    //-----------------------------------------------------------------------
99    void Billboard::_notifyOwner(BillboardSet* owner)
100    {
101        mParentSet = owner;
102    }
103    //-----------------------------------------------------------------------
104    void Billboard::setColour(const ColourValue& colour)
105    {
106        mColour = colour;
107    }
108    //-----------------------------------------------------------------------
109    const ColourValue& Billboard::getColour(void) const
110    {
111        return mColour;
112    }
113    //-----------------------------------------------------------------------
114    Real Billboard::getOwnWidth(void) const
115    {
116        return mWidth;
117    }
118    //-----------------------------------------------------------------------
119    Real Billboard::getOwnHeight(void) const
120    {
121        return mHeight;
122    }
123    //-----------------------------------------------------------------------
124    void Billboard::setTexcoordIndex(uint16 texcoordIndex)
125    {
126        mTexcoordIndex = texcoordIndex;
127        mUseTexcoordRect = false;
128    }
129    //-----------------------------------------------------------------------
130    void Billboard::setTexcoordRect(const FloatRect& texcoordRect)
131    {
132        mTexcoordRect = texcoordRect;
133        mUseTexcoordRect = true;
134    }
135    //-----------------------------------------------------------------------
136    void Billboard::setTexcoordRect(Real u0, Real v0, Real u1, Real v1)
137    {
138        setTexcoordRect(FloatRect(u0, v0, u1, v1));
139    }
140
141
142}
143
Note: See TracBrowser for help on using the repository browser.