Merge "Added memory pool logging" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / node.h
index 0102877..be26b7a 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_NODE_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_NODE_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_NODE_H
+#define DALI_INTERNAL_SCENE_GRAPH_NODE_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/actors/actor-enumerations.h>
-#include <dali/public-api/actors/draw-mode.h>
-#include <dali/public-api/common/set-wrapper.h>
-#include <dali/public-api/math/quaternion.h>
-#include <dali/public-api/math/math-utils.h>
-#include <dali/public-api/math/vector3.h>
+#include <dali/integration-api/debug.h>
 #include <dali/internal/common/message.h>
+#include <dali/internal/event/common/event-thread-services.h>
+#include <dali/internal/render/data-providers/node-data-provider.h>
 #include <dali/internal/update/common/animatable-property.h>
+#include <dali/internal/update/common/inherited-property.h>
 #include <dali/internal/update/common/property-owner.h>
-#include <dali/internal/update/common/property-vector3.h>
 #include <dali/internal/update/common/scene-graph-buffers.h>
-#include <dali/internal/update/common/inherited-property.h>
-#include <dali/integration-api/debug.h>
+#include <dali/internal/update/manager/transform-manager-property.h>
+#include <dali/internal/update/manager/transform-manager.h>
 #include <dali/internal/update/nodes/node-declarations.h>
