Revert "[Tizen] Change TransformManager dirty flags only if the value is really changed"
authorJiyun Yang <ji.yang@samsung.com>
Wed, 21 Aug 2024 04:06:59 +0000 (13:06 +0900)
committerJiyun Yang <ji.yang@samsung.com>
Wed, 21 Aug 2024 04:06:59 +0000 (13:06 +0900)
This reverts commit 5472b0b06e9da0019dbdbd25a37aeda25b6abd20.

automated-tests/src/dali-internal/utc-Dali-Internal-TransformManagerProperty.cpp
dali/internal/update/manager/transform-manager-property.h
dali/internal/update/manager/transform-manager.cpp
dali/internal/update/manager/transform-manager.h

index 99e648d..65e1164 100644 (file)
@@ -47,16 +47,16 @@ int UtcTransformManagerPropertyGetFloatComponentN(void)
   // For coverage
   DALI_LOG_TRACE_METHOD(gLogFilter);
 
-  struct TestNode
+  struct S
   {
     Dali::Internal::SceneGraph::TransformManagerData                                  txMgrData;
     Dali::Internal::SceneGraph::TransformManagerPropertyQuaternion<sizeof(txMgrData)> property;
-  } testNode;
+  } s;
 
   try
   {
     // There is no float component getter in derived class, only in base class.
-    testNode.property.GetFloatComponent(0u);
+    s.property.GetFloatComponent(0u);
   }
   catch(Dali::DaliException& e)
   {
@@ -73,19 +73,19 @@ int UtcTransformManagerPropertyUninitializedMgrData(void)
 {
   TestApplication application;
 
-  struct TestNode
+  struct S
   {
     const Vector3 input{1.0f, 2.0f, 3.0f};
 
     Dali::Internal::SceneGraph::TransformManagerData                            txMgrData;
     Dali::Internal::SceneGraph::TransformManagerVector3Input<sizeof(txMgrData)> property{Dali::Internal::SceneGraph::TRANSFORM_PROPERTY_POSITION, input};
-  } testNode;
+  } s;
 
-  Vector3 output = testNode.property.GetVector3(0);
+  Vector3 output = s.property.GetVector3(0);
 
   tet_infoline("Test that if input property's transform manager data is not initialized, that getting a value returns the initial value of the property.");
 
-  DALI_TEST_EQUALS(testNode.input, output, 0.001f, TEST_LOCATION);
+  DALI_TEST_EQUALS(s.input, output, 0.001f, TEST_LOCATION);
 
   END_TEST;
 }
