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

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

lic

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