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.
84 * @param[in] id The unique ID of the node
86 static Node* New( uint32_t id );
91 static void Delete( Node* node );
94 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
101 * Query whether the node is a layer.
102 * @return True if the node is a layer.
110 * Convert a node to a layer.
111 * @return A pointer to the layer, or NULL.
113 virtual Layer* GetLayer()
119 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
120 * A value is calculated that can be used during sorting to increase sort speed.
121 * @param[in] clippingId The Clipping ID of the node to set
122 * @param[in] clippingDepth The Clipping Depth of the node to set
123 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
125 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
127 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
128 // If not, if we traverse down a clipping tree and back up, and there is another
129 // node on the parent, this will have a non-zero clipping ID that must be ignored
130 if( clippingDepth > 0u )
132 mClippingDepth = clippingDepth;
134 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
135 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
136 // For the same ID, the clipping nodes must be first, so we negate the
137 // clipping enabled flag and set it as the least significant bit.
138 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
142 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
143 mClippingSortModifier = 0u;
146 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
147 // For this reason we can always update the member variable.
148 mScissorDepth = scissorDepth;
152 * Gets the Clipping ID for this node.
153 * @return The Clipping ID for this node.
155 uint32_t GetClippingId() const
157 return mClippingSortModifier >> 1u;
161 * Gets the Clipping Depth for this node.
162 * @return The Clipping Depth for this node.
164 uint32_t GetClippingDepth() const
166 return mClippingDepth;
170 * Gets the Scissor Clipping Depth for this node.
171 * @return The Scissor Clipping Depth for this node.
173 uint32_t GetScissorDepth() const
175 return mScissorDepth;
179 * Sets the clipping mode for this node.
180 * @param[in] clippingMode The ClippingMode to set
182 void SetClippingMode( const ClippingMode::Type clippingMode )
184 mClippingMode = clippingMode;
188 * Gets the Clipping Mode for this node.
189 * @return The ClippingMode of this node
191 ClippingMode::Type GetClippingMode() const
193 return mClippingMode;
197 * Add a renderer to the node
198 * @param[in] renderer The renderer added to the node
200 void AddRenderer( Renderer* renderer );
203 * Remove a renderer from the node
204 * @param[in] renderer The renderer to be removed
206 void RemoveRenderer( Renderer* renderer );
209 * Get the renderer at the given index
212 Renderer* GetRendererAt( uint32_t index ) const
214 return mRenderer[index];
218 * Retrieve the number of renderers for the node
220 uint32_t GetRendererCount() const
222 return static_cast<uint32_t>( mRenderer.Size() );
225 // Containment methods
228 * Query whether a node is the root node. Root nodes cannot have a parent node.
229 * A node becomes a root node, when it is installed by UpdateManager.
230 * @return True if the node is a root node.
238 * Set whether a node is the root node. Root nodes cannot have a parent node.
239 * This method should only be called by UpdateManager.
240 * @pre When isRoot is true, the node must not have a parent.
241 * @param[in] isRoot Whether the node is now a root node.
243 void SetRoot(bool isRoot);
246 * Retrieve the parent of a Node.
247 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
255 * Retrieve the parent of a Node.
256 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
258 const Node* GetParent() const
264 * Connect a node to the scene-graph.
265 * @pre A node cannot be added to itself.
266 * @pre The parent node is connected to the scene-graph.
267 * @pre The childNode does not already have a parent.
268 * @pre The childNode is not a root node.
269 * @param[in] childNode The child to add.
271 void ConnectChild( Node* childNode );
274 * Disconnect a child (& its children) from the scene-graph.
275 * @pre childNode is a child of this Node.
276 * @param[in] updateBufferIndex The current update buffer index.
277 * @param[in] childNode The node to disconnect.
279 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
282 * Retrieve the children a Node.
283 * @return The container of children.
285 const NodeContainer& GetChildren() const
291 * Retrieve the children a Node.
292 * @return The container of children.
294 NodeContainer& GetChildren()
302 * Flag that one of the node values has changed in the current frame.
303 * @param[in] flag The flag to set.
305 void SetDirtyFlag( NodePropertyFlags flag )
311 * Flag that all of the node values are dirty.
313 void SetAllDirtyFlags()
315 mDirtyFlags = NodePropertyFlags::ALL;
319 * Query whether a node is dirty.
320 * @return The dirty flags
322 NodePropertyFlags GetDirtyFlags() const;
325 * Query inherited dirty flags.
327 * @param The parentFlags to or with
328 * @return The inherited dirty flags
330 NodePropertyFlags GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const;
333 * Retrieve the parent-origin of the node.
334 * @return The parent-origin.
336 const Vector3& GetParentOrigin() const
338 return mParentOrigin.Get(0);
342 * Sets both the local & base parent-origins of the node.
343 * @param[in] origin The new local & base parent-origins.
345 void SetParentOrigin(const Vector3& origin)
347 mParentOrigin.Set(0,origin );
351 * Retrieve the anchor-point of the node.
352 * @return The anchor-point.
354 const Vector3& GetAnchorPoint() const
356 return mAnchorPoint.Get(0);
360 * Sets both the local & base anchor-points of the node.
361 * @param[in] anchor The new local & base anchor-points.
363 void SetAnchorPoint(const Vector3& anchor)
365 mAnchorPoint.Set(0, anchor );
369 * Retrieve the local position of the node, relative to its parent.
370 * @param[in] bufferIndex The buffer to read from.
371 * @return The local position.
373 const Vector3& GetPosition(BufferIndex bufferIndex) const
375 if( mTransformId != INVALID_TRANSFORM_ID )
377 return mPosition.Get(bufferIndex);
380 return Vector3::ZERO;
384 * Retrieve the position of the node derived from the position of all its parents.
385 * @return The world position.
387 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
389 return mWorldPosition.Get(bufferIndex);
393 * Set whether the Node inherits position.
394 * @param[in] inherit True if the parent position is inherited.
396 void SetInheritPosition(bool inherit)
398 if( mTransformId != INVALID_TRANSFORM_ID )
400 mTransformManager->SetInheritPosition( mTransformId, inherit );
405 * Retrieve the local orientation of the node, relative to its parent.
406 * @param[in] bufferIndex The buffer to read from.
407 * @return The local orientation.
409 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
411 if( mTransformId != INVALID_TRANSFORM_ID )
413 return mOrientation.Get(0);
416 return Quaternion::IDENTITY;
420 * Retrieve the orientation of the node derived from the rotation of all its parents.
421 * @param[in] bufferIndex The buffer to read from.
422 * @return The world rotation.
424 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
426 return mWorldOrientation.Get(0);
430 * Set whether the Node inherits orientation.
431 * @param[in] inherit True if the parent orientation is inherited.
433 void SetInheritOrientation(bool inherit)
435 if( mTransformId != INVALID_TRANSFORM_ID )
437 mTransformManager->SetInheritOrientation(mTransformId, inherit );
442 * Retrieve the local scale of the node, relative to its parent.
443 * @param[in] bufferIndex The buffer to read from.
444 * @return The local scale.
446 const Vector3& GetScale(BufferIndex bufferIndex) const
448 if( mTransformId != INVALID_TRANSFORM_ID )
450 return mScale.Get(0);
458 * Retrieve the scale of the node derived from the scale of all its parents.
459 * @param[in] bufferIndex The buffer to read from.
460 * @return The world scale.
462 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
464 return mWorldScale.Get(0);
468 * Set whether the Node inherits scale.
469 * @param inherit True if the Node inherits scale.
471 void SetInheritScale( bool inherit )
473 if( mTransformId != INVALID_TRANSFORM_ID )
475 mTransformManager->SetInheritScale(mTransformId, inherit );
480 * Retrieve the visibility of the node.
481 * @param[in] bufferIndex The buffer to read from.
482 * @return True if the node is visible.
484 bool IsVisible(BufferIndex bufferIndex) const
486 return mVisible[bufferIndex];
490 * Retrieve the opacity of the node.
491 * @param[in] bufferIndex The buffer to read from.
492 * @return The opacity.
494 float GetOpacity(BufferIndex bufferIndex) const
496 return mColor[bufferIndex].a;
500 * Retrieve the color of the node.
501 * @param[in] bufferIndex The buffer to read from.
504 const Vector4& GetColor(BufferIndex bufferIndex) const
506 return mColor[bufferIndex];
510 * Sets the color of the node derived from the color of all its parents.
511 * @param[in] color The world color.
512 * @param[in] updateBufferIndex The current update buffer index.
514 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
516 mWorldColor.Set( updateBufferIndex, color );
520 * Sets the color of the node derived from the color of all its parents.
521 * This method should only be called when the parents world color is up-to-date.
522 * @pre The node has a parent.
523 * @param[in] updateBufferIndex The current update buffer index.
525 void InheritWorldColor( BufferIndex updateBufferIndex )
527 DALI_ASSERT_DEBUG(mParent != NULL);
530 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
532 const Vector4& ownColor = mColor[updateBufferIndex];
533 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
535 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
537 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
539 else if( mColorMode == USE_PARENT_COLOR )
541 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
543 else // USE_OWN_COLOR
545 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
550 * Copies the previous inherited scale, if this changed in the previous frame.
551 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
552 * does not need to be recalculated in the current frame.
553 * @param[in] updateBufferIndex The current update buffer index.
555 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
557 mWorldColor.CopyPrevious( updateBufferIndex );
561 * Retrieve the color of the node, possibly derived from the color
562 * of all its parents, depending on the value of mColorMode.
563 * @param[in] bufferIndex The buffer to read from.
564 * @return The world color.
566 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
568 return mWorldColor[bufferIndex];
572 * Set the color mode. This specifies whether the Node uses its own color,
573 * or inherits its parent color.
574 * @param[in] colorMode The new color mode.
576 void SetColorMode( ColorMode colorMode )
578 mColorMode = colorMode;
580 SetDirtyFlag( NodePropertyFlags::COLOR );
584 * Retrieve the color mode.
585 * @return The color mode.
587 ColorMode GetColorMode() const
593 * Retrieve the size of the node.
594 * @param[in] bufferIndex The buffer to read from.
597 const Vector3& GetSize(BufferIndex bufferIndex) const
599 if( mTransformId != INVALID_TRANSFORM_ID )
604 return Vector3::ZERO;
608 * Retrieve the bounding sphere of the node
609 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
611 const Vector4& GetBoundingSphere() const
613 if( mTransformId != INVALID_TRANSFORM_ID )
615 return mTransformManager->GetBoundingSphere( mTransformId );
618 return Vector4::ZERO;
622 * Retrieve world matrix and size of the node
623 * @param[out] The local to world matrix of the node
624 * @param[out] size The current size of the node
626 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
628 if( mTransformId != INVALID_TRANSFORM_ID )
630 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
635 * Checks if local matrix has changed since last update
636 * @return true if local matrix has changed, false otherwise
638 bool IsLocalMatrixDirty() const
640 return (mTransformId != INVALID_TRANSFORM_ID) &&
641 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
645 * Retrieve the cached world-matrix of a node.
646 * @param[in] bufferIndex The buffer to read from.
647 * @return The world-matrix.
649 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
651 return mWorldMatrix.Get(bufferIndex);
655 * Mark the node as exclusive to a single RenderTask.
656 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
658 void SetExclusiveRenderTask( RenderTask* renderTask )
660 mExclusiveRenderTask = renderTask;
664 * Query whether the node is exclusive to a single RenderTask.
665 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
667 RenderTask* GetExclusiveRenderTask() const
669 return mExclusiveRenderTask;
673 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
674 * @param[in] drawMode The new draw-mode to use.
676 void SetDrawMode( const DrawMode::Type& drawMode )
678 mDrawMode = drawMode;
682 * Returns whether node is an overlay or not.
683 * @return True if node is an overlay, false otherwise.
685 DrawMode::Type GetDrawMode() const
691 * Returns the transform id of the node
692 * @return The transform component id of the node
694 TransformId GetTransformId() const
700 * Equality operator, checks for identity, not values.
703 bool operator==( const Node* rhs ) const
705 return ( this == rhs );
709 * @brief Sets the sibling order of the node
710 * @param[in] order The new order
712 void SetDepthIndex( uint32_t depthIndex )
714 mDepthIndex = depthIndex;
718 * @brief Get the depth index of the node
719 * @return Current depth index
721 uint32_t GetDepthIndex() const
727 * @brief Sets the boolean which states whether the position should use the anchor-point.
728 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
730 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
732 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
734 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
735 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
740 * @brief Sets whether the node is culled or not.
741 * @param[in] bufferIndex The buffer to read from.
742 * @param[in] culled True if the node is culled.
744 void SetCulled( BufferIndex bufferIndex, bool culled )
746 mCulled[bufferIndex] = culled;
750 * @brief Retrieves whether the node is culled or not.
751 * @param[in] bufferIndex The buffer to read from.
752 * @return True if the node is culled.
754 bool IsCulled( BufferIndex bufferIndex ) const
756 return mCulled[bufferIndex];
761 * @copydoc UniformMap::Add
763 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
766 * @copydoc UniformMap::Remove
768 void RemoveUniformMapping( const std::string& uniformName );
771 * Prepare the node for rendering.
772 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
773 * @param[in] updateBufferIndex The current update buffer index.
775 void PrepareRender( BufferIndex bufferIndex );
778 * Called by UpdateManager when the node is added.
779 * Creates a new transform component in the transform manager and initialize all the properties
780 * related to the transformation
781 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
783 void CreateTransform( SceneGraph::TransformManager* transformManager );
788 void ResetDirtyFlags( BufferIndex updateBufferIndex );
793 * Set the parent of a Node.
794 * @param[in] parentNode the new parent.
796 void SetParent( Node& parentNode );
801 * Protected constructor; See also Node::New()
802 * @param[in] id The Unique ID of the actor creating the node
807 * Protected virtual destructor; See also Node::Delete( Node* )
808 * Kept protected to allow destructor chaining from layer
812 private: // from NodeDataProvider
815 * @copydoc NodeDataProvider::GetModelMatrix
817 virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const
819 return GetWorldMatrix( bufferIndex );
823 * @copydoc NodeDataProvider::GetRenderColor
825 virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const
827 return GetWorldColor( bufferIndex );
830 public: // From UniformMapDataProvider
832 * @copydoc UniformMapDataProvider::GetUniformMapChanged
834 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
836 return mUniformMapChanged[bufferIndex];
840 * @copydoc UniformMapDataProvider::GetUniformMap
842 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
844 return mCollectedUniformMap[bufferIndex];
853 Node& operator=(const Node& rhs);
856 * Recursive helper to disconnect a Node and its children.
857 * Disconnected Nodes have no parent or children.
858 * @param[in] updateBufferIndex The current update buffer index.
860 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
862 public: // Default properties
864 TransformManager* mTransformManager;
865 TransformId mTransformId;
866 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
867 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
868 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
869 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
870 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
871 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
873 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
874 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
875 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
877 // Inherited properties; read-only from public API
879 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
880 TransformManagerVector3Input mWorldScale;
881 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
882 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
883 InheritedColor mWorldColor; ///< Full inherited color
885 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
886 const uint32_t mId; ///< The Unique ID of the node.
890 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
891 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
893 RendererContainer mRenderer; ///< Container of renderers; not owned
895 NodeContainer mChildren; ///< Container of children; not owned
897 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
898 uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
899 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
900 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
902 uint32_t mDepthIndex; ///< Depth index of the node
904 // flags, compressed to bitfield
905 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
906 uint32_t mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
907 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
908 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
909 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
910 bool mIsRoot:1; ///< True if the node cannot have a parent
911 bool mIsLayer:1; ///< True if the node is a layer
912 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
913 // Changes scope, should be at end of class
914 DALI_LOG_OBJECT_STRING_DECLARATION;
919 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
921 typedef MessageValue1< Node, bool > LocalType;
923 // Reserve some memory inside the message queue
924 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
926 // Construct message in the message queue memory; note that delete should not be called on the return value
927 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
930 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
932 typedef MessageValue1< Node, Vector3 > LocalType;
934 // Reserve some memory inside the message queue
935 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
937 // Construct message in the message queue memory; note that delete should not be called on the return value
938 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
941 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
943 typedef MessageValue1< Node, Vector3 > LocalType;
945 // Reserve some memory inside the message queue
946 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
948 // Construct message in the message queue memory; note that delete should not be called on the return value
949 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
952 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
954 typedef MessageValue1< Node, bool > LocalType;
956 // Reserve some memory inside the message queue
957 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
959 // Construct message in the message queue memory; note that delete should not be called on the return value
960 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
963 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
965 typedef MessageValue1< Node, bool > LocalType;
967 // Reserve some memory inside the message queue
968 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
970 // Construct message in the message queue memory; note that delete should not be called on the return value
971 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
974 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
976 typedef MessageValue1< Node, ColorMode > LocalType;
978 // Reserve some memory inside the message queue
979 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
981 // Construct message in the message queue memory; note that delete should not be called on the return value
982 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
985 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
987 typedef MessageValue1< Node, DrawMode::Type > LocalType;
989 // Reserve some memory inside the message queue
990 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
992 // Construct message in the message queue memory; note that delete should not be called on the return value
993 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
996 inline void AddRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
998 typedef MessageValue1< Node, Renderer* > LocalType;
1000 // Reserve some memory inside the message queue
1001 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1003 // Construct message in the message queue memory; note that delete should not be called on the return value
1004 new (slot) LocalType( &node, &Node::AddRenderer, renderer );
1007 inline void RemoveRendererMessage( EventThreadServices& eventThreadServices, const Node& node, Renderer* renderer )
1009 typedef MessageValue1< Node, Renderer* > LocalType;
1011 // Reserve some memory inside the message queue
1012 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1014 // Construct message in the message queue memory; note that delete should not be called on the return value
1015 new (slot) LocalType( &node, &Node::RemoveRenderer, renderer );
1018 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
1020 typedef MessageValue1< Node, uint32_t > LocalType;
1022 // Reserve some memory inside the message queue
1023 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1025 // Construct message in the message queue memory; note that delete should not be called on the return value
1026 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1029 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1031 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1033 // Reserve some memory inside the message queue
1034 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1036 // Construct message in the message queue memory; note that delete should not be called on the return value
1037 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1040 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1042 typedef MessageValue1< Node, bool > LocalType;
1044 // Reserve some memory inside the message queue
1045 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1047 // Construct message in the message queue memory; note that delete should not be called on the return value
1048 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1051 } // namespace SceneGraph
1053 // Template specialisation for OwnerPointer<Node>, because delete is protected
1055 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1057 if (mObject != NULL)
1059 Dali::Internal::SceneGraph::Node::Delete(mObject);
1063 } // namespace Internal
1065 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1067 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1069 Dali::Internal::SceneGraph::Node::Delete(pointer);
1073 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H