@@ -93,19 +93,19 @@ int UtcTransformManagerPropertyUninitializedMgrData(void)
 using namespace Dali::Internal::SceneGraph;
 int UtcDaliInternalTransformPropertyGetValueSize(void)
 {
-  struct PropertyValueSizeTestCase
+  struct S
   {
     Dali::Internal::PropertyInputImpl* property;
     Property::Value                    value;
     size_t                             size;
-    PropertyValueSizeTestCase(Dali::Internal::PropertyInputImpl* p, Property::Value v, size_t s)
+    S(Dali::Internal::PropertyInputImpl* p, Property::Value v, size_t s)
     : property(p),
       value(v),
       size(s)
     {
     }
   };
-  std::vector<PropertyValueSizeTestCase> properties;
+  std::vector<S> properties;
 
   properties.emplace_back(new TransformManagerPropertyVector3<TransformManagerProperty::TRANSFORM_PROPERTY_SCALE, 0>(), Vector3(2.3f, 4.5f, 1.9f), sizeof(Vector3));
 
@@ -117,9 +117,9 @@ int UtcDaliInternalTransformPropertyGetValueSize(void)
 
   properties.emplace_back(new TransformManagerMatrixInput<0>(), Matrix::IDENTITY, sizeof(Matrix));
 
-  for(auto& valueSizeTestCase : properties)
+  for(auto& s : properties)
   {
-    DALI_TEST_EQUALS(valueSizeTestCase.property->GetValueSize(), valueSizeTestCase.size, TEST_LOCATION);
+    DALI_TEST_EQUALS(s.property->GetValueSize(), s.size, TEST_LOCATION);
   }
 
   END_TEST;
@@ -127,18 +127,16 @@ int UtcDaliInternalTransformPropertyGetValueSize(void)
 
 int UtcDaliInternalTransformPropertyGetValueAddress(void)
 {
-  struct TestNode
+  struct N
   {
     BASE(TransformManagerData, mTransformManagerData);
     PROPERTY_WRAPPER(mTransformManagerData, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_SCALE, mScale);
-    PROPERTY_WRAPPER(mScale, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_ANCHOR_POINT, mAnchorPoint);
-    PROPERTY_WRAPPER(mAnchorPoint, TransformManagerPropertyVector3, TRANSFORM_PROPERTY_PARENT_ORIGIN, mParentOrigin);
-    TEMPLATE_WRAPPER(mParentOrigin, TransformManagerPropertyQuaternion, mOrientation);
+    TEMPLATE_WRAPPER(mScale, TransformManagerPropertyQuaternion, mOrientation);
     TEMPLATE_WRAPPER(mOrientation, TransformManagerVector3Input, mWorldPosition);
     TEMPLATE_WRAPPER(mWorldPosition, TransformManagerQuaternionInput, mWorldOrientation);
     TEMPLATE_WRAPPER(mWorldOrientation, TransformManagerMatrixInput, mWorldMatrix);
 
-    TestNode()
+    N()
     : mTransformManagerData(),
       mWorldPosition(TRANSFORM_PROPERTY_WORLD_POSITION, Vector3(1.0f, 1.0f, 1.0f)),
       mWorldOrientation(),
@@ -148,7 +146,7 @@ int UtcDaliInternalTransformPropertyGetValueAddress(void)
   };
 
   TransformManager testManager;
-  TestNode         node;
+  N                node;
   node.mTransformManagerData.mManager = &testManager;
   node.mTransformManagerData.mId      = testManager.CreateTransform();
 
@@ -157,52 +155,12 @@ int UtcDaliInternalTransformPropertyGetValueAddress(void)
 
   DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(1.2f, 1.2f, 1.2f), TEST_LOCATION);
 
-  // Test anchor point, for coverage.
-  addr = node.mAnchorPoint.GetValueAddress(0);
-  node.mAnchorPoint.Set(0, Vector3(0.5f, 0.1f, 0.0f));
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.1f, 0.0f), TEST_LOCATION);
-
-  node.mAnchorPoint.SetFloatComponent(0.9f, 1);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.9f, 0.0f), TEST_LOCATION);
-
-  node.mAnchorPoint.BakeFloatComponent(0.4f, 2);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.9f, 0.4f), TEST_LOCATION);
-
-  node.mAnchorPoint.BakeX(0, 0.0f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.9f, 0.4f), TEST_LOCATION);
-
-  node.mAnchorPoint.BakeY(0, 0.1f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.1f, 0.4f), TEST_LOCATION);
-
-  node.mAnchorPoint.BakeZ(0, 0.2f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.1f, 0.2f), TEST_LOCATION);
-
-  // Test parent origin, for coverage.
-  addr = node.mParentOrigin.GetValueAddress(0);
-  node.mParentOrigin.Set(0, Vector3(0.5f, 0.1f, 0.0f));
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.1f, 0.0f), TEST_LOCATION);
-
-  node.mParentOrigin.SetFloatComponent(0.9f, 1);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.9f, 0.0f), TEST_LOCATION);
-
-  node.mParentOrigin.BakeFloatComponent(0.4f, 2);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.5f, 0.9f, 0.4f), TEST_LOCATION);
-
-  node.mParentOrigin.BakeX(0, 0.0f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.9f, 0.4f), TEST_LOCATION);
-
-  node.mParentOrigin.BakeY(0, 0.1f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.1f, 0.4f), TEST_LOCATION);
-
-  node.mParentOrigin.BakeZ(0, 0.2f);
-  DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.0f, 0.1f, 0.2f), TEST_LOCATION);
-
   node.mOrientation.Set(0, Quaternion(Radian(1.619f), Vector3::ZAXIS));
   addr = node.mOrientation.GetValueAddress(0);
   DALI_TEST_EQUALS(*reinterpret_cast<const Quaternion*>(addr), Quaternion(Radian(1.619f), Vector3::ZAXIS), TEST_LOCATION);
 
