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/scene-graph-buffers.h>
34 #include <dali/internal/update/common/inherited-property.h>
35 #include <dali/internal/update/manager/transform-manager.h>
36 #include <dali/internal/update/manager/transform-manager-property.h>
37 #include <dali/internal/update/nodes/node-declarations.h>
38 #include <dali/internal/update/rendering/scene-graph-renderer.h>
46 // Value types used by messages.
47 template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
48 template <> struct ParameterType< ClippingMode::Type > : public BasicType< ClippingMode::Type > {};
59 // Flags which require the scene renderable lists to be updated
60 static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
63 * Node is the base class for all nodes in the Scene Graph.
65 * Each node provides a transformation which applies to the node and
66 * its children. Node data is double-buffered. This allows an update
67 * thread to modify node data, without interferring with another
68 * thread reading the values from the previous update traversal.
70 class Node : public PropertyOwner, public NodeDataProvider
75 static const ColorMode DEFAULT_COLOR_MODE;
80 * Construct a new Node.
87 static void Delete( Node* node );
90 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
95 * @return the unique ID of the node
97 uint32_t GetId() const;
102 * Query whether the node is a layer.
103 * @return True if the node is a layer.
111 * Convert a node to a layer.
112 * @return A pointer to the layer, or NULL.
114 virtual Layer* GetLayer()
120 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
121 * A value is calculated that can be used during sorting to increase sort speed.
122 * @param[in] clippingId The Clipping ID of the node to set
123 * @param[in] clippingDepth The Clipping Depth of the node to set
124 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
126 void SetClippingInformation( const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth )
128 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
129 // If not, if we traverse down a clipping tree and back up, and there is another
130 // node on the parent, this will have a non-zero clipping ID that must be ignored
131 if( clippingDepth > 0u )
133 mClippingDepth = clippingDepth;
135 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
136 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
137 // For the same ID, the clipping nodes must be first, so we negate the
138 // clipping enabled flag and set it as the least significant bit.
139 mClippingSortModifier = ( clippingId << 1u ) | ( mClippingMode == ClippingMode::DISABLED ? 1u : 0u );
143 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
144 mClippingSortModifier = 0u;
147 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
148 // For this reason we can always update the member variable.
149 mScissorDepth = scissorDepth;
153 * Gets the Clipping ID for this node.
154 * @return The Clipping ID for this node.
156 uint32_t GetClippingId() const
158 return mClippingSortModifier >> 1u;
162 * Gets the Clipping Depth for this node.
163 * @return The Clipping Depth for this node.
165 uint32_t GetClippingDepth() const
167 return mClippingDepth;
171 * Gets the Scissor Clipping Depth for this node.
172 * @return The Scissor Clipping Depth for this node.
174 uint32_t GetScissorDepth() const
176 return mScissorDepth;
180 * Sets the clipping mode for this node.
181 * @param[in] clippingMode The ClippingMode to set
183 void SetClippingMode( const ClippingMode::Type clippingMode )
185 SetPropertyDirty( true );
186 mClippingMode = clippingMode;
190 * Gets the Clipping Mode for this node.
191 * @return The ClippingMode of this node
193 ClippingMode::Type GetClippingMode() const
195 return mClippingMode;
199 * Add a renderer to the node
200 * @param[in] renderer The renderer added to the node
202 void AddRenderer( Renderer* renderer );
205 * Remove a renderer from the node
206 * @param[in] renderer The renderer to be removed
208 void RemoveRenderer( const Renderer* renderer );
211 * Get the renderer at the given index
214 Renderer* GetRendererAt( uint32_t index ) const
216 return mRenderer[index];
220 * Retrieve the number of renderers for the node
222 uint32_t GetRendererCount() const
224 return static_cast<uint32_t>( mRenderer.Size() );
227 // Containment methods
230 * Query whether a node is the root node. Root nodes cannot have a parent node.
231 * A node becomes a root node, when it is installed by UpdateManager.
232 * @return True if the node is a root node.
240 * Set whether a node is the root node. Root nodes cannot have a parent node.
241 * This method should only be called by UpdateManager.
242 * @pre When isRoot is true, the node must not have a parent.
243 * @param[in] isRoot Whether the node is now a root node.
245 void SetRoot(bool isRoot);
248 * Retrieve the parent of a Node.
249 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
257 * Retrieve the parent of a Node.
258 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
260 const Node* GetParent() const
266 * @return true if the node is connected to SceneGraph
268 bool ConnectedToScene()
270 return IsRoot() || GetParent();
274 * Connect a node to the scene-graph.
275 * @pre A node cannot be added to itself.
276 * @pre The parent node is connected to the scene-graph.
277 * @pre The childNode does not already have a parent.
278 * @pre The childNode is not a root node.
279 * @param[in] childNode The child to add.
281 void ConnectChild( Node* childNode );
284 * Disconnect a child (& its children) from the scene-graph.
285 * @pre childNode is a child of this Node.
286 * @param[in] updateBufferIndex The current update buffer index.
287 * @param[in] childNode The node to disconnect.
289 void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode );
292 * Retrieve the children a Node.
293 * @return The container of children.
295 const NodeContainer& GetChildren() const
301 * Retrieve the children a Node.
302 * @return The container of children.
304 NodeContainer& GetChildren()
312 * Flag that one of the node values has changed in the current frame.
313 * @param[in] flag The flag to set.
315 void SetDirtyFlag( NodePropertyFlags flag )
317 SetPropertyDirty( true );
322 * Flag that all of the node values are dirty.
324 void SetAllDirtyFlags()
326 mDirtyFlags = NodePropertyFlags::ALL;
330 * Query whether a node is dirty.
331 * @return The dirty flags
333 NodePropertyFlags GetDirtyFlags() const;
336 * Query inherited dirty flags.
338 * @param The parentFlags to or with
339 * @return The inherited dirty flags
341 NodePropertyFlags GetInheritedDirtyFlags( NodePropertyFlags parentFlags ) const;
344 * Retrieve the parent-origin of the node.
345 * @return The parent-origin.
347 const Vector3& GetParentOrigin() const
349 return mParentOrigin.Get(0);
353 * Sets both the local & base parent-origins of the node.
354 * @param[in] origin The new local & base parent-origins.
356 void SetParentOrigin(const Vector3& origin)
358 mParentOrigin.Set(0,origin );
362 * Retrieve the anchor-point of the node.
363 * @return The anchor-point.
365 const Vector3& GetAnchorPoint() const
367 return mAnchorPoint.Get(0);
371 * Sets both the local & base anchor-points of the node.
372 * @param[in] anchor The new local & base anchor-points.
374 void SetAnchorPoint(const Vector3& anchor)
376 mAnchorPoint.Set(0, anchor );
380 * Retrieve the local position of the node, relative to its parent.
381 * @param[in] bufferIndex The buffer to read from.
382 * @return The local position.
384 const Vector3& GetPosition(BufferIndex bufferIndex) const
386 if( mTransformId != INVALID_TRANSFORM_ID )
388 return mPosition.Get(bufferIndex);
391 return Vector3::ZERO;
395 * Retrieve the position of the node derived from the position of all its parents.
396 * @return The world position.
398 const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
400 return mWorldPosition.Get(bufferIndex);
404 * Set whether the Node inherits position.
405 * @param[in] inherit True if the parent position is inherited.
407 void SetInheritPosition(bool inherit)
409 if( mTransformId != INVALID_TRANSFORM_ID )
411 mTransformManager->SetInheritPosition( mTransformId, inherit );
416 * Retrieve the local orientation of the node, relative to its parent.
417 * @param[in] bufferIndex The buffer to read from.
418 * @return The local orientation.
420 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
422 if( mTransformId != INVALID_TRANSFORM_ID )
424 return mOrientation.Get(0);
427 return Quaternion::IDENTITY;
431 * Retrieve the orientation of the node derived from the rotation of all its parents.
432 * @param[in] bufferIndex The buffer to read from.
433 * @return The world rotation.
435 const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
437 return mWorldOrientation.Get(0);
441 * Set whether the Node inherits orientation.
442 * @param[in] inherit True if the parent orientation is inherited.
444 void SetInheritOrientation(bool inherit)
446 if( mTransformId != INVALID_TRANSFORM_ID )
448 mTransformManager->SetInheritOrientation(mTransformId, inherit );
453 * Retrieve the local scale of the node, relative to its parent.
454 * @param[in] bufferIndex The buffer to read from.
455 * @return The local scale.
457 const Vector3& GetScale(BufferIndex bufferIndex) const
459 if( mTransformId != INVALID_TRANSFORM_ID )
461 return mScale.Get(0);
469 * Retrieve the scale of the node derived from the scale of all its parents.
470 * @param[in] bufferIndex The buffer to read from.
471 * @return The world scale.
473 const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
475 return mWorldScale.Get(0);
479 * Set whether the Node inherits scale.
480 * @param inherit True if the Node inherits scale.
482 void SetInheritScale( bool inherit )
484 if( mTransformId != INVALID_TRANSFORM_ID )
486 mTransformManager->SetInheritScale(mTransformId, inherit );
491 * Retrieve the visibility of the node.
492 * @param[in] bufferIndex The buffer to read from.
493 * @return True if the node is visible.
495 bool IsVisible(BufferIndex bufferIndex) const
497 return mVisible[bufferIndex];
501 * Retrieve the opacity of the node.
502 * @param[in] bufferIndex The buffer to read from.
503 * @return The opacity.
505 float GetOpacity(BufferIndex bufferIndex) const
507 return mColor[bufferIndex].a;
511 * Retrieve the color of the node.
512 * @param[in] bufferIndex The buffer to read from.
515 const Vector4& GetColor(BufferIndex bufferIndex) const
517 return mColor[bufferIndex];
521 * Sets the color of the node derived from the color of all its parents.
522 * @param[in] color The world color.
523 * @param[in] updateBufferIndex The current update buffer index.
525 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
527 mWorldColor.Set( updateBufferIndex, color );
531 * Sets the color of the node derived from the color of all its parents.
532 * This method should only be called when the parents world color is up-to-date.
533 * @pre The node has a parent.
534 * @param[in] updateBufferIndex The current update buffer index.
536 void InheritWorldColor( BufferIndex updateBufferIndex )
538 DALI_ASSERT_DEBUG(mParent != NULL);
541 if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
543 const Vector4& ownColor = mColor[updateBufferIndex];
544 mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
546 else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
548 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
550 else if( mColorMode == USE_PARENT_COLOR )
552 mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
554 else // USE_OWN_COLOR
556 mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
561 * Copies the previous inherited scale, if this changed in the previous frame.
562 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
563 * does not need to be recalculated in the current frame.
564 * @param[in] updateBufferIndex The current update buffer index.
566 void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
568 mWorldColor.CopyPrevious( updateBufferIndex );
572 * Retrieve the color of the node, possibly derived from the color
573 * of all its parents, depending on the value of mColorMode.
574 * @param[in] bufferIndex The buffer to read from.
575 * @return The world color.
577 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
579 return mWorldColor[bufferIndex];
583 * Set the color mode. This specifies whether the Node uses its own color,
584 * or inherits its parent color.
585 * @param[in] colorMode The new color mode.
587 void SetColorMode( ColorMode colorMode )
589 mColorMode = colorMode;
591 SetDirtyFlag( NodePropertyFlags::COLOR );
595 * Retrieve the color mode.
596 * @return The color mode.
598 ColorMode GetColorMode() const
604 * Retrieve the size of the node.
605 * @param[in] bufferIndex The buffer to read from.
608 const Vector3& GetSize(BufferIndex bufferIndex) const
610 if( mTransformId != INVALID_TRANSFORM_ID )
615 return Vector3::ZERO;
619 * Retrieve the bounding sphere of the node
620 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
622 const Vector4& GetBoundingSphere() const
624 if( mTransformId != INVALID_TRANSFORM_ID )
626 return mTransformManager->GetBoundingSphere( mTransformId );
629 return Vector4::ZERO;
633 * Retrieve world matrix and size of the node
634 * @param[out] The local to world matrix of the node
635 * @param[out] size The current size of the node
637 void GetWorldMatrixAndSize( Matrix& worldMatrix, Vector3& size ) const
639 if( mTransformId != INVALID_TRANSFORM_ID )
641 mTransformManager->GetWorldMatrixAndSize( mTransformId, worldMatrix, size );
646 * Checks if local matrix has changed since last update
647 * @return true if local matrix has changed, false otherwise
649 bool IsLocalMatrixDirty() const
651 return (mTransformId != INVALID_TRANSFORM_ID) &&
652 (mTransformManager->IsLocalMatrixDirty( mTransformId ));
656 * Retrieve the cached world-matrix of a node.
657 * @param[in] bufferIndex The buffer to read from.
658 * @return The world-matrix.
660 const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
662 return mWorldMatrix.Get(bufferIndex);
666 * Mark the node as exclusive to a single RenderTask.
667 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
669 void SetExclusiveRenderTask( RenderTask* renderTask )
671 mExclusiveRenderTask = renderTask;
675 * Query whether the node is exclusive to a single RenderTask.
676 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
678 RenderTask* GetExclusiveRenderTask() const
680 return mExclusiveRenderTask;
684 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
685 * @param[in] drawMode The new draw-mode to use.
687 void SetDrawMode( const DrawMode::Type& drawMode )
689 SetPropertyDirty( true );
690 mDrawMode = drawMode;
694 * Returns whether node is an overlay or not.
695 * @return True if node is an overlay, false otherwise.
697 DrawMode::Type GetDrawMode() const
703 * Returns the transform id of the node
704 * @return The transform component id of the node
706 TransformId GetTransformId() const
712 * Equality operator, checks for identity, not values.
715 bool operator==( const Node* rhs ) const
717 return ( this == rhs );
721 * @brief Sets the sibling order of the node
722 * @param[in] order The new order
724 void SetDepthIndex( uint32_t depthIndex )
726 SetPropertyDirty( true );
727 mDepthIndex = depthIndex;
731 * @brief Get the depth index of the node
732 * @return Current depth index
734 uint32_t GetDepthIndex() const
740 * @brief Sets the boolean which states whether the position should use the anchor-point.
741 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
743 void SetPositionUsesAnchorPoint( bool positionUsesAnchorPoint )
745 if( mTransformId != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint )
747 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
748 mTransformManager->SetPositionUsesAnchorPoint( mTransformId, mPositionUsesAnchorPoint );
753 * @brief Sets whether the node is culled or not.
754 * @param[in] bufferIndex The buffer to read from.
755 * @param[in] culled True if the node is culled.
757 void SetCulled( BufferIndex bufferIndex, bool culled )
759 mCulled[bufferIndex] = culled;
763 * @brief Retrieves whether the node is culled or not.
764 * @param[in] bufferIndex The buffer to read from.
765 * @return True if the node is culled.
767 bool IsCulled( BufferIndex bufferIndex ) const
769 return mCulled[bufferIndex];
773 * @Is component changed
774 * @Return true if component is changed else false
776 bool IsComponentChanged() const
778 return (mTransformId != INVALID_TRANSFORM_ID) &&
779 (mTransformManager->IsComponentChanged( mTransformId ));
783 * Retrieve the update size hint of the node
784 * @return A vector3 describing the update size hint
786 void GetUpdateSizeHint( BufferIndex bufferIndex, Vector3& updateSizeHint ) const
788 if( mTransformId != INVALID_TRANSFORM_ID )
790 mTransformManager->GetUpdateSizeHint( mTransformId, updateSizeHint );
795 * Set Whether the partial update is available
796 * @param[in] partialUpdateAvailable value Set to true if the partial update is available
798 void SetPartialUpdateAvailable( bool value );
801 * Retrieve the whether the partial update is available
802 * @return true if the partial update is available
804 bool IsPartialUpdateAvailable() const;
807 * Set whether partial update needs to run following a render.
808 * @param[in] value Set to true if an partial update is required to be run
810 virtual void SetPropertyDirty( bool value );
813 * Query the property status following rendering of a frame.
814 * @return True if the property has changed
816 virtual bool IsPropertyDirty() const;
820 * @copydoc UniformMap::Add
822 void AddUniformMapping( OwnerPointer< UniformPropertyMapping >& map );
825 * @copydoc UniformMap::Remove
827 void RemoveUniformMapping( const std::string& uniformName );
830 * Prepare the node for rendering.
831 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
832 * @param[in] updateBufferIndex The current update buffer index.
834 void PrepareRender( BufferIndex bufferIndex );
837 * Called by UpdateManager when the node is added.
838 * Creates a new transform component in the transform manager and initialize all the properties
839 * related to the transformation
840 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
842 void CreateTransform( SceneGraph::TransformManager* transformManager );
847 void ResetDirtyFlags( BufferIndex updateBufferIndex );
852 * Set the parent of a Node.
853 * @param[in] parentNode the new parent.
855 void SetParent( Node& parentNode );
860 * Protected constructor; See also Node::New()
865 * Protected virtual destructor; See also Node::Delete( Node* )
866 * Kept protected to allow destructor chaining from layer
870 private: // from NodeDataProvider
873 * @copydoc NodeDataProvider::GetModelMatrix
875 virtual const Matrix& GetModelMatrix( BufferIndex bufferIndex ) const
877 return GetWorldMatrix( bufferIndex );
881 * @copydoc NodeDataProvider::GetRenderColor
883 virtual const Vector4& GetRenderColor( BufferIndex bufferIndex ) const
885 return GetWorldColor( bufferIndex );
888 public: // From UniformMapDataProvider
890 * @copydoc UniformMapDataProvider::GetUniformMapChanged
892 virtual bool GetUniformMapChanged( BufferIndex bufferIndex ) const
894 return mUniformMapChanged[bufferIndex];
898 * @copydoc UniformMapDataProvider::GetUniformMap
900 virtual const CollectedUniformMap& GetUniformMap( BufferIndex bufferIndex ) const
902 return mCollectedUniformMap[bufferIndex];
911 Node& operator=(const Node& rhs);
914 * Recursive helper to disconnect a Node and its children.
915 * Disconnected Nodes have no parent or children.
916 * @param[in] updateBufferIndex The current update buffer index.
918 void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex );
920 public: // Default properties
922 TransformManager* mTransformManager;
923 TransformId mTransformId;
924 TransformManagerPropertyVector3 mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
925 TransformManagerPropertyVector3 mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
926 TransformManagerPropertyVector3 mSize; ///< Size is provided for layouting
927 TransformManagerPropertyVector3 mPosition; ///< Local transform; distance between parent-origin & anchor-point
928 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
929 TransformManagerPropertyVector3 mScale; ///< Local transform; scale relative to parent node
930 TransformManagerPropertyVector3 mUpdateSizeHint; ///< Local transform; update size hint is provided for partial update
932 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
933 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
934 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
936 // Inherited properties; read-only from public API
938 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
939 TransformManagerVector3Input mWorldScale;
940 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
941 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
942 InheritedColor mWorldColor; ///< Full inherited color
944 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
945 const uint32_t mId; ///< The Unique ID of the node.
949 static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
951 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
952 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
954 RendererContainer mRenderer; ///< Container of renderers; not owned
956 NodeContainer mChildren; ///< Container of children; not owned
958 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
959 uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
960 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
961 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
963 uint32_t mDepthIndex; ///< Depth index of the node
965 // flags, compressed to bitfield
966 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
967 uint32_t mRegenerateUniformMap:2; ///< Indicate if the uniform map has to be regenerated this frame
968 DrawMode::Type mDrawMode:3; ///< How the Node and its children should be drawn
969 ColorMode mColorMode:3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
970 ClippingMode::Type mClippingMode:3; ///< The clipping mode of this node
971 bool mIsRoot:1; ///< True if the node cannot have a parent
972 bool mIsLayer:1; ///< True if the node is a layer
973 bool mPositionUsesAnchorPoint:1; ///< True if the node should use the anchor-point when calculating the position
975 bool mPartialUpdateAvailable; ///< True if the partial update is available
977 // Changes scope, should be at end of class
978 DALI_LOG_OBJECT_STRING_DECLARATION;
983 inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
985 typedef MessageValue1< Node, bool > LocalType;
987 // Reserve some memory inside the message queue
988 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
990 // Construct message in the message queue memory; note that delete should not be called on the return value
991 new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
994 inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
996 typedef MessageValue1< Node, Vector3 > LocalType;
998 // Reserve some memory inside the message queue
999 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1001 // Construct message in the message queue memory; note that delete should not be called on the return value
1002 new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
1005 inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
1007 typedef MessageValue1< Node, Vector3 > LocalType;
1009 // Reserve some memory inside the message queue
1010 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1012 // Construct message in the message queue memory; note that delete should not be called on the return value
1013 new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
1016 inline void SetInheritPositionMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
1018 typedef MessageValue1< Node, bool > LocalType;
1020 // Reserve some memory inside the message queue
1021 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1023 // Construct message in the message queue memory; note that delete should not be called on the return value
1024 new (slot) LocalType( &node, &Node::SetInheritPosition, inherit );
1027 inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
1029 typedef MessageValue1< Node, bool > LocalType;
1031 // Reserve some memory inside the message queue
1032 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1034 // Construct message in the message queue memory; note that delete should not be called on the return value
1035 new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
1038 inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
1040 typedef MessageValue1< Node, ColorMode > LocalType;
1042 // Reserve some memory inside the message queue
1043 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1045 // Construct message in the message queue memory; note that delete should not be called on the return value
1046 new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
1049 inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
1051 typedef MessageValue1< Node, DrawMode::Type > LocalType;
1053 // Reserve some memory inside the message queue
1054 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1056 // Construct message in the message queue memory; note that delete should not be called on the return value
1057 new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
1060 inline void AttachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
1062 typedef MessageValue1< Node, Renderer* > LocalType;
1064 // Reserve some memory inside the message queue
1065 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1067 // Construct message in the message queue memory; note that delete should not be called on the return value
1068 new (slot) LocalType( &node, &Node::AddRenderer, const_cast<Renderer*>( &renderer ) );
1071 inline void DetachRendererMessage( EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer )
1073 typedef MessageValue1< Node, const Renderer* > LocalType;
1075 // Reserve some memory inside the message queue
1076 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1078 // Construct message in the message queue memory; note that delete should not be called on the return value
1079 new (slot) LocalType( &node, &Node::RemoveRenderer, &renderer );
1082 inline void SetDepthIndexMessage( EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex )
1084 typedef MessageValue1< Node, uint32_t > LocalType;
1086 // Reserve some memory inside the message queue
1087 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1089 // Construct message in the message queue memory; note that delete should not be called on the return value
1090 new (slot) LocalType( &node, &Node::SetDepthIndex, depthIndex );
1093 inline void SetClippingModeMessage( EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode )
1095 typedef MessageValue1< Node, ClippingMode::Type > LocalType;
1097 // Reserve some memory inside the message queue
1098 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1100 // Construct message in the message queue memory; note that delete should not be called on the return value
1101 new (slot) LocalType( &node, &Node::SetClippingMode, clippingMode );
1104 inline void SetPositionUsesAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint )
1106 typedef MessageValue1< Node, bool > LocalType;
1108 // Reserve some memory inside the message queue
1109 uint32_t* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
1111 // Construct message in the message queue memory; note that delete should not be called on the return value
1112 new (slot) LocalType( &node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint );
1115 } // namespace SceneGraph
1117 // Template specialisation for OwnerPointer<Node>, because delete is protected
1119 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1121 if (mObject != NULL)
1123 Dali::Internal::SceneGraph::Node::Delete(mObject);
1127 } // namespace Internal
1129 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1131 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete( Dali::Internal::SceneGraph::Node* pointer )
1133 Dali::Internal::SceneGraph::Node::Delete(pointer);
1137 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H