[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-scene3d / public-api / model-motion / motion-index / motion-transform-index.h
1 #ifndef DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H
2 #define DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H
3
4 /*
5  * Copyright (c) 2023 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali-scene3d/public-api/model-motion/motion-index/motion-index.h>
25
26 namespace Dali
27 {
28 namespace Scene3D
29 {
30 //Forward declarations.
31 namespace Internal
32 {
33 class MotionTransformIndex;
34 } // namespace Internal
35
36 /**
37  * @addtogroup dali_scene3d_model_motion_motion_transform_index
38  * @{
39  */
40
41 /**
42  * @brief Specialized MotionIndex to control transform.
43  * It will be used when app developer don't care about Dali::Actor::Property list,
44  * but want to change the transform properties anyway fast enough.
45  *
46  * Each TransformType has their own matched MotionValue type.
47  *
48  * @code
49  *
50  * MotionTransformIndex position = MotionTransformIndex::New("nodeName", MotionTransformIndex::TransformType::POSITION);
51  *
52  * // We can change the property later.
53  * MotionTransformIndex orientation = MotionTransformIndex::New();
54  * orientation.SetModelNodeId("nodeName");
55  * orientation.SetTransformType(MotionTransformIndex::TransformType::ORIENTATION);
56  *
57  * @endcode
58  *
59  * @SINCE_2_2.34
60  */
61 class DALI_SCENE3D_API MotionTransformIndex : public MotionIndex
62 {
63 public:
64   /**
65    * @brief The type of Transform
66    * @SINCE_2_2.34
67    */
68   enum class TransformType
69   {
70     INVALID = -1,
71
72     POSITION = 0, ///< The position of ModelNode. MotionValue should be Vector3.
73     POSITION_X,   ///< The x position of ModelNode. MotionValue should be float.
74     POSITION_Y,   ///< The y position of ModelNode. MotionValue should be float.
75     POSITION_Z,   ///< The z position of ModelNode. MotionValue should be float.
76
77     ORIENTATION, ///< The orientation of ModelNode. MotionValue should be Quaternion.
78
79     SCALE,   ///< The scale of ModelNode. MotionValue should be Vector3.
80     SCALE_X, ///< The x scale of ModelNode. MotionValue should be float.
81     SCALE_Y, ///< The y scale of ModelNode. MotionValue should be float.
82     SCALE_Z, ///< The z scale of ModelNode. MotionValue should be float.
83   };
84
85 public: // Creation & Destruction
86   /**
87    * @brief Create an initialized MotionTransformIndex.
88    *
89    * @SINCE_2_2.34
90    * @return A handle to a newly allocated Dali resource
91    */
92   static MotionTransformIndex New();
93
94   /**
95    * @brief Create an initialized MotionTransformIndex with values.
96    *
97    * @SINCE_2_2.34
98    * @param[in] modelNodeId The id of model node what this motion index looks.
99    * @param[in] type The type of transform what this motion index looks.
100    * @return A handle to a newly allocated Dali resource
101    */
102   static MotionTransformIndex New(Property::Key modelNodeId, TransformType type);
103
104   /**
105    * @brief Creates an uninitialized MotionTransformIndex.
106    *
107    * Only derived versions can be instantiated. Calling member
108    * functions with an uninitialized Dali::Object is not allowed.
109    *
110    * @SINCE_2_2.34
111    */
112   MotionTransformIndex();
113
114   /**
115    * @brief Destructor.
116    *
117    * This is non-virtual since derived Handle types must not contain data or virtual methods.
118    *
119    * @SINCE_2_2.34
120    */
121   ~MotionTransformIndex();
122
123   /**
124    * @brief Copy constructor.
125    *
126    * @SINCE_2_2.34
127    * @param[in] motionTransformIndex Handle to an object
128    */
129   MotionTransformIndex(const MotionTransformIndex& motionTransformIndex);
130
131   /**
132    * @brief Move constructor
133    *
134    * @SINCE_2_2.34
135    * @param[in] rhs A reference to the moved handle
136    */
137   MotionTransformIndex(MotionTransformIndex&& rhs) noexcept;
138
139   /**
140    * @brief Assignment operator.
141    *
142    * @SINCE_2_2.34
143    * @param[in] motionTransformIndex Handle to an object
144    * @return reference to this
145    */
146   MotionTransformIndex& operator=(const MotionTransformIndex& motionTransformIndex);
147
148   /**
149    * @brief Move assignment
150    *
151    * @SINCE_2_2.34
152    * @param[in] rhs A reference to the moved handle
153    * @return A reference to this
154    */
155   MotionTransformIndex& operator=(MotionTransformIndex&& rhs) noexcept;
156
157   /**
158    * @brief Downcasts an Object handle to MotionTransformIndex.
159    *
160    * If handle points to a MotionTransformIndex, the downcast produces valid handle.
161    * If not, the returned handle is left uninitialized.
162    *
163    * @SINCE_2_2.34
164    * @param[in] handle Handle to an object
165    * @return Handle to a MotionTransformIndex or an uninitialized handle
166    */
167   static MotionTransformIndex DownCast(BaseHandle handle);
168
169 public: // Public Method
170   /**
171    * @brief Set the type of transform what this motion index looks.
172    *
173    * @SINCE_2_2.34
174    * @param[in] type The type of transform.
175    */
176   void SetTransformType(TransformType type);
177
178   /**
179    * @brief Get the type of transform what this motion index looks.
180    *
181    * @SINCE_2_2.34
182    * @return The type of transform.
183    */
184   TransformType GetTransformType() const;
185
186 public: // Not intended for application developers
187   /// @cond internal
188   /**
189    * @brief Creates a handle using the Scene3D::Internal implementation.
190    *
191    * @param[in] implementation The MotionTransformIndex implementation
192    */
193   DALI_INTERNAL MotionTransformIndex(Dali::Scene3D::Internal::MotionTransformIndex* implementation);
194   /// @endcond
195 };
196
197 /**
198  * @}
199  */
200
201 } // namespace Scene3D
202
203 } // namespace Dali
204
205 #endif // DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H