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 // Flags which require the scene renderable lists to be updated
62 static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
65 * Node is the base class for all nodes in the Scene Graph.
67 * Each node provides a transformation which applies to the node and
68 * its children. Node data is double-buffered. This allows an update
69 * thread to modify node data, without interferring with another
70 * thread reading the values from the previous update traversal.
72 class Node : public PropertyOwner, public NodeDataProvider
77 static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
78 static const ColorMode DEFAULT_COLOR_MODE;
83 * Construct a new Node.
90 static void Delete( Node* node );
93 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
98 * @return the unique ID of the node
100 uint32_t GetId() const;
105 * Query whether the node is a layer.
106 * @return True if the node is a layer.
114 * Convert a node to a layer.
115 * @return A pointer to the layer, or NULL.
117 virtual Layer* GetLayer()
123 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
124 * A value is calculated that can be used during sorting to increase sort speed.
125 * @param[in] clippingId The Clipping ID of the node to set
126 * @param[in] clippingDepth The Clipping Depth of the node to set
127 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
129 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
131 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
132 // If not, if we traverse down a clipping tree and back up, and there is another
133 // node on the parent, this will have a non-zero clipping ID that must be ignored
134 if( clippingDepth > 0u )
136 mClippingDepth = clippingDepth;
138 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
139 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
140 // For the same ID, the clipping nodes must be first, so we negate the
141 // clipping enabled flag and set it as the least significant bit.
142 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
146 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
147 mClippingSortModifier = 0u;
150 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
151 // For this reason we can always update the member variable.
152 mScissorDepth = scissorDepth;
156 * Gets the Clipping ID for this node.
157 * @return The Clipping ID for this node.
159 uint32_t GetClippingId() const
161 return mClippingSortModifier >> 1u;
165 * Gets the Clipping Depth for this node.
166 * @return The Clipping Depth for this node.
168 uint32_t GetClippingDepth() const
170 return mClippingDepth;
174 * Gets the Scissor Clipping Depth for this node.
175 * @return The Scissor Clipping Depth for this node.
177 uint32_t GetScissorDepth() const
179 return mScissorDepth;
183 * Sets the clipping mode for this node.
184 * @param[in] clippingMode The ClippingMode to set
186 void SetClippingMode( const ClippingMode::Type clippingMode )
188 mClippingMode = clippingMode;
192 * Gets the Clipping Mode for this node.
193 * @return The ClippingMode of this node
195 ClippingMode::Type GetClippingMode() const
197 return mClippingMode;
201 * Add a renderer to the node
202 * @param[in] renderer The renderer added to the node
204 void AddRenderer( Renderer* renderer );
207 * Remove a renderer from the node
208 * @param[in] renderer The renderer to be removed
210 void RemoveRenderer( Renderer* renderer );
213 * Get the renderer at the given index
216 Renderer* GetRendererAt( uint32_t index ) const
218 return mRenderer[index];
222 * Retrieve the number of renderers for the node
224 uint32_t GetRendererCount() const
226 return static_cast<uint32_t>( mRenderer.Size() );
229 // Containment methods
232 * Query whether a node is the root node. Root nodes cannot have a parent node.
233 * A node becomes a root node, when it is installed by UpdateManager.
234 * @return True if the node is a root node.
242 * Set whether a node is the root node. Root nodes cannot have a parent node.
243 * This method should only be called by UpdateManager.
244 * @pre When isRoot is true, the node must not have a parent.
245 * @param[in] isRoot Whether the node is now a root node.
247 void SetRoot(bool isRoot);
250 * Retrieve the parent of a Node.
251 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
259 * Retrieve the parent of a Node.
260 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
262 const Node* GetParent() const
268 * Connect a node to the scene-graph.
269 * @pre A node cannot be added to itself.
270 * @pre The parent node is connected to the scene-graph.
271 * @pre The childNode does not already have a parent.
272 * @pre The childNode is not a root node.
273 * @param[in] childNode The child to add.
275 void ConnectChild( Node* childNode );
278 * Disconnect a child (& its children) from the scene-graph.
279 * @pre childNode is a child of this Node.
280 * @param[in] updateBufferIndex The current update buffer index.
281 * @param[in] childNode The node to disconnect.
283 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
286 * Retrieve the children a Node.
287 * @return The container of children.
289 const NodeContainer& GetChildren() const
295 * Retrieve the children a Node.
296 * @return The container of children.
298 NodeContainer& GetChildren()
306 * Flag that one of the node values has changed in the current frame.
307 * @param[in] flag The flag to set.
309 void SetDirtyFlag( NodePropertyFlags flag )
315 * Flag that all of the node values are dirty.
317 void SetAllDirtyFlags()
319 mDirtyFlags = NodePropertyFlags::ALL;
323 * Query whether a node is dirty.
324 * @return The dirty flags
326 NodePropertyFlags GetDirtyFlags() const;
329 * Query inherited dirty flags.
331 * @param The parentFlags to or with
332 * @return The inherited dirty flags
334 NodePropertyFlags GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const;
337 * Retrieve the parent-origin of the node.
338 * @return The parent-origin.
340 const Vector3& GetParentOrigin() const
342 return mParentOrigin.Get(0);
346 * Sets both the local & base parent-origins of the node.
347 * @param[in] origin The new local & base parent-origins.
349 void SetParentOrigin(const Vector3& origin)
351 mParentOrigin.Set(0,origin );
355 * Retrieve the anchor-point of the node.
356 * @return The anchor-point.
358 const Vector3& GetAnchorPoint() const
360 return mAnchorPoint.Get(0);
364 * Sets both the local & base anchor-points of the node.
365 * @param[in] anchor The new local & base anchor-points.
367 void SetAnchorPoint(const Vector3& anchor)
369 mAnchorPoint.Set(0, anchor );
373 * Retrieve the local position of the node, relative to its parent.
374 * @param[in] bufferIndex The buffer to read from.
375 * @return The local position.
377 const Vector3& GetPosition(BufferIndex bufferIndex) const
379 if( mTransformId != INVALID_TRANSFORM_ID )
381 return mPosition.Get(bufferIndex);
384 return Vector3::ZERO;
388 * Retrieve the position of the node derived from the position of all its parents.
389 * @return The world position.
391 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
393 return mWorldPosition.Get(bufferIndex);
397 * Set whether the Node inherits position.
398 * @param[in] inherit True if the parent position is inherited.
400 void SetInheritPosition(bool inherit)
402 if( mTransformId != INVALID_TRANSFORM_ID )
404 mTransformManager->SetInheritPosition( mTransformId, inherit );
409 * Retrieve the local orientation of the node, relative to its parent.
410 * @param[in] bufferIndex The buffer to read from.
411 * @return The local orientation.
413 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
415 if( mTransformId != INVALID_TRANSFORM_ID )
417 return mOrientation.Get(0);
420 return Quaternion::IDENTITY;
424 * Retrieve the orientation of the node derived from the rotation of all its parents.
425 * @param[in] bufferIndex The buffer to read from.
426 * @return The world rotation.
428 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
430 return mWorldOrientation.Get(0);
434 * Set whether the Node inherits orientation.
435 * @param[in] inherit True if the parent orientation is inherited.
437 void SetInheritOrientation(bool inherit)
439 if( mTransformId != INVALID_TRANSFORM_ID )
441 mTransformManager->SetInheritOrientation(mTransformId, inherit );
446 * Retrieve the local scale of the node, relative to its parent.
447 * @param[in] bufferIndex The buffer to read from.
448 * @return The local scale.
450 const Vector3& GetScale(BufferIndex bufferIndex) const
452 if( mTransformId != INVALID_TRANSFORM_ID )
454 return mScale.Get(0);
462 * Retrieve the scale of the node derived from the scale of all its parents.
463 * @param[in] bufferIndex The buffer to read from.
464 * @return The world scale.
466 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
468 return mWorldScale.Get(0);
472 * Set whether the Node inherits scale.
473 * @param inherit True if the Node inherits scale.
475 void SetInheritScale( bool inherit )
477 if( mTransformId != INVALID_TRANSFORM_ID )
479 mTransformManager->SetInheritScale(mTransformId, inherit );
484 * Retrieve the visibility of the node.
485 * @param[in] bufferIndex The buffer to read from.
486 * @return True if the node is visible.
488 bool IsVisible(BufferIndex bufferIndex) const
490 return mVisible[bufferIndex];
494 * Retrieve the opacity of the node.
495 * @param[in] bufferIndex The buffer to read from.
496 * @return The opacity.
498 float GetOpacity(BufferIndex bufferIndex) const
500 return mColor[bufferIndex].a;
504 * Retrieve the color of the node.
505 * @param[in] bufferIndex The buffer to read from.
508 const Vector4& GetColor(BufferIndex bufferIndex) const
510 return mColor[bufferIndex];
514 * Sets the color of the node derived from the color of all its parents.
515 * @param[in] color The world color.
516 * @param[in] updateBufferIndex The current update buffer index.
518 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
520 mWorldColor.Set( updateBufferIndex, color );
524 * Sets the color of the node derived from the color of all its parents.
525 * This method should only be called when the parents world color is up-to-date.
526 * @pre The node has a parent.
527 * @param[in] updateBufferIndex The current update buffer index.
529 void InheritWorldColor( BufferIndex updateBufferIndex )
531 DALI_ASSERT_DEBUG(mParent != NULL);
534 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
536 const Vector4& ownColor = mColor[updateBufferIndex];
537 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
539 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
541 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
543 else if( mColorMode == USE_PARENT_COLOR )
545 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
547 else // USE_OWN_COLOR
549 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
554 * Copies the previous inherited scale, if this changed in the previous frame.
555 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
556 * does not need to be recalculated in the current frame.
557 * @param[in] updateBufferIndex The current update buffer index.
559 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
561 mWorldColor.CopyPrevious( updateBufferIndex );
565 * Retrieve the color of the node, possibly derived from the color
566 * of all its parents, depending on the value of mColorMode.
567 * @param[in] bufferIndex The buffer to read from.
568 * @return The world color.
570 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
572 return mWorldColor[bufferIndex];
576 * Set the color mode. This specifies whether the Node uses its own color,
577 * or inherits its parent color.
578 * @param[in] colorMode The new color mode.
580 void SetColorMode( ColorMode colorMode )
582 mColorMode = colorMode;
584 SetDirtyFlag( NodePropertyFlags::COLOR );
588 * Retrieve the color mode.
589 * @return The color mode.
591 ColorMode GetColorMode() const
597 * Retrieve the size of the node.
598 * @param[in] bufferIndex The buffer to read from.
601 const Vector3& GetSize(BufferIndex bufferIndex) const
603 if( mTransformId != INVALID_TRANSFORM_ID )
608 return Vector3::ZERO;
612 * Retrieve the bounding sphere of the node
613 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
615 const Vector4& GetBoundingSphere() const
617 if( mTransformId != INVALID_TRANSFORM_ID )
619 return mTransformManager->GetBoundingSphere( mTransformId );
622 return Vector4::ZERO;
626 * Retrieve world matrix and size of the node
627 * @param[out] The local to world matrix of the node
628 * @param[out] size The current size of the node
630 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
632 if( mTransformId != INVALID_TRANSFORM_ID )
634 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
639 * Checks if local matrix has changed since last update
640 * @return true if local matrix has changed, false otherwise
642 bool IsLocalMatrixDirty() const
644 return (mTransformId != INVALID_TRANSFORM_ID) &&
645 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
649 * Retrieve the cached world-matrix of a node.
650 * @param[in] bufferIndex The buffer to read from.
651 * @return The world-matrix.
653 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
655 return mWorldMatrix.Get(bufferIndex);
659 * Mark the node as exclusive to a single RenderTask.
660 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
662 void SetExclusiveRenderTask( RenderTask* renderTask )
664 mExclusiveRenderTask = renderTask;
668 * Query whether the node is exclusive to a single RenderTask.
669 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
671 RenderTask* GetExclusiveRenderTask() const
673 return mExclusiveRenderTask;
677 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
678 * @param[in] drawMode The new draw-mode to use.
680 void SetDrawMode( const DrawMode::Type& drawMode )
682 mDrawMode = drawMode;
686 * Returns whether node is an overlay or not.
687 * @return True if node is an overlay, false otherwise.
689 DrawMode::Type GetDrawMode() const
695 * Returns the transform id of the node
696 * @return The transform component id of the node
698 TransformId GetTransformId() const
704 * Equality operator, checks for identity, not values.
707 bool operator==( const Node* rhs ) const
709 return ( this == rhs );
713 * @brief Sets the sibling order of the node
714 * @param[in] order The new order
716 void SetDepthIndex( uint32_t depthIndex )
718 mDepthIndex = depthIndex;
722 * @brief Get the depth index of the node
723 * @return Current depth index
725 uint32_t GetDepthIndex() const
731 * @brief Sets the boolean which states whether the position should use the anchor-point.
732 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
734 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
736 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
738 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
739 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
744 * @brief Sets whether the node is culled or not.
745 * @param[in] bufferIndex The buffer to read from.
746 * @param[in] culled True if the node is culled.
748 void SetCulled( BufferIndex bufferIndex, bool culled )
750 mCulled[bufferIndex] = culled;
754 * @brief Retrieves whether the node is culled or not.
755 * @param[in] bufferIndex The buffer to read from.
756 * @return True if the node is culled.
758 bool IsCulled( BufferIndex bufferIndex ) const
760 return mCulled[bufferIndex];
765 * @copydoc UniformMap::Add
767 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
770 * @copydoc UniformMap::Remove
772 void RemoveUniformMapping( const std::string& uniformName );
775 * Prepare the node for rendering.
776 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
777 * @param[in] updateBufferIndex The current update buffer index.
779 void PrepareRender( BufferIndex bufferIndex );
782 * Called by UpdateManager when the node is added.
783 * Creates a new transform component in the transform manager and initialize all the properties
784 * related to the transformation
785 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
787 void CreateTransform( SceneGraph::TransformManager* transformManager );
792 void ResetDirtyFlags( BufferIndex updateBufferIndex );
797 * Set the parent of a Node.
798 * @param[in] parentNode the new parent.
800 void SetParent( Node& parentNode );
805 * Protected constructor; See also Node::New()
810 * Protected virtual destructor; See also Node::Delete( Node* )
811 * Kept protected to allow destructor chaining from layer
815 private: // from NodeDataProvider
818 * @copydoc NodeDataProvider::GetModelMatrix
820 virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const
822 return GetWorldMatrix( bufferIndex );
826 * @copydoc NodeDataProvider::GetRenderColor
828 virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const
830 return GetWorldColor( bufferIndex );
833 public: // From UniformMapDataProvider
835 * @copydoc UniformMapDataProvider::GetUniformMapChanged
837 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
839 return mUniformMapChanged[bufferIndex];
843 * @copydoc UniformMapDataProvider::GetUniformMap
845 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
847 return mCollectedUniformMap[bufferIndex];
856 Node& operator=(const Node& rhs);
859 * Recursive helper to disconnect a Node and its children.
860 * Disconnected Nodes have no parent or children.
861 * @param[in] updateBufferIndex The current update buffer index.
863 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
865 public: // Default properties
867 TransformManager* mTransformManager;
868 TransformId mTransformId;
869 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
870 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
871 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
872 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
873 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
874 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
876 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
877 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
878 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
880 // Inherited properties; read-only from public API
882 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
883 TransformManagerVector3Input mWorldScale;
884 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
885 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
886 InheritedColor mWorldColor; ///< Full inherited color
888 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
889 const uint32_t mId; ///< The Unique ID of the node.
893 static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
895 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
896 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
898 RendererContainer mRenderer; ///< Container of renderers; not owned
900 NodeContainer mChildren; ///< Container of children; not owned
902 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
903 uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
904 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
905 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
907 uint32_t mDepthIndex; ///< Depth index of the node
909 // flags, compressed to bitfield
910 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
911 uint32_t mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
912 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
913 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
914 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
915 bool mIsRoot:1; ///< True if the node cannot have a parent
916 bool mIsLayer:1; ///< True if the node is a layer
917 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
919 // Changes scope, should be at end of class
920 DALI_LOG_OBJECT_STRING_DECLARATION;
925 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
927 typedef MessageValue1< Node, bool > LocalType;
929 // Reserve some memory inside the message queue
930 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
932 // Construct message in the message queue memory; note that delete should not be called on the return value
933 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
936 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
938 typedef MessageValue1< Node, Vector3 > LocalType;
940 // Reserve some memory inside the message queue
941 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
943 // Construct message in the message queue memory; note that delete should not be called on the return value
944 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
947 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
949 typedef MessageValue1< Node, Vector3 > LocalType;
951 // Reserve some memory inside the message queue
952 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
954 // Construct message in the message queue memory; note that delete should not be called on the return value
955 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
958 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
960 typedef MessageValue1< Node, bool > LocalType;
962 // Reserve some memory inside the message queue
963 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
965 // Construct message in the message queue memory; note that delete should not be called on the return value
966 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
969 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
971 typedef MessageValue1< Node, bool > LocalType;
973 // Reserve some memory inside the message queue
974 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
976 // Construct message in the message queue memory; note that delete should not be called on the return value
977 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
980 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
982 typedef MessageValue1< Node, ColorMode > LocalType;
984 // Reserve some memory inside the message queue
985 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
987 // Construct message in the message queue memory; note that delete should not be called on the return value
988 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
991 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
993 typedef MessageValue1< Node, DrawMode::Type > LocalType;
995 // Reserve some memory inside the message queue
996 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
998 // Construct message in the message queue memory; note that delete should not be called on the return value
999 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
1002 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1004 typedef MessageValue1< Node, Renderer* > LocalType;
1006 // Reserve some memory inside the message queue
1007 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1009 // Construct message in the message queue memory; note that delete should not be called on the return value
1010 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
1013 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1015 typedef MessageValue1< Node, Renderer* > LocalType;
1017 // Reserve some memory inside the message queue
1018 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1020 // Construct message in the message queue memory; note that delete should not be called on the return value
1021 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
1024 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
1026 typedef MessageValue1< Node, uint32_t > LocalType;
1028 // Reserve some memory inside the message queue
1029 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1031 // Construct message in the message queue memory; note that delete should not be called on the return value
1032 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1035 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1037 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1039 // Reserve some memory inside the message queue
1040 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1042 // Construct message in the message queue memory; note that delete should not be called on the return value
1043 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1046 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1048 typedef MessageValue1< Node, bool > LocalType;
1050 // Reserve some memory inside the message queue
1051 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1053 // Construct message in the message queue memory; note that delete should not be called on the return value
1054 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1057 } // namespace SceneGraph
1059 // Template specialisation for OwnerPointer<Node>, because delete is protected
1061 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1063 if (mObject != NULL)
1065 Dali::Internal::SceneGraph::Node::Delete(mObject);
1069 } // namespace Internal
1071 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1073 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1075 Dali::Internal::SceneGraph::Node::Delete(pointer);
1079 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H