-#include <dali/internal/update/node-attachments/node-attachment-declarations.h>
-#include <dali/internal/render/renderers/render-data-provider.h>
+#include <dali/internal/update/nodes/node-helper.h>
+#include <dali/internal/update/nodes/partial-rendering-data.h>
+#include <dali/internal/update/rendering/scene-graph-renderer.h>
+#include <dali/public-api/actors/actor-enumerations.h>
+#include <dali/public-api/actors/draw-mode.h>
+#include <dali/public-api/math/math-utils.h>
+#include <dali/public-api/math/quaternion.h>
+#include <dali/public-api/math/vector3.h>
 
 namespace Dali
 {
-
 namespace Internal
 {
-
-// value types used by messages
-template <> struct ParameterType< ColorMode > : public BasicType< ColorMode > {};
-template <> struct ParameterType< PositionInheritanceMode > : public BasicType< PositionInheritanceMode > {};
-template <> struct ParameterType< SizeMode > : public BasicType< SizeMode > {};
+// Value types used by messages.
+template<>
+struct ParameterType<ColorMode> : public BasicType<ColorMode>
+{
+};
+template<>
+struct ParameterType<ClippingMode::Type> : public BasicType<ClippingMode::Type>
+{
+};
 
 namespace SceneGraph
 {
-
 class DiscardQueue;
 class Layer;
-class NodeAttachment;
 class RenderTask;
 class UpdateManager;
-
-/**
- * Flag whether property has changed, during the Update phase.
- */
-enum NodePropertyFlags
-{
-  NothingFlag          = 0x000,
-  TransformFlag        = 0x001,
-  VisibleFlag          = 0x002,
-  ColorFlag            = 0x004,
-  SizeFlag             = 0x008,
-  OverlayFlag          = 0x010,
-  SortModifierFlag     = 0x020,
-  ChildDeletedFlag     = 0x040
-};
-
-static const int AllFlags = ( ChildDeletedFlag << 1 ) - 1; // all the flags
-
-/**
- * Size is not inherited.
- * VisibleFlag is inherited so that attachments can be synchronized with nodes after they become visible
- */
-static const int InheritedDirtyFlags = TransformFlag | VisibleFlag | ColorFlag | OverlayFlag;
+class Node;
 
 // Flags which require the scene renderable lists to be updated
-static const int RenderableUpdateFlags = TransformFlag | SortModifierFlag | ChildDeletedFlag;
+static NodePropertyFlags RenderableUpdateFlags = NodePropertyFlags::TRANSFORM | NodePropertyFlags::CHILD_DELETED;
 
 /**
  * Node is the base class for all nodes in the Scene Graph.
- * Each node provides a transformation which applies to the node and its children.
- * Node data is double-buffered. This allows an update thread to modify node data, without interferring
- * with another thread reading the values from the previous update traversal.
+ *
+ * Each node provides a transformation which applies to the node and
+ * its children.  Node data is double-buffered. This allows an update
+ * thread to modify node data, without interferring with another
+ * thread reading the values from the previous update traversal.
  */
-class Node : public PropertyOwner, public RenderDataProvider
+class Node : public PropertyOwner, public NodeDataProvider
 {
 public:
-
   // Defaults
-  static const PositionInheritanceMode DEFAULT_POSITION_INHERITANCE_MODE;
   static const ColorMode DEFAULT_COLOR_MODE;
-  static const SizeMode DEFAULT_SIZE_MODE;
 
   // Creation methods
 
@@ -105,79 +86,172 @@ public:
   static Node* New();
 
   /**
-   * Virtual destructor
+   * Deletes a Node.
    */
-  virtual ~Node();
+  static void Delete(Node* node);
 
   /**
-   * When a Node is marked "active" it has been disconnected, but its properties have been modified.
-   * @note An inactive Node will be skipped during the UpdateManager ResetProperties stage.
-   * @param[in] isActive True if the Node is active.
+   * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
    */
-  void SetActive( bool isActive )
+  void OnDestroy();
+
+  /**
+   * @return the unique ID of the node
+   */
+  uint32_t GetId() const;
+
+  // Layer interface
+
+  /**
+   * Query whether the node is a layer.
+   * @return True if the node is a layer.
+   */
+  bool IsLayer() const
   {
-    mIsActive = isActive;
+    return mIsLayer;
   }
 
   /**
-   * Query whether the Node is active.
-   * @return True if the Node is active.
+   * Convert a node to a layer.
+   * @return A pointer to the layer, or NULL.
    */
-  bool IsActive() const
+  virtual Layer* GetLayer()
   {
-    return mIsActive;
+    return nullptr;
   }
 
+  // Camera interface
+
   /**
-   * Called during UpdateManager::DestroyNode shortly before Node is destroyed.
+   * Query whether the node is a camera.
+   * @return True if the node is a camera.
    */
-  void OnDestroy();
+  bool IsCamera() const
+  {
+    return mIsCamera;
+  }
 
-  // Layer interface
+  /**
+   * Mark an node and its sub tree according to the updated flag.
+   * @param[in] updated The updated flag
+   * (used for partial rendering to mark an animating sub tree for example).
+   */
+  void SetUpdatedTree(bool updated)
+  {
+    mUpdated = updated;
+
+    for(Node* child : mChildren)
+    {
+      child->SetUpdatedTree(updated);
+    }
+  }
 
   /**
-   * Query whether the node is a layer.
-   * @return True if the node is a layer.
+   * This method sets clipping information on the node based on its hierarchy in the scene-graph.
+   * A value is calculated that can be used during sorting to increase sort speed.
+   * @param[in] clippingId The Clipping ID of the node to set
+   * @param[in] clippingDepth The Clipping Depth of the node to set
+   * @param[in] scissorDepth The Scissor Clipping Depth of the node to set
    */
-  bool IsLayer()
+  void SetClippingInformation(const uint32_t clippingId, const uint32_t clippingDepth, const uint32_t scissorDepth)
   {
-    return (GetLayer() != NULL);
+    // We only set up the sort value if we have a stencil clipping depth, IE. At least 1 clipping node has been hit.
+    // If not, if we traverse down a clipping tree and back up, and there is another
+    // node on the parent, this will have a non-zero clipping ID that must be ignored
+    if(clippingDepth > 0u)
+    {
+      mClippingDepth = clippingDepth;
+
+      // Calculate the sort value here on write, as when read (during sort) it may be accessed several times.
+      // The items must be sorted by Clipping ID first (so the ID is kept in the most-significant bits).
+      // For the same ID, the clipping nodes must be first, so we negate the
+      // clipping enabled flag and set it as the least significant bit.
+      mClippingSortModifier = (clippingId << 1u) | (mClippingMode == ClippingMode::DISABLED ? 1u : 0u);
+    }
+    else
+    {
+      // If we do not have a clipping depth, then set this to 0 so we do not have a Clipping ID either.
+      mClippingSortModifier = 0u;
+    }
+
+    // The scissor depth does not modify the clipping sort modifier (as scissor clips are 2D only).
+    // For this reason we can always update the member variable.
+    mScissorDepth = scissorDepth;
   }
 
   /**
-   * Convert a node to a layer.
-   * @return A pointer to the layer, or NULL.
+   * Gets the Clipping ID for this node.
+   * @return The Clipping ID for this node.
    */
-  virtual Layer* GetLayer()
+  uint32_t GetClippingId() const
+  {
+    return mClippingSortModifier >> 1u;
+  }
+
+  /**
+   * Gets the Clipping Depth for this node.
+   * @return The Clipping Depth for this node.
+   */
+  uint32_t GetClippingDepth() const
   {
-    return NULL;
+    return mClippingDepth;
   }
 
-  // Attachments
+  /**
+   * Gets the Scissor Clipping Depth for this node.
+   * @return The Scissor Clipping Depth for this node.
+   */
+  uint32_t GetScissorDepth() const
+  {
+    return mScissorDepth;
+  }
 
   /**
-   * Attach an object to this Node; This should only be done by UpdateManager::AttachToNode.
-   * @pre The Node does not already have an attachment.
-   * @param[in] attachment The object to attach.
+   * Sets the clipping mode for this node.
+   * @param[in] clippingMode The ClippingMode to set
    */
-  void Attach( NodeAttachment& attachment );
+  void SetClippingMode(const ClippingMode::Type clippingMode)
+  {
+    mClippingMode = clippingMode;
+    SetDirtyFlag(NodePropertyFlags::TRANSFORM);
+  }
 
   /**
-   * Query the node if it has an attachment.
-   * @return True if it has an attachment.
+   * Gets the Clipping Mode for this node.
+   * @return The ClippingMode of this node
    */
-  bool HasAttachment() const
+  ClippingMode::Type GetClippingMode() const
   {
-    return mAttachment;
+    return mClippingMode;
   }
 
   /**
-   * Retreive the object attached to this node.
-   * @return The attachment.
+   * Add a renderer to the node
+   * @param[in] renderer The renderer added to the node
    */
-  NodeAttachment& GetAttachment() const
+  void AddRenderer(Renderer* renderer);
+
+  /**
+   * Remove a renderer from the node
+   * @param[in] renderer The renderer to be removed
+   */
+  void RemoveRenderer(const Renderer* renderer);
+
+  /*
+   * Get the renderer at the given index
+   * @param[in] index
+   */
+  Renderer* GetRendererAt(uint32_t index) const
   {
-    return *mAttachment;
+    return mRenderer[index];
+  }
+
+  /**
+   * Retrieve the number of renderers for the node
+   */
+  uint32_t GetRendererCount() const
+  {
+    return static_cast<uint32_t>(mRenderer.Size());
   }
 
   // Containment methods
@@ -219,26 +293,30 @@ public:
   }
 
   /**
+   * @return true if the node is connected to SceneGraph
+   */
+  bool ConnectedToScene()
+  {
+    return IsRoot() || GetParent();
+  }
+
+  /**
    * Connect a node to the scene-graph.
    * @pre A node cannot be added to itself.
    * @pre The parent node is connected to the scene-graph.
    * @pre The childNode does not already have a parent.
    * @pre The childNode is not a root node.
    * @param[in] childNode The child to add.
-   * @param[in] index to insert at, if not supplied or -1 it will be appended
-   *
    */
-  void ConnectChild( Node* childNode, int index = -1);
+  void ConnectChild(Node* childNode);
 
   /**
    * Disconnect a child (& its children) from the scene-graph.
    * @pre childNode is a child of this Node.
    * @param[in] updateBufferIndex The current update buffer index.
    * @param[in] childNode The node to disconnect.
-   * @param[in] connectedNodes Disconnected Node attachments should be removed from here.
-   * @param[in] disconnectedNodes Disconnected Node attachments should be added here.
    */
-  void DisconnectChild( BufferIndex updateBufferIndex, Node& childNode, std::set<Node*>& connectedNodes,  std::set<Node*>& disconnectedNodes );
+  void DisconnectChild(BufferIndex updateBufferIndex, Node& childNode);
 
   /**
    * Retrieve the children a Node.
@@ -274,23 +352,22 @@ public:
    */
   void SetAllDirtyFlags()
   {
-    mDirtyFlags = AllFlags;
+    mDirtyFlags = NodePropertyFlags::ALL;
   }
 
   /**
    * Query whether a node is dirty.
    * @return The dirty flags
    */
-  int GetDirtyFlags() const;
+  NodePropertyFlags GetDirtyFlags() const;
 
   /**
-   * Query whether a node is clean.
-   * @return True if the node is clean.
+   * Query inherited dirty flags.
+   *
+   * @param The parentFlags to or with
+   * @return The inherited dirty flags
    */
-  bool IsClean() const
-  {
-    return ( NothingFlag == GetDirtyFlags() );
-  }
+  NodePropertyFlags GetInheritedDirtyFlags(NodePropertyFlags parentFlags) const;
 
   /**
    * Retrieve the parent-origin of the node.
@@ -298,7 +375,12 @@ public:
    */
   const Vector3& GetParentOrigin() const
   {
-    return mParentOrigin.mValue;
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mParentOrigin.Get(0);
+    }
+
+    return Vector3::ZERO;
   }
 
   /**
@@ -307,8 +389,7 @@ public:
    */
   void SetParentOrigin(const Vector3& origin)
   {
-    mParentOrigin.mValue = origin;
-    mParentOrigin.OnSet();
+    mParentOrigin.Set(0, origin);
   }
 
   /**
@@ -317,7 +398,12 @@ public:
    */
   const Vector3& GetAnchorPoint() const
   {
-    return mAnchorPoint.mValue;
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mAnchorPoint.Get(0);
+    }
+
+    return Vector3::ZERO;
   }
 
   /**
@@ -326,8 +412,7 @@ public:
    */
   void SetAnchorPoint(const Vector3& anchor)
   {
-    mAnchorPoint.mValue = anchor;
-    mAnchorPoint.OnSet();
+    mAnchorPoint.Set(0, anchor);
   }
 
   /**
@@ -337,161 +422,37 @@ public:
    */
   const Vector3& GetPosition(BufferIndex bufferIndex) const
   {
-    return mPosition[bufferIndex];
-  }
-
-  /**
-   * Sets both the local & base positions of the node.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] position The new local & base position.
-   */
-  void BakePosition(BufferIndex updateBufferIndex, const Vector3& position)
-  {
-    mPosition.Bake( updateBufferIndex, position );
-  }
-
-  /**
-   * Sets the world of the node derived from the position of all its parents.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] position The world position.
-   */
-  void SetWorldPosition( BufferIndex updateBufferIndex, const Vector3& position )
-  {
-    mWorldPosition.Set( updateBufferIndex, position );
-  }
-
-  /**
-   * Sets the position of the node derived from the position of all its parents.
-   * This method should only be called when the parent's world position is up-to-date.
-   * With a non-central anchor-point, the local orientation and scale affects the world position.
-   * Therefore the world orientation & scale must be updated before the world position.
-   * @pre The node has a parent.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void InheritWorldPosition(BufferIndex updateBufferIndex)
-  {
-    DALI_ASSERT_DEBUG(mParent != NULL);
-
-    switch( mPositionInheritanceMode )
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
     {
-      case INHERIT_PARENT_POSITION  : ///@see Dali::PositionInheritanceMode for how these modes are expected to work
-      {
-        Vector3 finalPosition(-0.5f, -0.5f, -0.5f);
-
-        finalPosition += mParentOrigin.mValue;
-        finalPosition *= mParent->GetSize(updateBufferIndex);
-        finalPosition += mPosition[updateBufferIndex];
-        finalPosition *= mParent->GetWorldScale(updateBufferIndex);
-        const Quaternion& parentWorldOrientation = mParent->GetWorldOrientation(updateBufferIndex);
-        if(!parentWorldOrientation.IsIdentity())
-        {
-          finalPosition *= parentWorldOrientation;
-        }
-
-        // check if a node needs to be offsetted locally (only applies when AnchorPoint is not central)
-        // dont use operator== as that does a slower comparison (and involves function calls)
-        Vector3 localOffset(0.5f, 0.5f, 0.5f);    // AnchorPoint::CENTER
-        localOffset -= mAnchorPoint.mValue;
-
-        if( ( fabsf( localOffset.x ) >= Math::MACHINE_EPSILON_0 ) ||
-            ( fabsf( localOffset.y ) >= Math::MACHINE_EPSILON_0 ) ||
-            ( fabsf( localOffset.z ) >= Math::MACHINE_EPSILON_0 ) )
-        {
-          localOffset *= mSize[updateBufferIndex];
-
-          Vector3 scale = mWorldScale[updateBufferIndex];
-          if(GetTransmitGeometryScaling())
-          {
-            // Remove geometry scaling to get back to actor scale
-            scale /= mGeometryScale;
-          }
-          // Also pick up sign of local scale
-          if (mScale[updateBufferIndex].x < 0.0f)
-          {
-            scale.x = -scale.x;
-          }
-          if (mScale[updateBufferIndex].y < 0.0f)
-          {
-            scale.y = -scale.y;
-          }
-          if (mScale[updateBufferIndex].z < 0.0f)
-          {
-            scale.z = -scale.z;
-          }
-
-          // If the anchor-point is not central, then position is affected by the local orientation & scale
-          localOffset *= scale;
-          const Quaternion& localWorldOrientation = mWorldOrientation[updateBufferIndex];
-          if(!localWorldOrientation.IsIdentity())
-          {
-            localOffset *= localWorldOrientation;
-          }
-          finalPosition += localOffset;
-        }
-
-        finalPosition += mParent->GetWorldPosition(updateBufferIndex);
-        mWorldPosition.Set( updateBufferIndex, finalPosition );
-        break;
-      }
-      case USE_PARENT_POSITION_PLUS_LOCAL_POSITION :
-      {
-        // copy parents position plus local transform
-        mWorldPosition.Set( updateBufferIndex, mParent->GetWorldPosition(updateBufferIndex) + mPosition[updateBufferIndex] );
-        break;
-      }
-      case USE_PARENT_POSITION :
-      {
-        // copy parents position
-        mWorldPosition.Set( updateBufferIndex, mParent->GetWorldPosition(updateBufferIndex) );
-        break;
-      }
-      case DONT_INHERIT_POSITION :
-      {
-        // use local position as world position
-        mWorldPosition.Set( updateBufferIndex, mPosition[updateBufferIndex] );
-        break;
-      }
+      return mPosition.Get(bufferIndex);
     }
-  }
 
-  /**
-   * Copies the previous inherited position, if this changed in the previous frame.
-   * This method should be called instead of InheritWorldPosition i.e. if the inherited position
-   * does not need to be recalculated in the current frame.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void CopyPreviousWorldPosition( BufferIndex updateBufferIndex )
-  {
-    mWorldPosition.CopyPrevious( updateBufferIndex );
+    return Vector3::ZERO;
   }
 
   /**
    * Retrieve the position of the node derived from the position of all its parents.
    * @return The world position.
    */
-  const Vector3& GetWorldPosition( BufferIndex bufferIndex ) const
+  const Vector3& GetWorldPosition(BufferIndex bufferIndex) const
   {
-    return mWorldPosition[bufferIndex];
-  }
-
-  /**
-   * Set the position inheritance mode.
-   * @see Dali::Actor::PositionInheritanceMode
-   * @param[in] mode The new position inheritance mode.
-   */
-  void SetPositionInheritanceMode( PositionInheritanceMode mode )
-  {
-    mPositionInheritanceMode = mode;
-
-    SetDirtyFlag(TransformFlag);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldPosition.Get(bufferIndex);
+    }
+    return Vector3::ZERO;
   }
 
   /**
-   * @return The position inheritance mode.
+   * Set whether the Node inherits position.
+   * @param[in] inherit True if the parent position is inherited.
    */
