// Copyright (C) 2002-2006 Nikolaus Gebhardt // This file is part of the "Irrlicht Engine". // For conditions of distribution and use, see copyright notice in irrlicht.h #pragma once #using using namespace System; #pragma unmanaged #include "..\\..\\include\\irrlicht.h" #pragma managed #include "escenenodetype.h" #include "Box3D.h" #include "Material.h" #include "Matrix4.h" namespace Irrlicht { namespace Scene { public __gc class ISceneNodeAnimator; /// /// Scene node interface. /// A scene node is a node in the hirachical scene graph. Every scene node may have children, /// which are other scene nodes. Children move relative the their parents position. If the parent of a node is not /// visible, its children won't be visible too. In this way, it is for example easily possible /// to attach a light to a moving car, or to place a walking character on a moving platform /// on a moving ship. /// public __gc class ISceneNode { public: /// /// Creates a scene node from a native C++ scene node. Don't use this, its better to create /// scene nodes using the SceneManager with its addSceneNode() methods. /// ISceneNode(irr::scene::ISceneNode* realSceneNode); /// Destructor ~ISceneNode(); /// /// Determines whether two SceneNodes instances are equal. Simply compares the Irrlicht C++ instance pointers. /// bool Equals( System::Object __gc* obj) { ISceneNode* node = dynamic_cast( obj ); return node && node->SceneNode == SceneNode; } /// /// Renders the node. /// void Render(); /// /// Returns or sets the name of the node. /// __property System::String* get_Name(); /// /// Returns or sets the name of the node. /// __property void set_Name(System::String* name); /// /// Returns the axis aligned, not transformed bounding box of this node. /// This means that if this node is a animated 3d character, moving in a room, /// the bounding box will always be around the origin. To get the box in /// real world coordinates, just transform it with the matrix you receive with /// getAbsoluteTransformation() or simply use getTransformedBoundingBox(), /// which does the same. /// __property Core::Box3D get_BoundingBox(); /// /// Returns the axis aligned, transformed and animated absolute bounding box /// of this node. /// __property Core::Box3D get_TransformedBoundingBox(); /// /// Returns the absolute transformation of the node. Is recalculated every OnPostRender()-call. /// __property Core::Matrix4 get_AbsoluteTransformation(); /// /// Returns the relative transformation of the scene node. /// The relative transformation is stored internally as 3 vectors: /// translation, rotation and scale. To get the relative transformation /// matrix, it is calculated from these values. /// __property Core::Matrix4 get_RelativeTransformation(); /// /// Sets or gets if the node is visible. This is only an option, set by the user and has /// nothing to do with geometry culling /// __property bool get_Visible(); /// /// Sets or gets if the node is visible. This is only an option, set by the user and has /// nothing to do with geometry culling /// __property void set_Visible(bool visible); /// /// Sets or gets the id of the scene node. This id can be used to identify the node. /// __property int get_ID(); /// /// Sets or gets the id of the scene node. This id can be used to identify the node. /// __property void set_ID(int id); /// /// Adds a child to this scene node. If the scene node already /// has got a parent, it is removed from there as child. /// void AddChild(ISceneNode* child); /// /// Removes a child from this scene node. /// /// Returns true if the child could be removed, and false if not. bool RemoveChild(ISceneNode* child); /// /// Removes all children of this scene node /// void RemoveAll(); /// /// Returns list of children. Note: This is slow because it will create wrapper objects every call. /// __property ISceneNode* get_Children() []; /// /// Removes this scene node from the scene, deleting it. /// void Remove(); /// /// Adds an animator which should animate this node. /// void AddAnimator(ISceneNodeAnimator* animator); /// /// Removes an animator from this scene node. /// void RemoveAnimator(ISceneNodeAnimator* animator); /// /// Removes all animators from this scene node. /// void RemoveAnimators(); /// /// 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. /// /// Zero based index i. The maximal value for this may be MaterialCount - 1. /// Returns the material of that index. Video::Material GetMaterial(int i); /// /// 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. /// /// Zero based index i. The maximal value for this may be MaterialCount - 1. /// Returns the material of that index. void SetMaterial(int i, Video::Material); /// /// Returns amount of materials used by this scene node. /// /// Returns current count of materials used by this scene node. __property int get_MaterialCount(); /// /// Sets all material flags at once to a new value. Helpful for /// example, if you want to be the the whole mesh to be lighted by /// /// Which flag of all materials to be set. /// New value of the flag. void SetMaterialFlag(Video::MaterialFlag flag, bool newvalue); /// /// Sets the texture of the specified layer in all materials of this /// scene node to the new texture. /// /// Layer of texture to be set. Must be a value greater or /// equal than 0 and smaller than MATERIAL_MAX_TEXTURES. /// Texture to be used. void SetMaterialTexture(int textureLayer, Video::ITexture* texture); /// /// Sets the material type of all materials s32 this scene node /// to a new material type. /// /// New type of material to be set. void SetMaterialType(Video::MaterialType newType); /// /// Sets or gets the scale of the scene node. /// __property Core::Vector3D get_Scale(); /// /// Sets or gets the scale of the scene node. /// __property void set_Scale(Core::Vector3D scale); /// /// Sets or gets the rotation of the node. Note that this is /// the relative rotation of the node. /// __property Core::Vector3D get_Rotation(); /// /// Sets or gets the rotation of the node. Note that this is /// the relative rotation of the node. /// __property void set_Rotation(Core::Vector3D s); /// /// Sets or gets the position of the node. Note that the position is /// relative to the parent. /// __property Core::Vector3D get_Position(); /// /// Sets or gets the position of the node. Note that the position is /// relative to the parent. /// __property void set_Position(Core::Vector3D p); /// /// Gets the abolute position of the node. The position is absolute. /// __property Core::Vector3D get_AbsolutePosition(); /// /// Sets or gets if automatic culling based on the bounding /// box is enabled. Automatic culling is enabled by default. Note that not /// all SceneNodes support culling (the billboard scene node for example) /// and that some nodes always cull their geometry because it is their /// only reason for existance, for example the OctreeSceneNode. /// __property void set_AutomaticCulling(bool enabled); /// /// Sets or gets if automatic culling based on the bounding /// box is enabled. Automatic culling is enabled by default. Note that not /// all SceneNodes support culling (the billboard scene node for example) /// and that some nodes always cull their geometry because it is their /// only reason for existance, for example the OctreeSceneNode. /// __property bool get_AutomaticCulling(); /// /// Gets or sets if debug data like bounding boxes should be drawn. /// Please note that not all scene nodes support this feature. /// __property void set_DebugDataVisible(bool visible); /// /// Gets or sets if debug data like bounding boxes should be drawn. /// Please note that not all scene nodes support this feature. /// __property bool get_DebugDataVisible(); /// /// Sets or gets if this scene node is a debug object. Debug objects have some special properties, /// for example they can be easily excluded from collision detection or from serialization, etc. /// __property void set_IsDebugObject(bool debugObject); /// /// Sets or gets if this scene node is a debug object. Debug objects have some special properties, /// for example they can be easily excluded from collision detection or from serialization, etc. /// __property bool get_IsDebugObject(); /// /// Returns a const reference to the list of all children. /// //const core::list& getChildren() const /// /// Changes the parent of the scene node. /// void SetParent(ISceneNode* newParent); /// /// Gets or sets the triangle selector attached to this scene node. /// The Selector can be used by the engine for doing collision /// detection. You can create a TriangleSelector with /// ISceneManager::createTriangleSelector() or /// ISceneManager::createOctTreeTriangleSelector and set it with /// ISceneNode::setTriangleSelector(). If a scene node got no triangle /// selector, but collision tests should be done with it, a triangle /// selector is created using the bounding box of the scene node. /// //__property ITriangleSelector* get_TriangleSelector(); /// /// Gets or sets the triangle selector attached to this scene node. /// The Selector can be used by the engine for doing collision /// detection. You can create a TriangleSelector with /// ISceneManager::createTriangleSelector() or /// ISceneManager::createOctTreeTriangleSelector and set it with /// ISceneNode::setTriangleSelector(). If a scene node got no triangle /// selector, but collision tests should be done with it, a triangle /// selector is created using the bounding box of the scene node. /// //__property void set_TriangleSelector(ITriangleSelector* tri); /// /// updates the absolute position based on the relative and the parents position /// void UpdateAbsolutePosition(); /// /// Returns the internal pointer to the native C++ irrlicht scene node. /// Do not use this, only needed by the internal .NET wrapper. /// __property irr::scene::ISceneNode* get_NativeSceneNode(); /// /// Returns the type of the scene node /// __property SceneNodeType get_SceneNodeType(); protected: irr::scene::ISceneNode* SceneNode; }; } }