-  Matrix& worldMatrix = node.mWorldMatrix.Get(0);
-  worldMatrix         = Matrix::IDENTITY;
+  Matrix& m = node.mWorldMatrix.Get(0);
+  m         = Matrix::IDENTITY;
 
   addr = node.mWorldPosition.GetValueAddress(0);
   DALI_TEST_EQUALS(*reinterpret_cast<const Vector3*>(addr), Vector3(0.f, 0.f, 0.f), TEST_LOCATION);
index 18abd45..e093e01 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_UPDATE_TRANSFORM_MANAGER_PROPERTY_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.
@@ -222,6 +222,16 @@ struct TransformManagerPropertyVector3 final : public TransformManagerPropertyHa
     GetTxManagerData()->Manager()->SetVector3PropertyValue(GetTxManagerData()->Id(), PropertyT, value);
   }
 
+  void SetComponent(BufferIndex bufferIndex, float value, uint32_t component)
+  {
+    GetTxManagerData()->Manager()->SetVector3PropertyComponentValue(GetTxManagerData()->Id(), PropertyT, value, component);
+  }
+
+  void BakeComponent(BufferIndex bufferIndex, float value, uint32_t component)
+  {
+    GetTxManagerData()->Manager()->BakeVector3PropertyComponentValue(GetTxManagerData()->Id(), PropertyT, value, component);
+  }
+
   void Bake(BufferIndex bufferIndex, const Vector3& value) override
   {
     GetTxManagerData()->Manager()->BakeVector3PropertyValue(GetTxManagerData()->Id(), PropertyT, value);
index 3aea570..cdee80f 100644 (file)
@@ -82,141 +82,6 @@ inline void CalculateCenterPosition(
 }
 
 DALI_INIT_TRACE_FILTER(gTraceFilter, DALI_TRACE_UPDATE_PROCESS, false);
-
-/**
- * @brief Helper codes to set / bake the dirty flags for the components.
- * It will be useful when we want to reduce the number of lines.
- */
-
-/**
- * @brief Append dirty flags to both component and global dirty flags.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] flag The flag what we want to append.
- */
-inline void AppendDirtyFlags(uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const uint8_t flag)
-{
-  componentDirtyFlag |= flag;
-  globalDirtyFlag |= flag;
-}
-
-/**
- * @brief Change the inherit mode for each mode and update dirty flags.
- * @param[in,out] inheritanceMode The inheritance mode of the component.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] inherit True if we want to set the inherit mode as true. False otherwise.
- */
-inline void UpdateInheritMode(uint32_t& inheritanceMode, uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const InheritanceMode inheritModeFlag, const bool inherit)
-{
-  if(inherit)
-  {
-    if(!(inheritanceMode & inheritModeFlag))
-    {
-      AppendDirtyFlags(componentDirtyFlag, globalDirtyFlag, STATIC_COMPONENT_FLAG);
-      inheritanceMode |= inheritModeFlag;
-    }
-  }
-  else
-  {
-    if(inheritanceMode & inheritModeFlag)
-    {
-      AppendDirtyFlags(componentDirtyFlag, globalDirtyFlag, STATIC_COMPONENT_FLAG);
-      inheritanceMode &= ~inheritModeFlag;
-    }
-  }
-}
-
-/**
- * @brief Set transform property value and update dirty flags.
- * @tparam T The type of the transform component. It can be either float or Vector3.
- * @param[in,out] current The current value of the transform component. It would be changed as input vlaue.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] value The value what we want to set.
- * @param[in] flag The flag what we want to append.
- */
-template<typename T>
-inline void SetTransfromProperty(T& current, uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const T& value, const uint8_t flag = SET_FLAG)
-{
-  current = value;
-  AppendDirtyFlags(componentDirtyFlag, globalDirtyFlag, flag);
-}
-
-/**
- * @brief Bake transform property value and update dirty flags.
- * @tparam T The type of the transform component. It can be either float or Vector3.
- * @param[in,out] current The current value of the transform component.
- * @param[in,out] base The base value of the transform component.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] value The value what we want to bake.
- * @param[in] flag The flag what we want to append.
- */
-template<typename T>
-inline void BakeTransfromProperty(T& current, T& base, uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const T& value)
-{
-  current = base = value;
-  AppendDirtyFlags(componentDirtyFlag, globalDirtyFlag, BAKED_FLAG);
-}
-
-/**
- * @brief Set transform property value and update dirty flags only if current value changed.
- * @tparam T The type of the transform component. It can be either float or Vector3.
- * @param[in,out] current The current value of the transform component.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] value The value what we want to set.
- * @param[in] flag The flag what we want to append.
- */
-template<typename T>
-inline void SetTransfromPropertyIfChanged(T& current, uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const T& value, const uint8_t flag = SET_FLAG)
-{
-  if constexpr(std::is_same_v<T, float>)
-  {
-    if(!Equals(current, value))
-    {
-      SetTransfromProperty(current, componentDirtyFlag, globalDirtyFlag, value, flag);
-    }
-  }
-  else
-  {
-    if(current != value)
-    {
-      SetTransfromProperty(current, componentDirtyFlag, globalDirtyFlag, value, flag);
-    }
-  }
-}
-
-/**
- * @brief Bake transform property value and update dirty flags only if base value changed.
- * @tparam T The type of the transform component. It can be either float or Vector3.
- * @param[in,out] current The current value of the transform component.
- * @param[in,out] base The base value of the transform component.
- * @param[in,out] componentDirtyFlag The dirty flag of the component.
- * @param[in,out] globalDirtyFlag The dirty flag of the global.
- * @param[in] value The value what we want to bake.
- * @param[in] flag The flag what we want to append.
- */
-template<typename T>
-inline void BakeTransfromPropertyIfChanged(T& current, T& base, uint8_t& componentDirtyFlag, uint8_t& globalDirtyFlag, const T& value)
-{
-  if constexpr(std::is_same_v<T, float>)
-  {
-    if(!Equals(base, value))
-    {
-      BakeTransfromProperty(current, base, componentDirtyFlag, globalDirtyFlag, value);
-    }
-  }
-  else
-  {
-    if(base != value)
-    {
-      BakeTransfromProperty(current, base, componentDirtyFlag, globalDirtyFlag, value);
-    }
-  }
-}
-
 } // unnamed namespace
 
 TransformManager::TransformManager()
