[2072] | 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: |
---|
[8614] | 25 | * Maurus Kaufmann |
---|
[2072] | 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef _Billboard_H__ |
---|
| 31 | #define _Billboard_H__ |
---|
| 32 | |
---|
| 33 | #include "OrxonoxPrereqs.h" |
---|
[3196] | 34 | |
---|
[8614] | 35 | #include "OgreBillboardSet.h" |
---|
| 36 | |
---|
[2072] | 37 | #include "util/Math.h" |
---|
| 38 | #include "tools/BillboardSet.h" |
---|
[3196] | 39 | #include "interfaces/TeamColourable.h" |
---|
[5737] | 40 | #include "worldentities/StaticEntity.h" |
---|
[2072] | 41 | |
---|
| 42 | namespace orxonox |
---|
| 43 | { |
---|
[3196] | 44 | class _OrxonoxExport Billboard : public StaticEntity, public TeamColourable |
---|
[2072] | 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_; } |
---|
[7491] | 66 | |
---|
[3053] | 67 | inline void setRotation(const Radian& rotation) |
---|
| 68 | { this->rotation_ = rotation; this->changedRotation(); } |
---|
| 69 | inline const Radian& getRotation() const |
---|
| 70 | { return this->rotation_; } |
---|
[7491] | 71 | |
---|
[8710] | 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(); } |
---|
[8614] | 79 | |
---|
[8710] | 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 | |
---|
[2826] | 88 | virtual void setTeamColour(const ColourValue& colour) |
---|
| 89 | { this->setColour(colour); } |
---|
[8614] | 90 | |
---|
| 91 | void setBillboardType(Ogre::BillboardType bbt); |
---|
| 92 | |
---|
[8710] | 93 | inline void setDefaultDimensions(float width, float height) |
---|
| 94 | { if(this->billboard_.getBillboardSet()) |
---|
| 95 | this->billboard_.getBillboardSet()->setDefaultDimensions(width, height); } |
---|
[2826] | 96 | |
---|
[8710] | 97 | inline void setTextureCoords(const Ogre::FloatRect* coords, unsigned int numCoords) |
---|
| 98 | { if(this->billboard_.getBillboardSet()) |
---|
| 99 | this->billboard_.getBillboardSet()->setTextureCoords(coords, numCoords); } |
---|
[8614] | 100 | |
---|
[2662] | 101 | protected: |
---|
| 102 | inline BillboardSet& getBillboardSet() |
---|
| 103 | { return this->billboard_; } |
---|
| 104 | |
---|
| 105 | virtual void changedColour(); |
---|
| 106 | |
---|
[2072] | 107 | private: |
---|
[7163] | 108 | void registerVariables(); |
---|
[2072] | 109 | void changedMaterial(); |
---|
[8614] | 110 | void changedRotation(); |
---|
[2072] | 111 | |
---|
| 112 | BillboardSet billboard_; |
---|
| 113 | std::string material_; |
---|
| 114 | ColourValue colour_; |
---|
[8614] | 115 | Radian rotation_; |
---|
[2072] | 116 | }; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | #endif /* _Billboard_H__ */ |
---|