1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_MESH_SCENE_NODE_H_INCLUDED__
\r
6 #define __C_MESH_SCENE_NODE_H_INCLUDED__
\r
8 #include "IMeshSceneNode.h"
\r
16 class CMeshSceneNode : public IMeshSceneNode
\r
21 CMeshSceneNode(IMesh* mesh, ISceneNode* parent, ISceneManager* mgr, s32 id,
\r
22 const core::vector3df& position = core::vector3df(0,0,0),
\r
23 const core::vector3df& rotation = core::vector3df(0,0,0),
\r
24 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f));
\r
27 virtual ~CMeshSceneNode();
\r
30 void OnRegisterSceneNode() override;
\r
32 //! renders the node.
\r
33 void render() override;
\r
35 //! returns the axis aligned bounding box of this node
\r
36 const core::aabbox3d<f32>& getBoundingBox() const override;
\r
38 //! returns the material based on the zero based index i. To get the amount
\r
39 //! of materials used by this scene node, use getMaterialCount().
\r
40 //! This function is needed for inserting the node into the scene hierarchy on a
\r
41 //! optimal position for minimizing renderstate changes, but can also be used
\r
42 //! to directly modify the material of a scene node.
\r
43 video::SMaterial& getMaterial(u32 i) override;
\r
45 //! returns amount of materials used by this scene node.
\r
46 u32 getMaterialCount() const override;
\r
48 //! Returns type of the scene node
\r
49 ESCENE_NODE_TYPE getType() const override { return ESNT_MESH; }
\r
52 void setMesh(IMesh* mesh) override;
\r
54 //! Returns the current mesh
\r
55 IMesh* getMesh(void) override { return Mesh; }
\r
57 //! Creates shadow volume scene node as child of this node
\r
58 //! and returns a pointer to it.
\r
59 virtual IShadowVolumeSceneNode* addShadowVolumeSceneNode(const IMesh* shadowMesh,
\r
60 s32 id, bool zfailmethod=true, f32 infinity=10000.0f) override;
\r
62 //! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
\r
63 /* In this way it is possible to change the materials a mesh causing all mesh scene nodes
\r
64 referencing this mesh to change too. */
\r
65 void setReadOnlyMaterials(bool readonly) override;
\r
67 //! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
\r
68 bool isReadOnlyMaterials() const override;
\r
70 //! Creates a clone of this scene node and its children.
\r
71 ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0) override;
\r
73 //! Removes a child from this scene node.
\r
74 //! Implemented here, to be able to remove the shadow properly, if there is one,
\r
75 //! or to remove attached child.
\r
76 bool removeChild(ISceneNode* child) override;
\r
80 void copyMaterials();
\r
82 core::array<video::SMaterial> Materials;
\r
83 core::aabbox3d<f32> Box;
\r
84 video::SMaterial ReadOnlyMaterial;
\r
87 IShadowVolumeSceneNode* Shadow;
\r
90 bool ReadOnlyMaterials;
\r
93 } // end namespace scene
\r
94 } // end namespace irr
\r