@@ -308,7 +173,8 @@ void TransformManager::SetParent(TransformId id, TransformId parentId)
   if(DALI_LIKELY(mParent[index] != parentId))
   {
     mParent[index] = parentId;
-    AppendDirtyFlags(mComponentDirty[index], mDirtyFlags, STATIC_COMPONENT_FLAG); ///< Need to calculate local matrix, at least 1 frame.
+    mComponentDirty[index] |= STATIC_COMPONENT_FLAG; ///< Need to calculate local matrix, at least 1 frame.
+    mDirtyFlags |= STATIC_COMPONENT_FLAG;
 
     mReorder = true;
   }
@@ -327,19 +193,49 @@ Matrix& TransformManager::GetWorldMatrix(TransformId id)
 void TransformManager::SetInheritPosition(TransformId id, bool inherit)
 {
   TransformId index = mIds[id];
-  UpdateInheritMode(mInheritanceMode[index], mComponentDirty[index], mDirtyFlags, INHERIT_POSITION, inherit);
+  if(inherit)
+  {
+    mInheritanceMode[index] |= INHERIT_POSITION;
+  }
+  else
+  {
+    mInheritanceMode[index] &= ~INHERIT_POSITION;
+  }
+
+  mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+  mDirtyFlags |= STATIC_COMPONENT_FLAG;
 }
 
 void TransformManager::SetInheritScale(TransformId id, bool inherit)
 {
   TransformId index = mIds[id];
-  UpdateInheritMode(mInheritanceMode[index], mComponentDirty[index], mDirtyFlags, INHERIT_SCALE, inherit);
+  if(inherit)
+  {
+    mInheritanceMode[index] |= INHERIT_SCALE;
+  }
+  else
+  {
+    mInheritanceMode[index] &= ~INHERIT_SCALE;
+  }
+
+  mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+  mDirtyFlags |= STATIC_COMPONENT_FLAG;
 }
 
 void TransformManager::SetInheritOrientation(TransformId id, bool inherit)
 {
   TransformId index = mIds[id];
-  UpdateInheritMode(mInheritanceMode[index], mComponentDirty[index], mDirtyFlags, INHERIT_ORIENTATION, inherit);
+  if(inherit)
+  {
+    mInheritanceMode[index] |= INHERIT_ORIENTATION;
+  }
+  else
+  {
+    mInheritanceMode[index] &= ~INHERIT_ORIENTATION;
+  }
+
+  mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+  mDirtyFlags |= STATIC_COMPONENT_FLAG;
 }
 
 void TransformManager::ResetToBaseValue()
