2008-05-22 04:51:37 -07:00
|
|
|
// Copyright (C) 2002-2008 Nikolaus Gebhardt
|
2007-05-20 11:03:49 -07:00
|
|
|
// This file is part of the "Irrlicht Engine".
|
|
|
|
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
|
|
|
|
|
|
|
#ifndef __C_TEST_SCENE_NODE_H_INCLUDED__
|
|
|
|
#define __C_TEST_SCENE_NODE_H_INCLUDED__
|
|
|
|
|
2008-03-19 02:29:57 -07:00
|
|
|
#include "IMeshSceneNode.h"
|
|
|
|
#include "SMesh.h"
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
namespace irr
|
|
|
|
{
|
|
|
|
namespace scene
|
|
|
|
{
|
2008-03-19 02:29:57 -07:00
|
|
|
class CCubeSceneNode : public IMeshSceneNode
|
2007-05-20 11:03:49 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
//! constructor
|
|
|
|
CCubeSceneNode(f32 size, ISceneNode* parent, ISceneManager* mgr, s32 id,
|
|
|
|
const core::vector3df& position = core::vector3df(0,0,0),
|
|
|
|
const core::vector3df& rotation = core::vector3df(0,0,0),
|
|
|
|
const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f));
|
|
|
|
|
|
|
|
virtual void OnRegisterSceneNode();
|
|
|
|
|
|
|
|
//! renders the node.
|
|
|
|
virtual void render();
|
|
|
|
|
|
|
|
//! returns the axis aligned bounding box of this node
|
|
|
|
virtual const core::aabbox3d<f32>& getBoundingBox() const;
|
|
|
|
|
|
|
|
//! returns the material based on the zero based index i. To get the amount
|
|
|
|
//! of materials used by this scene node, use getMaterialCount().
|
|
|
|
//! This function is needed for inserting the node into the scene hirachy on a
|
|
|
|
//! optimal position for minimizing renderstate changes, but can also be used
|
|
|
|
//! to directly modify the material of a scene node.
|
|
|
|
virtual video::SMaterial& getMaterial(u32 i);
|
|
|
|
|
|
|
|
//! returns amount of materials used by this scene node.
|
2007-09-16 16:41:55 -07:00
|
|
|
virtual u32 getMaterialCount() const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Returns type of the scene node
|
|
|
|
virtual ESCENE_NODE_TYPE getType() const { return ESNT_CUBE; }
|
|
|
|
|
|
|
|
//! Writes attributes of the scene node.
|
2007-09-14 15:25:59 -07:00
|
|
|
virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const;
|
2007-05-20 11:03:49 -07:00
|
|
|
|
|
|
|
//! Reads attributes of the scene node.
|
|
|
|
virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0);
|
|
|
|
|
|
|
|
//! Creates a clone of this scene node and its children.
|
|
|
|
virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0);
|
|
|
|
|
2008-03-19 02:29:57 -07:00
|
|
|
//! Sets a new mesh to display
|
|
|
|
virtual void setMesh(IMesh* mesh) {}
|
|
|
|
|
|
|
|
//! Returns the current mesh
|
|
|
|
virtual IMesh* getMesh(void) { return &Mesh; }
|
|
|
|
|
|
|
|
//! Sets if the scene node should not copy the materials of the mesh but use them in a read only style.
|
|
|
|
/* In this way it is possible to change the materials a mesh causing all mesh scene nodes
|
|
|
|
referencing this mesh to change too. */
|
|
|
|
virtual void setReadOnlyMaterials(bool readonly) {}
|
|
|
|
|
|
|
|
//! Returns if the scene node should not copy the materials of the mesh but use them in a read only style
|
|
|
|
virtual bool isReadOnlyMaterials() const { return false; }
|
|
|
|
|
2007-05-20 11:03:49 -07:00
|
|
|
private:
|
|
|
|
void setSize();
|
|
|
|
|
2008-03-19 02:29:57 -07:00
|
|
|
SMesh Mesh;
|
2007-05-20 11:03:49 -07:00
|
|
|
f32 Size;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // end namespace scene
|
|
|
|
} // end namespace irr
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|