Added the possibility to use multiple graphics engines in cmake (only Engine done...
[openstranded.git] / src / eal / scenenode.cc
blobb753d8a6f662e5161b6747498eaa2cdc495f82c4
1 /*
2 * This file defines SceneNodes, the representants of entities in the
3 * world.
5 * Copyright (C) 2009 Mathias Gottschlag
7 * This file is part of OpenStranded
9 * OpenStranded is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation, either version 3 of the License, or
12 * (at your option) any later version.
14 * OpenStranded is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with OpenStranded. If not, see <http://www.gnu.org/licenses/>.
23 #include "eal/scenenode.hh"
24 #include "eal/engine.hh"
25 #include "eal/irrlicht/irrlichtengine.hh"
27 #include <irrlicht/irrlicht.h>
28 using namespace irr;
30 namespace eal
32 SceneNode::SceneNode ()
34 node = 0;
36 SceneNode::~SceneNode ()
38 if (node)
39 node->remove();
42 std::string
43 SceneNode::getModel ()
45 return model;
48 void
49 SceneNode::setModel (std::string model)
51 this->model = model;
52 // Delete old scene node
53 if (node)
54 node->remove();
55 // Create new scene node
56 scene::ISceneManager *smgr = ((IrrlichtEngine*)Engine::get())->getSceneManager();
57 scene::IAnimatedMesh *mesh = smgr->getMesh(model.c_str());
58 node = smgr->addAnimatedMeshSceneNode(mesh);
61 Texture&
62 SceneNode::getTexture ()
66 void
67 SceneNode::setTexture (Texture &texture)
71 Color&
72 SceneNode::getColor ()
76 void
77 SceneNode::setColor (Color &color)
81 void
82 SceneNode::setPosition (Vector3 position)
84 this->position = position;
85 if (node)
87 node->setPosition(core::vector3df(position.x, position.y, position.z));
91 Vector3
92 SceneNode::getPosition ()
94 return position;
97 void
98 SceneNode::setRotation (RotationVector &rotation)
102 RotationVector&
103 SceneNode::getRotation ()
107 void
108 SceneNode::playAnimation (int start, int end, double speed, int mode)