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