-  PositionInheritanceMode GetPositionInheritanceMode() const
+  void SetInheritPosition(bool inherit)
   {
-    return mPositionInheritanceMode;
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      mTransformManagerData.Manager()->SetInheritPosition(mTransformManagerData.Id(), inherit);
+    }
   }
 
   /**
@@ -501,62 +462,12 @@ public:
    */
   const Quaternion& GetOrientation(BufferIndex bufferIndex) const
   {
-    return mOrientation[bufferIndex];
-  }
-
-  /**
-   * Sets both the local & base orientations of the node.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] orientation The new local & base orientation.
-   */
-  void BakeOrientation(BufferIndex updateBufferIndex, const Quaternion& orientation)
-  {
-    mOrientation.Bake( updateBufferIndex, orientation );
-  }
-
-  /**
-   * Sets the orientation of the node derived from the rotation of all its parents.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] orientation The world orientation.
-   */
-  void SetWorldOrientation( BufferIndex updateBufferIndex, const Quaternion& orientation )
-  {
-    mWorldOrientation.Set( updateBufferIndex, orientation );
-  }
-
-  /**
-   * Sets the orientation of the node derived from the rotation of all its parents.
-   * This method should only be called when the parents world orientation is up-to-date.
-   * @pre The node has a parent.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void InheritWorldOrientation( BufferIndex updateBufferIndex )
-  {
-    DALI_ASSERT_DEBUG(mParent != NULL);
-
-    const Quaternion& localOrientation = mOrientation[updateBufferIndex];
-
-    if(localOrientation.IsIdentity())
-    {
-      mWorldOrientation.Set( updateBufferIndex, mParent->GetWorldOrientation(updateBufferIndex) );
-    }
-    else
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
     {
-      Quaternion finalOrientation( mParent->GetWorldOrientation(updateBufferIndex) );
-      finalOrientation *= localOrientation;
-      mWorldOrientation.Set( updateBufferIndex, finalOrientation );
+      return mOrientation.Get(0);
     }
-  }
 
-  /**
-   * Copies the previous inherited orientation, if this changed in the previous frame.
-   * This method should be called instead of InheritWorldOrientation i.e. if the inherited orientation
-   * does not need to be recalculated in the current frame.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void CopyPreviousWorldOrientation( BufferIndex updateBufferIndex )
-  {
-    mWorldOrientation.CopyPrevious( updateBufferIndex );
+    return Quaternion::IDENTITY;
   }
 
   /**
@@ -564,9 +475,13 @@ public:
    * @param[in] bufferIndex The buffer to read from.
    * @return The world rotation.
    */
