1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/actors/actor-enumerations.h>
23 #include <dali/public-api/actors/draw-mode.h>
24 #include <dali/public-api/math/quaternion.h>
25 #include <dali/public-api/math/math-utils.h>
26 #include <dali/public-api/math/vector3.h>
27 #include <dali/integration-api/debug.h>
28 #include <dali/internal/common/message.h>
29 #include <dali/internal/event/common/event-thread-services.h>
30 #include <dali/internal/render/data-providers/node-data-provider.h>
31 #include <dali/internal/update/common/animatable-property.h>
32 #include <dali/internal/update/common/property-owner.h>
33 #include <dali/internal/update/common/property-vector3.h>
34 #include <dali/internal/update/common/scene-graph-buffers.h>
35 #include <dali/internal/update/common/inherited-property.h>
36 #include <dali/internal/update/manager/transform-manager.h>
37 #include <dali/internal/update/manager/transform-manager-property.h>
38 #include <dali/internal/update/nodes/node-declarations.h>
39 #include <dali/internal/update/rendering/scene-graph-renderer.h>
47 // Value types used by messages.
48 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
49 template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
50 template <> struct ParameterType< ClippingMode::Type > : public BasicType< ClippingMode::Type > {};
61 * Flag whether property has changed, during the Update phase.
63 enum NodePropertyFlags
66 TransformFlag = 0x001,
71 SortModifierFlag = 0x020,
72 ChildDeletedFlag = 0x040,
75 static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
78 * Size is not inherited. VisibleFlag is inherited
80 static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
82 // Flags which require the scene renderable lists to be updated
83 static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
86 * Node is the base class for all nodes in the Scene Graph.
88 * Each node provides a transformation which applies to the node and
89 * its children. Node data is double-buffered. This allows an update
90 * thread to modify node data, without interferring with another
91 * thread reading the values from the previous update traversal.
93 class Node : public PropertyOwner, public NodeDataProvider
98 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
99 static const ColorMode DEFAULT_COLOR_MODE;
104 * Construct a new Node.
105 * @param[in] id The unique ID of the node
107 static Node* New( unsigned int id );
112 static void Delete( Node* node );
115 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
122 * Query whether the node is a layer.
123 * @return True if the node is a layer.
131 * Convert a node to a layer.
132 * @return A pointer to the layer, or NULL.
134 virtual Layer* GetLayer()
140 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
141 * A value is calculated that can be used during sorting to increase sort speed.
142 * @param[in] clippingId The Clipping ID of the node to set
143 * @param[in] clippingDepth The Clipping Depth of the node to set
144 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
146 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
148 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
149 // If not, if we traverse down a clipping tree and back up, and there is another
150 // node on the parent, this will have a non-zero clipping ID that must be ignored
151 if( clippingDepth > 0u )
153 mClippingDepth = clippingDepth;
155 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
156 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
157 // For the same ID, the clipping nodes must be first, so we negate the
158 // clipping enabled flag and set it as the least significant bit.
159 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
163 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
164 mClippingSortModifier = 0u;
167 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
168 // For this reason we can always update the member variable.
169 mScissorDepth = scissorDepth;
173 * Gets the Clipping ID for this node.
174 * @return The Clipping ID for this node.
176 uint32_t GetClippingId() const
178 return mClippingSortModifier >> 1u;
182 * Gets the Clipping Depth for this node.
183 * @return The Clipping Depth for this node.
185 uint32_t GetClippingDepth() const
187 return mClippingDepth;
191 * Gets the Scissor Clipping Depth for this node.
192 * @return The Scissor Clipping Depth for this node.
194 uint32_t GetScissorDepth() const
196 return mScissorDepth;
200 * Sets the clipping mode for this node.
201 * @param[in] clippingMode The ClippingMode to set
203 void SetClippingMode( const ClippingMode::Type clippingMode )
205 mClippingMode = clippingMode;
209 * Gets the Clipping Mode for this node.
210 * @return The ClippingMode of this node
212 ClippingMode::Type GetClippingMode() const
214 return mClippingMode;
218 * Add a renderer to the node
219 * @param[in] renderer The renderer added to the node
221 void AddRenderer( Renderer* renderer );
224 * Remove a renderer from the node
225 * @param[in] renderer The renderer to be removed
227 void RemoveRenderer( Renderer* renderer );
230 * Get the renderer at the given index
233 Renderer* GetRendererAt( unsigned int index ) const
235 return mRenderer[index];
239 * Retrieve the number of renderers for the node
241 unsigned int GetRendererCount()
243 return mRenderer.Size();
246 // Containment methods
249 * Query whether a node is the root node. Root nodes cannot have a parent node.
250 * A node becomes a root node, when it is installed by UpdateManager.
251 * @return True if the node is a root node.
259 * Set whether a node is the root node. Root nodes cannot have a parent node.
260 * This method should only be called by UpdateManager.
261 * @pre When isRoot is true, the node must not have a parent.
262 * @param[in] isRoot Whether the node is now a root node.
264 void SetRoot(bool isRoot);
267 * Retrieve the parent of a Node.
268 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
276 * Retrieve the parent of a Node.
277 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
279 const Node* GetParent() const
285 * Connect a node to the scene-graph.
286 * @pre A node cannot be added to itself.
287 * @pre The parent node is connected to the scene-graph.
288 * @pre The childNode does not already have a parent.
289 * @pre The childNode is not a root node.
290 * @param[in] childNode The child to add.
292 void ConnectChild( Node* childNode );
295 * Disconnect a child (& its children) from the scene-graph.
296 * @pre childNode is a child of this Node.
297 * @param[in] updateBufferIndex The current update buffer index.
298 * @param[in] childNode The node to disconnect.
300 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
303 * Retrieve the children a Node.
304 * @return The container of children.
306 const NodeContainer& GetChildren() const
312 * Retrieve the children a Node.
313 * @return The container of children.
315 NodeContainer& GetChildren()
323 * Flag that one of the node values has changed in the current frame.
324 * @param[in] flag The flag to set.
326 void SetDirtyFlag(NodePropertyFlags flag)
332 * Flag that all of the node values are dirty.
334 void SetAllDirtyFlags()
336 mDirtyFlags = AllFlags;
340 * Query whether a node is dirty.
341 * @return The dirty flags
343 int GetDirtyFlags() const;
346 * Retrieve the parent-origin of the node.
347 * @return The parent-origin.
349 const Vector3& GetParentOrigin() const
351 return mParentOrigin.Get(0);
355 * Sets both the local & base parent-origins of the node.
356 * @param[in] origin The new local & base parent-origins.
358 void SetParentOrigin(const Vector3& origin)
360 mParentOrigin.Set(0,origin );
364 * Retrieve the anchor-point of the node.
365 * @return The anchor-point.
367 const Vector3& GetAnchorPoint() const
369 return mAnchorPoint.Get(0);
373 * Sets both the local & base anchor-points of the node.
374 * @param[in] anchor The new local & base anchor-points.
376 void SetAnchorPoint(const Vector3& anchor)
378 mAnchorPoint.Set(0, anchor );
382 * Retrieve the local position of the node, relative to its parent.
383 * @param[in] bufferIndex The buffer to read from.
384 * @return The local position.
386 const Vector3& GetPosition(BufferIndex bufferIndex) const
388 if( mTransformId != INVALID_TRANSFORM_ID )
390 return mPosition.Get(bufferIndex);
393 return Vector3::ZERO;
397 * Retrieve the position of the node derived from the position of all its parents.
398 * @return The world position.
400 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
402 return mWorldPosition.Get(bufferIndex);
406 * Set whether the Node inherits position.
407 * @param[in] inherit True if the parent position is inherited.
409 void SetInheritPosition(bool inherit)
411 if( mTransformId != INVALID_TRANSFORM_ID )
413 mTransformManager->SetInheritPosition( mTransformId, inherit );
418 * Retrieve the local orientation of the node, relative to its parent.
419 * @param[in] bufferIndex The buffer to read from.
420 * @return The local orientation.
422 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
424 if( mTransformId != INVALID_TRANSFORM_ID )
426 return mOrientation.Get(0);
429 return Quaternion::IDENTITY;
433 * Retrieve the orientation of the node derived from the rotation of all its parents.
434 * @param[in] bufferIndex The buffer to read from.
435 * @return The world rotation.
437 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
439 return mWorldOrientation.Get(0);
443 * Set whether the Node inherits orientation.
444 * @param[in] inherit True if the parent orientation is inherited.
446 void SetInheritOrientation(bool inherit)
448 if( mTransformId != INVALID_TRANSFORM_ID )
450 mTransformManager->SetInheritOrientation(mTransformId, inherit );
455 * Retrieve the local scale of the node, relative to its parent.
456 * @param[in] bufferIndex The buffer to read from.
457 * @return The local scale.
459 const Vector3& GetScale(BufferIndex bufferIndex) const
461 if( mTransformId != INVALID_TRANSFORM_ID )
463 return mScale.Get(0);
471 * Retrieve the scale of the node derived from the scale of all its parents.
472 * @param[in] bufferIndex The buffer to read from.
473 * @return The world scale.
475 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
477 return mWorldScale.Get(0);
481 * Set whether the Node inherits scale.
482 * @param inherit True if the Node inherits scale.
484 void SetInheritScale( bool inherit )
486 if( mTransformId != INVALID_TRANSFORM_ID )
488 mTransformManager->SetInheritScale(mTransformId, inherit );
493 * Retrieve the visibility of the node.
494 * @param[in] bufferIndex The buffer to read from.
495 * @return True if the node is visible.
497 bool IsVisible(BufferIndex bufferIndex) const
499 return mVisible[bufferIndex];
503 * Retrieve the opacity of the node.
504 * @param[in] bufferIndex The buffer to read from.
505 * @return The opacity.
507 float GetOpacity(BufferIndex bufferIndex) const
509 return mColor[bufferIndex].a;
513 * Retrieve the color of the node.
514 * @param[in] bufferIndex The buffer to read from.
517 const Vector4& GetColor(BufferIndex bufferIndex) const
519 return mColor[bufferIndex];
523 * Sets the color of the node derived from the color of all its parents.
524 * @param[in] color The world color.
525 * @param[in] updateBufferIndex The current update buffer index.
527 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
529 mWorldColor.Set( updateBufferIndex, color );
533 * Sets the color of the node derived from the color of all its parents.
534 * This method should only be called when the parents world color is up-to-date.
535 * @pre The node has a parent.
536 * @param[in] updateBufferIndex The current update buffer index.
538 void InheritWorldColor( BufferIndex updateBufferIndex )
540 DALI_ASSERT_DEBUG(mParent != NULL);
543 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
545 const Vector4& ownColor = mColor[updateBufferIndex];
546 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
548 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
550 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
552 else if( mColorMode == USE_PARENT_COLOR )
554 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
556 else // USE_OWN_COLOR
558 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
563 * Copies the previous inherited scale, if this changed in the previous frame.
564 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
565 * does not need to be recalculated in the current frame.
566 * @param[in] updateBufferIndex The current update buffer index.
568 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
570 mWorldColor.CopyPrevious( updateBufferIndex );
574 * Retrieve the color of the node, possibly derived from the color
575 * of all its parents, depending on the value of mColorMode.
576 * @param[in] bufferIndex The buffer to read from.
577 * @return The world color.
579 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
581 return mWorldColor[bufferIndex];
585 * Set the color mode. This specifies whether the Node uses its own color,
586 * or inherits its parent color.
587 * @param[in] colorMode The new color mode.
589 void SetColorMode(ColorMode colorMode)
591 mColorMode = colorMode;
593 SetDirtyFlag(ColorFlag);
597 * Retrieve the color mode.
598 * @return The color mode.
600 ColorMode GetColorMode() const
606 * Retrieve the size of the node.
607 * @param[in] bufferIndex The buffer to read from.
610 const Vector3& GetSize(BufferIndex bufferIndex) const
612 if( mTransformId != INVALID_TRANSFORM_ID )
617 return Vector3::ZERO;
621 * Retrieve the bounding sphere of the node
622 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
624 const Vector4& GetBoundingSphere() const
626 if( mTransformId != INVALID_TRANSFORM_ID )
628 return mTransformManager->GetBoundingSphere( mTransformId );
631 return Vector4::ZERO;
635 * Retrieve world matrix and size of the node
636 * @param[out] The local to world matrix of the node
637 * @param[out] size The current size of the node
639 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
641 if( mTransformId != INVALID_TRANSFORM_ID )
643 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
648 * Checks if local matrix has changed since last update
649 * @return true if local matrix has changed, false otherwise
651 bool IsLocalMatrixDirty() const
653 return (mTransformId != INVALID_TRANSFORM_ID) &&
654 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
658 * Retrieve the cached world-matrix of a node.
659 * @param[in] bufferIndex The buffer to read from.
660 * @return The world-matrix.
662 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
664 return mWorldMatrix.Get(bufferIndex);
668 * Mark the node as exclusive to a single RenderTask.
669 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
671 void SetExclusiveRenderTask( RenderTask* renderTask )
673 mExclusiveRenderTask = renderTask;
677 * Query whether the node is exclusive to a single RenderTask.
678 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
680 RenderTask* GetExclusiveRenderTask() const
682 return mExclusiveRenderTask;
686 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
687 * @param[in] drawMode The new draw-mode to use.
689 void SetDrawMode( const DrawMode::Type& drawMode )
691 mDrawMode = drawMode;
695 * Returns whether node is an overlay or not.
696 * @return True if node is an overlay, false otherwise.
698 DrawMode::Type GetDrawMode() const
704 * Returns the transform id of the node
705 * @return The transform component id of the node
707 TransformId GetTransformId() const
713 * Equality operator, checks for identity, not values.
716 bool operator==( const Node* rhs ) const
718 return ( this == rhs );
722 * @brief Sets the sibling order of the node
723 * @param[in] order The new order
725 void SetDepthIndex( unsigned int depthIndex ){ mDepthIndex = depthIndex; }
728 * @brief Get the depth index of the node
729 * @return Current depth index
731 unsigned int GetDepthIndex(){ return mDepthIndex; }
734 * @brief Sets the boolean which states whether the position should use the anchor-point.
735 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
737 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
739 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
741 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
742 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
747 * @brief Sets whether the node is culled or not.
748 * @param[in] bufferIndex The buffer to read from.
749 * @param[in] culled True if the node is culled.
751 void SetCulled( BufferIndex bufferIndex, bool culled )
753 mCulled[bufferIndex] = culled;
757 * @brief Retrieves whether the node is culled or not.
758 * @param[in] bufferIndex The buffer to read from.
759 * @return True if the node is culled.
761 bool IsCulled( BufferIndex bufferIndex ) const
763 return mCulled[bufferIndex];
768 * @copydoc UniformMap::Add
770 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
773 * @copydoc UniformMap::Remove
775 void RemoveUniformMapping( const std::string& uniformName );
778 * Prepare the node for rendering.
779 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
780 * @param[in] updateBufferIndex The current update buffer index.
782 void PrepareRender( BufferIndex bufferIndex );
785 * Called by UpdateManager when the node is added.
786 * Creates a new transform component in the transform manager and initialize all the properties
787 * related to the transformation
788 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
790 void CreateTransform( SceneGraph::TransformManager* transformManager );
795 void ResetDirtyFlags( BufferIndex updateBufferIndex );
800 * Set the parent of a Node.
801 * @param[in] parentNode the new parent.
803 void SetParent( Node& parentNode );
808 * Protected constructor; See also Node::New()
809 * @param[in] id The Unique ID of the actor creating the node
811 Node( unsigned int id );
814 * Protected virtual destructor; See also Node::Delete( Node* )
815 * Kept protected to allow destructor chaining from layer
819 private: // from NodeDataProvider
822 * @copydoc NodeDataProvider::GetModelMatrix
824 virtual const Matrix& GetModelMatrix( unsigned int bufferId ) const
826 return GetWorldMatrix( bufferId );
830 * @copydoc NodeDataProvider::GetRenderColor
832 virtual const Vector4& GetRenderColor( unsigned int bufferId ) const
834 return GetWorldColor( bufferId );
837 public: // From UniformMapDataProvider
839 * @copydoc UniformMapDataProvider::GetUniformMapChanged
841 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
843 return mUniformMapChanged[bufferIndex];
847 * @copydoc UniformMapDataProvider::GetUniformMap
849 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
851 return mCollectedUniformMap[bufferIndex];
860 Node& operator=(const Node& rhs);
863 * Recursive helper to disconnect a Node and its children.
864 * Disconnected Nodes have no parent or children.
865 * @param[in] updateBufferIndex The current update buffer index.
867 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
869 public: // Default properties
871 TransformManager* mTransformManager;
872 TransformId mTransformId;
873 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
874 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
875 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
876 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
877 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
878 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
880 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
881 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
882 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
884 // Inherited properties; read-only from public API
886 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
887 TransformManagerVector3Input mWorldScale;
888 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
889 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
890 InheritedColor mWorldColor; ///< Full inherited color
892 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
893 const unsigned int mId; ///< The Unique ID of the node.
897 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
898 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
900 RendererContainer mRenderer; ///< Container of renderers; not owned
902 NodeContainer mChildren; ///< Container of children; not owned
904 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
905 unsigned int mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
906 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
907 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
909 uint32_t mDepthIndex; ///< Depth index of the node
911 // flags, compressed to bitfield
912 unsigned int mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
913 int mDirtyFlags:8; ///< A composite set of flags for each of the Node properties
914 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
915 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
916 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
917 bool mIsRoot:1; ///< True if the node cannot have a parent
918 bool mIsLayer:1; ///< True if the node is a layer
919 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
920 // Changes scope, should be at end of class
921 DALI_LOG_OBJECT_STRING_DECLARATION;
926 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
928 typedef MessageValue1< Node, bool > LocalType;
930 // Reserve some memory inside the message queue
931 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
933 // Construct message in the message queue memory; note that delete should not be called on the return value
934 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
937 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
939 typedef MessageValue1< Node, Vector3 > LocalType;
941 // Reserve some memory inside the message queue
942 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
944 // Construct message in the message queue memory; note that delete should not be called on the return value
945 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
948 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
950 typedef MessageValue1< Node, Vector3 > LocalType;
952 // Reserve some memory inside the message queue
953 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
955 // Construct message in the message queue memory; note that delete should not be called on the return value
956 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
959 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
961 typedef MessageValue1< Node, bool > LocalType;
963 // Reserve some memory inside the message queue
964 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
966 // Construct message in the message queue memory; note that delete should not be called on the return value
967 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
970 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
972 typedef MessageValue1< Node, bool > LocalType;
974 // Reserve some memory inside the message queue
975 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
977 // Construct message in the message queue memory; note that delete should not be called on the return value
978 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
981 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
983 typedef MessageValue1< Node, ColorMode > LocalType;
985 // Reserve some memory inside the message queue
986 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
988 // Construct message in the message queue memory; note that delete should not be called on the return value
989 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
992 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
994 typedef MessageValue1< Node, DrawMode::Type > LocalType;
996 // Reserve some memory inside the message queue
997 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
999 // Construct message in the message queue memory; note that delete should not be called on the return value
1000 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
1003 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1005 typedef MessageValue1< Node, Renderer* > LocalType;
1007 // Reserve some memory inside the message queue
1008 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1010 // Construct message in the message queue memory; note that delete should not be called on the return value
1011 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
1014 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1016 typedef MessageValue1< Node, Renderer* > LocalType;
1018 // Reserve some memory inside the message queue
1019 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1021 // Construct message in the message queue memory; note that delete should not be called on the return value
1022 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
1025 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, unsigned int depthIndex )
1027 typedef MessageValue1< Node, unsigned int > LocalType;
1029 // Reserve some memory inside the message queue
1030 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1032 // Construct message in the message queue memory; note that delete should not be called on the return value
1033 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1036 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1038 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1040 // Reserve some memory inside the message queue
1041 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1043 // Construct message in the message queue memory; note that delete should not be called on the return value
1044 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1047 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1049 typedef MessageValue1< Node, bool > LocalType;
1051 // Reserve some memory inside the message queue
1052 unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1054 // Construct message in the message queue memory; note that delete should not be called on the return value
1055 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1058 } // namespace SceneGraph
1060 // Template specialisation for OwnerPointer<Node>, because delete is protected
1062 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1064 if (mObject != NULL)
1066 Dali::Internal::SceneGraph::Node::Delete(mObject);
1070 } // namespace Internal
1072 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1074 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1076 Dali::Internal::SceneGraph::Node::Delete(pointer);
1080 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H