1 #ifndef DALI_INTERNAL_UPDATE_PROXY_IMPL_H
2 #define DALI_INTERNAL_UPDATE_PROXY_IMPL_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/common/vector-wrapper.h>
25 #include <dali/public-api/math/matrix.h>
26 #include <dali/public-api/math/vector3.h>
27 #include <dali/internal/common/buffer-index.h>
28 #include <dali/internal/update/manager/transform-manager.h>
29 #include <dali/internal/update/nodes/node.h>
38 * @brief The implementation of Dali::UpdateProxy.
40 * Ref-counting is not required for this object.
42 * @see Dali::UpdateProxy
50 * @param[in] transformManager Ref to the TransformManager in order to set/get transform properties of nodes
51 * @param[in] rootNode The root node for this proxy
53 UpdateProxy( SceneGraph::TransformManager& transformManager, SceneGraph::Node& rootNode );
60 // Movable but not copyable
62 UpdateProxy( const UpdateProxy& ) = delete; ///< Deleted copy constructor.
63 UpdateProxy( UpdateProxy&& ) = default; ///< Default move constructor.
64 UpdateProxy& operator=( const UpdateProxy& ) = delete; ///< Deleted copy assignment operator.
65 UpdateProxy& operator=( UpdateProxy&& ) = default; ///< Default move assignment operator.
68 * @copydoc Dali::UpdateProxy::GetPosition()
70 bool GetPosition( unsigned int id, Vector3& position) const;
73 * @copydoc Dali::UpdateProxy::SetPosition()
75 bool SetPosition( unsigned int id, const Vector3& position );
78 * @copydoc Dali::UpdateProxy::BakePosition()
80 bool BakePosition( unsigned int id, const Vector3& position );
83 * @copydoc Dali::UpdateProxy::GetSize()
85 bool GetSize( unsigned int id, Vector3& size ) const;
88 * @copydoc Dali::UpdateProxy::SetSize()
90 bool SetSize( unsigned int id, const Vector3& size );
93 * @copydoc Dali::UpdateProxy::BakeSize()
95 bool BakeSize( unsigned int id, const Vector3& size );
98 * @copydoc Dali::UpdateProxy::GetPositionAndSize()
100 bool GetPositionAndSize( unsigned int id, Vector3& position, Vector3& size ) const;
103 * @copydoc Dali::UpdateProxy::GetScale()
105 bool GetScale( unsigned int id, Vector3& scale ) const;
108 * @copydoc Dali::UpdateProxy::SetScale()
110 bool SetScale( unsigned int id, const Vector3& scale );
113 * @copydoc Dali::UpdateProxy::BakeScale()
115 bool BakeScale( unsigned int id, const Vector3& scale );
118 * @copydoc Dali::UpdateProxy::GetColor()
120 bool GetColor( unsigned int id, Vector4& color ) const;
123 * @copydoc Dali::UpdateProxy::SetColor()
125 bool SetColor( unsigned int id, const Vector4& color ) const;
128 * @copydoc Dali::UpdateProxy::BakeColor()
130 bool BakeColor( unsigned int id, const Vector4& color ) const;
133 * @brief Retrieves the root-node used by this class
134 * @return The root node used by this class.
136 SceneGraph::Node& GetRootNode() const
142 * @brief Sets the buffer index to use when processing the next callback.
143 * @param[in] bufferIndex The current buffer index
145 void SetCurrentBufferIndex( BufferIndex bufferIndex )
147 mCurrentBufferIndex = bufferIndex;
151 * @brief Informs the update-proxy that the node hierarchy has changed.
153 void NodeHierarchyChanged();
158 * @brief Retrieves the node with the specified ID.
159 * @param[in] id The ID of the node required
160 * @return A pointer to the required node if found.
161 * @note This caches the last accessed node.
163 SceneGraph::Node* GetNodeWithId( unsigned int id ) const;
168 * Structure to store the ID & Node pair
172 unsigned int id; ///< The ID of the node
173 SceneGraph::Node* node; ///< The node itself
176 mutable std::vector< IdNodePair > mNodeContainer; ///< Used to store cached pointers to already searched for Nodes.
177 mutable IdNodePair mLastCachedIdNodePair; ///< Used to cache the last retrieved id-node pair.
178 BufferIndex mCurrentBufferIndex;
180 SceneGraph::TransformManager& mTransformManager; ///< Reference to the Transform Manager.
181 SceneGraph::Node& mRootNode; ///< The root node of this update proxy.
184 } // namespace Internal
188 #endif // DALI_INTERNAL_UPDATE_PROXY_IMPL_H