-  const Quaternion& GetWorldOrientation( BufferIndex bufferIndex ) const
+  const Quaternion& GetWorldOrientation(BufferIndex bufferIndex) const
   {
-    return mWorldOrientation[bufferIndex];
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldOrientation.Get(0);
+    }
+    return Quaternion::IDENTITY;
   }
 
   /**
@@ -575,161 +490,25 @@ public:
    */
   void SetInheritOrientation(bool inherit)
   {
-    if (inherit != mInheritOrientation)
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
     {
-      mInheritOrientation = inherit;
-
-      SetDirtyFlag(TransformFlag);
+      mTransformManagerData.Manager()->SetInheritOrientation(mTransformManagerData.Id(), inherit);
     }
   }
 
   /**
-   * Query whether the node inherits orientation from its parent.
-   * @return True if the parent orientation is inherited.
-   */
-  bool IsOrientationInherited() const
-  {
-    return mInheritOrientation;
-  }
-
-  /**
-   * @brief Defines how a child actor's size is affected by its parent's size.
-   * @param[in] mode The size relative to parent mode to use.
-   */
-  void SetSizeMode( SizeMode mode )
-  {
-    if ( mode != mSizeMode )
-    {
-      mSizeMode = mode;
-
-      SetDirtyFlag( TransformFlag );
-    }
-  }
-
-  /**
-   * Query how the child actor's size is affected by its parent's size.
-   * @return The size relative to parent mode in use.
-   */
-  SizeMode GetSizeMode() const
-  {
-    return mSizeMode;
-  }
-
-  /**
-   * Sets the factor of the parents size used for the child actor.
-   * Note: Only used for certain SizeModes.
-   * @param[in] factor The vector to multiply the parents size by to get the childs size.
-   */
-  void SetSizeModeFactor( const Vector3& factor )
-  {
-    mSizeModeFactor = factor;
-
-    SetDirtyFlag( TransformFlag );
-  }
-
-  /**
-   * Gets the factor of the parents size used for the child actor.
-   * Note: Only used for certain SizeModes.
-   * @return The vector being used to multiply the parents size by to get the childs size.
-   */
-  const Vector3& GetSizeModeFactor() const
-  {
-    return mSizeModeFactor;
-  }
-
-  /**
-   * Set the initial volume of the node. Used for calculating geometry scaling
-   * as the node size is changed  when transmitGeometryScaling is set to true.
-   *
-   * This property is not animatable.
-   *
-   * @param[in] volume The initial volume of this nodes meshes & children
-   */
-  void SetInitialVolume( const Vector3& volume )
-  {
-    mInitialVolume = volume;
-    SetDirtyFlag(SizeFlag);
-  }
-
-  /**
-   * Get the initial volume.  Used for calculating geometry scaling
-   * when TransmitGeometryScaling is true (i.e., the scaling is baked
-   * into the node tranform)
-   *
-   * @return The initial volume of this node and children.
-   */
-  Vector3 GetInitialVolume()
-  {
-    return mInitialVolume;
-  }
-
-  /**
-   * Sets whether the geometry scaling should be applied to the node
-   * (In which case, set the initial scale using SetInitialVolume()).
-   *
-   * If it is applied to the node, then the attachments are not scaled,
-   * as the scaling is then already baked into the node transform.
-   *
-   * @param[in] transmitGeometryScaling true if scaling is to be applied
-   * to the node.
-   */
-  void SetTransmitGeometryScaling(bool transmitGeometryScaling)
-  {
-    mTransmitGeometryScaling = transmitGeometryScaling;
-    SetDirtyFlag(SizeFlag);
-  }
-
-  /**
-   * Find out whether the node allows geometry scaling to be transmitted to its children.
-   * @return true if transmitted.
-   */
-  bool GetTransmitGeometryScaling() const
-  {
-    return mTransmitGeometryScaling;
-  }
-
-  /**
    * Retrieve the local scale of the node, relative to its parent.
    * @param[in] bufferIndex The buffer to read from.
    * @return The local scale.
    */
   const Vector3& GetScale(BufferIndex bufferIndex) const
   {
-    return mScale[bufferIndex];
-  }
-
-  /**
-   * Sets the scale of the node derived from the scale of all its parents and a pre-scale
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] scale The world scale.
-   */
-  void SetWorldScale(BufferIndex updateBufferIndex, const Vector3& scale)
-  {
-    mWorldScale.Set( updateBufferIndex, mGeometryScale * scale );
-  }
-
-  /**
-   * Sets the scale of the node derived from the scale of all its parents and a pre-scale.
-   * This method should only be called when the parents world scale is up-to-date.
-   * @pre The node has a parent.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void InheritWorldScale(BufferIndex updateBufferIndex)
-  {
-    DALI_ASSERT_DEBUG(mParent != NULL);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mScale.Get(0);
+    }
 
-    mWorldScale.Set( updateBufferIndex, mParent->GetWorldScale(updateBufferIndex) * mGeometryScale * mScale[updateBufferIndex] );
-  }
-
-  /**
-   * Copies the previous inherited scale, if this changed in the previous frame.
-   * This method should be called instead of InheritWorldScale i.e. if the inherited scale
-   * does not need to be recalculated in the current frame.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void CopyPreviousWorldScale( BufferIndex updateBufferIndex )
-  {
-    mWorldScale.CopyPrevious( updateBufferIndex );
+    return Vector3::ONE;
   }
 
   /**
@@ -737,65 +516,28 @@ public:
    * @param[in] bufferIndex The buffer to read from.
    * @return The world scale.
    */
-  const Vector3& GetWorldScale( BufferIndex bufferIndex ) const
+  const Vector3& GetWorldScale(BufferIndex bufferIndex) const
   {
-    return mWorldScale[bufferIndex];
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldScale.Get(0);
+    }
+    return Vector3::ONE;
   }
 
   /**
    * Set whether the Node inherits scale.
    * @param inherit True if the Node inherits scale.
    */
