1
// Copyright (C) 2002-2011 Nikolaus Gebhardt
2
// This file is part of the "Irrlicht Engine".
3
// For conditions of distribution and use, see copyright notice in irrlicht.h
5
#ifndef __C_CUBE_SCENE_NODE_H_INCLUDED__
6
#define __C_CUBE_SCENE_NODE_H_INCLUDED__
8
#include "IMeshSceneNode.h"
15
class CCubeSceneNode : public IMeshSceneNode
20
CCubeSceneNode(f32 size, ISceneNode* parent, ISceneManager* mgr, s32 id,
21
const core::vector3df& position = core::vector3df(0,0,0),
22
const core::vector3df& rotation = core::vector3df(0,0,0),
23
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f));
25
virtual ~CCubeSceneNode();
27
virtual void OnRegisterSceneNode();
30
virtual void render();
32
//! returns the axis aligned bounding box of this node
33
virtual const core::aabbox3d<f32>& getBoundingBox() const;
35
//! returns the material based on the zero based index i. To get the amount
36
//! of materials used by this scene node, use getMaterialCount().
37
//! This function is needed for inserting the node into the scene hirachy on a
38
//! optimal position for minimizing renderstate changes, but can also be used
39
//! to directly modify the material of a scene node.
40
virtual video::SMaterial& getMaterial(u32 i);
42
//! returns amount of materials used by this scene node.
43
virtual u32 getMaterialCount() const;
45
//! Returns type of the scene node
46
virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; }
48
//! Writes attributes of the scene node.
49
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
51
//! Reads attributes of the scene node.
52
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
54
//! Creates a clone of this scene node and its children.
55
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
57
//! Sets a new mesh to display
58
virtual void setMesh(IMesh* mesh) {}
60
//! Returns the current mesh
61
virtual IMesh* getMesh(void) { return Mesh; }
63
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
64
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
65
referencing this mesh to change too. */
66
virtual void setReadOnlyMaterials(bool readonly) {}
68
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
69
virtual bool isReadOnlyMaterials() const { return false; }
78
} // end namespace scene
79
} // end namespace irr