Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/weapons/projectiles/BillboardProjectile.cc @ 10035

Last change on this file since 10035 was 9667, checked in by landauf, 11 years ago

merged core6 back to trunk

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