-  void SetInheritScale( bool inherit )
+  void SetInheritScale(bool inherit)
   {
-    if( inherit != mInheritScale )
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
     {
-      mInheritScale = inherit;
-
-      SetDirtyFlag( TransformFlag );
+      mTransformManagerData.Manager()->SetInheritScale(mTransformManagerData.Id(), inherit);
     }
   }
 
   /**
-   * Query whether the Node inherits scale.
-   * @return if scale is inherited
-   */
-  bool IsScaleInherited() const
-  {
-    return mInheritScale;
-  }
-
-  /**
-   * Sets a geometry scale, calculated when TransmitGeometryScaling is true.
-   * Must only be used from render thread.
-   * @param[in] geometryScale The geometry scale value
-   */
-  void SetGeometryScale(Vector3 geometryScale)
-  {
-    mGeometryScale = geometryScale;
-
-    SetDirtyFlag( TransformFlag );
-  }
-
-  /**
-   * Retrieve the geometry scale, calculated when TransmitGeometryScaling is true.
-   * @return The geometry scale value.
-   */
-  const Vector3& GetGeometryScale() const
-  {
-    return mGeometryScale;
-  }
-
-  /**
-   * Copies the previously used size, if this changed in the previous frame.
-   * @param[in] updateBufferIndex The current update buffer index.
-   */
-  void CopyPreviousSize( BufferIndex updateBufferIndex )
-  {
-    SetSize( updateBufferIndex, GetSize( 1u - updateBufferIndex ) );
-  }
-
-  /**
    * Retrieve the visibility of the node.
    * @param[in] bufferIndex The buffer to read from.
    * @return True if the node is visible.
@@ -806,14 +548,6 @@ public:
   }
 
   /**
-   * Retrieves whether a node is fully visible.
-   * A node is fully visible if is visible and all its ancestors are visible.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @return True if the node is fully visible.
-   */
-  bool IsFullyVisible( BufferIndex updateBufferIndex ) const;
-
-  /**
    * Retrieve the opacity of the node.
    * @param[in] bufferIndex The buffer to read from.
    * @return The opacity.
@@ -840,7 +574,7 @@ public:
    */
   void SetWorldColor(const Vector4& color, BufferIndex updateBufferIndex)
   {
-    mWorldColor.Set( updateBufferIndex, color );
+    mWorldColor.Set(updateBufferIndex, color);
   }
 
   /**
@@ -849,27 +583,27 @@ public:
    * @pre The node has a parent.
    * @param[in] updateBufferIndex The current update buffer index.
    */
-  void InheritWorldColor( BufferIndex updateBufferIndex )
+  void InheritWorldColor(BufferIndex updateBufferIndex)
   {
     DALI_ASSERT_DEBUG(mParent != NULL);
 
     // default first
-    if( mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA )
+    if(mColorMode == USE_OWN_MULTIPLY_PARENT_ALPHA)
     {
       const Vector4& ownColor = mColor[updateBufferIndex];
-      mWorldColor.Set( updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a );
+      mWorldColor.Set(updateBufferIndex, ownColor.r, ownColor.g, ownColor.b, ownColor.a * mParent->GetWorldColor(updateBufferIndex).a);
     }
-    else if( mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR )
+    else if(mColorMode == USE_OWN_MULTIPLY_PARENT_COLOR)
     {
-      mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex] );
+      mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) * mColor[updateBufferIndex]);
     }
-    else if( mColorMode == USE_PARENT_COLOR )
+    else if(mColorMode == USE_PARENT_COLOR)
     {
-      mWorldColor.Set( updateBufferIndex, mParent->GetWorldColor(updateBufferIndex) );
+      mWorldColor.Set(updateBufferIndex, mParent->GetWorldColor(updateBufferIndex));
     }
     else // USE_OWN_COLOR
     {
-      mWorldColor.Set( updateBufferIndex, mColor[updateBufferIndex] );
+      mWorldColor.Set(updateBufferIndex, mColor[updateBufferIndex]);
     }
   }
 
@@ -879,9 +613,9 @@ public:
    * does not need to be recalculated in the current frame.
    * @param[in] updateBufferIndex The current update buffer index.
    */
-  void CopyPreviousWorldColor( BufferIndex updateBufferIndex )
+  void CopyPreviousWorldColor(BufferIndex updateBufferIndex)
   {
-    mWorldColor.CopyPrevious( updateBufferIndex );
+    mWorldColor.CopyPrevious(updateBufferIndex);
   }
 
   /**
@@ -904,7 +638,7 @@ public:
   {
     mColorMode = colorMode;
 
-    SetDirtyFlag(ColorFlag);
+    SetDirtyFlag(NodePropertyFlags::COLOR);
   }
 
   /**
@@ -917,64 +651,91 @@ public:
   }
 
   /**
-   * Sets the size of the node.
-   * @param[in] bufferIndex The buffer to write to.
-   * @param[in] size The size to write.
+   * Retrieve the size of the node.
+   * @param[in] bufferIndex The buffer to read from.
+   * @return The size.
    */
-  void SetSize( BufferIndex bufferIndex, const Vector3& size )
+  const Vector3& GetSize(BufferIndex bufferIndex) const
   {
-    mSize[bufferIndex] = size;
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mSize.Get(0);
+    }
+
+    return Vector3::ZERO;
   }
 
   /**
-   * Retrieve the size of the node.
-   * @param[in] bufferIndex The buffer to read from.
-   * @return The size.
+   * Retrieve the update area hint of the node.
+   * @return The update area hint.
    */
-  const Vector3& GetSize(BufferIndex bufferIndex) const
+  const Vector4& GetUpdateAreaHint() const
   {
-    return mSize[bufferIndex];
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mUpdateAreaHint.Get(0);
+    }
+
+    return Vector4::ZERO;
   }
 
   /**
-   * Set the world-matrix of a node, with scale + rotation + translation.
-   * Scale and rotation are centered at the origin.
-   * Translation is applied independently of the scale or rotatation axis.
-   * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] scale The scale.
-   * @param[in] rotation The rotation.
-   * @param[in] translation The translation.
+   * Retrieve the bounding sphere of the node
+   * @return A vector4 describing the bounding sphere. XYZ is the center and W is the radius
    */
-  void SetWorldMatrix( BufferIndex updateBufferIndex, const Vector3& scale, const Quaternion& rotation, const Vector3& translation )
+  const Vector4& GetBoundingSphere() const
   {
-    mWorldMatrix.Get( updateBufferIndex ).SetTransformComponents( scale, rotation, translation );
-    mWorldMatrix.SetDirty( updateBufferIndex );
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mTransformManagerData.Manager()->GetBoundingSphere(mTransformManagerData.Id());
+    }
+
+    return Vector4::ZERO;
   }
 
   /**
-   * Retrieve the cached world-matrix of a node.
-   * @param[in] bufferIndex The buffer to read from.
-   * @return The world-matrix.
+   * Retrieve world matrix and size of the node
+   * @param[out] The local to world matrix of the node
+   * @param[out] size The current size of the node
    */
-  const Matrix& GetWorldMatrix( BufferIndex bufferIndex ) const
+  void GetWorldMatrixAndSize(Matrix& worldMatrix, Vector3& size) const
   {
-    return mWorldMatrix[ bufferIndex ];
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      mTransformManagerData.Manager()->GetWorldMatrixAndSize(mTransformManagerData.Id(), worldMatrix, size);
+    }
   }
 
   /**
-   * Copy previous frames world matrix
-   * @param[in] updateBufferIndex The current update buffer index.
+   * Checks if local matrix has changed since last update
+   * @return true if local matrix has changed, false otherwise
    */