@@ -636,23 +532,28 @@ Vector3& TransformManager::GetVector3PropertyValue(TransformId id, TransformMana
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      return mTxComponentAnimatable[mIds[id]].mPosition;
+      TransformId index(mIds[id]);
+      return mTxComponentAnimatable[index].mPosition;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      return mTxComponentAnimatable[mIds[id]].mScale;
+      TransformId index(mIds[id]);
+      return mTxComponentAnimatable[index].mScale;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      return mTxComponentStatic[mIds[id]].mParentOrigin;
+      TransformId index(mIds[id]);
+      return mTxComponentStatic[index].mParentOrigin;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      return mTxComponentStatic[mIds[id]].mAnchorPoint;
+      TransformId index(mIds[id]);
+      return mTxComponentStatic[index].mAnchorPoint;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      return mSize[mIds[id]];
+      TransformId index(mIds[id]);
+      return mSize[index];
     }
     default:
     {
@@ -734,27 +635,34 @@ void TransformManager::SetVector3PropertyValue(TransformId id, TransformManagerP
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      SetTransfromProperty(mTxComponentAnimatable[index].mPosition, mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags    = SET_FLAG;
+      mTxComponentAnimatable[index].mPosition = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      SetTransfromProperty(mTxComponentAnimatable[index].mScale, mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags = SET_FLAG;
+      mTxComponentAnimatable[index].mScale = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromProperty(mTxComponentStatic[index].mParentOrigin, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+      mDirtyFlags |= STATIC_COMPONENT_FLAG;
+      mTxComponentStatic[index].mParentOrigin = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromProperty(mTxComponentStatic[index].mAnchorPoint, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+      mDirtyFlags |= STATIC_COMPONENT_FLAG;
+      mTxComponentStatic[index].mAnchorPoint = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      SetTransfromProperty(mSize[index], mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags = SET_FLAG;
+      mSize[index]                         = value;
       break;
     }
     default:
@@ -772,27 +680,34 @@ void TransformManager::SetVector3PropertyComponentValue(TransformId id, Transfor
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      SetTransfromPropertyIfChanged(mTxComponentAnimatable[index].mPosition[component], mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags               = SET_FLAG;
+      mTxComponentAnimatable[index].mPosition[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      SetTransfromPropertyIfChanged(mTxComponentAnimatable[index].mScale[component], mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags            = SET_FLAG;
+      mTxComponentAnimatable[index].mScale[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mParentOrigin[component], mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+      mDirtyFlags |= STATIC_COMPONENT_FLAG;
+      mTxComponentStatic[index].mParentOrigin[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mAnchorPoint[component], mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+      mTxComponentStatic[index].mAnchorPoint[component] = value;
+      mDirtyFlags |= STATIC_COMPONENT_FLAG;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      SetTransfromPropertyIfChanged(mSize[index][component], mComponentDirty[index], mDirtyFlags, value);
+      mComponentDirty[index] = mDirtyFlags = SET_FLAG;
+      mSize[index][component]              = value;
       break;
     }
     default:
@@ -805,32 +720,34 @@ void TransformManager::SetVector3PropertyComponentValue(TransformId id, Transfor
 void TransformManager::BakeVector3PropertyValue(TransformId id, TransformManagerProperty property, const Vector3& value)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      BakeTransfromProperty(mTxComponentAnimatable[index].mPosition, mTxComponentAnimatableBaseValue[index].mPosition, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mPosition = mTxComponentAnimatableBaseValue[index].mPosition = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      BakeTransfromProperty(mTxComponentAnimatable[index].mScale, mTxComponentAnimatableBaseValue[index].mScale, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mScale = mTxComponentAnimatableBaseValue[index].mScale = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromProperty(mTxComponentStatic[index].mParentOrigin, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mParentOrigin = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromProperty(mTxComponentStatic[index].mAnchorPoint, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mAnchorPoint = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      BakeTransfromProperty(mSize[index], mSizeBase[index], mComponentDirty[index], mDirtyFlags, value);
+      mSize[index] = mSizeBase[index] = value;
       break;
     }
     default:
@@ -843,7 +760,8 @@ void TransformManager::BakeVector3PropertyValue(TransformId id, TransformManager
 void TransformManager::BakeRelativeVector3PropertyValue(TransformId id, TransformManagerProperty property, const Vector3& value)
 {
   TransformId index(mIds[id]);
-  AppendDirtyFlags(mComponentDirty[index], mDirtyFlags, BAKED_FLAG);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
@@ -882,7 +800,8 @@ void TransformManager::BakeRelativeVector3PropertyValue(TransformId id, Transfor
 void TransformManager::BakeMultiplyVector3PropertyValue(TransformId id, TransformManagerProperty property, const Vector3& value)
 {
   TransformId index(mIds[id]);
-  AppendDirtyFlags(mComponentDirty[index], mDirtyFlags, BAKED_FLAG);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
@@ -921,32 +840,34 @@ void TransformManager::BakeMultiplyVector3PropertyValue(TransformId id, Transfor
 void TransformManager::BakeVector3PropertyComponentValue(TransformId id, TransformManagerProperty property, float value, unsigned int component)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mPosition[component], mTxComponentAnimatableBaseValue[index].mPosition[component], mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mPosition[component] = mTxComponentAnimatableBaseValue[index].mPosition[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mScale[component], mTxComponentAnimatableBaseValue[index].mScale[component], mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mScale[component] = mTxComponentAnimatableBaseValue[index].mScale[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mParentOrigin[component], mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mParentOrigin[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mAnchorPoint[component], mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mAnchorPoint[component] = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      BakeTransfromPropertyIfChanged(mSize[index][component], mSizeBase[index][component], mComponentDirty[index], mDirtyFlags, value);
+      mSize[index][component] = mSizeBase[index][component] = value;
       break;
     }
     default:
@@ -959,32 +880,34 @@ void TransformManager::BakeVector3PropertyComponentValue(TransformId id, Transfo
 void TransformManager::BakeXVector3PropertyValue(TransformId id, TransformManagerProperty property, float value)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mPosition.x, mTxComponentAnimatableBaseValue[index].mPosition.x, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mPosition.x = mTxComponentAnimatableBaseValue[index].mPosition.x = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mScale.x, mTxComponentAnimatableBaseValue[index].mScale.x, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mScale.x = mTxComponentAnimatableBaseValue[index].mScale.x = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mParentOrigin.x, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mParentOrigin.x = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mAnchorPoint.x, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mAnchorPoint.x = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      BakeTransfromPropertyIfChanged(mSize[index].x, mSizeBase[index].x, mComponentDirty[index], mDirtyFlags, value);
+      mSize[index].x = mSizeBase[index].x = value;
       break;
     }
     default:
@@ -997,32 +920,34 @@ void TransformManager::BakeXVector3PropertyValue(TransformId id, TransformManage
 void TransformManager::BakeYVector3PropertyValue(TransformId id, TransformManagerProperty property, float value)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mPosition.y, mTxComponentAnimatableBaseValue[index].mPosition.y, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mPosition.y = mTxComponentAnimatableBaseValue[index].mPosition.y = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mScale.y, mTxComponentAnimatableBaseValue[index].mScale.y, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mScale.y = mTxComponentAnimatableBaseValue[index].mScale.y = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mParentOrigin.y, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mParentOrigin.y = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mAnchorPoint.y, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mAnchorPoint.y = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      BakeTransfromPropertyIfChanged(mSize[index].y, mSizeBase[index].y, mComponentDirty[index], mDirtyFlags, value);
+      mSize[index].y = mSizeBase[index].y = value;
       break;
     }
     default:
@@ -1035,32 +960,34 @@ void TransformManager::BakeYVector3PropertyValue(TransformId id, TransformManage
 void TransformManager::BakeZVector3PropertyValue(TransformId id, TransformManagerProperty property, float value)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   switch(property)
   {
     case TRANSFORM_PROPERTY_POSITION:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mPosition.z, mTxComponentAnimatableBaseValue[index].mPosition.z, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mPosition.z = mTxComponentAnimatableBaseValue[index].mPosition.z = value;
       break;
     }
     case TRANSFORM_PROPERTY_SCALE:
     {
-      BakeTransfromPropertyIfChanged(mTxComponentAnimatable[index].mScale.z, mTxComponentAnimatableBaseValue[index].mScale.z, mComponentDirty[index], mDirtyFlags, value);
+      mTxComponentAnimatable[index].mScale.z = mTxComponentAnimatableBaseValue[index].mScale.z = value;
       break;
     }
     case TRANSFORM_PROPERTY_PARENT_ORIGIN:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mParentOrigin.z, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mParentOrigin.z = value;
       break;
     }
     case TRANSFORM_PROPERTY_ANCHOR_POINT:
     {
-      SetTransfromPropertyIfChanged(mTxComponentStatic[index].mAnchorPoint.z, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+      mTxComponentStatic[index].mAnchorPoint.z = value;
       break;
     }
     case TRANSFORM_PROPERTY_SIZE:
     {
-      BakeTransfromPropertyIfChanged(mSize[index].z, mSizeBase[index].z, mComponentDirty[index], mDirtyFlags, value);
+      mSize[index].z = mSizeBase[index].z = value;
       break;
     }
     default:
@@ -1072,7 +999,8 @@ void TransformManager::BakeZVector3PropertyValue(TransformId id, TransformManage
 
 Quaternion& TransformManager::GetQuaternionPropertyValue(TransformId id)
 {
-  return mTxComponentAnimatable[mIds[id]].mOrientation;
+  TransformId index(mIds[id]);
+  return mTxComponentAnimatable[index].mOrientation;
 }
 
 const Quaternion& TransformManager::GetQuaternionPropertyValue(TransformId id) const
@@ -1083,19 +1011,25 @@ const Quaternion& TransformManager::GetQuaternionPropertyValue(TransformId id) c
 void TransformManager::SetQuaternionPropertyValue(TransformId id, const Quaternion& q)
 {
   TransformId index(mIds[id]);
-  SetTransfromProperty(mTxComponentAnimatable[index].mOrientation, mComponentDirty[index], mDirtyFlags, q);
+  mComponentDirty[index] = mDirtyFlags = SET_FLAG;
+
+  mTxComponentAnimatable[index].mOrientation = q;
 }
 
 void TransformManager::BakeQuaternionPropertyValue(TransformId id, const Quaternion& q)
 {
   TransformId index(mIds[id]);
-  BakeTransfromProperty(mTxComponentAnimatable[index].mOrientation, mTxComponentAnimatableBaseValue[index].mOrientation, mComponentDirty[index], mDirtyFlags, q);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
+
+  mTxComponentAnimatable[index].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = q;
 }
 
 void TransformManager::BakeRelativeQuaternionPropertyValue(TransformId id, const Quaternion& q)
 {
   TransformId index(mIds[id]);
-  AppendDirtyFlags(mComponentDirty[index], mDirtyFlags, BAKED_FLAG);
+  mComponentDirty[index] |= BAKED_FLAG;
+  mDirtyFlags |= BAKED_FLAG;
 
   mTxComponentAnimatable[index].mOrientation = mTxComponentAnimatableBaseValue[index].mOrientation = mTxComponentAnimatable[index].mOrientation * q;
 }
@@ -1115,8 +1049,10 @@ void TransformManager::GetWorldMatrixAndSize(TransformId id, Matrix& worldMatrix
 void TransformManager::SetPositionUsesAnchorPoint(TransformId id, bool value)
 {
   TransformId index(mIds[id]);
+  mComponentDirty[index] |= STATIC_COMPONENT_FLAG;
+  mDirtyFlags |= STATIC_COMPONENT_FLAG;
 
-  SetTransfromPropertyIfChanged(mTxComponentStatic[index].mPositionUsesAnchorPoint, mComponentDirty[index], mDirtyFlags, value, STATIC_COMPONENT_FLAG);
+  mTxComponentStatic[index].mPositionUsesAnchorPoint = value;
 }
 
 } //namespace SceneGraph
index 97458a2..432399d 100644 (file)
@@ -425,9 +425,9 @@ private:
   Vector<bool>       mWorldMatrixDirty;                                 ///< 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 ///< Dirty flags for all transform components. Age down at Update time.
-  bool    mReorder : 1; ///< Flag to determine if the components have to reordered in the next Update
-  bool    mUpdated : 1; ///< Flag whether we have updated the transform components previous frame.
+  uint8_t mDirtyFlags : 2; ///< Dirty flags for all transform components. Age down at Update time.
+  bool    mReorder : 1;    ///< Flag to determine if the components have to reordered in the next Update
+  bool    mUpdated : 1;    ///< Flag whether we have updated the transform components previous frame.
 };
 
 } //namespace SceneGraph