1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
5 * Copyright (c) 2022 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/integration-api/debug.h>
23 #include <dali/internal/common/message.h>
24 #include <dali/internal/event/common/event-thread-services.h>
25 #include <dali/internal/render/data-providers/node-data-provider.h>
26 #include <dali/internal/update/common/animatable-property.h>
27 #include <dali/internal/update/common/inherited-property.h>
28 #include <dali/internal/update/common/property-owner.h>
29 #include <dali/internal/update/common/scene-graph-buffers.h>
30 #include <dali/internal/update/manager/transform-manager-property.h>
31 #include <dali/internal/update/manager/transform-manager.h>
32 #include <dali/internal/update/nodes/node-declarations.h>
33 #include <dali/internal/update/nodes/partial-rendering-data.h>
34 #include <dali/internal/update/rendering/scene-graph-renderer.h>
35 #include <dali/public-api/actors/actor-enumerations.h>
36 #include <dali/public-api/actors/draw-mode.h>
37 #include <dali/public-api/math/math-utils.h>
38 #include <dali/public-api/math/quaternion.h>
39 #include <dali/public-api/math/vector3.h>
45 // Value types used by messages.
47 struct ParameterType<ColorMode> : public BasicType<ColorMode>
51 struct ParameterType<ClippingMode::Type> : public BasicType<ClippingMode::Type>
63 // Flags which require the scene renderable lists to be updated
64 static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
67 * Node is the base class for all nodes in the Scene Graph.
69 * Each node provides a transformation which applies to the node and
70 * its children. Node data is double-buffered. This allows an update
71 * thread to modify node data, without interferring with another
72 * thread reading the values from the previous update traversal.
74 class Node : public PropertyOwner, public NodeDataProvider
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()
125 * Query whether the node is a camera.
126 * @return True if the node is a camera.
128 bool IsCamera() const
134 * Mark an node and its sub tree according to the updated flag.
135 * @param[in] updated The updated flag
136 * (used for partial rendering to mark an animating sub tree for example).
138 void SetUpdatedTree(bool updated)
142 for(Node* child : mChildren)
144 child->SetUpdatedTree(updated);
149 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
150 * A value is calculated that can be used during sorting to increase sort speed.
151 * @param[in] clippingId The Clipping ID of the node to set
152 * @param[in] clippingDepth The Clipping Depth of the node to set
153 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
155 void SetClippingInformation(const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth)
157 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
158 // If not, if we traverse down a clipping tree and back up, and there is another
159 // node on the parent, this will have a non-zero clipping ID that must be ignored
160 if(clippingDepth > 0u)
162 mClippingDepth = clippingDepth;
164 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
165 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
166 // For the same ID, the clipping nodes must be first, so we negate the
167 // clipping enabled flag and set it as the least significant bit.
168 mClippingSortModifier = (clippingId << 1u) | (mClippingMode == ClippingMode::DISABLED ? 1u : 0u);
172 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
173 mClippingSortModifier = 0u;
176 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
177 // For this reason we can always update the member variable.
178 mScissorDepth = scissorDepth;
182 * Gets the Clipping ID for this node.
183 * @return The Clipping ID for this node.
185 uint32_t GetClippingId() const
187 return mClippingSortModifier >> 1u;
191 * Gets the Clipping Depth for this node.
192 * @return The Clipping Depth for this node.
194 uint32_t GetClippingDepth() const
196 return mClippingDepth;
200 * Gets the Scissor Clipping Depth for this node.
201 * @return The Scissor Clipping Depth for this node.
203 uint32_t GetScissorDepth() const
205 return mScissorDepth;
209 * Sets the clipping mode for this node.
210 * @param[in] clippingMode The ClippingMode to set
212 void SetClippingMode(const ClippingMode::Type clippingMode)
214 mClippingMode = clippingMode;
215 SetDirtyFlag(NodePropertyFlags::TRANSFORM);
219 * Gets the Clipping Mode for this node.
220 * @return The ClippingMode of this node
222 ClippingMode::Type GetClippingMode() const
224 return mClippingMode;
228 * Add a renderer to the node
229 * @param[in] renderer The renderer added to the node
231 void AddRenderer(Renderer* renderer);
234 * Remove a renderer from the node
235 * @param[in] renderer The renderer to be removed
237 void RemoveRenderer(const Renderer* renderer);
240 * Get the renderer at the given index
243 Renderer* GetRendererAt(uint32_t index) const
245 return mRenderer[index];
249 * Retrieve the number of renderers for the node
251 uint32_t GetRendererCount() const
253 return static_cast<uint32_t>(mRenderer.Size());
256 // Containment methods
259 * Query whether a node is the root node. Root nodes cannot have a parent node.
260 * A node becomes a root node, when it is installed by UpdateManager.
261 * @return True if the node is a root node.
269 * Set whether a node is the root node. Root nodes cannot have a parent node.
270 * This method should only be called by UpdateManager.
271 * @pre When isRoot is true, the node must not have a parent.
272 * @param[in] isRoot Whether the node is now a root node.
274 void SetRoot(bool isRoot);
277 * Retrieve the parent of a Node.
278 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
286 * Retrieve the parent of a Node.
287 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
289 const Node* GetParent() const
295 * @return true if the node is connected to SceneGraph
297 bool ConnectedToScene()
299 return IsRoot() || GetParent();
303 * Connect a node to the scene-graph.
304 * @pre A node cannot be added to itself.
305 * @pre The parent node is connected to the scene-graph.
306 * @pre The childNode does not already have a parent.
307 * @pre The childNode is not a root node.
308 * @param[in] childNode The child to add.
310 void ConnectChild(Node* childNode);
313 * Disconnect a child (& its children) from the scene-graph.
314 * @pre childNode is a child of this Node.
315 * @param[in] updateBufferIndex The current update buffer index.
316 * @param[in] childNode The node to disconnect.
318 void DisconnectChild(BufferIndex updateBufferIndex, Node& childNode);
321 * Retrieve the children a Node.
322 * @return The container of children.
324 const NodeContainer& GetChildren() const
330 * Retrieve the children a Node.
331 * @return The container of children.
333 NodeContainer& GetChildren()
341 * Flag that one of the node values has changed in the current frame.
342 * @param[in] flag The flag to set.
344 void SetDirtyFlag(NodePropertyFlags flag)
350 * Flag that all of the node values are dirty.
352 void SetAllDirtyFlags()
354 mDirtyFlags = NodePropertyFlags::ALL;
358 * Query whether a node is dirty.
359 * @return The dirty flags
361 NodePropertyFlags GetDirtyFlags() const;
364 * Query inherited dirty flags.
366 * @param The parentFlags to or with
367 * @return The inherited dirty flags
369 NodePropertyFlags GetInheritedDirtyFlags(NodePropertyFlags parentFlags) const;
372 * Retrieve the parent-origin of the node.
373 * @return The parent-origin.
375 const Vector3& GetParentOrigin() const
377 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
379 return mParentOrigin.Get(0);
382 return Vector3::ZERO;
386 * Sets both the local & base parent-origins of the node.
387 * @param[in] origin The new local & base parent-origins.
389 void SetParentOrigin(const Vector3& origin)
391 mParentOrigin.Set(0, origin);
395 * Retrieve the anchor-point of the node.
396 * @return The anchor-point.
398 const Vector3& GetAnchorPoint() const
400 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
402 return mAnchorPoint.Get(0);
405 return Vector3::ZERO;
409 * Sets both the local & base anchor-points of the node.
410 * @param[in] anchor The new local & base anchor-points.
412 void SetAnchorPoint(const Vector3& anchor)
414 mAnchorPoint.Set(0, anchor);
418 * Retrieve the local position of the node, relative to its parent.
419 * @param[in] bufferIndex The buffer to read from.
420 * @return The local position.
422 const Vector3& GetPosition(BufferIndex bufferIndex) const
424 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
426 return mPosition.Get(bufferIndex);
429 return Vector3::ZERO;
433 * Retrieve the position of the node derived from the position of all its parents.
434 * @return The world position.
436 const Vector3& GetWorldPosition(BufferIndex bufferIndex) const
438 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
440 return mWorldPosition.Get(bufferIndex);
442 return Vector3::ZERO;
446 * Set whether the Node inherits position.
447 * @param[in] inherit True if the parent position is inherited.
449 void SetInheritPosition(bool inherit)
451 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
453 mTransformManagerData.Manager()->SetInheritPosition(mTransformManagerData.Id(), inherit);
458 * Retrieve the local orientation of the node, relative to its parent.
459 * @param[in] bufferIndex The buffer to read from.
460 * @return The local orientation.
462 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
464 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
466 return mOrientation.Get(0);
469 return Quaternion::IDENTITY;
473 * Retrieve the orientation of the node derived from the rotation of all its parents.
474 * @param[in] bufferIndex The buffer to read from.
475 * @return The world rotation.
477 const Quaternion& GetWorldOrientation(BufferIndex bufferIndex) const
479 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
481 return mWorldOrientation.Get(0);
483 return Quaternion::IDENTITY;
487 * Set whether the Node inherits orientation.
488 * @param[in] inherit True if the parent orientation is inherited.
490 void SetInheritOrientation(bool inherit)
492 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
494 mTransformManagerData.Manager()->SetInheritOrientation(mTransformManagerData.Id(), inherit);
499 * Retrieve the local scale of the node, relative to its parent.
500 * @param[in] bufferIndex The buffer to read from.
501 * @return The local scale.
503 const Vector3& GetScale(BufferIndex bufferIndex) const
505 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
507 return mScale.Get(0);
514 * Retrieve the scale of the node derived from the scale of all its parents.
515 * @param[in] bufferIndex The buffer to read from.
516 * @return The world scale.
518 const Vector3& GetWorldScale(BufferIndex bufferIndex) const
520 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
522 return mWorldScale.Get(0);
528 * Set whether the Node inherits scale.
529 * @param inherit True if the Node inherits scale.
531 void SetInheritScale(bool inherit)
533 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
535 mTransformManagerData.Manager()->SetInheritScale(mTransformManagerData.Id(), inherit);
540 * Retrieve the visibility of the node.
541 * @param[in] bufferIndex The buffer to read from.
542 * @return True if the node is visible.
544 bool IsVisible(BufferIndex bufferIndex) const
546 return mVisible[bufferIndex];
550 * Retrieve the opacity of the node.
551 * @param[in] bufferIndex The buffer to read from.
552 * @return The opacity.
554 float GetOpacity(BufferIndex bufferIndex) const
556 return mColor[bufferIndex].a;
560 * Retrieve the color of the node.
561 * @param[in] bufferIndex The buffer to read from.
564 const Vector4& GetColor(BufferIndex bufferIndex) const
566 return mColor[bufferIndex];
570 * Sets the color of the node derived from the color of all its parents.
571 * @param[in] color The world color.
572 * @param[in] updateBufferIndex The current update buffer index.
574 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
576 mWorldColor.Set(updateBufferIndex, color);
580 * Sets the color of the node derived from the color of all its parents.
581 * This method should only be called when the parents world color is up-to-date.
582 * @pre The node has a parent.
583 * @param[in] updateBufferIndex The current update buffer index.
585 void InheritWorldColor(BufferIndex updateBufferIndex)
587 DALI_ASSERT_DEBUG(mParent != NULL);
590 if(mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA)
592 const Vector4& ownColor = mColor[updateBufferIndex];
593 mWorldColor.Set(updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a);
595 else if(mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR)
597 mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex]);
599 else if(mColorMode == USE_PARENT_COLOR)
601 mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex));
603 else // USE_OWN_COLOR
605 mWorldColor.Set(updateBufferIndex, mColor[updateBufferIndex]);
610 * Copies the previous inherited scale, if this changed in the previous frame.
611 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
612 * does not need to be recalculated in the current frame.
613 * @param[in] updateBufferIndex The current update buffer index.
615 void CopyPreviousWorldColor(BufferIndex updateBufferIndex)
617 mWorldColor.CopyPrevious(updateBufferIndex);
621 * Retrieve the color of the node, possibly derived from the color
622 * of all its parents, depending on the value of mColorMode.
623 * @param[in] bufferIndex The buffer to read from.
624 * @return The world color.
626 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
628 return mWorldColor[bufferIndex];
632 * Set the color mode. This specifies whether the Node uses its own color,
633 * or inherits its parent color.
634 * @param[in] colorMode The new color mode.
636 void SetColorMode(ColorMode colorMode)
638 mColorMode = colorMode;
640 SetDirtyFlag(NodePropertyFlags::COLOR);
644 * Retrieve the color mode.
645 * @return The color mode.
647 ColorMode GetColorMode() const
653 * Retrieve the size of the node.
654 * @param[in] bufferIndex The buffer to read from.
657 const Vector3& GetSize(BufferIndex bufferIndex) const
659 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
664 return Vector3::ZERO;
668 * Retrieve the update area hint of the node.
669 * @return The update area hint.
671 const Vector4& GetUpdateAreaHint() const
673 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
675 return mUpdateAreaHint.Get(0);
678 return Vector4::ZERO;
682 * Retrieve the bounding sphere of the node
683 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
685 const Vector4& GetBoundingSphere() const
687 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
689 return mTransformManagerData.Manager()->GetBoundingSphere(mTransformManagerData.Id());
692 return Vector4::ZERO;
696 * Retrieve world matrix and size of the node
697 * @param[out] The local to world matrix of the node
698 * @param[out] size The current size of the node
700 void GetWorldMatrixAndSize(Matrix& worldMatrix, Vector3& size) const
702 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
704 mTransformManagerData.Manager()->GetWorldMatrixAndSize(mTransformManagerData.Id(), worldMatrix, size);
709 * Checks if local matrix has changed since last update
710 * @return true if local matrix has changed, false otherwise
712 bool IsLocalMatrixDirty() const
714 return (mTransformManagerData.Id() != INVALID_TRANSFORM_ID) &&
715 (mTransformManagerData.Manager()->IsLocalMatrixDirty(mTransformManagerData.Id()));
719 * Retrieve the cached world-matrix of a node.
720 * @param[in] bufferIndex The buffer to read from.
721 * @return The world-matrix.
723 const Matrix& GetWorldMatrix(BufferIndex bufferIndex) const
725 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
727 return mWorldMatrix.Get(bufferIndex);
730 return Matrix::IDENTITY;
734 * Mark the node as exclusive to a single RenderTask.
735 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
737 void SetExclusiveRenderTask(RenderTask* renderTask)
739 mExclusiveRenderTask = renderTask;
743 * Query whether the node is exclusive to a single RenderTask.
744 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
746 RenderTask* GetExclusiveRenderTask() const
748 return mExclusiveRenderTask;
752 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
753 * @param[in] drawMode The new draw-mode to use.
755 void SetDrawMode(const DrawMode::Type& drawMode)
757 mDrawMode = drawMode;
761 * Returns whether node is an overlay or not.
762 * @return True if node is an overlay, false otherwise.
764 DrawMode::Type GetDrawMode() const
769 void SetTransparent(bool transparent)
771 mTransparent = transparent;
774 bool IsTransparent() const
780 * Returns the transform id of the node
781 * @return The transform component id of the node
783 TransformId GetTransformId() const
785 return mTransformManagerData.Id();
789 * Equality operator, checks for identity, not values.
792 bool operator==(const Node* rhs) const
794 return (this == rhs);
798 * @brief Sets the sibling order of the node
799 * @param[in] order The new order
801 void SetDepthIndex(uint32_t depthIndex)
803 if(depthIndex != mDepthIndex)
805 SetDirtyFlag(NodePropertyFlags::DEPTH_INDEX);
806 mDepthIndex = depthIndex;
811 * @brief Get the depth index of the node
812 * @return Current depth index
814 uint32_t GetDepthIndex() const
820 * @brief Sets the boolean which states whether the position should use the anchor-point.
821 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
823 void SetPositionUsesAnchorPoint(bool positionUsesAnchorPoint)
825 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint)
827 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
828 mTransformManagerData.Manager()->SetPositionUsesAnchorPoint(mTransformManagerData.Id(), mPositionUsesAnchorPoint);
833 * @brief Sets whether the node is culled or not.
834 * @param[in] bufferIndex The buffer to read from.
835 * @param[in] culled True if the node is culled.
837 void SetCulled(BufferIndex bufferIndex, bool culled)
839 mCulled[bufferIndex] = culled;
843 * @brief Retrieves whether the node is culled or not.
844 * @param[in] bufferIndex The buffer to read from.
845 * @return True if the node is culled.
847 bool IsCulled(BufferIndex bufferIndex) const
849 return mCulled[bufferIndex];
853 * @brief Get the total capacity of the memory pools
854 * @return The capacity of the memory pools
856 * @note This is different to the node count.
858 static uint32_t GetMemoryPoolCapacity();
861 * @brief Returns partial rendering data associated with the node.
862 * @return The partial rendering data
864 PartialRenderingData& GetPartialRenderingData()
866 return mPartialRenderingData;
871 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::IsAnimationPossible
873 bool IsAnimationPossible() const override;
876 * Called by UpdateManager when the node is added.
877 * Creates a new transform component in the transform manager and initialize all the properties
878 * related to the transformation
879 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
881 void CreateTransform(SceneGraph::TransformManager* transformManager);
886 void ResetDirtyFlags(BufferIndex updateBufferIndex);
889 * Update uniform hash
890 * @param[in] bufferIndex The buffer to read from.
892 void UpdateUniformHash(BufferIndex bufferIndex);
896 * Set the parent of a Node.
897 * @param[in] parentNode the new parent.
899 void SetParent(Node& parentNode);
903 * Protected constructor; See also Node::New()
908 * Protected virtual destructor; See also Node::Delete( Node* )
909 * Kept protected to allow destructor chaining from layer
913 private: // from NodeDataProvider
915 * @copydoc NodeDataProvider::GetRenderColor
917 const Vector4& GetRenderColor(BufferIndex bufferIndex) const override
919 return GetWorldColor(bufferIndex);
923 * @copydoc NodeDataProvider::GetNodeUniformMap
925 const UniformMap& GetNodeUniformMap() const override
927 return GetUniformMap();
931 // Delete copy and move
932 Node(const Node&) = delete;
933 Node(Node&&) = delete;
934 Node& operator=(const Node& rhs) = delete;
935 Node& operator=(Node&& rhs) = delete;
938 * Recursive helper to disconnect a Node and its children.
939 * Disconnected Nodes have no parent or children.
940 * @param[in] updateBufferIndex The current update buffer index.
942 void RecursiveDisconnectFromSceneGraph(BufferIndex updateBufferIndex);
944 public: // Default properties
945 using TransformManagerParentsOrigin = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_PARENT_ORIGIN>;
946 using TransformManagerAnchorPoint = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_ANCHOR_POINT>;
947 using TransformManagerSize = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_SIZE>;
948 using TransformManagerPosition = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_POSITION>;
949 using TransformManagerScale = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_SCALE>;
951 TransformManagerData mTransformManagerData;
952 TransformManagerParentsOrigin mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
953 TransformManagerAnchorPoint mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
954 TransformManagerSize mSize; ///< Size is provided for layouting
955 TransformManagerPosition mPosition; ///< Local transform; distance between parent-origin & anchor-point
956 TransformManagerScale mScale; ///< Local transform; scale relative to parent node
957 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
959 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
960 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
961 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
962 AnimatableProperty<Vector4> mUpdateAreaHint; ///< Update area hint is provided for damaged area calculation. (x, y, width, height)
963 ///< This is not animatable. It is just double-buffered. (Because all these bloody properties are).
965 // Inherited properties; read-only from public API
967 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
968 TransformManagerVector3Input mWorldScale;
969 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
970 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
971 InheritedColor mWorldColor; ///< Full inherited color
973 uint64_t mUniformsHash{0u}; ///< Hash of uniform map property values
974 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
975 const uint32_t mId; ///< The Unique ID of the node.
978 static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
980 PartialRenderingData mPartialRenderingData; ///< Cache to determine if this should be rendered again
982 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
983 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
985 RendererContainer mRenderer; ///< Container of renderers; not owned
987 NodeContainer mChildren; ///< Container of children; not owned
989 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
990 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
992 uint32_t mDepthIndex; ///< Depth index of the node
994 // flags, compressed to bitfield
995 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
996 DrawMode::Type mDrawMode : 3; ///< How the Node and its children should be drawn
997 ColorMode mColorMode : 3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
998 ClippingMode::Type mClippingMode : 3; ///< The clipping mode of this node
999 bool mIsRoot : 1; ///< True if the node cannot have a parent
1000 bool mIsLayer : 1; ///< True if the node is a layer
1001 bool mIsCamera : 1; ///< True if the node is a camera
1002 bool mPositionUsesAnchorPoint : 1; ///< True if the node should use the anchor-point when calculating the position
1003 bool mTransparent : 1; ///< True if this node is transparent. This value do not affect children.
1005 // Changes scope, should be at end of class
1006 DALI_LOG_OBJECT_STRING_DECLARATION;
1009 // Messages for Node
1011 inline void SetInheritOrientationMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1013 using LocalType = MessageValue1<Node, bool>;
1015 // Reserve some memory inside the message queue
1016 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1018 // Construct message in the message queue memory; note that delete should not be called on the return value
1019 new(slot) LocalType(&node, &Node::SetInheritOrientation, inherit);
1022 inline void SetParentOriginMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin)
1024 using LocalType = MessageValue1<Node, Vector3>;
1026 // Reserve some memory inside the message queue
1027 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1029 // Construct message in the message queue memory; note that delete should not be called on the return value
1030 new(slot) LocalType(&node, &Node::SetParentOrigin, origin);
1033 inline void SetAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor)
1035 using LocalType = MessageValue1<Node, Vector3>;
1037 // Reserve some memory inside the message queue
1038 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1040 // Construct message in the message queue memory; note that delete should not be called on the return value
1041 new(slot) LocalType(&node, &Node::SetAnchorPoint, anchor);
1044 inline void SetInheritPositionMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1046 using LocalType = MessageValue1<Node, bool>;
1048 // Reserve some memory inside the message queue
1049 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1051 // Construct message in the message queue memory; note that delete should not be called on the return value
1052 new(slot) LocalType(&node, &Node::SetInheritPosition, inherit);
1055 inline void SetInheritScaleMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1057 using LocalType = MessageValue1<Node, bool>;
1059 // Reserve some memory inside the message queue
1060 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1062 // Construct message in the message queue memory; note that delete should not be called on the return value
1063 new(slot) LocalType(&node, &Node::SetInheritScale, inherit);
1066 inline void SetColorModeMessage(EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode)
1068 using LocalType = MessageValue1<Node, ColorMode>;
1070 // Reserve some memory inside the message queue
1071 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1073 // Construct message in the message queue memory; note that delete should not be called on the return value
1074 new(slot) LocalType(&node, &Node::SetColorMode, colorMode);
1077 inline void SetDrawModeMessage(EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode)
1079 using LocalType = MessageValue1<Node, DrawMode::Type>;
1081 // Reserve some memory inside the message queue
1082 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1084 // Construct message in the message queue memory; note that delete should not be called on the return value
1085 new(slot) LocalType(&node, &Node::SetDrawMode, drawMode);
1088 inline void SetTransparentMessage(EventThreadServices& eventThreadServices, const Node& node, bool transparent)
1090 using LocalType = MessageValue1<Node, bool>;
1092 // Reserve some memory inside the message queue
1093 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1095 // Construct message in the message queue memory; note that delete should not be called on the return value
1096 new(slot) LocalType(&node, &Node::SetTransparent, transparent);
1099 inline void DetachRendererMessage(EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer)
1101 using LocalType = MessageValue1<Node, const Renderer*>;
1103 // Reserve some memory inside the message queue
1104 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1106 // Construct message in the message queue memory; note that delete should not be called on the return value
1107 new(slot) LocalType(&node, &Node::RemoveRenderer, &renderer);
1110 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex)
1112 using LocalType = MessageValue1<Node, uint32_t>;
1114 // Reserve some memory inside the message queue
1115 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1117 // Construct message in the message queue memory; note that delete should not be called on the return value
1118 new(slot) LocalType(&node, &Node::SetDepthIndex, depthIndex);
1121 inline void SetClippingModeMessage(EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode)
1123 using LocalType = MessageValue1<Node, ClippingMode::Type>;
1125 // Reserve some memory inside the message queue
1126 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1128 // Construct message in the message queue memory; note that delete should not be called on the return value
1129 new(slot) LocalType(&node, &Node::SetClippingMode, clippingMode);
1132 inline void SetPositionUsesAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint)
1134 using LocalType = MessageValue1<Node, bool>;
1136 // Reserve some memory inside the message queue
1137 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1139 // Construct message in the message queue memory; note that delete should not be called on the return value
1140 new(slot) LocalType(&node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint);
1143 } // namespace SceneGraph
1145 // Template specialisation for OwnerPointer<Node>, because delete is protected
1147 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1149 if(mObject != nullptr)
1151 Dali::Internal::SceneGraph::Node::Delete(mObject);
1155 } // namespace Internal
1157 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1159 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete(Dali::Internal::SceneGraph::Node* pointer)
1161 Dali::Internal::SceneGraph::Node::Delete(pointer);
1165 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H