-  void CopyPreviousWorldMatrix( BufferIndex updateBufferIndex )
+  bool IsLocalMatrixDirty() const
   {
-    mWorldMatrix.CopyPrevious( updateBufferIndex );
+    return (mTransformManagerData.Id() != INVALID_TRANSFORM_ID) &&
+           (mTransformManagerData.Manager()->IsLocalMatrixDirty(mTransformManagerData.Id()));
+  }
+
+  /**
+   * Retrieve the cached world-matrix of a node.
+   * @param[in] bufferIndex The buffer to read from.
+   * @return The world-matrix.
+   */
+  const Matrix& GetWorldMatrix(BufferIndex bufferIndex) const
+  {
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldMatrix.Get(bufferIndex);
+    }
+
+    return Matrix::IDENTITY;
   }
 
   /**
    * Mark the node as exclusive to a single RenderTask.
    * @param[in] renderTask The render-task, or NULL if the Node is not exclusive to a single RenderTask.
    */
-  void SetExclusiveRenderTask( RenderTask* renderTask )
+  void SetExclusiveRenderTask(RenderTask* renderTask)
   {
     mExclusiveRenderTask = renderTask;
   }
@@ -992,7 +753,7 @@ public:
    * Set how the Node and its children should be drawn; see Dali::Actor::SetDrawMode() for more details.
    * @param[in] drawMode The new draw-mode to use.
    */
-  void SetDrawMode( const DrawMode::Type& drawMode )
+  void SetDrawMode(const DrawMode::Type& drawMode)
   {
     mDrawMode = drawMode;
   }
@@ -1006,140 +767,246 @@ public:
     return mDrawMode;
   }
 
+  void SetTransparent(bool transparent)
+  {
+    mTransparent = transparent;
+  }
+
+  bool IsTransparent() const
+  {
+    return mTransparent;
+  }
+
+  /*
+   * Returns the transform id of the node
+   * @return The transform component id of the node
+   */
+  TransformId GetTransformId() const
+  {
+    return mTransformManagerData.Id();
+  }
+
   /**
    * Equality operator, checks for identity, not values.
-   *
+   * @param[in]
    */
-  bool operator==( const Node* rhs ) const
+  bool operator==(const Node* rhs) const
   {
-    if ( this == rhs )
+    return (this == rhs);
+  }
+
+  /**
+   * @brief Sets the sibling order of the node
+   * @param[in] order The new order
+   */
+  void SetDepthIndex(uint32_t depthIndex)
+  {
+    if(depthIndex != mDepthIndex)
     {
-      return true;
+      SetDirtyFlag(NodePropertyFlags::DEPTH_INDEX);
+      SetUpdated(true);
+      mDepthIndex = depthIndex;
     }
-    return false;
   }
 
   /**
-   * Set the inhibit local transform flag.@n
-   * Setting this flag will stop the node's local transform (position, scale and orientation)
-   * being applied on top of its parents transformation.
-   * @param[in] flag When true, local transformation is inhibited when calculating the world matrix.
+   * @brief Get the depth index of the node
+   * @return Current depth index
    */
-  void SetInhibitLocalTransform( bool flag )
+  uint32_t GetDepthIndex() const
   {
-    SetDirtyFlag( TransformFlag );
-    mInhibitLocalTransform = flag;
+    return mDepthIndex;
   }
 
   /**
-   * Get the inhibit local transform flag.@n
-   * See @ref SetInhibitLocalTransform
-   * @result A flag, when true, local transformation is inhibited when calculating the world matrix.
+   * @brief Sets the boolean which states whether the position should use the anchor-point.
+   * @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
    */
-  bool GetInhibitLocalTransform() const
+  void SetPositionUsesAnchorPoint(bool positionUsesAnchorPoint)
   {
-    return mInhibitLocalTransform;
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID && mPositionUsesAnchorPoint != positionUsesAnchorPoint)
+    {
+      mPositionUsesAnchorPoint = positionUsesAnchorPoint;
+      mTransformManagerData.Manager()->SetPositionUsesAnchorPoint(mTransformManagerData.Id(), mPositionUsesAnchorPoint);
+    }
   }
 
-protected:
+  /**
+   * @brief Sets whether the node is culled or not.
+   * @param[in] bufferIndex The buffer to read from.
+   * @param[in] culled True if the node is culled.
+   */
+  void SetCulled(BufferIndex bufferIndex, bool culled)
+  {
+    mCulled[bufferIndex] = culled;
+  }
+
+  /**
+   * @brief Retrieves whether the node is culled or not.
+   * @param[in] bufferIndex The buffer to read from.
+   * @return True if the node is culled.
+   */
+  bool IsCulled(BufferIndex bufferIndex) const
+  {
+    return mCulled[bufferIndex];
+  }
 
   /**
+   * @brief Get the total capacity of the memory pools
+   * @return The capacity of the memory pools
+   *
+   * @note This is different to the node count.
+   */
+  static uint32_t GetMemoryPoolCapacity();
+
+  /**
+   * @brief Returns partial rendering data associated with the node.
+   * @return The partial rendering data
+   */
+  PartialRenderingData& GetPartialRenderingData()
+  {
+    return mPartialRenderingData;
+  }
+
+public:
+  /**
+   * @copydoc Dali::Internal::SceneGraph::PropertyOwner::IsAnimationPossible
+   */
+  bool IsAnimationPossible() const override;
+
+  /**
+   * Called by UpdateManager when the node is added.
+   * Creates a new transform component in the transform manager and initialize all the properties
+   * related to the transformation
+   * @param[in] transformManager A pointer to the trnasform manager (Owned by UpdateManager)
+   */
+  void CreateTransform(SceneGraph::TransformManager* transformManager);
+
+  /**
+   * Reset dirty flags
+   */
+  void ResetDirtyFlags(BufferIndex updateBufferIndex);
+
+  /**
+   * Update uniform hash
+   * @param[in] bufferIndex The buffer to read from.
+   */
+  void UpdateUniformHash(BufferIndex bufferIndex);
+
+protected:
+  /**
    * Set the parent of a Node.
    * @param[in] parentNode the new parent.
    */
   void SetParent(Node& parentNode);
 
+protected:
   /**
    * Protected constructor; See also Node::New()
    */
   Node();
 
-private: // from RenderDataProvider
+  /**
+   * Protected virtual destructor; See also Node::Delete( Node* )
+   * Kept protected to allow destructor chaining from layer
+   */
+  ~Node() override;
 
+private: // from NodeDataProvider
   /**
-   * @copydoc RenderDataProvider::GetModelMatrix
+   * @copydoc NodeDataProvider::GetRenderColor
    */
-  virtual const Matrix& GetModelMatrix( unsigned int bufferId )
+  const Vector4& GetRenderColor(BufferIndex bufferIndex) const override
   {
-    return GetWorldMatrix( bufferId );
+    return GetWorldColor(bufferIndex);
   }
 
   /**
-   * @copydoc RenderDataProvider::GetRenderColor
+   * @copydoc NodeDataProvider::GetNodeUniformMap
    */
-  virtual const Vector4& GetRenderColor( unsigned int bufferId )
+  const UniformMap& GetNodeUniformMap() const override
   {
-    return GetWorldColor( bufferId );
+    return GetUniformMap();
   }
 
 private:
-
-  // Undefined
-  Node(const Node&);
-
-  // Undefined
-  Node& operator=(const Node& rhs);
-
-  /**
-   * @copydoc Dali::Internal::SceneGraph::PropertyOwner::ResetDefaultProperties()
-   */
-  virtual void ResetDefaultProperties( BufferIndex updateBufferIndex );
+  // Delete copy and move
+  Node(const Node&)                = delete;
+  Node(Node&&)                     = delete;
+  Node& operator=(const Node& rhs) = delete;
+  Node& operator=(Node&& rhs)      = delete;
 
   /**
    * Recursive helper to disconnect a Node and its children.
    * Disconnected Nodes have no parent or children.
    * @param[in] updateBufferIndex The current update buffer index.
-   * @param[in] connectedNodes Disconnected Node attachments should be removed from here.
-   * @param[in] disconnectedNodes Disconnected Node attachments should be added here.
    */
-  void RecursiveDisconnectFromSceneGraph( BufferIndex updateBufferIndex, std::set<Node*>& connectedNodes, std::set<Node*>& disconnectedNodes );
+  void RecursiveDisconnectFromSceneGraph(BufferIndex updateBufferIndex);
 
 public: // Default properties
+  // Define a base offset for the following wrappers. The wrapper macros calculate offsets from the previous
+  // element such that each wrapper type generates a compile time offset to the transform manager data.
+  BASE(TransformManagerData, mTransformManagerData);
+  PROPERTY_WRAPPER(mTransformManagerData, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_PARENT_ORIGIN,
+                   mParentOrigin); // Local transform; the position is relative to this. Sets the Transform flag dirty when changed
 
-  PropertyVector3                mParentOrigin;  ///< Local transform; the position is relative to this. Sets the TransformFlag dirty when changed
-  PropertyVector3                mAnchorPoint;   ///< Local transform; local center of rotation. Sets the TransformFlag dirty when changed
+  PROPERTY_WRAPPER(mParentOrigin, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_ANCHOR_POINT,
+                   mAnchorPoint); // Local transform; local center of rotation. Sets the Transform flag dirty when changed
 
-  AnimatableProperty<Vector3>    mSize;          ///< Size is provided for layouting
-  AnimatableProperty<Vector3>    mPosition;      ///< Local transform; distance between parent-origin & anchor-point
-  AnimatableProperty<Quaternion> mOrientation;   ///< Local transform; rotation relative to parent node
-  AnimatableProperty<Vector3>    mScale;         ///< Local transform; scale relative to parent node
-  AnimatableProperty<bool>       mVisible;       ///< Visibility can be inherited from the Node hierachy
-  AnimatableProperty<Vector4>    mColor;         ///< Color can be inherited from the Node hierarchy
+  PROPERTY_WRAPPER(mAnchorPoint, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_SIZE,
+                   mSize); // Size is provided for layouting
 
-  // Inherited properties; read-only from public API
+  PROPERTY_WRAPPER(mSize, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_POSITION,
+                   mPosition); // Local transform; distance between parent-origin & anchor-point
+  PROPERTY_WRAPPER(mPosition, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_SCALE,
+                   mScale); // Local transform; scale relative to parent node
+
+  TEMPLATE_WRAPPER(mScale, TransformManagerPropertyQuaternion,
+                   mOrientation); // Local transform; rotation relative to parent node
 
-  InheritedVector3    mWorldPosition;     ///< Full inherited position
-  InheritedQuaternion mWorldOrientation;  ///< Full inherited orientation
-  InheritedVector3    mWorldScale;        ///< Full inherited scale
-  InheritedMatrix     mWorldMatrix;       ///< Full inherited world matrix
-  InheritedColor      mWorldColor;        ///< Full inherited color
+  // Inherited properties; read-only from public API
+  TEMPLATE_WRAPPER(mOrientation, TransformManagerVector3Input, mWorldPosition);      // Full inherited position
+  TEMPLATE_WRAPPER(mWorldPosition, TransformManagerVector3Input, mWorldScale);       // Full inherited scale
+  TEMPLATE_WRAPPER(mWorldScale, TransformManagerQuaternionInput, mWorldOrientation); // Full inherited orientation
+  TEMPLATE_WRAPPER(mWorldOrientation, TransformManagerMatrixInput, mWorldMatrix);    // Full inherited world matrix
+
+  AnimatableProperty<bool>    mVisible;        ///< Visibility can be inherited from the Node hierachy
+  AnimatableProperty<bool>    mCulled;         ///< True if the node is culled. This is not animatable. It is just double-buffered.
+  AnimatableProperty<Vector4> mColor;          ///< Color can be inherited from the Node hierarchy
+  InheritedColor              mWorldColor;     ///< Full inherited color
+  AnimatableProperty<Vector4> mUpdateAreaHint; ///< Update area hint is provided for damaged area calculation. (x, y, width, height)
+                                               ///< This is not animatable. It is just double-buffered. (Because all these bloody properties are).
+
+  uint64_t       mUniformsHash{0u};     ///< Hash of uniform map property values
+  uint32_t       mClippingSortModifier; ///< Contains bit-packed clipping information for quick access when sorting
+  const uint32_t mId;                   ///< The Unique ID of the node.
 
 protected:
+  static uint32_t mNodeCounter; ///< count of total nodes, used for unique ids
 
-  Node*               mParent;                       ///< Pointer to parent node (a child is owned by its parent)
-  RenderTask*         mExclusiveRenderTask;          ///< Nodes can be marked as exclusive to a single RenderTask
+  PartialRenderingData mPartialRenderingData; ///< Cache to determine if this should be rendered again
 
-  NodeAttachmentOwner mAttachment;                   ///< Optional owned attachment
-  NodeContainer       mChildren;                     ///< Container of children; not owned
+  Node*       mParent;              ///< Pointer to parent node (a child is owned by its parent)
+  RenderTask* mExclusiveRenderTask; ///< Nodes can be marked as exclusive to a single RenderTask
 
-  Vector3             mGeometryScale;                ///< Applied before calculating world transform.
-  Vector3             mInitialVolume;                ///< Initial volume... TODO - need a better name.
-  Vector3             mSizeModeFactor;               ///< Factor of parent size. Used for certain SizeModes.
+  RendererContainer mRenderer; ///< Container of renderers; not owned
 
-  // flags, compressed to bitfield
-  int  mDirtyFlags:10;                               ///< A composite set of flags for each of the Node properties
+  NodeContainer mChildren; ///< Container of children; not owned
 
-  bool mIsRoot:1;                                    ///< True if the node cannot have a parent
-  bool mInheritOrientation:1;                        ///< Whether the parent's orientation should be inherited.
-  bool mInheritScale:1;                              ///< Whether the parent's scale should be inherited.
-  bool mTransmitGeometryScaling:1;                   ///< Whether geometry scaling should be applied to world transform.
-  bool mInhibitLocalTransform:1;                     ///< whether local transform should be applied.
-  bool mIsActive:1;                                  ///< When a Node is marked "active" it has been disconnected, and its properties have not been modified
+  uint32_t mClippingDepth; ///< The number of stencil clipping nodes deep this node is
+  uint32_t mScissorDepth;  ///< The number of scissor clipping nodes deep this node is
+  uint32_t mDepthIndex;    ///< Depth index of the node
 
