Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/objecthierarchy/src/orxonox/tools/BillboardSet.cc @ 2019

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

many changes, most important: BaseObject takes now a pointer to it's creator which is needed to build a level hierarchy (with different scenes)

  • Property svn:eol-style set to native
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#include "OrxonoxStableHeaders.h"
30#include "BillboardSet.h"
31
32#include <sstream>
33#include <cassert>
34#include <OgreSceneManager.h>
35
36#include "GraphicsEngine.h"
37#include "util/Math.h"
38
39namespace orxonox
40{
41    unsigned int BillboardSet::billboardSetCounter_s = 0;
42
43    BillboardSet::BillboardSet()
44    {
45        this->billboardSet_ = 0;
46    }
47
48    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, int count)
49    {
50        assert(scenemanager);
51
52        std::ostringstream name;
53        name << (BillboardSet::billboardSetCounter_s++);
54        this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
55        this->billboardSet_->createBillboard(Vector3::ZERO);
56        this->billboardSet_->setMaterialName(file);
57
58        this->scenemanager_ = scenemanager;
59    }
60
61    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, int count)
62    {
63        assert(scenemanager);
64
65        std::ostringstream name;
66        name << (BillboardSet::billboardSetCounter_s++);
67        this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
68        this->billboardSet_->createBillboard(Vector3::ZERO, colour);
69        this->billboardSet_->setMaterialName(file);
70
71        this->scenemanager_ = scenemanager;
72    }
73
74    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const Vector3& position, int count)
75    {
76        assert(scenemanager);
77
78        std::ostringstream name;
79        name << (BillboardSet::billboardSetCounter_s++);
80        this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
81        this->billboardSet_->createBillboard(position);
82        this->billboardSet_->setMaterialName(file);
83
84        this->scenemanager_ = scenemanager;
85    }
86
87    void BillboardSet::setBillboardSet(Ogre::SceneManager* scenemanager, const std::string& file, const ColourValue& colour, const Vector3& position, int count)
88    {
89        assert(scenemanager);
90
91        std::ostringstream name;
92        name << (BillboardSet::billboardSetCounter_s++);
93        this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + name.str(), count);
94        this->billboardSet_->createBillboard(position, colour);
95        this->billboardSet_->setMaterialName(file);
96
97        this->scenemanager_ = scenemanager;
98    }
99
100    BillboardSet::~BillboardSet()
101    {
102        if (this->billboardSet_ && this->scenemanager_)
103            this->scenemanager_->destroyBillboardSet(this->billboardSet_);
104    }
105}
Note: See TracBrowser for help on using the repository browser.