Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy2/src/orxonox/objects/worldentities/Backlight.h @ 2213

Last change on this file since 2213 was 2212, checked in by landauf, 16 years ago

maybe fixed backlight crash

File size: 3.5 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 *      ...
26 *
27 */
28
29#ifndef _Backlight_H__
30#define _Backlight_H__
31
32#include "OrxonoxPrereqs.h"
33#include "Billboard.h"
34#include "objects/Tickable.h"
35#include "tools/Timer.h"
36
37namespace orxonox
38{
39    class _OrxonoxExport Backlight : public Billboard, public Tickable
40    {
41        public:
42            Backlight(BaseObject* creator);
43            virtual ~Backlight();
44
45            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
46            void registerVariables();
47
48            virtual void tick(float dt);
49            virtual void changedActivity();
50            virtual void changedVisibility();
51
52            inline void setWidth(float width)
53                { this->width_ = width; this->update_width(); }
54            inline float getWidth() const
55                { return this->width_; }
56
57            inline void setLifetime(float lifetime)
58                { this->lifetime_ = lifetime; this->update_lifetime(); }
59            inline float getLifetime() const
60                { return this->lifetime_; }
61
62            inline void setTurnOffTime(float turnofftime)
63                { this->turnofftime_ = turnofftime; }
64            inline float getTurnOffTime() const
65                { return this->turnofftime_; }
66
67            inline void setLength(float length)
68                { this->length_ = length; this->update_length(); }
69            inline float getLength() const
70                { return this->length_; }
71
72            inline void setMaxElements(size_t maxelements)
73                { this->maxelements_ = maxelements; this->update_maxelements(); }
74            inline size_t getMaxElements() const
75                { return this->maxelements_; }
76
77            inline void setTrailMaterial(const std::string& material)
78                { this->trailmaterial_ = material; this->update_trailmaterial(); }
79            inline const std::string& getTrailMaterial() const
80                { return this->trailmaterial_; }
81
82            virtual void changedScale();
83
84        private:
85            void stopturnoff();
86            virtual void changedColour();
87            void update_width();
88            void update_lifetime();
89            void update_length();
90            void update_maxelements();
91            void update_trailmaterial();
92
93            Ogre::RibbonTrail* ribbonTrail_;
94            Ogre::SceneNode* ribbonTrailNode_;
95            float width_;
96            float length_;
97            float lifetime_;
98            float turnofftime_;
99            bool bTurningOff_;
100            size_t maxelements_;
101            std::string trailmaterial_;
102            char tickcount_;
103            Timer<Backlight> turnofftimer_;
104    };
105}
106
107#endif /* _Backlight_H__ */
Note: See TracBrowser for help on using the repository browser.