-  DrawMode::Type          mDrawMode:2;               ///< How the Node and its children should be drawn
-  PositionInheritanceMode mPositionInheritanceMode:2;///< Determines how position is inherited, 2 bits is enough
-  ColorMode               mColorMode:2;              ///< Determines whether mWorldColor is inherited, 2 bits is enough
-  SizeMode                mSizeMode:2;               ///< Determines how the actors parent affects the actors size.
+  // flags, compressed to bitfield
+  NodePropertyFlags  mDirtyFlags;                  ///< Dirty flags for each of the Node properties
+  DrawMode::Type     mDrawMode : 3;                ///< How the Node and its children should be drawn
+  ColorMode          mColorMode : 3;               ///< Determines whether mWorldColor is inherited, 2 bits is enough
+  ClippingMode::Type mClippingMode : 3;            ///< The clipping mode of this node
+  bool               mIsRoot : 1;                  ///< True if the node cannot have a parent
+  bool               mIsLayer : 1;                 ///< True if the node is a layer
+  bool               mIsCamera : 1;                ///< True if the node is a camera
+  bool               mPositionUsesAnchorPoint : 1; ///< True if the node should use the anchor-point when calculating the position
+  bool               mTransparent : 1;             ///< True if this node is transparent. This value do not affect children.
 
   // Changes scope, should be at end of class
   DALI_LOG_OBJECT_STRING_DECLARATION;
@@ -1147,131 +1014,158 @@ protected:
 
 // Messages for Node
 
-inline void SetInheritOrientationMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
+inline void SetInheritOrientationMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
 {
-  typedef MessageValue1< Node, bool > LocalType;
+  using LocalType = MessageValue1<Node, bool>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetInheritOrientation, inherit );
+  new(slot) LocalType(&node, &Node::SetInheritOrientation, inherit);
 }
 
-inline void SetSizeModeMessage( EventThreadServices& eventThreadServices, const Node& node, SizeMode mode )
+inline void SetParentOriginMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin)
 {
-  typedef MessageValue1< Node, SizeMode > LocalType;
+  using LocalType = MessageValue1<Node, Vector3>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetSizeMode, mode );
+  new(slot) LocalType(&node, &Node::SetParentOrigin, origin);
 }
 
-inline void SetSizeModeFactorMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& factor )
+inline void SetAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor)
 {
-  typedef MessageValue1< Node, Vector3 > LocalType;
+  using LocalType = MessageValue1<Node, Vector3>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetSizeModeFactor, factor );
+  new(slot) LocalType(&node, &Node::SetAnchorPoint, anchor);
 }
 
-inline void SetInitialVolumeMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& initialVolume )
+inline void SetInheritPositionMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
 {
-  typedef MessageValue1< Node, Vector3 > LocalType;
+  using LocalType = MessageValue1<Node, bool>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetInitialVolume, initialVolume );
+  new(slot) LocalType(&node, &Node::SetInheritPosition, inherit);
 }
 
-inline void SetTransmitGeometryScalingMessage( EventThreadServices& eventThreadServices, const Node& node, bool transmitGeometryScaling )
+inline void SetInheritScaleMessage(EventThreadServices& eventThreadServices, const Node& node, bool inherit)
 {
-  typedef MessageValue1< Node, bool > LocalType;
+  using LocalType = MessageValue1<Node, bool>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetTransmitGeometryScaling, transmitGeometryScaling );
+  new(slot) LocalType(&node, &Node::SetInheritScale, inherit);
 }
 
-inline void SetParentOriginMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& origin )
+inline void SetColorModeMessage(EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode)
 {
-  typedef MessageValue1< Node, Vector3 > LocalType;
+  using LocalType = MessageValue1<Node, ColorMode>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetParentOrigin, origin );
+  new(slot) LocalType(&node, &Node::SetColorMode, colorMode);
 }
 
-inline void SetAnchorPointMessage( EventThreadServices& eventThreadServices, const Node& node, const Vector3& anchor )
+inline void SetDrawModeMessage(EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode)
 {
-  typedef MessageValue1< Node, Vector3 > LocalType;
+  using LocalType = MessageValue1<Node, DrawMode::Type>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetAnchorPoint, anchor );
+  new(slot) LocalType(&node, &Node::SetDrawMode, drawMode);
 }
 
-inline void SetPositionInheritanceModeMessage( EventThreadServices& eventThreadServices, const Node& node, PositionInheritanceMode mode )
+inline void SetTransparentMessage(EventThreadServices& eventThreadServices, const Node& node, bool transparent)
 {
-  typedef MessageValue1< Node, PositionInheritanceMode > LocalType;
+  using LocalType = MessageValue1<Node, bool>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetPositionInheritanceMode, mode );
+  new(slot) LocalType(&node, &Node::SetTransparent, transparent);
 }
 
-inline void SetInheritScaleMessage( EventThreadServices& eventThreadServices, const Node& node, bool inherit )
+inline void DetachRendererMessage(EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer)
 {
-  typedef MessageValue1< Node, bool > LocalType;
+  using LocalType = MessageValue1<Node, const Renderer*>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetInheritScale, inherit );
+  new(slot) LocalType(&node, &Node::RemoveRenderer, &renderer);
 }
 
-inline void SetColorModeMessage( EventThreadServices& eventThreadServices, const Node& node, ColorMode colorMode )
+inline void SetDepthIndexMessage(EventThreadServices& eventThreadServices, const Node& node, uint32_t depthIndex)
 {
-  typedef MessageValue1< Node, ColorMode > LocalType;
+  using LocalType = MessageValue1<Node, uint32_t>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetColorMode, colorMode );
+  new(slot) LocalType(&node, &Node::SetDepthIndex, depthIndex);
 }
 
-inline void SetDrawModeMessage( EventThreadServices& eventThreadServices, const Node& node, DrawMode::Type drawMode )
+inline void SetClippingModeMessage(EventThreadServices& eventThreadServices, const Node& node, ClippingMode::Type clippingMode)
 {
-  typedef MessageValue1< Node, DrawMode::Type > LocalType;
+  using LocalType = MessageValue1<Node, ClippingMode::Type>;
 
   // Reserve some memory inside the message queue
-  unsigned int* slot = eventThreadServices.ReserveMessageSlot( sizeof( LocalType ) );
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
 
   // Construct message in the message queue memory; note that delete should not be called on the return value
-  new (slot) LocalType( &node, &Node::SetDrawMode, drawMode );
+  new(slot) LocalType(&node, &Node::SetClippingMode, clippingMode);
+}
+
+inline void SetPositionUsesAnchorPointMessage(EventThreadServices& eventThreadServices, const Node& node, bool positionUsesAnchorPoint)
+{
+  using LocalType = MessageValue1<Node, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&node, &Node::SetPositionUsesAnchorPoint, positionUsesAnchorPoint);
 }
 
 } // namespace SceneGraph
 
+// Template specialisation for OwnerPointer<Node>, because delete is protected
+template<>
+inline void OwnerPointer<Dali::Internal::SceneGraph::Node>::Reset()
+{
+  if(mObject != nullptr)
+  {
+    Dali::Internal::SceneGraph::Node::Delete(mObject);
+    mObject = nullptr;
+  }
+}
 } // namespace Internal
 
+// Template specialisations for OwnerContainer<Node*>, because delete is protected
+template<>
+inline void OwnerContainer<Dali::Internal::SceneGraph::Node*>::Delete(Dali::Internal::SceneGraph::Node* pointer)
+{
+  Dali::Internal::SceneGraph::Node::Delete(pointer);
+}
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_NODE_H_
+#endif // DALI_INTERNAL_SCENE_GRAPH_NODE_H