Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/shader/src/orxonox/objects/RotatingProjectile.cc @ 10877

Last change on this file since 10877 was 1505, checked in by rgrieder, 16 years ago

f* svn: It doesn't even inform you if you attempt to set a non existing property. It is svn:eol-style and not eol-style when using the command by the way…

  • 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 *
4 *
5 *   License notice:
6 *
7 *   This program is free software; you can redistribute it and/or
8 *   modify it under the terms of the GNU General Public License
9 *   as published by the Free Software Foundation; either version 2
10 *   of the License, or (at your option) any later version.
11 *
12 *   This program is distributed in the hope that it will be useful,
13 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *   GNU General Public License for more details.
16 *
17 *   You should have received a copy of the GNU General Public License
18 *   along with this program; if not, write to the Free Software
19 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20 *
21 *   Author:
22 *      Fabian 'x3n' Landau
23 *   Co-authors:
24 *      ...
25 *
26 */
27
28#include "OrxonoxStableHeaders.h"
29#include "RotatingProjectile.h"
30
31#include "core/CoreIncludes.h"
32#include "core/ConfigValueIncludes.h"
33#include <OgreBillboard.h>
34
35namespace orxonox
36{
37    CreateFactory(RotatingProjectile);
38
39    RotatingProjectile::RotatingProjectile(SpaceShip* owner) : Projectile(owner)
40    {
41        RegisterObject(RotatingProjectile);
42
43        this->time_ = 0;
44
45        if (/*this->owner_*/true)
46        {
47            this->rotatingBillboard1_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
48            this->rotatingBillboard2_.setBillboardSet("Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1);
49
50            this->rotatingNode1_ = this->getNode()->createChildSceneNode(this->getName() + "rotating1", Vector3(0, 50, 0));
51            this->rotatingNode2_ = this->getNode()->createChildSceneNode(this->getName() + "rotating2", Vector3(0, -50, 0));
52            this->rotatingNode1_->attachObject(this->rotatingBillboard1_.getBillboardSet());
53            this->rotatingNode2_->attachObject(this->rotatingBillboard2_.getBillboardSet());
54            this->rotatingNode1_->scale(0.3, 0.3, 0.3);
55            this->rotatingNode2_->scale(0.3, 0.3, 0.3);
56        }
57
58        this->setConfigValues();
59    }
60
61    RotatingProjectile::~RotatingProjectile()
62    {
63    }
64
65    void RotatingProjectile::setConfigValues()
66    {
67        SetConfigValue(colour_, ColourValue(1.0, 0.0, 0.0));
68
69        this->rotatingBillboard1_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
70        this->rotatingBillboard2_.getBillboardSet()->getBillboard(0)->setColour(this->colour_);
71    }
72
73    void RotatingProjectile::tick(float dt)
74    {
75        this->time_ += dt;
76
77        this->rotatingNode1_->setPosition(0, 50 * sin(this->time_ * 20), 50 * cos(this->time_ * 20));
78        this->rotatingNode2_->setPosition(0, -50 * sin(this->time_ * 20), -50 * cos(this->time_ * 20));
79
80        Projectile::tick(dt);
81    }
82}
Note: See TracBrowser for help on using the repository browser.