Revert "[Tizen] Make TransformManager check WorldMatrix dirty, instead local matrix...
authorWoochan Lee <wc0917.lee@samsung.com>
Wed, 7 Aug 2024 05:04:14 +0000 (14:04 +0900)
committerWoochan Lee <wc0917.lee@samsung.com>
Wed, 7 Aug 2024 05:04:14 +0000 (14:04 +0900)
This reverts commit 092ee2a7117ba21dd7bde496ca82ae4214724eea.

dali/internal/update/manager/transform-manager.cpp
dali/internal/update/manager/transform-manager.h
dali/internal/update/manager/update-algorithms.cpp
dali/internal/update/nodes/node.h
dali/internal/update/render-tasks/scene-graph-camera.cpp

index 879d20b8b91554c6185d4662a2073c72296ec13a..5b8ffbb667fdba3fca465f90d27ef85c9d824542 100644 (file)
@@ -116,7 +116,7 @@ TransformId TransformManager::CreateTransform()
     mTxComponentAnimatableBaseValue.PushBack(TransformComponentAnimatable());
     mSizeBase.PushBack(Vector3(0.0f, 0.0f, 0.0f));
     mComponentDirty.PushBack(CLEAN_FLAG);
-    mWorldMatrixDirty.PushBack(false);
+    mLocalMatrixDirty.PushBack(false);
   }
   else
   {
@@ -133,7 +133,7 @@ TransformId TransformManager::CreateTransform()
     mBoundingSpheres[mComponentCount]  = Vector4(0.0f, 0.0f, 0.0f, 0.0f);
     mSizeBase[mComponentCount]         = Vector3(0.0f, 0.0f, 0.0f);
     mComponentDirty[mComponentCount]   = CLEAN_FLAG;
-    mWorldMatrixDirty[mComponentCount] = false;
+    mLocalMatrixDirty[mComponentCount] = false;
   }
 
   mComponentCount++;
@@ -155,7 +155,7 @@ void TransformManager::RemoveTransform(TransformId id)
   mTxComponentAnimatableBaseValue[index] = mTxComponentAnimatableBaseValue[mComponentCount];
   mSizeBase[index]                       = mSizeBase[mComponentCount];
   mComponentDirty[index]                 = mComponentDirty[mComponentCount];
-  mWorldMatrixDirty[index]               = mWorldMatrixDirty[mComponentCount];
+  mLocalMatrixDirty[index]               = mLocalMatrixDirty[mComponentCount];
   mBoundingSpheres[index]                = mBoundingSpheres[mComponentCount];
 
   TransformId lastItemId = mComponentId[mComponentCount];
@@ -252,7 +252,7 @@ void TransformManager::ResetToBaseValue()
 
     if(mUpdated)
     {
-      memset(&mWorldMatrixDirty[0], false, sizeof(bool) * mComponentCount);
+      memset(&mLocalMatrixDirty[0], false, sizeof(bool) * mComponentCount);
     }
   }
 }
