Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/OgreMain/src/OgreBillboard.cpp @ 5

Last change on this file since 5 was 5, checked in by anonymous, 17 years ago

=hoffentlich gehts jetzt

File size: 5.0 KB
Line 
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-2006 Torus Knot Software Ltd
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
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#include "OgreStableHeaders.h"
30
31#include "OgreBillboard.h"
32
33#include "OgreBillboardSet.h"
34
35namespace Ogre {
36
37    //-----------------------------------------------------------------------
38    Billboard::Billboard():
39        mOwnDimensions(false),
40        mUseTexcoordRect(false),
41        mTexcoordIndex(0),
42                mPosition(Vector3::ZERO),
43        mDirection(Vector3::ZERO),       
44        mParentSet(0),
45        mColour(ColourValue::White),
46                mRotation(0)
47    {
48    }
49    //-----------------------------------------------------------------------
50    Billboard::~Billboard()
51    {
52    }
53    //-----------------------------------------------------------------------
54    Billboard::Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour)
55        : mOwnDimensions(false)
56        , mUseTexcoordRect(false)
57        , mTexcoordIndex(0)
58        , mPosition(position)
59        , mDirection(Vector3::ZERO)
60        , mParentSet(owner)
61        , mColour(colour)
62        , mRotation(0)
63    {
64    }
65    //-----------------------------------------------------------------------
66    void Billboard::setRotation(const Radian& rotation)
67    {
68        mRotation = rotation;
69        if (mRotation != Radian(0))
70            mParentSet->_notifyBillboardRotated();
71    }
72    //-----------------------------------------------------------------------
73    void Billboard::setPosition(const Vector3& position)
74    {
75        mPosition = position;
76    }
77    //-----------------------------------------------------------------------
78    void Billboard::setPosition(Real x, Real y, Real z)
79    {
80        mPosition.x = x;
81        mPosition.y = y;
82        mPosition.z = z;
83    }
84    //-----------------------------------------------------------------------
85    const Vector3& Billboard::getPosition(void) const
86    {
87        return mPosition;
88    }
89    //-----------------------------------------------------------------------
90    void Billboard::setDimensions(Real width, Real height)
91    {
92        mOwnDimensions = true;
93        mWidth = width;
94        mHeight = height;
95        mParentSet->_notifyBillboardResized();
96    }
97    //-----------------------------------------------------------------------
98    bool Billboard::hasOwnDimensions(void) const
99    {
100        return mOwnDimensions;
101    }
102    //-----------------------------------------------------------------------
103    void Billboard::_notifyOwner(BillboardSet* owner)
104    {
105        mParentSet = owner;
106    }
107    //-----------------------------------------------------------------------
108    void Billboard::setColour(const ColourValue& colour)
109    {
110        mColour = colour;
111    }
112    //-----------------------------------------------------------------------
113    const ColourValue& Billboard::getColour(void) const
114    {
115        return mColour;
116    }
117    //-----------------------------------------------------------------------
118    Real Billboard::getOwnWidth(void) const
119    {
120        return mWidth;
121    }
122    //-----------------------------------------------------------------------
123    Real Billboard::getOwnHeight(void) const
124    {
125        return mHeight;
126    }
127    //-----------------------------------------------------------------------
128    void Billboard::setTexcoordIndex(uint16 texcoordIndex)
129    {
130        mTexcoordIndex = texcoordIndex;
131        mUseTexcoordRect = false;
132    }
133    //-----------------------------------------------------------------------
134    void Billboard::setTexcoordRect(const FloatRect& texcoordRect)
135    {
136        mTexcoordRect = texcoordRect;
137        mUseTexcoordRect = true;
138    }
139    //-----------------------------------------------------------------------
140    void Billboard::setTexcoordRect(Real u0, Real v0, Real u1, Real v1)
141    {
142        setTexcoordRect(FloatRect(u0, v0, u1, v1));
143    }
144
145
146}
147
Note: See TracBrowser for help on using the repository browser.