1 #ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
2 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
5 * Copyright (c) 2021 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/rendering/scene-graph-renderer.h>
34 #include <dali/public-api/actors/actor-enumerations.h>
35 #include <dali/public-api/actors/draw-mode.h>
36 #include <dali/public-api/math/math-utils.h>
37 #include <dali/public-api/math/quaternion.h>
38 #include <dali/public-api/math/vector3.h>
44 // Value types used by messages.
46 struct ParameterType<ColorMode> : public BasicType<ColorMode>
50 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
76 static const ColorMode DEFAULT_COLOR_MODE;
81 * Construct a new Node.
88 static void Delete(Node* node);
91 * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
96 * @return the unique ID of the node
98 uint32_t GetId() const;
103 * Query whether the node is a layer.
104 * @return True if the node is a layer.
112 * Convert a node to a layer.
113 * @return A pointer to the layer, or NULL.
115 virtual Layer* GetLayer()
121 * Mark an node and its sub tree according to the updated flag.
122 * @param[in] updated The updated flag
123 * (used for partial rendering to mark an animating sub tree for example).
125 void SetUpdatedTree(bool updated)
129 for(Node* child : mChildren)
131 child->SetUpdatedTree(updated);
136 * This method sets clipping information on the node based on its hierarchy in the scene-graph.
137 * A value is calculated that can be used during sorting to increase sort speed.
138 * @param[in] clippingId The Clipping ID of the node to set
139 * @param[in] clippingDepth The Clipping Depth of the node to set
140 * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
142 void SetClippingInformation(const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth)
144 // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
145 // If not, if we traverse down a clipping tree and back up, and there is another
146 // node on the parent, this will have a non-zero clipping ID that must be ignored
147 if(clippingDepth > 0u)
149 mClippingDepth = clippingDepth;
151 // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
152 // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
153 // For the same ID, the clipping nodes must be first, so we negate the
154 // clipping enabled flag and set it as the least significant bit.
155 mClippingSortModifier = (clippingId << 1u) | (mClippingMode == ClippingMode::DISABLED ? 1u : 0u);
159 // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
160 mClippingSortModifier = 0u;
163 // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
164 // For this reason we can always update the member variable.
165 mScissorDepth = scissorDepth;
169 * Gets the Clipping ID for this node.
170 * @return The Clipping ID for this node.
172 uint32_t GetClippingId() const
174 return mClippingSortModifier >> 1u;
178 * Gets the Clipping Depth for this node.
179 * @return The Clipping Depth for this node.
181 uint32_t GetClippingDepth() const
183 return mClippingDepth;
187 * Gets the Scissor Clipping Depth for this node.
188 * @return The Scissor Clipping Depth for this node.
190 uint32_t GetScissorDepth() const
192 return mScissorDepth;
196 * Sets the clipping mode for this node.
197 * @param[in] clippingMode The ClippingMode to set
199 void SetClippingMode(const ClippingMode::Type clippingMode)
201 mClippingMode = clippingMode;
205 * Gets the Clipping Mode for this node.
206 * @return The ClippingMode of this node
208 ClippingMode::Type GetClippingMode() const
210 return mClippingMode;
214 * Add a renderer to the node
215 * @param[in] renderer The renderer added to the node
217 void AddRenderer(Renderer* renderer);
220 * Remove a renderer from the node
221 * @param[in] renderer The renderer to be removed
223 void RemoveRenderer(const Renderer* renderer);
226 * Get the renderer at the given index
229 Renderer* GetRendererAt(uint32_t index) const
231 return mRenderer[index];
235 * Retrieve the number of renderers for the node
237 uint32_t GetRendererCount() const
239 return static_cast<uint32_t>(mRenderer.Size());
242 // Containment methods
245 * Query whether a node is the root node. Root nodes cannot have a parent node.
246 * A node becomes a root node, when it is installed by UpdateManager.
247 * @return True if the node is a root node.
255 * Set whether a node is the root node. Root nodes cannot have a parent node.
256 * This method should only be called by UpdateManager.
257 * @pre When isRoot is true, the node must not have a parent.
258 * @param[in] isRoot Whether the node is now a root node.
260 void SetRoot(bool isRoot);
263 * Retrieve the parent of a Node.
264 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
272 * Retrieve the parent of a Node.
273 * @return The parent node, or NULL if the Node has not been added to the scene-graph.
275 const Node* GetParent() const
281 * @return true if the node is connected to SceneGraph
283 bool ConnectedToScene()
285 return IsRoot() || GetParent();
289 * Connect a node to the scene-graph.
290 * @pre A node cannot be added to itself.
291 * @pre The parent node is connected to the scene-graph.
292 * @pre The childNode does not already have a parent.
293 * @pre The childNode is not a root node.
294 * @param[in] childNode The child to add.
296 void ConnectChild(Node* childNode);
299 * Disconnect a child (& its children) from the scene-graph.
300 * @pre childNode is a child of this Node.
301 * @param[in] updateBufferIndex The current update buffer index.
302 * @param[in] childNode The node to disconnect.
304 void DisconnectChild(BufferIndex updateBufferIndex, Node& childNode);
307 * Retrieve the children a Node.
308 * @return The container of children.
310 const NodeContainer& GetChildren() const
316 * Retrieve the children a Node.
317 * @return The container of children.
319 NodeContainer& GetChildren()
327 * Flag that one of the node values has changed in the current frame.
328 * @param[in] flag The flag to set.
330 void SetDirtyFlag(NodePropertyFlags flag)
336 * Flag that all of the node values are dirty.
338 void SetAllDirtyFlags()
340 mDirtyFlags = NodePropertyFlags::ALL;
344 * Query whether a node is dirty.
345 * @return The dirty flags
347 NodePropertyFlags GetDirtyFlags() const;
350 * Query inherited dirty flags.
352 * @param The parentFlags to or with
353 * @return The inherited dirty flags
355 NodePropertyFlags GetInheritedDirtyFlags(NodePropertyFlags parentFlags) const;
358 * Retrieve the parent-origin of the node.
359 * @return The parent-origin.
361 const Vector3& GetParentOrigin() const
363 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
365 return mParentOrigin.Get(0);
368 return Vector3::ZERO;
372 * Sets both the local & base parent-origins of the node.
373 * @param[in] origin The new local & base parent-origins.
375 void SetParentOrigin(const Vector3& origin)
377 mParentOrigin.Set(0, origin);
381 * Retrieve the anchor-point of the node.
382 * @return The anchor-point.
384 const Vector3& GetAnchorPoint() const
386 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
388 return mAnchorPoint.Get(0);
391 return Vector3::ZERO;
395 * Sets both the local & base anchor-points of the node.
396 * @param[in] anchor The new local & base anchor-points.
398 void SetAnchorPoint(const Vector3& anchor)
400 mAnchorPoint.Set(0, anchor);
404 * Retrieve the local position of the node, relative to its parent.
405 * @param[in] bufferIndex The buffer to read from.
406 * @return The local position.
408 const Vector3& GetPosition(BufferIndex bufferIndex) const
410 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
412 return mPosition.Get(bufferIndex);
415 return Vector3::ZERO;
419 * Retrieve the position of the node derived from the position of all its parents.
420 * @return The world position.
422 const Vector3& GetWorldPosition(BufferIndex bufferIndex) const
424 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
426 return mWorldPosition.Get(bufferIndex);
428 return Vector3::ZERO;
432 * Set whether the Node inherits position.
433 * @param[in] inherit True if the parent position is inherited.
435 void SetInheritPosition(bool inherit)
437 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
439 mTransformManagerData.Manager()->SetInheritPosition(mTransformManagerData.Id(), inherit);
444 * Retrieve the local orientation of the node, relative to its parent.
445 * @param[in] bufferIndex The buffer to read from.
446 * @return The local orientation.
448 const Quaternion& GetOrientation(BufferIndex bufferIndex) const
450 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
452 return mOrientation.Get(0);
455 return Quaternion::IDENTITY;
459 * Retrieve the orientation of the node derived from the rotation of all its parents.
460 * @param[in] bufferIndex The buffer to read from.
461 * @return The world rotation.
463 const Quaternion& GetWorldOrientation(BufferIndex bufferIndex) const
465 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
467 return mWorldOrientation.Get(0);
469 return Quaternion::IDENTITY;
473 * Set whether the Node inherits orientation.
474 * @param[in] inherit True if the parent orientation is inherited.
476 void SetInheritOrientation(bool inherit)
478 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
480 mTransformManagerData.Manager()->SetInheritOrientation(mTransformManagerData.Id(), inherit);
485 * Retrieve the local scale of the node, relative to its parent.
486 * @param[in] bufferIndex The buffer to read from.
487 * @return The local scale.
489 const Vector3& GetScale(BufferIndex bufferIndex) const
491 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
493 return mScale.Get(0);
500 * Retrieve the scale of the node derived from the scale of all its parents.
501 * @param[in] bufferIndex The buffer to read from.
502 * @return The world scale.
504 const Vector3& GetWorldScale(BufferIndex bufferIndex) const
506 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
508 return mWorldScale.Get(0);
514 * Set whether the Node inherits scale.
515 * @param inherit True if the Node inherits scale.
517 void SetInheritScale(bool inherit)
519 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
521 mTransformManagerData.Manager()->SetInheritScale(mTransformManagerData.Id(), inherit);
526 * Retrieve the visibility of the node.
527 * @param[in] bufferIndex The buffer to read from.
528 * @return True if the node is visible.
530 bool IsVisible(BufferIndex bufferIndex) const
532 return mVisible[bufferIndex];
536 * Retrieve the opacity of the node.
537 * @param[in] bufferIndex The buffer to read from.
538 * @return The opacity.
540 float GetOpacity(BufferIndex bufferIndex) const
542 return mColor[bufferIndex].a;
546 * Retrieve the color of the node.
547 * @param[in] bufferIndex The buffer to read from.
550 const Vector4& GetColor(BufferIndex bufferIndex) const
552 return mColor[bufferIndex];
556 * Sets the color of the node derived from the color of all its parents.
557 * @param[in] color The world color.
558 * @param[in] updateBufferIndex The current update buffer index.
560 void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
562 mWorldColor.Set(updateBufferIndex, color);
566 * Sets the color of the node derived from the color of all its parents.
567 * This method should only be called when the parents world color is up-to-date.
568 * @pre The node has a parent.
569 * @param[in] updateBufferIndex The current update buffer index.
571 void InheritWorldColor(BufferIndex updateBufferIndex)
573 DALI_ASSERT_DEBUG(mParent != NULL);
576 if(mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA)
578 const Vector4& ownColor = mColor[updateBufferIndex];
579 mWorldColor.Set(updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a);
581 else if(mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR)
583 mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex]);
585 else if(mColorMode == USE_PARENT_COLOR)
587 mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex));
589 else // USE_OWN_COLOR
591 mWorldColor.Set(updateBufferIndex, mColor[updateBufferIndex]);
596 * Copies the previous inherited scale, if this changed in the previous frame.
597 * This method should be called instead of InheritWorldScale i.e. if the inherited scale
598 * does not need to be recalculated in the current frame.
599 * @param[in] updateBufferIndex The current update buffer index.
601 void CopyPreviousWorldColor(BufferIndex updateBufferIndex)
603 mWorldColor.CopyPrevious(updateBufferIndex);
607 * Retrieve the color of the node, possibly derived from the color
608 * of all its parents, depending on the value of mColorMode.
609 * @param[in] bufferIndex The buffer to read from.
610 * @return The world color.
612 const Vector4& GetWorldColor(BufferIndex bufferIndex) const
614 return mWorldColor[bufferIndex];
618 * Set the color mode. This specifies whether the Node uses its own color,
619 * or inherits its parent color.
620 * @param[in] colorMode The new color mode.
622 void SetColorMode(ColorMode colorMode)
624 mColorMode = colorMode;
626 SetDirtyFlag(NodePropertyFlags::COLOR);
630 * Retrieve the color mode.
631 * @return The color mode.
633 ColorMode GetColorMode() const
639 * Retrieve the size of the node.
640 * @param[in] bufferIndex The buffer to read from.
643 const Vector3& GetSize(BufferIndex bufferIndex) const
645 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
650 return Vector3::ZERO;
654 * Retrieve the update size hint of the node.
655 * @return The update size hint.
657 const Vector3& GetUpdateSizeHint() const
659 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
661 return mUpdateSizeHint.Get(0);
664 return Vector3::ZERO;
668 * Retrieve the bounding sphere of the node
669 * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
671 const Vector4& GetBoundingSphere() const
673 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
675 return mTransformManagerData.Manager()->GetBoundingSphere(mTransformManagerData.Id());
678 return Vector4::ZERO;
682 * Retrieve world matrix and size of the node
683 * @param[out] The local to world matrix of the node
684 * @param[out] size The current size of the node
686 void GetWorldMatrixAndSize(Matrix& worldMatrix, Vector3& size) const
688 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
690 mTransformManagerData.Manager()->GetWorldMatrixAndSize(mTransformManagerData.Id(), worldMatrix, size);
695 * Checks if local matrix has changed since last update
696 * @return true if local matrix has changed, false otherwise
698 bool IsLocalMatrixDirty() const
700 return (mTransformManagerData.Id() != INVALID_TRANSFORM_ID) &&
701 (mTransformManagerData.Manager()->IsLocalMatrixDirty(mTransformManagerData.Id()));
705 * Retrieve the cached world-matrix of a node.
706 * @param[in] bufferIndex The buffer to read from.
707 * @return The world-matrix.
709 const Matrix& GetWorldMatrix(BufferIndex bufferIndex) const
711 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
713 return mWorldMatrix.Get(bufferIndex);
716 return Matrix::IDENTITY;
720 * Mark the node as exclusive to a single RenderTask.
721 * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
723 void SetExclusiveRenderTask(RenderTask* renderTask)
725 mExclusiveRenderTask = renderTask;
729 * Query whether the node is exclusive to a single RenderTask.
730 * @return The render-task, or NULL if the Node is not exclusive to a single RenderTask.
732 RenderTask* GetExclusiveRenderTask() const
734 return mExclusiveRenderTask;
738 * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
739 * @param[in] drawMode The new draw-mode to use.
741 void SetDrawMode(const DrawMode::Type& drawMode)
743 mDrawMode = drawMode;
747 * Returns whether node is an overlay or not.
748 * @return True if node is an overlay, false otherwise.
750 DrawMode::Type GetDrawMode() const
755 void SetTransparent(bool transparent)
757 mTransparent = transparent;
760 bool IsTransparent() const
766 * Returns the transform id of the node
767 * @return The transform component id of the node
769 TransformId GetTransformId() const
771 return mTransformManagerData.Id();
775 * Equality operator, checks for identity, not values.
778 bool operator==(const Node* rhs) const
780 return (this == rhs);
784 * @brief Sets the sibling order of the node
785 * @param[in] order The new order
787 void SetDepthIndex(uint32_t depthIndex)
789 if(depthIndex != mDepthIndex)
791 SetDirtyFlag(NodePropertyFlags::DEPTH_INDEX);
792 mDepthIndex = depthIndex;
797 * @brief Get the depth index of the node
798 * @return Current depth index
800 uint32_t GetDepthIndex() const
806 * @brief Sets the boolean which states whether the position should use the anchor-point.
807 * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
809 void SetPositionUsesAnchorPoint(bool positionUsesAnchorPoint)
811 if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint)
813 mPositionUsesAnchorPoint = positionUsesAnchorPoint;
814 mTransformManagerData.Manager()->SetPositionUsesAnchorPoint(mTransformManagerData.Id(), mPositionUsesAnchorPoint);
819 * @brief Sets whether the node is culled or not.
820 * @param[in] bufferIndex The buffer to read from.
821 * @param[in] culled True if the node is culled.
823 void SetCulled(BufferIndex bufferIndex, bool culled)
825 mCulled[bufferIndex] = culled;
829 * @brief Retrieves whether the node is culled or not.
830 * @param[in] bufferIndex The buffer to read from.
831 * @return True if the node is culled.
833 bool IsCulled(BufferIndex bufferIndex) const
835 return mCulled[bufferIndex];
840 * @copydoc UniformMap::Add
842 void AddUniformMapping(const UniformPropertyMapping& map) override;
845 * @copydoc UniformMap::Remove
847 void RemoveUniformMapping(const ConstString& uniformName) override;
850 * @copydoc Dali::Internal::SceneGraph::PropertyOwner::IsAnimationPossible
852 bool IsAnimationPossible() const override;
855 * Prepare the node for rendering.
856 * This is called by the UpdateManager when an object is due to be rendered in the current frame.
857 * @param[in] updateBufferIndex The current update buffer index.
859 void PrepareRender(BufferIndex bufferIndex);
862 * Called by UpdateManager when the node is added.
863 * Creates a new transform component in the transform manager and initialize all the properties
864 * related to the transformation
865 * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
867 void CreateTransform(SceneGraph::TransformManager* transformManager);
872 void ResetDirtyFlags(BufferIndex updateBufferIndex);
876 * Set the parent of a Node.
877 * @param[in] parentNode the new parent.
879 void SetParent(Node& parentNode);
883 * Protected constructor; See also Node::New()
888 * Protected virtual destructor; See also Node::Delete( Node* )
889 * Kept protected to allow destructor chaining from layer
893 private: // from NodeDataProvider
895 * @copydoc NodeDataProvider::GetModelMatrix
897 const Matrix& GetModelMatrix(BufferIndex bufferIndex) const override
899 return GetWorldMatrix(bufferIndex);
903 * @copydoc NodeDataProvider::GetRenderColor
905 const Vector4& GetRenderColor(BufferIndex bufferIndex) const override
907 return GetWorldColor(bufferIndex);
910 public: // From UniformMapDataProvider
912 * @copydoc UniformMapDataProvider::GetUniformMapChanged
914 bool GetUniformMapChanged(BufferIndex bufferIndex) const override
916 return mUniformMapChanged[bufferIndex];
920 * @copydoc UniformMapDataProvider::GetUniformMap
922 const CollectedUniformMap& GetUniformMap(BufferIndex bufferIndex) const override
924 return mCollectedUniformMap[bufferIndex];
932 Node& operator=(const Node& rhs);
935 * Recursive helper to disconnect a Node and its children.
936 * Disconnected Nodes have no parent or children.
937 * @param[in] updateBufferIndex The current update buffer index.
939 void RecursiveDisconnectFromSceneGraph(BufferIndex updateBufferIndex);
941 public: // Default properties
942 using TransformManagerParentsOrigin = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_PARENT_ORIGIN>;
943 using TransformManagerAnchorPoint = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_ANCHOR_POINT>;
944 using TransformManagerSize = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_SIZE>;
945 using TransformManagerPosition = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_POSITION>;
946 using TransformManagerScale = TransformManagerPropertyVector3<TRANSFORM_PROPERTY_SCALE>;
948 TransformManagerData mTransformManagerData;
949 TransformManagerParentsOrigin mParentOrigin; ///< Local transform; the position is relative to this. Sets the Transform flag dirty when changed
950 TransformManagerAnchorPoint mAnchorPoint; ///< Local transform; local center of rotation. Sets the Transform flag dirty when changed
951 TransformManagerSize mSize; ///< Size is provided for layouting
952 TransformManagerPosition mPosition; ///< Local transform; distance between parent-origin & anchor-point
953 TransformManagerScale mScale; ///< Local transform; scale relative to parent node
954 TransformManagerPropertyQuaternion mOrientation; ///< Local transform; rotation relative to parent node
956 AnimatableProperty<bool> mVisible; ///< Visibility can be inherited from the Node hierachy
957 AnimatableProperty<bool> mCulled; ///< True if the node is culled. This is not animatable. It is just double-buffered.
958 AnimatableProperty<Vector4> mColor; ///< Color can be inherited from the Node hierarchy
959 AnimatableProperty<Vector3> mUpdateSizeHint; ///< Update size hint is provided for damaged area calculation. This is not animatable. It is just double-buffered. (Because all these bloody properties are).
961 // Inherited properties; read-only from public API
963 TransformManagerVector3Input mWorldPosition; ///< Full inherited position
964 TransformManagerVector3Input mWorldScale;
965 TransformManagerQuaternionInput mWorldOrientation; ///< Full inherited orientation
966 TransformManagerMatrixInput mWorldMatrix; ///< Full inherited world matrix
967 InheritedColor mWorldColor; ///< Full inherited color
969 uint32_t mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
970 const uint32_t mId; ///< The Unique ID of the node.
973 static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
975 Node* mParent; ///< Pointer to parent node (a child is owned by its parent)
976 RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
978 RendererContainer mRenderer; ///< Container of renderers; not owned
980 NodeContainer mChildren; ///< Container of children; not owned
982 CollectedUniformMap mCollectedUniformMap[2]; ///< Uniform maps of the node
983 uint32_t mUniformMapChanged[2]; ///< Records if the uniform map has been altered this frame
984 uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
985 uint32_t mScissorDepth; ///< The number of scissor clipping nodes deep this node is
987 uint32_t mDepthIndex; ///< Depth index of the node
989 // flags, compressed to bitfield
990 NodePropertyFlags mDirtyFlags; ///< Dirty flags for each of the Node properties
991 uint32_t mRegenerateUniformMap : 2; ///< Indicate if the uniform map has to be regenerated this frame
992 DrawMode::Type mDrawMode : 3; ///< How the Node and its children should be drawn
993 ColorMode mColorMode : 3; ///< Determines whether mWorldColor is inherited, 2 bits is enough
994 ClippingMode::Type mClippingMode : 3; ///< The clipping mode of this node
995 bool mIsRoot : 1; ///< True if the node cannot have a parent
996 bool mIsLayer : 1; ///< True if the node is a layer
997 bool mPositionUsesAnchorPoint : 1; ///< True if the node should use the anchor-point when calculating the position
998 bool mTransparent : 1; ///< True if this node is transparent. This value do not affect children.
1000 // Changes scope, should be at end of class
1001 DALI_LOG_OBJECT_STRING_DECLARATION;
1004 // Messages for Node
1006 inline void SetInheritOrientationMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1008 using LocalType = MessageValue1<Node, bool>;
1010 // Reserve some memory inside the message queue
1011 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1013 // Construct message in the message queue memory; note that delete should not be called on the return value
1014 new(slot) LocalType(&node, &Node::SetInheritOrientation, inherit);
1017 inline void SetParentOriginMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin)
1019 using LocalType = MessageValue1<Node, Vector3>;
1021 // Reserve some memory inside the message queue
1022 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1024 // Construct message in the message queue memory; note that delete should not be called on the return value
1025 new(slot) LocalType(&node, &Node::SetParentOrigin, origin);
1028 inline void SetAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor)
1030 using LocalType = MessageValue1<Node, Vector3>;
1032 // Reserve some memory inside the message queue
1033 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1035 // Construct message in the message queue memory; note that delete should not be called on the return value
1036 new(slot) LocalType(&node, &Node::SetAnchorPoint, anchor);
1039 inline void SetInheritPositionMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1041 using LocalType = MessageValue1<Node, bool>;
1043 // Reserve some memory inside the message queue
1044 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1046 // Construct message in the message queue memory; note that delete should not be called on the return value
1047 new(slot) LocalType(&node, &Node::SetInheritPosition, inherit);
1050 inline void SetInheritScaleMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
1052 using LocalType = MessageValue1<Node, bool>;
1054 // Reserve some memory inside the message queue
1055 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1057 // Construct message in the message queue memory; note that delete should not be called on the return value
1058 new(slot) LocalType(&node, &Node::SetInheritScale, inherit);
1061 inline void SetColorModeMessage(EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode)
1063 using LocalType = MessageValue1<Node, ColorMode>;
1065 // Reserve some memory inside the message queue
1066 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1068 // Construct message in the message queue memory; note that delete should not be called on the return value
1069 new(slot) LocalType(&node, &Node::SetColorMode, colorMode);
1072 inline void SetDrawModeMessage(EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode)
1074 using LocalType = MessageValue1<Node, DrawMode::Type>;
1076 // Reserve some memory inside the message queue
1077 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1079 // Construct message in the message queue memory; note that delete should not be called on the return value
1080 new(slot) LocalType(&node, &Node::SetDrawMode, drawMode);
1083 inline void SetTransparentMessage(EventThreadServices& eventThreadServices, const Node& node, bool transparent)
1085 using LocalType = MessageValue1<Node, bool>;
1087 // Reserve some memory inside the message queue
1088 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1090 // Construct message in the message queue memory; note that delete should not be called on the return value
1091 new(slot) LocalType(&node, &Node::SetTransparent, transparent);
1094 inline void DetachRendererMessage(EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer)
1096 using LocalType = MessageValue1<Node, const Renderer*>;
1098 // Reserve some memory inside the message queue
1099 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1101 // Construct message in the message queue memory; note that delete should not be called on the return value
1102 new(slot) LocalType(&node, &Node::RemoveRenderer, &renderer);
1105 inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex)
1107 using LocalType = MessageValue1<Node, uint32_t>;
1109 // Reserve some memory inside the message queue
1110 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1112 // Construct message in the message queue memory; note that delete should not be called on the return value
1113 new(slot) LocalType(&node, &Node::SetDepthIndex, depthIndex);
1116 inline void SetClippingModeMessage(EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode)
1118 using LocalType = MessageValue1<Node, ClippingMode::Type>;
1120 // Reserve some memory inside the message queue
1121 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1123 // Construct message in the message queue memory; note that delete should not be called on the return value
1124 new(slot) LocalType(&node, &Node::SetClippingMode, clippingMode);
1127 inline void SetPositionUsesAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint)
1129 using LocalType = MessageValue1<Node, bool>;
1131 // Reserve some memory inside the message queue
1132 uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
1134 // Construct message in the message queue memory; note that delete should not be called on the return value
1135 new(slot) LocalType(&node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint);
1138 } // namespace SceneGraph
1140 // Template specialisation for OwnerPointer<Node>, because delete is protected
1142 inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
1144 if(mObject != nullptr)
1146 Dali::Internal::SceneGraph::Node::Delete(mObject);
1150 } // namespace Internal
1152 // Template specialisations for OwnerContainer<Node*>, because delete is protected
1154 inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete(Dali::Internal::SceneGraph::Node* pointer)
1156 Dali::Internal::SceneGraph::Node::Delete(pointer);
1160 #endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H