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 __I_SCENE_NODE_H_INCLUDED__
\r
6 #define __I_SCENE_NODE_H_INCLUDED__
\r
8 #include "IAttributeExchangingObject.h"
\r
9 #include "ESceneNodeTypes.h"
\r
10 #include "ECullingTypes.h"
\r
11 #include "EDebugSceneTypes.h"
\r
12 #include "ISceneNodeAnimator.h"
\r
13 #include "ITriangleSelector.h"
\r
14 #include "SMaterial.h"
\r
15 #include "irrString.h"
\r
16 #include "aabbox3d.h"
\r
17 #include "matrix4.h"
\r
18 #include "irrList.h"
\r
19 #include "IAttributes.h"
\r
25 class ISceneManager;
\r
27 //! Typedef for list of scene nodes
\r
28 typedef core::list<ISceneNode*> ISceneNodeList;
\r
29 //! Typedef for list of scene node animators
\r
30 typedef core::list<ISceneNodeAnimator*> ISceneNodeAnimatorList;
\r
32 //! Scene node interface.
\r
33 /** A scene node is a node in the hierarchical scene graph. Every scene
\r
34 node may have children, which are also scene nodes. Children move
\r
35 relative to their parent's position. If the parent of a node is not
\r
36 visible, its children won't be visible either. In this way, it is for
\r
37 example easily possible to attach a light to a moving car, or to place
\r
38 a walking character on a moving platform on a moving ship.
\r
40 class ISceneNode : virtual public io::IAttributeExchangingObject
\r
45 ISceneNode(ISceneNode* parent, ISceneManager* mgr, s32 id=-1,
\r
46 const core::vector3df& position = core::vector3df(0,0,0),
\r
47 const core::vector3df& rotation = core::vector3df(0,0,0),
\r
48 const core::vector3df& scale = core::vector3df(1.0f, 1.0f, 1.0f))
\r
49 : RelativeTranslation(position), RelativeRotation(rotation), RelativeScale(scale),
\r
50 Parent(0), SceneManager(mgr), TriangleSelector(0), ID(id),
\r
51 AutomaticCullingState(EAC_BOX), DebugDataVisible(EDS_OFF),
\r
52 IsVisible(true), IsDebugObject(false)
\r
55 parent->addChild(this);
\r
57 updateAbsolutePosition();
\r
62 virtual ~ISceneNode()
\r
64 // delete all children
\r
67 // delete all animators
\r
68 ISceneNodeAnimatorList::Iterator ait = Animators.begin();
\r
69 for (; ait != Animators.end(); ++ait)
\r
72 if (TriangleSelector)
\r
73 TriangleSelector->drop();
\r
77 //! This method is called just before the rendering process of the whole scene.
\r
78 /** Nodes may register themselves in the render pipeline during this call,
\r
79 precalculate the geometry which should be renderered, and prevent their
\r
80 children from being able to register themselves if they are clipped by simply
\r
81 not calling their OnRegisterSceneNode method.
\r
82 If you are implementing your own scene node, you should overwrite this method
\r
83 with an implementation code looking like this:
\r
86 SceneManager->registerNodeForRendering(this);
\r
88 ISceneNode::OnRegisterSceneNode();
\r
91 virtual void OnRegisterSceneNode()
\r
95 ISceneNodeList::Iterator it = Children.begin();
\r
96 for (; it != Children.end(); ++it)
\r
97 (*it)->OnRegisterSceneNode();
\r
102 //! OnAnimate() is called just before rendering the whole scene.
\r
103 /** Nodes may calculate or store animations here, and may do other useful things,
\r
104 depending on what they are. Also, OnAnimate() should be called for all
\r
105 child scene nodes here. This method will be called once per frame, independent
\r
106 of whether the scene node is visible or not.
\r
107 \param timeMs Current time in milliseconds. */
\r
108 virtual void OnAnimate(u32 timeMs)
\r
112 // animate this node with all animators
\r
114 ISceneNodeAnimatorList::Iterator ait = Animators.begin();
\r
115 while (ait != Animators.end())
\r
117 // continue to the next node before calling animateNode()
\r
118 // so that the animator may remove itself from the scene
\r
119 // node without the iterator becoming invalid
\r
120 ISceneNodeAnimator* anim = *ait;
\r
122 if ( anim->isEnabled() )
\r
124 anim->animateNode(this, timeMs);
\r
128 // update absolute position
\r
129 updateAbsolutePosition();
\r
131 // perform the post render process on all children
\r
133 ISceneNodeList::Iterator it = Children.begin();
\r
134 for (; it != Children.end(); ++it)
\r
135 (*it)->OnAnimate(timeMs);
\r
140 //! Renders the node.
\r
141 virtual void render() = 0;
\r
144 //! Returns the name of the node.
\r
145 /** \return Name as character string. */
\r
146 virtual const c8* getName() const
\r
148 return Name.c_str();
\r
152 //! Sets the name of the node.
\r
153 /** \param name New name of the scene node. */
\r
154 virtual void setName(const c8* name)
\r
160 //! Sets the name of the node.
\r
161 /** \param name New name of the scene node. */
\r
162 virtual void setName(const core::stringc& name)
\r
168 //! Get the axis aligned, not transformed bounding box of this node.
\r
169 /** This means that if this node is an animated 3d character,
\r
170 moving in a room, the bounding box will always be around the
\r
171 origin. To get the box in real world coordinates, just
\r
172 transform it with the matrix you receive with
\r
173 getAbsoluteTransformation() or simply use
\r
174 getTransformedBoundingBox(), which does the same.
\r
175 \return The non-transformed bounding box. */
\r
176 virtual const core::aabbox3d<f32>& getBoundingBox() const = 0;
\r
179 //! Get the axis aligned, transformed and animated absolute bounding box of this node.
\r
180 /** Note: The result is still an axis-aligned bounding box, so it's size
\r
181 changes with rotation.
\r
182 \return The transformed bounding box. */
\r
183 virtual const core::aabbox3d<f32> getTransformedBoundingBox() const
\r
185 core::aabbox3d<f32> box = getBoundingBox();
\r
186 AbsoluteTransformation.transformBoxEx(box);
\r
190 //! Get a the 8 corners of the original bounding box transformed and
\r
191 //! animated by the absolute transformation.
\r
192 /** Note: The result is _not_ identical to getTransformedBoundingBox().getEdges(),
\r
193 but getting an aabbox3d of these edges would then be identical.
\r
194 \param edges Receives an array with the transformed edges */
\r
195 virtual void getTransformedBoundingBoxEdges(core::array< core::vector3d<f32> >& edges) const
\r
198 getBoundingBox().getEdges( edges.pointer() );
\r
199 for ( u32 i=0; i<8; ++i )
\r
200 AbsoluteTransformation.transformVect( edges[i] );
\r
203 //! Get the absolute transformation of the node. Is recalculated every OnAnimate()-call.
\r
204 /** NOTE: For speed reasons the absolute transformation is not
\r
205 automatically recalculated on each change of the relative
\r
206 transformation or by a transformation change of an parent. Instead the
\r
207 update usually happens once per frame in OnAnimate. You can enforce
\r
208 an update with updateAbsolutePosition().
\r
209 \return The absolute transformation matrix. */
\r
210 virtual const core::matrix4& getAbsoluteTransformation() const
\r
212 return AbsoluteTransformation;
\r
216 //! Returns the relative transformation of the scene node.
\r
217 /** The relative transformation is stored internally as 3
\r
218 vectors: translation, rotation and scale. To get the relative
\r
219 transformation matrix, it is calculated from these values.
\r
220 \return The relative transformation matrix. */
\r
221 virtual core::matrix4 getRelativeTransformation() const
\r
224 mat.setRotationDegrees(RelativeRotation);
\r
225 mat.setTranslation(RelativeTranslation);
\r
227 if (RelativeScale != core::vector3df(1.f,1.f,1.f))
\r
229 core::matrix4 smat;
\r
230 smat.setScale(RelativeScale);
\r
238 //! Returns whether the node should be visible (if all of its parents are visible).
\r
239 /** This is only an option set by the user, but has nothing to
\r
240 do with geometry culling
\r
241 \return The requested visibility of the node, true means
\r
242 visible (if all parents are also visible). */
\r
243 virtual bool isVisible() const
\r
248 //! Check whether the node is truly visible, taking into accounts its parents' visibility
\r
249 /** \return true if the node and all its parents are visible,
\r
250 false if this or any parent node is invisible. */
\r
251 virtual bool isTrulyVisible() const
\r
259 return Parent->isTrulyVisible();
\r
262 //! Sets if the node should be visible or not.
\r
263 /** All children of this node won't be visible either, when set
\r
264 to false. Invisible nodes are not valid candidates for selection by
\r
265 collision manager bounding box methods.
\r
266 \param isVisible If the node shall be visible. */
\r
267 virtual void setVisible(bool isVisible)
\r
269 IsVisible = isVisible;
\r
273 //! Get the id of the scene node.
\r
274 /** This id can be used to identify the node.
\r
276 virtual s32 getID() const
\r
282 //! Sets the id of the scene node.
\r
283 /** This id can be used to identify the node.
\r
284 \param id The new id. */
\r
285 virtual void setID(s32 id)
\r
291 //! Adds a child to this scene node.
\r
292 /** If the scene node already has a parent it is first removed
\r
293 from the other parent.
\r
294 \param child A pointer to the new child. */
\r
295 virtual void addChild(ISceneNode* child)
\r
297 if (child && (child != this))
\r
299 // Change scene manager?
\r
300 if (SceneManager != child->SceneManager)
\r
301 child->setSceneManager(SceneManager);
\r
304 child->remove(); // remove from old parent
\r
305 Children.push_back(child);
\r
306 child->Parent = this;
\r
311 //! Removes a child from this scene node.
\r
312 /** If found in the children list, the child pointer is also
\r
313 dropped and might be deleted if no other grab exists.
\r
314 \param child A pointer to the child which shall be removed.
\r
315 \return True if the child was removed, and false if not,
\r
316 e.g. because it couldn't be found in the children list. */
\r
317 virtual bool removeChild(ISceneNode* child)
\r
319 ISceneNodeList::Iterator it = Children.begin();
\r
320 for (; it != Children.end(); ++it)
\r
321 if ((*it) == child)
\r
325 Children.erase(it);
\r
333 //! Removes all children of this scene node
\r
334 /** The scene nodes found in the children list are also dropped
\r
335 and might be deleted if no other grab exists on them.
\r
337 virtual void removeAll()
\r
339 ISceneNodeList::Iterator it = Children.begin();
\r
340 for (; it != Children.end(); ++it)
\r
350 //! Removes this scene node from the scene
\r
351 /** If no other grab exists for this node, it will be deleted.
\r
353 virtual void remove()
\r
356 Parent->removeChild(this);
\r
360 //! Adds an animator which should animate this node.
\r
361 /** \param animator A pointer to the new animator. */
\r
362 virtual void addAnimator(ISceneNodeAnimator* animator)
\r
366 Animators.push_back(animator);
\r
372 //! Get a list of all scene node animators.
\r
373 /** \return The list of animators attached to this node. */
\r
374 const core::list<ISceneNodeAnimator*>& getAnimators() const
\r
380 //! Removes an animator from this scene node.
\r
381 /** If the animator is found, it is also dropped and might be
\r
382 deleted if not other grab exists for it.
\r
383 \param animator A pointer to the animator to be deleted. */
\r
384 virtual void removeAnimator(ISceneNodeAnimator* animator)
\r
386 ISceneNodeAnimatorList::Iterator it = Animators.begin();
\r
387 for (; it != Animators.end(); ++it)
\r
389 if ((*it) == animator)
\r
392 Animators.erase(it);
\r
399 //! Removes all animators from this scene node.
\r
400 /** The animators might also be deleted if no other grab exists
\r
402 virtual void removeAnimators()
\r
404 ISceneNodeAnimatorList::Iterator it = Animators.begin();
\r
405 for (; it != Animators.end(); ++it)
\r
412 //! Returns the material based on the zero based index i.
\r
413 /** To get the amount of materials used by this scene node, use
\r
414 getMaterialCount(). This function is needed for inserting the
\r
415 node into the scene hierarchy at an optimal position for
\r
416 minimizing renderstate changes, but can also be used to
\r
417 directly modify the material of a scene node.
\r
418 \param num Zero based index. The maximal value is getMaterialCount() - 1.
\r
419 \return The material at that index. */
\r
420 virtual video::SMaterial& getMaterial(u32 num)
\r
422 return video::IdentityMaterial;
\r
426 //! Get amount of materials used by this scene node.
\r
427 /** \return Current amount of materials of this scene node. */
\r
428 virtual u32 getMaterialCount() const
\r
434 //! Sets all material flags at once to a new value.
\r
435 /** Useful, for example, if you want the whole mesh to be
\r
437 \param flag Which flag of all materials to be set.
\r
438 \param newvalue New value of that flag. */
\r
439 void setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
\r
441 for (u32 i=0; i<getMaterialCount(); ++i)
\r
442 getMaterial(i).setFlag(flag, newvalue);
\r
446 //! Sets the texture of the specified layer in all materials of this scene node to the new texture.
\r
447 /** \param textureLayer Layer of texture to be set. Must be a
\r
448 value smaller than MATERIAL_MAX_TEXTURES.
\r
449 \param texture New texture to be used. */
\r
450 void setMaterialTexture(u32 textureLayer, video::ITexture* texture)
\r
452 if (textureLayer >= video::MATERIAL_MAX_TEXTURES)
\r
455 for (u32 i=0; i<getMaterialCount(); ++i)
\r
456 getMaterial(i).setTexture(textureLayer, texture);
\r
460 //! Sets the material type of all materials in this scene node to a new material type.
\r
461 /** \param newType New type of material to be set. */
\r
462 void setMaterialType(video::E_MATERIAL_TYPE newType)
\r
464 for (u32 i=0; i<getMaterialCount(); ++i)
\r
465 getMaterial(i).MaterialType = newType;
\r
469 //! Gets the scale of the scene node relative to its parent.
\r
470 /** This is the scale of this node relative to its parent.
\r
471 If you want the absolute scale, use
\r
472 getAbsoluteTransformation().getScale()
\r
473 \return The scale of the scene node. */
\r
474 virtual const core::vector3df& getScale() const
\r
476 return RelativeScale;
\r
480 //! Sets the relative scale of the scene node.
\r
481 /** \param scale New scale of the node, relative to its parent. */
\r
482 virtual void setScale(const core::vector3df& scale)
\r
484 RelativeScale = scale;
\r
488 //! Gets the rotation of the node relative to its parent.
\r
489 /** Note that this is the relative rotation of the node.
\r
490 If you want the absolute rotation, use
\r
491 getAbsoluteTransformation().getRotation()
\r
492 \return Current relative rotation of the scene node. */
\r
493 virtual const core::vector3df& getRotation() const
\r
495 return RelativeRotation;
\r
499 //! Sets the rotation of the node relative to its parent.
\r
500 /** This only modifies the relative rotation of the node.
\r
501 \param rotation New rotation of the node in degrees. */
\r
502 virtual void setRotation(const core::vector3df& rotation)
\r
504 RelativeRotation = rotation;
\r
508 //! Gets the position of the node relative to its parent.
\r
509 /** Note that the position is relative to the parent. If you want
\r
510 the position in world coordinates, use getAbsolutePosition() instead.
\r
511 \return The current position of the node relative to the parent. */
\r
512 virtual const core::vector3df& getPosition() const
\r
514 return RelativeTranslation;
\r
518 //! Sets the position of the node relative to its parent.
\r
519 /** Note that the position is relative to the parent.
\r
520 \param newpos New relative position of the scene node. */
\r
521 virtual void setPosition(const core::vector3df& newpos)
\r
523 RelativeTranslation = newpos;
\r
527 //! Gets the absolute position of the node in world coordinates.
\r
528 /** If you want the position of the node relative to its parent,
\r
529 use getPosition() instead.
\r
530 NOTE: For speed reasons the absolute position is not
\r
531 automatically recalculated on each change of the relative
\r
532 position or by a position change of an parent. Instead the
\r
533 update usually happens once per frame in OnAnimate. You can enforce
\r
534 an update with updateAbsolutePosition().
\r
535 \return The current absolute position of the scene node (updated on last call of updateAbsolutePosition). */
\r
536 virtual core::vector3df getAbsolutePosition() const
\r
538 return AbsoluteTransformation.getTranslation();
\r
542 //! Set a culling style or disable culling completely.
\r
543 /** Box cullling (EAC_BOX) is set by default. Note that not
\r
544 all SceneNodes support culling and that some nodes always cull
\r
545 their geometry because it is their only reason for existence,
\r
546 for example the OctreeSceneNode.
\r
547 \param state The culling state to be used. Check E_CULLING_TYPE for possible values.*/
\r
548 void setAutomaticCulling( u32 state)
\r
550 AutomaticCullingState = state;
\r
554 //! Gets the automatic culling state.
\r
555 /** \return The automatic culling state. */
\r
556 u32 getAutomaticCulling() const
\r
558 return AutomaticCullingState;
\r
562 //! Sets if debug data like bounding boxes should be drawn.
\r
563 /** A bitwise OR of the types from @ref irr::scene::E_DEBUG_SCENE_TYPE.
\r
564 Please note that not all scene nodes support all debug data types.
\r
565 \param state The debug data visibility state to be used. */
\r
566 virtual void setDebugDataVisible(u32 state)
\r
568 DebugDataVisible = state;
\r
571 //! Returns if debug data like bounding boxes are drawn.
\r
572 /** \return A bitwise OR of the debug data values from
\r
573 @ref irr::scene::E_DEBUG_SCENE_TYPE that are currently visible. */
\r
574 u32 isDebugDataVisible() const
\r
576 return DebugDataVisible;
\r
580 //! Sets if this scene node is a debug object.
\r
581 /** Debug objects have some special properties, for example they can be easily
\r
582 excluded from collision detection or from serialization, etc. */
\r
583 void setIsDebugObject(bool debugObject)
\r
585 IsDebugObject = debugObject;
\r
589 //! Returns if this scene node is a debug object.
\r
590 /** Debug objects have some special properties, for example they can be easily
\r
591 excluded from collision detection or from serialization, etc.
\r
592 \return If this node is a debug object, true is returned. */
\r
593 bool isDebugObject() const
\r
595 return IsDebugObject;
\r
599 //! Returns a const reference to the list of all children.
\r
600 /** \return The list of all children of this node. */
\r
601 const core::list<ISceneNode*>& getChildren() const
\r
607 //! Changes the parent of the scene node.
\r
608 /** \param newParent The new parent to be used. */
\r
609 virtual void setParent(ISceneNode* newParent)
\r
614 Parent = newParent;
\r
617 Parent->addChild(this);
\r
623 //! Returns the triangle selector attached to this scene node.
\r
624 /** The Selector can be used by the engine for doing collision
\r
625 detection. You can create a TriangleSelector with
\r
626 ISceneManager::createTriangleSelector() or
\r
627 ISceneManager::createOctreeTriangleSelector and set it with
\r
628 ISceneNode::setTriangleSelector(). If a scene node got no triangle
\r
629 selector, but collision tests should be done with it, a triangle
\r
630 selector is created using the bounding box of the scene node.
\r
631 \return A pointer to the TriangleSelector or 0, if there
\r
633 virtual ITriangleSelector* getTriangleSelector() const
\r
635 return TriangleSelector;
\r
639 //! Sets the triangle selector of the scene node.
\r
640 /** The Selector can be used by the engine for doing collision
\r
641 detection. You can create a TriangleSelector with
\r
642 ISceneManager::createTriangleSelector() or
\r
643 ISceneManager::createOctreeTriangleSelector(). Some nodes may
\r
644 create their own selector by default, so it would be good to
\r
645 check if there is already a selector in this node by calling
\r
646 ISceneNode::getTriangleSelector().
\r
647 \param selector New triangle selector for this scene node. */
\r
648 virtual void setTriangleSelector(ITriangleSelector* selector)
\r
650 if (TriangleSelector != selector)
\r
652 if (TriangleSelector)
\r
653 TriangleSelector->drop();
\r
655 TriangleSelector = selector;
\r
656 if (TriangleSelector)
\r
657 TriangleSelector->grab();
\r
662 //! Updates the absolute position based on the relative and the parents position
\r
663 /** Note: This does not recursively update the parents absolute positions, so if you have a deeper
\r
664 hierarchy you might want to update the parents first.*/
\r
665 virtual void updateAbsolutePosition()
\r
669 AbsoluteTransformation =
\r
670 Parent->getAbsoluteTransformation() * getRelativeTransformation();
\r
673 AbsoluteTransformation = getRelativeTransformation();
\r
677 //! Returns the parent of this scene node
\r
678 /** \return A pointer to the parent. */
\r
679 scene::ISceneNode* getParent() const
\r
685 //! Returns type of the scene node
\r
686 /** \return The type of this node. */
\r
687 virtual ESCENE_NODE_TYPE getType() const
\r
689 return ESNT_UNKNOWN;
\r
693 //! Writes attributes of the scene node.
\r
694 /** Implement this to expose the attributes of your scene node
\r
695 for scripting languages, editors, debuggers or xml
\r
696 serialization purposes.
\r
697 \param out The attribute container to write into.
\r
698 \param options Additional options which might influence the
\r
700 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options=0) const _IRR_OVERRIDE_
\r
704 out->addString("Name", Name.c_str());
\r
705 out->addInt("Id", ID );
\r
707 out->addVector3d("Position", getPosition() );
\r
708 out->addVector3d("Rotation", getRotation() );
\r
709 out->addVector3d("Scale", getScale() );
\r
711 out->addBool("Visible", IsVisible );
\r
712 out->addInt("AutomaticCulling", AutomaticCullingState);
\r
713 out->addInt("DebugDataVisible", DebugDataVisible );
\r
714 out->addBool("IsDebugObject", IsDebugObject );
\r
718 //! Reads attributes of the scene node.
\r
719 /** Implement this to set the attributes of your scene node for
\r
720 scripting languages, editors, debuggers or xml deserialization
\r
722 \param in The attribute container to read from.
\r
723 \param options Additional options which might influence the
\r
724 deserialization. */
\r
725 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options=0) _IRR_OVERRIDE_
\r
729 Name = in->getAttributeAsString("Name", Name);
\r
730 ID = in->getAttributeAsInt("Id", ID);
\r
732 setPosition(in->getAttributeAsVector3d("Position", RelativeTranslation));
\r
733 setRotation(in->getAttributeAsVector3d("Rotation", RelativeRotation));
\r
734 setScale(in->getAttributeAsVector3d("Scale", RelativeScale));
\r
736 IsVisible = in->getAttributeAsBool("Visible", IsVisible);
\r
737 if (in->existsAttribute("AutomaticCulling"))
\r
739 s32 tmpState = in->getAttributeAsEnumeration("AutomaticCulling",
\r
740 scene::AutomaticCullingNames);
\r
741 if (tmpState != -1)
\r
742 AutomaticCullingState = (u32)tmpState;
\r
744 AutomaticCullingState = in->getAttributeAsInt("AutomaticCulling");
\r
747 DebugDataVisible = in->getAttributeAsInt("DebugDataVisible", DebugDataVisible);
\r
748 IsDebugObject = in->getAttributeAsBool("IsDebugObject", IsDebugObject);
\r
750 updateAbsolutePosition();
\r
753 //! Creates a clone of this scene node and its children.
\r
754 /** \param newParent An optional new parent.
\r
755 \param newManager An optional new scene manager.
\r
756 \return The newly created clone of this node. */
\r
757 virtual ISceneNode* clone(ISceneNode* newParent=0, ISceneManager* newManager=0)
\r
759 return 0; // to be implemented by derived classes
\r
762 //! Retrieve the scene manager for this node.
\r
763 /** \return The node's scene manager. */
\r
764 virtual ISceneManager* getSceneManager(void) const { return SceneManager; }
\r
768 //! A clone function for the ISceneNode members.
\r
769 /** This method can be used by clone() implementations of
\r
771 \param toCopyFrom The node from which the values are copied
\r
772 \param newManager The new scene manager. */
\r
773 void cloneMembers(ISceneNode* toCopyFrom, ISceneManager* newManager)
\r
775 Name = toCopyFrom->Name;
\r
776 AbsoluteTransformation = toCopyFrom->AbsoluteTransformation;
\r
777 RelativeTranslation = toCopyFrom->RelativeTranslation;
\r
778 RelativeRotation = toCopyFrom->RelativeRotation;
\r
779 RelativeScale = toCopyFrom->RelativeScale;
\r
780 ID = toCopyFrom->ID;
\r
781 setTriangleSelector(toCopyFrom->TriangleSelector);
\r
782 AutomaticCullingState = toCopyFrom->AutomaticCullingState;
\r
783 DebugDataVisible = toCopyFrom->DebugDataVisible;
\r
784 IsVisible = toCopyFrom->IsVisible;
\r
785 IsDebugObject = toCopyFrom->IsDebugObject;
\r
788 SceneManager = newManager;
\r
790 SceneManager = toCopyFrom->SceneManager;
\r
794 ISceneNodeList::Iterator it = toCopyFrom->Children.begin();
\r
795 for (; it != toCopyFrom->Children.end(); ++it)
\r
796 (*it)->clone(this, newManager);
\r
800 ISceneNodeAnimatorList::Iterator ait = toCopyFrom->Animators.begin();
\r
801 for (; ait != toCopyFrom->Animators.end(); ++ait)
\r
803 ISceneNodeAnimator* anim = (*ait)->createClone(this, SceneManager);
\r
812 //! Sets the new scene manager for this node and all children.
\r
813 //! Called by addChild when moving nodes between scene managers
\r
814 void setSceneManager(ISceneManager* newManager)
\r
816 SceneManager = newManager;
\r
818 ISceneNodeList::Iterator it = Children.begin();
\r
819 for (; it != Children.end(); ++it)
\r
820 (*it)->setSceneManager(newManager);
\r
823 //! Name of the scene node.
\r
824 core::stringc Name;
\r
826 //! Absolute transformation of the node.
\r
827 core::matrix4 AbsoluteTransformation;
\r
829 //! Relative translation of the scene node.
\r
830 core::vector3df RelativeTranslation;
\r
832 //! Relative rotation of the scene node.
\r
833 core::vector3df RelativeRotation;
\r
835 //! Relative scale of the scene node.
\r
836 core::vector3df RelativeScale;
\r
838 //! Pointer to the parent
\r
839 ISceneNode* Parent;
\r
841 //! List of all children of this node
\r
842 core::list<ISceneNode*> Children;
\r
844 //! List of all animator nodes
\r
845 core::list<ISceneNodeAnimator*> Animators;
\r
847 //! Pointer to the scene manager
\r
848 ISceneManager* SceneManager;
\r
850 //! Pointer to the triangle selector
\r
851 ITriangleSelector* TriangleSelector;
\r
853 //! ID of the node.
\r
856 //! Automatic culling state
\r
857 u32 AutomaticCullingState;
\r
859 //! Flag if debug data should be drawn, such as Bounding Boxes.
\r
860 u32 DebugDataVisible;
\r
862 //! Is the node visible?
\r
865 //! Is debug object?
\r
866 bool IsDebugObject;
\r
870 } // end namespace scene
\r
871 } // end namespace irr
\r