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_SHPERE_SCENE_NODE_H_INCLUDED__
6
#define __C_SHPERE_SCENE_NODE_H_INCLUDED__
8
#include "IMeshSceneNode.h"
15
class CSphereSceneNode : public IMeshSceneNode
20
CSphereSceneNode(f32 size, u32 polyCountX, u32 polyCountY, 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));
26
virtual ~CSphereSceneNode();
28
virtual void OnRegisterSceneNode();
31
virtual void render();
33
//! returns the axis aligned bounding box of this node
34
virtual const core::aabbox3d<f32>& getBoundingBox() const;
36
//! returns the material based on the zero based index i. To get the amount
37
//! of materials used by this scene node, use getMaterialCount().
38
//! This function is needed for inserting the node into the scene hirachy on a
39
//! optimal position for minimizing renderstate changes, but can also be used
40
//! to directly modify the material of a scene node.
41
virtual video::SMaterial& getMaterial(u32 i);
43
//! returns amount of materials used by this scene node.
44
virtual u32 getMaterialCount() const;
46
//! Returns type of the scene node
47
virtual ESCENE_NODE_TYPE getType() const { return ESNT_SPHERE; }
49
//! Writes attributes of the scene node.
50
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
52
//! Reads attributes of the scene node.
53
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
55
//! Creates a clone of this scene node and its children.
56
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
58
//! The mesh cannot be changed
59
virtual void setMesh(IMesh* mesh) {}
61
//! Returns the current mesh
62
virtual IMesh* getMesh() { return Mesh; }
64
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
65
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
66
referencing this mesh to change too. */
67
virtual void setReadOnlyMaterials(bool readonly) {}
69
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
70
virtual bool isReadOnlyMaterials() const { return false; }
75
core::aabbox3d<f32> Box;
81
} // end namespace scene
82
} // end namespace irr