@@ -292,10 +292,9 @@ bool TransformManager::Update()
       const TransformId& parentIndex = mIds[mParent[i]];
       if(DALI_LIKELY(mInheritanceMode[i] == INHERIT_ALL))
       {
-        if(mComponentDirty[i] || mWorldMatrixDirty[parentIndex])
+        if(mComponentDirty[i] || mLocalMatrixDirty[parentIndex])
         {
-          // TODO : Skip world matrix comparision. Is it improve performance?
-          mWorldMatrixDirty[i] = true;
+          mLocalMatrixDirty[i] = true;
 
           //Full transform inherited
           CalculateCenterPosition(centerPosition, mTxComponentStatic[i], mTxComponentAnimatable[i].mScale, mTxComponentAnimatable[i].mOrientation, mSize[i], half, topLeft);
@@ -308,8 +307,8 @@ bool TransformManager::Update()
       }
       else
       {
-        // Keep previous worldMatrix for comparison.
-        Matrix previousWorldMatrix = mWorld[i];
+        // Keep previous localMatrix for comparison.
+        Matrix previousLocalMatrix = mLocal[i];
 
         // Get Parent information.
         Vector3       parentPosition, parentScale;
@@ -371,18 +370,14 @@ bool TransformManager::Update()
         inverseParentMatrix.SetInverseTransformComponents(parentScale, parentOrientation, parentPosition);
         mLocal[i] = inverseParentMatrix * mWorld[i];
 
-        // TODO : We need to check mComponentDirty since we have to check the size changeness.
-        //        Could we check size changeness only?
-        mWorldMatrixDirty[i] = mComponentDirty[i] || (previousWorldMatrix != mWorld[i]);
+        mLocalMatrixDirty[i] = mComponentDirty[i] || (previousLocalMatrix != mLocal[i]);
       }
     }
     else //Component has no parent or doesn't inherit transform
     {
       if(mComponentDirty[i])
       {
-        // TODO : We need to check mComponentDirty since we have to check the size changeness.
-        //        Could we check size changeness only?
-        mWorldMatrixDirty[i] = true;
+        mLocalMatrixDirty[i] = true;
 
         CalculateCenterPosition(centerPosition, mTxComponentStatic[i], mTxComponentAnimatable[i].mScale, mTxComponentAnimatable[i].mOrientation, mSize[i], half, topLeft);
         localPosition = mTxComponentAnimatable[i].mPosition + centerPosition;
@@ -399,7 +394,7 @@ bool TransformManager::Update()
     mBoundingSpheres[i]   = mWorld[i].GetTranslation();
     mBoundingSpheres[i].w = Length(centerToEdgeWorldSpace);
 
-    mUpdated = mUpdated || mWorldMatrixDirty[i];
+    mUpdated = mUpdated || mLocalMatrixDirty[i];
 
     mComponentDirty[i] >>= 1u; ///< age down.
   }
@@ -507,7 +502,7 @@ void TransformManager::ReorderComponents()
     mTxComponentAnimatableBaseValue.Resize(mComponentCount);
     mSizeBase.Resize(mComponentCount);
     mComponentDirty.Resize(mComponentCount);
-    mWorldMatrixDirty.Resize(mComponentCount);
+    mLocalMatrixDirty.Resize(mComponentCount);
     mOrderedComponents.Resize(mComponentCount);
 
     mTxComponentAnimatable.ShrinkToFit();
@@ -522,7 +517,7 @@ void TransformManager::ReorderComponents()
     mTxComponentAnimatableBaseValue.ShrinkToFit();
     mSizeBase.ShrinkToFit();
     mComponentDirty.ShrinkToFit();
-    mWorldMatrixDirty.ShrinkToFit();
+    mLocalMatrixDirty.ShrinkToFit();
     mOrderedComponents.ShrinkToFit();
   }
 #endif
index 432399d4b354a19eeddc78844743ecdb0fd75cd2..b304ba1985e1280b6d294a9ae7c9eefef77d71b3 100644 (file)
@@ -179,13 +179,13 @@ public:
   Matrix& GetWorldMatrix(TransformId id);
 
   /**
-   * Checks if the world transform was updated in the last Update
+   * Checks if the local transform was updated in the last Update
    * @param[in] id Id of the transform
-   * @return true if world matrix changed in the last update, false otherwise
+   * @return true if local matrix changed in the last update, false otherwise
    */
