[dali_2.3.19] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / public-api / controls / model3d-view / model3d-view.h
1 #ifndef DALI_TOOLKIT_MODEL3D_VIEW_H
2 #define DALI_TOOLKIT_MODEL3D_VIEW_H
3
4 /*
5  * Copyright (c) 2020 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 // INTERNAL INCLUDES
22 #include <dali-toolkit/public-api/controls/control.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Internal DALI_INTERNAL
29 {
30 class Model3dView;
31 }
32
33 /**
34  * @addtogroup dali_toolkit_controls_model3d_view
35  * @{
36  */
37
38 /**
39  * @brief Model3dView is a control for displaying 3d geometry.
40  *
41  * All the geometry loaded with the control is automatically centered and scaled to fit
42  * the size of all the other controls. So the max is (0.5,0.5) and the min is (-0.5,-0.5).
43  *
44  * @SINCE_1_1.4
45  */
46 class DALI_TOOLKIT_API Model3dView : public Control
47 {
48 public:
49   /**
50    * @brief Enumeration for the start and end property ranges for this control.
51    * @SINCE_1_1.4
52    */
53   enum PropertyRange
54   {
55     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1, ///< @SINCE_1_1.4
56     PROPERTY_END_INDEX   = PROPERTY_START_INDEX + 1000,             ///< Reserve property indices @SINCE_1_1.4
57
58     ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,       ///< @SINCE_1_1.4
59     ANIMATABLE_PROPERTY_END_INDEX   = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000 ///< Reserve animatable property indices @SINCE_1_1.4
60   };
61
62   /**
63    * @brief Enumeration for the instance of properties belonging to the TextLabel class.
64    * @SINCE_1_1.4
65    */
66   struct Property
67   {
68     /**
69      * @brief Enumeration for the instance of properties belonging to the TextLabel class.
70      * @SINCE_1_1.4
71      */
72     enum
73     {
74       GEOMETRY_URL = PROPERTY_START_INDEX, ///< name "geometryUrl",       The path to the geometry file,    type STRING @SINCE_1_1.4
75       MATERIAL_URL,                        ///< name "materialUrl",       The path to the material file,    type STRING @SINCE_1_1.4
76       IMAGES_URL,                          ///< name "imagesUrl",         The path to the images directory, type STRING @SINCE_1_1.4
77       ILLUMINATION_TYPE,                   ///< name "illuminationType",  The type of illumination,         type INTEGER @SINCE_1_1.4
78       TEXTURE0_URL,                        ///< name "texture0Url",       The path to first texture,        type STRING @SINCE_1_1.4
79       TEXTURE1_URL,                        ///< name "texture1Url",       The path to second texture,       type STRING @SINCE_1_1.4
80       TEXTURE2_URL,                        ///< name "texture2Url",       The path to third texture,        type STRING @SINCE_1_1.4
81
82       LIGHT_POSITION = ANIMATABLE_PROPERTY_START_INDEX ///< name "lightPosition",     The coordinates of the light,     type Vector3 @SINCE_1_1.4
83     };
84   };
85
86   /**
87    * @brief Enumeration for the type of illumination.
88    * @SINCE_1_1.4
89    */
90   enum IlluminationType
91   {
92     DIFFUSE,                ///< diffuse @SINCE_1_1.4
93     DIFFUSE_WITH_TEXTURE,   ///< diffuse with texture @SINCE_1_1.4
94     DIFFUSE_WITH_NORMAL_MAP ///< diffuse with normal map @SINCE_1_1.4
95   };
96
97   /**
98    * @brief Creates a new instance of a Model3dView control.
99    *
100    * @SINCE_1_1.4
101    * @return A handle to the new Model3dView control
102    */
103   static Model3dView New();
104
105   /**
106    * @brief Creates a new instance of a Model3dView control.
107    *
108    * @SINCE_1_1.4
109    * @param[in] objUrl The path to the geometry file
110    * @param[in] mtlUrl The path to the material file
111    * @param[in] imagesUrl The path to the images directory
112    * @return A handle to the new Model3dView control
113    */
114   static Model3dView New(const std::string& objUrl, const std::string& mtlUrl, const std::string& imagesUrl);
115
116   /**
117    * @brief Creates an uninitialized Model3dView.
118    *
119    * Only derived versions can be instantiated. Calling member
120    * functions with an uninitialized Dali::Object is not allowed.
121    * @SINCE_1_1.4
122    */
123   Model3dView();
124
125   /**
126    * @brief Destructor.
127    *
128    * This is non-virtual since derived Handle types must not contain data or virtual methods.
129    * @SINCE_1_1.4
130    */
131   ~Model3dView();
132
133   /**
134    * @brief Copy constructor.
135    * @SINCE_1_1.4
136    * @param[in] model3dView Handle to an object
137    */
138   Model3dView(const Model3dView& model3dView);
139
140   /**
141    * @brief Move constructor
142    * @SINCE_1_9.23
143    *
144    * @param[in] rhs A reference to the moved handle
145    */
146   Model3dView(Model3dView&& rhs) noexcept;
147
148   /**
149    * @brief Assignment operator.
150    * @SINCE_1_1.4
151    * @param[in] model3dView Handle to an object
152    * @return reference to this
153    */
154   Model3dView& operator=(const Model3dView& model3dView);
155
156   /**
157    * @brief Move assignment
158    * @SINCE_1_9.23
159    *
160    * @param[in] rhs A reference to the moved handle
161    * @return A reference to this
162    */
163   Model3dView& operator=(Model3dView&& rhs) noexcept;
164
165   /**
166    * @brief Downcasts an Object handle to Model3dView.
167    *
168    * If handle points to a Model3dView, the downcast produces valid handle.
169    * If not, the returned handle is left uninitialized.
170    *
171    * @SINCE_1_1.4
172    * @param[in] handle Handle to an object
173    * @return Handle to a Model3dView or an uninitialized handle
174    */
175   static Model3dView DownCast(BaseHandle handle);
176
177 public: // Not intended for application developers
178   /// @cond internal
179   /**
180    * @brief Creates a handle using the Toolkit::Internal implementation.
181    *
182    * @SINCE_1_1.4
183    * @param[in] implementation The Control implementation
184    */
185   DALI_INTERNAL Model3dView(Internal::Model3dView& implementation);
186
187   /**
188    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
189    *
190    * @SINCE_1_1.4
191    * @param[in] internal A pointer to the internal CustomActor
192    */
193   DALI_INTERNAL Model3dView(Dali::Internal::CustomActor* internal);
194   /// @endcond
195 };
196
197 /**
198  * @}
199  */
200 } // namespace Toolkit
201
202 } // namespace Dali
203
204 #endif // DALI_TOOLKIT_MODEL3D_VIEW_H