source: flair-src/trunk/lib/FlairSimulator/src/MeshSceneNode.cpp@ 8

Last change on this file since 8 was 8, checked in by Sanahuja Guillaume, 6 years ago

simulator

File size: 1.8 KB
Line 
1// created: 2012/08/22
2// filename: MeshSceneNode.cpp
3//
4// author: Guillaume Sanahuja
5// Copyright Heudiasyc UMR UTC/CNRS 7253
6//
7// version: $Id: $
8//
9// purpose: classe definissant un IMeshSceneNode
10//
11/*********************************************************************/
12#ifdef GL
13
14#include "MeshSceneNode.h"
15#include "Gui.h"
16#include "Model.h"
17#include <ISceneManager.h>
18#include <IVideoDriver.h>
19
20using namespace irr;
21using namespace irr::video;
22using namespace irr::scene;
23using namespace irr::core;
24using namespace flair::core;
25
26namespace flair
27{
28namespace simulator
29{
30
31MeshSceneNode::MeshSceneNode(Model* parent,IMesh* mesh,
32 const vector3df& position ,const vector3df& rotation,
33 ITexture* texture, s32 id ): IMeshSceneNode(parent->getSceneNode(), getGui()->getSceneManager(), id,position,rotation)
34{
35 Material.Wireframe = false;
36 Material.Lighting = false;
37
38 setMesh(mesh);
39
40 if(texture!=NULL)
41 {
42 setMaterialTexture(0,texture);
43 }
44
45 parent->Box()->addInternalBox(getTransformedBoundingBox());
46}
47
48
49void MeshSceneNode::OnRegisterSceneNode(void)
50{
51 if (IsVisible)
52 SceneManager->registerNodeForRendering(this);
53
54 ISceneNode::OnRegisterSceneNode();
55}
56
57void MeshSceneNode::render(void)
58{
59 IVideoDriver* driver = SceneManager->getVideoDriver();
60
61 driver->setMaterial(Material);
62 driver->setTransform(ETS_WORLD, AbsoluteTransformation);
63 driver->drawMeshBuffer(mesh->getMeshBuffer(0));
64}
65
66
67SMaterial& MeshSceneNode::getMaterial(u32 i)
68{
69 return Material;
70}
71
72void MeshSceneNode::setMesh(IMesh* ptr)
73{
74 mesh=ptr;
75 Box=mesh->getBoundingBox();
76}
77
78
79IMesh* MeshSceneNode::getMesh(void)
80{
81 return mesh;
82}
83
84
85void MeshSceneNode::setReadOnlyMaterials(bool readonly)
86{
87
88}
89
90} // end namespace simulator
91} // end namespace flair
92#endif //GL
Note: See TracBrowser for help on using the repository browser.