-  bool IsWorldMatrixDirty(TransformId id) const
+  bool IsLocalMatrixDirty(TransformId id) const
   {
-    return mWorldMatrixDirty[mIds[id]];
+    return mLocalMatrixDirty[mIds[id]];
   }
 
   /**
@@ -422,7 +422,7 @@ private:
                                                                         ///< Or If we change static component changed, flag become non-zero. Age down at Update time.
                                                                         ///< Note that we don't replace dirty flag as BAKE even if we call Bake operation.
                                                                         ///< (Since single dirty flag controls multiple animatable properties ; Position, Size, Scale, Orientation.)
-  Vector<bool>       mWorldMatrixDirty;                                 ///< 1u if the local matrix has been updated in this frame, 0 otherwise
+  Vector<bool>       mLocalMatrixDirty;                                 ///< 1u if the local matrix has been updated in this frame, 0 otherwise
   Vector<SOrderItem> mOrderedComponents;                                ///< Used to reorder components when hierarchy changes
 
   uint8_t mDirtyFlags : 2; ///< Dirty flags for all transform components. Age down at Update time.
index 1873e30bba38eb42c2de2f1f9d482ba1069f665a..d70bcaae52e9806d78b8a7e250ae6d7b44fc7cc2 100644 (file)
@@ -207,7 +207,7 @@ inline void UpdateLayers(Node&             node,
 {
   // Some dirty flags are inherited from parent
   NodePropertyFlags nodeDirtyFlags = node.GetDirtyFlags() | node.GetInheritedDirtyFlags(parentFlags);
-  nodeDirtyFlags |= (node.IsWorldMatrixDirty() ? NodePropertyFlags::TRANSFORM : NodePropertyFlags::NOTHING);
+  nodeDirtyFlags |= (node.IsLocalMatrixDirty() ? NodePropertyFlags::TRANSFORM : NodePropertyFlags::NOTHING);
 
   Layer* nodeIsLayer(node.GetLayer());
   Layer* layer = nodeIsLayer ? nodeIsLayer : &currentLayer;
@@ -255,7 +255,7 @@ void UpdateLayerTree(Layer&      layer,
                      BufferIndex updateBufferIndex)
 {
   NodePropertyFlags nodeDirtyFlags = layer.GetDirtyFlags();
-  nodeDirtyFlags |= (layer.IsWorldMatrixDirty() ? NodePropertyFlags::TRANSFORM : NodePropertyFlags::NOTHING);
+  nodeDirtyFlags |= (layer.IsLocalMatrixDirty() ? NodePropertyFlags::TRANSFORM : NodePropertyFlags::NOTHING);
 
   layer.SetReuseRenderers(updateBufferIndex, nodeDirtyFlags == NodePropertyFlags::NOTHING);
 
index 6bfecbec930e1401329d418ecd042ac93e86535d..52f76bbbe5099a594676b21601dcf4be24fd9cdd 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_NODE_H
 
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -740,10 +740,10 @@ public:
    * Checks if local matrix has changed since last update
    * @return true if local matrix has changed, false otherwise
    */
-  bool IsWorldMatrixDirty() const
+  bool IsLocalMatrixDirty() const
   {
     return (mTransformManagerData.Id() != INVALID_TRANSFORM_ID) &&
-           (mTransformManagerData.Manager()->IsWorldMatrixDirty(mTransformManagerData.Id()));
+           (mTransformManagerData.Manager()->IsLocalMatrixDirty(mTransformManagerData.Id()));
   }
 
   /**
index e5a6f25811f5a56a51a3fa273ae8c5cbd29bbc10..d044c6cca98f14b90cb8cb917142c815b0387aff 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -551,7 +551,7 @@ const PropertyBase* Camera::GetProjectionDirection() const
 void Camera::Update(BufferIndex updateBufferIndex)
 {
   // if this has changes in world position we need to update camera for next 2 frames
-  if(IsWorldMatrixDirty())
+  if(IsLocalMatrixDirty())
   {
     mUpdateViewFlag = UPDATE_COUNT;
   }
@@ -875,7 +875,7 @@ uint32_t Camera::UpdateProjection(BufferIndex updateBufferIndex)
         {
           Matrix& projectionMatrix = mProjectionMatrix.Get(updateBufferIndex);
           Orthographic(projectionMatrix,
-                       static_cast<Dali::DevelCameraActor::ProjectionDirection>(mProjectionDirection[0]),
+                      static_cast<Dali::DevelCameraActor::ProjectionDirection>(mProjectionDirection[0]),
                        mOrthographicSize[updateBufferIndex],
                        mAspectRatio[updateBufferIndex],
                        mNearClippingPlane[updateBufferIndex],