#define DALI_INTERNAL_UPDATE_PROXY_IMPL_H
/*
- * Copyright (c) 2018 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.
// EXTERNAL INCLUDES
#include <cstdint>
+#include <memory>
// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-#include <dali/public-api/math/matrix.h>
-#include <dali/public-api/math/vector3.h>
#include <dali/internal/common/buffer-index.h>
#include <dali/internal/update/manager/transform-manager.h>
#include <dali/internal/update/nodes/node.h>
+#include <dali/public-api/common/vector-wrapper.h>
+#include <dali/public-api/math/matrix.h>
+#include <dali/public-api/math/vector3.h>
namespace Dali
{
-
namespace Internal
{
+namespace SceneGraph
+{
+class UpdateManager;
+}
/**
* @brief The implementation of Dali::UpdateProxy.
class UpdateProxy
{
public:
-
/**
* @brief Constructor.
+ * @param[in] updateManager Ref to the UpdateManager in order to add property resetters
* @param[in] transformManager Ref to the TransformManager in order to set/get transform properties of nodes
* @param[in] rootNode The root node for this proxy
*/
- UpdateProxy( SceneGraph::TransformManager& transformManager, SceneGraph::Node& rootNode );
+ UpdateProxy(SceneGraph::UpdateManager& updateManager, SceneGraph::TransformManager& transformManager, SceneGraph::Node& rootNode);
/**
* @brief Destructor.
// Movable but not copyable
- UpdateProxy( const UpdateProxy& ) = delete; ///< Deleted copy constructor.
- UpdateProxy( UpdateProxy&& ) = default; ///< Default move constructor.
- UpdateProxy& operator=( const UpdateProxy& ) = delete; ///< Deleted copy assignment operator.
- UpdateProxy& operator=( UpdateProxy&& ) = default; ///< Default move assignment operator.
+ UpdateProxy(const UpdateProxy&) = delete; ///< Deleted copy constructor.
+ UpdateProxy(UpdateProxy&&) = default; ///< Default move constructor.
+ UpdateProxy& operator=(const UpdateProxy&) = delete; ///< Deleted copy assignment operator.
+ UpdateProxy& operator=(UpdateProxy&&) = delete; ///< Deleted move assignment operator.
/**
* @copydoc Dali::UpdateProxy::GetPosition()
*/
- bool GetPosition( uint32_t id, Vector3& position) const;
+ bool GetPosition(uint32_t id, Vector3& position) const;
/**
* @copydoc Dali::UpdateProxy::SetPosition()
*/
- bool SetPosition( uint32_t id, const Vector3& position );
+ bool SetPosition(uint32_t id, const Vector3& position);
/**
* @copydoc Dali::UpdateProxy::BakePosition()
*/
- bool BakePosition( uint32_t id, const Vector3& position );
+ bool BakePosition(uint32_t id, const Vector3& position);
/**
* @copydoc Dali::UpdateProxy::GetSize()
*/
- bool GetSize( uint32_t id, Vector3& size ) const;
+ bool GetSize(uint32_t id, Vector3& size) const;
/**
* @copydoc Dali::UpdateProxy::SetSize()
*/
- bool SetSize( uint32_t id, const Vector3& size );
+ bool SetSize(uint32_t id, const Vector3& size);
/**
* @copydoc Dali::UpdateProxy::BakeSize()
*/
- bool BakeSize( uint32_t id, const Vector3& size );
+ bool BakeSize(uint32_t id, const Vector3& size);
/**
* @copydoc Dali::UpdateProxy::GetPositionAndSize()
*/
- bool GetPositionAndSize( uint32_t id, Vector3& position, Vector3& size ) const;
+ bool GetPositionAndSize(uint32_t id, Vector3& position, Vector3& size) const;
+
+ /**
+ * @copydoc Dali::UpdateProxy::GetWorldPositionScaleAndSize()
+ */
+ bool GetWorldPositionScaleAndSize(uint32_t id, Vector3& position, Vector3& scale, Vector3& size) const;
/**
* @copydoc Dali::UpdateProxy::GetScale()
*/
- bool GetScale( uint32_t id, Vector3& scale ) const;
+ bool GetScale(uint32_t id, Vector3& scale) const;
/**
* @copydoc Dali::UpdateProxy::SetScale()
*/
- bool SetScale( uint32_t id, const Vector3& scale );
+ bool SetScale(uint32_t id, const Vector3& scale);
/**
* @copydoc Dali::UpdateProxy::BakeScale()
*/
- bool BakeScale( uint32_t id, const Vector3& scale );
+ bool BakeScale(uint32_t id, const Vector3& scale);
/**
* @copydoc Dali::UpdateProxy::GetColor()
*/
- bool GetColor( uint32_t id, Vector4& color ) const;
+ bool GetColor(uint32_t id, Vector4& color) const;
/**
* @copydoc Dali::UpdateProxy::SetColor()
*/
- bool SetColor( uint32_t id, const Vector4& color ) const;
+ bool SetColor(uint32_t id, const Vector4& color);
/**
* @copydoc Dali::UpdateProxy::BakeColor()
*/
- bool BakeColor( uint32_t id, const Vector4& color ) const;
+ bool BakeColor(uint32_t id, const Vector4& color);
/**
* @brief Retrieves the root-node used by this class
* @brief Sets the buffer index to use when processing the next callback.
* @param[in] bufferIndex The current buffer index
*/
- void SetCurrentBufferIndex( BufferIndex bufferIndex )
+ void SetCurrentBufferIndex(BufferIndex bufferIndex)
{
mCurrentBufferIndex = bufferIndex;
}
*/
void NodeHierarchyChanged();
-private:
+ /**
+ * @brief Adds node resetter for each dirty node whose animatable properties have been changed.
+ */
+ void AddNodeResetters();
+private:
/**
* @brief Retrieves the node with the specified ID.
* @param[in] id The ID of the node required
* @return A pointer to the required node if found.
* @note This caches the last accessed node.
*/
- SceneGraph::Node* GetNodeWithId( uint32_t id ) const;
+ SceneGraph::Node* GetNodeWithId(uint32_t id) const;
-private:
+ /**
+ * @brief Adds a property-resetter for non-transform properties so that they can be reset to their base value every frame.
+ * @param[in] node The node the property belongs to
+ * @param[in] propertyBase The property itself
+ */
+ void AddResetter(SceneGraph::Node& node, SceneGraph::PropertyBase& propertyBase);
+private:
/**
* Structure to store the ID & Node pair
*/
struct IdNodePair
{
- uint32_t id; ///< The ID of the node
+ uint32_t id; ///< The ID of the node
SceneGraph::Node* node; ///< The node itself
};
- mutable std::vector< IdNodePair > mNodeContainer; ///< Used to store cached pointers to already searched for Nodes.
- mutable IdNodePair mLastCachedIdNodePair; ///< Used to cache the last retrieved id-node pair.
- BufferIndex mCurrentBufferIndex;
+ class PropertyModifier;
+ using PropertyModifierPtr = std::unique_ptr<PropertyModifier>;
+ mutable std::vector<IdNodePair> mNodeContainer; ///< Used to store cached pointers to already searched for Nodes.
+ mutable IdNodePair mLastCachedIdNodePair; ///< Used to cache the last retrieved id-node pair.
+ mutable std::vector<uint32_t> mDirtyNodes; ///< Used to store the ID of the dirty nodes with non-transform property modifications.
+ BufferIndex mCurrentBufferIndex;
+
+ SceneGraph::UpdateManager& mUpdateManager; ///< Reference to the Update Manager.
SceneGraph::TransformManager& mTransformManager; ///< Reference to the Transform Manager.
- SceneGraph::Node& mRootNode; ///< The root node of this update proxy.
+ SceneGraph::Node& mRootNode; ///< The root node of this update proxy.
+
+ PropertyModifierPtr mPropertyModifier; ///< To ensure non-transform property modifications reset to base values.
};
} // namespace Internal