[2099] | 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 | |
---|
[8855] | 29 | /** |
---|
| 30 | @file BillboardProjectile.h |
---|
| 31 | @brief Implementation of the BillboardProjectile class. |
---|
| 32 | */ |
---|
| 33 | |
---|
[2099] | 34 | #include "BillboardProjectile.h" |
---|
| 35 | |
---|
[3196] | 36 | #include "core/CoreIncludes.h" |
---|
[2896] | 37 | #include "core/GameMode.h" |
---|
[5735] | 38 | #include "Scene.h" |
---|
[2099] | 39 | |
---|
| 40 | namespace orxonox |
---|
| 41 | { |
---|
| 42 | CreateFactory(BillboardProjectile); |
---|
| 43 | |
---|
[2662] | 44 | BillboardProjectile::BillboardProjectile(BaseObject* creator) : Projectile(creator) |
---|
[2099] | 45 | { |
---|
| 46 | RegisterObject(BillboardProjectile); |
---|
| 47 | |
---|
[2896] | 48 | if (GameMode::showsGraphics()) |
---|
[2662] | 49 | { |
---|
| 50 | assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity |
---|
[8855] | 51 | |
---|
| 52 | // Create the billboard. |
---|
[3196] | 53 | this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(0.5f, 0.5f, 0.7f, 0.8f), 1); |
---|
[2662] | 54 | this->attachOgreObject(this->billboard_.getBillboardSet()); |
---|
| 55 | } |
---|
| 56 | |
---|
[6502] | 57 | this->setScale(0.2f); |
---|
[2099] | 58 | } |
---|
| 59 | |
---|
| 60 | BillboardProjectile::~BillboardProjectile() |
---|
| 61 | { |
---|
[2896] | 62 | if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet()) |
---|
[2662] | 63 | this->detachOgreObject(this->billboard_.getBillboardSet()); |
---|
[2099] | 64 | } |
---|
| 65 | |
---|
[8855] | 66 | /** |
---|
| 67 | @brief |
---|
| 68 | Set the colour of the BillboardProjectile. |
---|
| 69 | @param colour |
---|
| 70 | The colour to be set. |
---|
| 71 | */ |
---|
[2099] | 72 | void BillboardProjectile::setColour(const ColourValue& colour) |
---|
| 73 | { |
---|
[2662] | 74 | this->billboard_.setColour(colour); |
---|
[2099] | 75 | } |
---|
[5735] | 76 | |
---|
[8855] | 77 | /** |
---|
| 78 | @brief |
---|
| 79 | Set the material of the BillboardProjectile. |
---|
| 80 | @param material |
---|
| 81 | The material name. |
---|
| 82 | */ |
---|
[2969] | 83 | void BillboardProjectile::setMaterial(const std::string& material) |
---|
| 84 | { |
---|
| 85 | this->billboard_.setMaterial(material); |
---|
| 86 | } |
---|
[2099] | 87 | |
---|
[8855] | 88 | /** |
---|
| 89 | @brief |
---|
| 90 | Is called when the visibility of the BillboardProjectile has changed. |
---|
| 91 | */ |
---|
[2099] | 92 | void BillboardProjectile::changedVisibility() |
---|
| 93 | { |
---|
| 94 | SUPER(BillboardProjectile, changedVisibility); |
---|
[2662] | 95 | |
---|
[8855] | 96 | // Also change the visibility of the billboard. |
---|
[2099] | 97 | this->billboard_.setVisible(this->isVisible()); |
---|
| 98 | } |
---|
| 99 | } |
---|