Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/animated_space_boundaries/src/orxonox/graphics/Billboard.h @ 12141

Last change on this file since 12141 was 8710, checked in by FelixSchulthess, 14 years ago

space boundary billboard is now animated. test run with myTestLevel.oxw

  • Property svn:eol-style set to native
File size: 4.3 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      Maurus Kaufmann
26 *      ...
27 *
28 */
29
30#ifndef _Billboard_H__
31#define _Billboard_H__
32
33#include "OrxonoxPrereqs.h"
34
35#include "OgreBillboardSet.h"
36
37#include "util/Math.h"
38#include "tools/BillboardSet.h"
39#include "interfaces/TeamColourable.h"
40#include "worldentities/StaticEntity.h"
41
42namespace orxonox
43{
44    class _OrxonoxExport Billboard : public StaticEntity, public TeamColourable
45    {
46        public:
47            Billboard(BaseObject* creator);
48            virtual ~Billboard();
49
50            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
51
52            virtual void changedVisibility();
53
54            inline const BillboardSet& getBillboardSet() const
55                { return this->billboard_; }
56
57            inline void setMaterial(const std::string& material)
58                { this->material_ = material; this->changedMaterial(); }
59            inline const std::string& getMaterial() const
60                { return this->material_; }
61
62            inline void setColour(const ColourValue& colour)
63                { this->colour_ = colour; this->changedColour(); }
64            inline const ColourValue& getColour() const
65                { return this->colour_; }
66
67            inline void setRotation(const Radian& rotation)
68                { this->rotation_ = rotation; this->changedRotation(); }
69            inline const Radian& getRotation() const
70                { return this->rotation_; }
71
72            /// use normalised vector as argument
73            inline void setCommonDirection(const Vector3 vec)
74                { if(this->billboard_.getBillboardSet())
75                    this->billboard_.getBillboardSet()->setCommonDirection(vec); }
76            inline const Vector3 getCommonDirection()
77                { if(this->billboard_.getBillboardSet())
78                    return this->billboard_.getBillboardSet()->getCommonDirection(); }
79
80            /// use normalised vector as argument
81            inline void setCommonUpVector(const Vector3 vec)
82                { if(this->billboard_.getBillboardSet())
83                    this->billboard_.getBillboardSet()->setCommonUpVector( vec ); }
84            inline const Vector3 getCommonUpVector()
85                { if(this->billboard_.getBillboardSet())
86                    return this->billboard_.getBillboardSet()->getCommonUpVector(); }
87
88            virtual void setTeamColour(const ColourValue& colour)
89                { this->setColour(colour); }
90               
91            void setBillboardType(Ogre::BillboardType bbt);
92           
93            inline void setDefaultDimensions(float width, float height)
94                { if(this->billboard_.getBillboardSet())
95                    this->billboard_.getBillboardSet()->setDefaultDimensions(width, height); }
96
97            inline void setTextureCoords(const Ogre::FloatRect* coords, unsigned int numCoords)
98                { if(this->billboard_.getBillboardSet())
99                    this->billboard_.getBillboardSet()->setTextureCoords(coords, numCoords); }
100
101        protected:
102            inline BillboardSet& getBillboardSet()
103                { return this->billboard_; }
104
105            virtual void changedColour();
106
107        private:
108            void registerVariables();
109            void changedMaterial();
110            void changedRotation();
111
112            BillboardSet billboard_;
113            std::string material_;
114            ColourValue colour_;
115            Radian rotation_;
116    };
117}
118
119#endif /* _Billboard_H__ */
Note: See TracBrowser for help on using the repository browser.