1 #ifndef DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H
2 #define DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H
5 * Copyright (c) 2023 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.
24 #include <dali-scene3d/public-api/model-motion/motion-index/motion-index.h>
30 //Forward declarations.
33 class MotionTransformIndex;
34 } // namespace Internal
37 * @addtogroup dali_scene3d_model_motion_motion_transform_index
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.
48 * MotionTransformIndex position = MotionTransformIndex::New("nodeName", MotionTransformIndex::TransformType::POSITION);
50 * // We can change the property later.
51 * MotionTransformIndex orientation = MotionTransformIndex::New();
52 * orientation.SetModelNodeId("nodeName");
53 * orientation.SetTransformType(MotionTransformIndex::TransformType::ORIENTATION);
59 class DALI_SCENE3D_API MotionTransformIndex : public MotionIndex
63 * @brief The type of Transform
66 enum class TransformType
70 POSITION = 0, ///< The position of ModelNode. MotionValue should be Vector3.
71 POSITION_X, ///< The x position of ModelNode. MotionValue should be float.
72 POSITION_Y, ///< The y position of ModelNode. MotionValue should be float.
73 POSITION_Z, ///< The z position of ModelNode. MotionValue should be float.
75 ORIENTATION, ///< The orientation of ModelNode. MotionValue should be Quaternion.
77 SCALE, ///< The scale of ModelNode. MotionValue should be Vector3.
78 SCALE_X, ///< The x scale of ModelNode. MotionValue should be float.
79 SCALE_Y, ///< The y scale of ModelNode. MotionValue should be float.
80 SCALE_Z, ///< The z scale of ModelNode. MotionValue should be float.
83 public: // Creation & Destruction
85 * @brief Create an initialized MotionTransformIndex.
88 * @return A handle to a newly allocated Dali resource
90 static MotionTransformIndex New();
93 * @brief Create an initialized MotionTransformIndex with values.
96 * @param[in] modelNodeId The id of model node what this motion index looks.
97 * @param[in] type The type of transform what this motion index looks.
98 * @return A handle to a newly allocated Dali resource
100 static MotionTransformIndex New(Property::Key modelNodeId, TransformType type);
103 * @brief Creates an uninitialized MotionTransformIndex.
105 * Only derived versions can be instantiated. Calling member
106 * functions with an uninitialized Dali::Object is not allowed.
110 MotionTransformIndex();
115 * This is non-virtual since derived Handle types must not contain data or virtual methods.
119 ~MotionTransformIndex();
122 * @brief Copy constructor.
125 * @param[in] motionTransformIndex Handle to an object
127 MotionTransformIndex(const MotionTransformIndex& motionTransformIndex);
130 * @brief Move constructor
133 * @param[in] rhs A reference to the moved handle
135 MotionTransformIndex(MotionTransformIndex&& rhs) noexcept;
138 * @brief Assignment operator.
141 * @param[in] motionTransformIndex Handle to an object
142 * @return reference to this
144 MotionTransformIndex& operator=(const MotionTransformIndex& motionTransformIndex);
147 * @brief Move assignment
150 * @param[in] rhs A reference to the moved handle
151 * @return A reference to this
153 MotionTransformIndex& operator=(MotionTransformIndex&& rhs) noexcept;
156 * @brief Downcasts an Object handle to MotionTransformIndex.
158 * If handle points to a MotionTransformIndex, the downcast produces valid handle.
159 * If not, the returned handle is left uninitialized.
162 * @param[in] handle Handle to an object
163 * @return Handle to a MotionTransformIndex or an uninitialized handle
165 static MotionTransformIndex DownCast(BaseHandle handle);
167 public: // Public Method
169 * @brief Set the type of transform what this motion index looks.
172 * @param[in] type The type of transform.
174 void SetTransformType(TransformType type);
177 * @brief Get the type of transform what this motion index looks.
180 * @return The type of transform.
182 TransformType GetTransformType() const;
184 public: // Not intended for application developers
187 * @brief Creates a handle using the Scene3D::Internal implementation.
189 * @param[in] implementation The MotionTransformIndex implementation
191 DALI_INTERNAL MotionTransformIndex(Dali::Scene3D::Internal::MotionTransformIndex* implementation);
199 } // namespace Scene3D
203 #endif // DALI_SCENE3D_MODEL_MOTION_MOTION_TRANSFORM_INDEX_H