Merge "Use Vector4 for the update area" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / update / manager / update-proxy-impl.cpp
index f5a387e..0613bd8 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 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.
@@ -103,6 +103,44 @@ bool UpdateProxy::BakePosition(uint32_t id, const Vector3& position)
   return success;
 }
 
+bool UpdateProxy::GetOrientation(uint32_t id, Quaternion& orientation) const
+{
+  bool                    success = false;
+  const SceneGraph::Node* node    = GetNodeWithId(id);
+  if(node)
+  {
+    const SceneGraph::TransformManager& transformManager = mTransformManager; // To ensure we call the const getter
+
+    orientation = transformManager.GetQuaternionPropertyValue(node->GetTransformId());
+    success     = true;
+  }
+  return success;
+}
+
+bool UpdateProxy::SetOrientation(uint32_t id, const Quaternion& orientation)
+{
+  bool              success = false;
+  SceneGraph::Node* node    = GetNodeWithId(id);
+  if(node)
+  {
+    mTransformManager.SetQuaternionPropertyValue(node->GetTransformId(), orientation);
+    success = true;
+  }
+  return success;
+}
+
+bool UpdateProxy::BakeOrientation(uint32_t id, const Quaternion& orientation)
+{
+  bool              success = false;
+  SceneGraph::Node* node    = GetNodeWithId(id);
+  if(node)
+  {
+    mTransformManager.BakeQuaternionPropertyValue(node->GetTransformId(), orientation);
+    success = true;
+  }
+  return success;
+}
+
 bool UpdateProxy::GetSize(uint32_t id, Vector3& size) const
 {
   bool                    success = false;
@@ -154,6 +192,40 @@ bool UpdateProxy::GetPositionAndSize(uint32_t id, Vector3& position, Vector3& si
   return success;
 }
 
+bool UpdateProxy::GetWorldPositionScaleAndSize(uint32_t id, Vector3& position, Vector3& scale, Vector3& size) const
+{
+  bool                    success = false;
+  const SceneGraph::Node* node    = GetNodeWithId(id);
+  if(node)
+  {
+    const SceneGraph::TransformManager& transformManager = mTransformManager; // To ensure we call the const getter
+    const Matrix&                       worldMatrix      = transformManager.GetWorldMatrix(node->GetTransformId());
+
+    Quaternion orientation;
+    worldMatrix.GetTransformComponents(position, orientation, scale);
+
+    size    = transformManager.GetVector3PropertyValue(node->GetTransformId(), SceneGraph::TRANSFORM_PROPERTY_SIZE);
+    success = true;
+  }
+  return success;
+}
+
+bool UpdateProxy::GetWorldTransformAndSize(uint32_t id, Vector3& position, Vector3& scale, Quaternion& orientation, Vector3& size) const
+{
+  bool                    success = false;
+  const SceneGraph::Node* node    = GetNodeWithId(id);
+  if(node)
+  {
+    const SceneGraph::TransformManager& transformManager = mTransformManager; // To ensure we call the const getter
+    const Matrix&                       worldMatrix      = transformManager.GetWorldMatrix(node->GetTransformId());
+
+    worldMatrix.GetTransformComponents(position, orientation, scale);
+    size    = transformManager.GetVector3PropertyValue(node->GetTransformId(), SceneGraph::TRANSFORM_PROPERTY_SIZE);
+    success = true;
+  }
+  return success;
+}
+
 bool UpdateProxy::GetScale(uint32_t id, Vector3& scale) const
 {
   bool                    success = false;