New control to load OBJ files
[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  * @brief Model3dView is a control for displaying 3d geometry.
36  *
37  * All the geometry loaded with the control is automatically centered and scaled to fit
38  * the size of all the other controls. So the max is (0.5,0.5) and the min is (-0.5,-0.5)
39 */
40 class DALI_IMPORT_API Model3dView : public Control
41 {
42 public:
43
44   /**
45    * @brief The start and end property ranges for this control.
46    */
47   enum PropertyRange
48   {
49     PROPERTY_START_INDEX = Control::CONTROL_PROPERTY_END_INDEX + 1,
50     PROPERTY_END_INDEX =   PROPERTY_START_INDEX + 1000,              ///< Reserve property indices
51
52     ANIMATABLE_PROPERTY_START_INDEX = ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX,
53     ANIMATABLE_PROPERTY_END_INDEX =   ANIMATABLE_PROPERTY_REGISTRATION_START_INDEX + 1000              ///< Reserve animatable property indices
54   };
55
56   /**
57    * @brief An enumeration of properties belonging to the TextLabel class.
58    */
59   struct Property
60   {
61     enum
62     {
63       GEOMETRY_URL = PROPERTY_START_INDEX,  ///< name "geometry-url",      The path to the geometry file,    type STRING
64       MATERIAL_URL,                         ///< name "material-url",      The path to the material file,    type STRING
65       IMAGES_URL,                           ///< name "images-url",        The path to the images directory, type STRING
66       ILLUMINATION_TYPE,                    ///< name "illumination-type", The type of illumination,         type INTEGER
67       TEXTURE0_URL,                         ///< name "texture0-url",      The path to first texture,        type STRING
68       TEXTURE1_URL,                         ///< name "texture1-url",      The path to second texture,       type STRING
69       TEXTURE2_URL,                         ///< name "texture2-url",      The path to third texture,        type STRING
70
71       LIGHT_POSITION = ANIMATABLE_PROPERTY_START_INDEX    ///< name "light-position",    The coordinates of the light,     type Vector3
72     };
73   };
74
75   enum IlluminationType
76   {
77     DIFFUSE,
78     DIFFUSE_WITH_TEXTURE,
79     DIFFUSE_WITH_NORMAL_MAP
80   };
81
82
83   /**
84    * @brief Create a new instance of a Model3dView control.
85    *
86    * @return A handle to the new Model3dView control.
87    */
88   static Model3dView New();
89
90   /**
91    * @brief Create a new instance of a Model3dView control.
92    *
93    * @return A handle to the new Model3dView control.
94    */
95   static Model3dView New( const std::string& objUrl, const std::string& mtlUrl, const std::string& imagesUrl );
96
97
98   /**
99    * @brief Create an uninitialized Model3dView
100    *
101    * Only derived versions can be instantiated.  Calling member
102    * functions with an uninitialized Dali::Object is not allowed.
103    */
104   Model3dView();
105
106   /**
107    * @brief Destructor
108    *
109    * This is non-virtual since derived Handle types must not contain data or virtual methods.
110    */
111   ~Model3dView();
112
113   /**
114    * @brief Copy constructor.
115    */
116   Model3dView( const Model3dView& model3dView );
117
118   /**
119    * @brief Assignment operator.
120    */
121   Model3dView& operator=( const Model3dView& model3dView );
122
123   /**
124    * @brief Downcast an Object handle to Model3dView.
125    *
126    * If handle points to a Model3dView the downcast produces valid
127    * handle. If not the returned handle is left uninitialized.
128    *
129    * @param[in] handle Handle to an object
130    * @return handle to a Model3dView or an uninitialized handle
131    */
132   static Model3dView DownCast( BaseHandle handle );
133
134 public: // Not intended for application developers
135
136   /**
137    * @brief Creates a handle using the Toolkit::Internal implementation.
138    *
139    * @param[in]  implementation  The Control implementation.
140    */
141   DALI_INTERNAL Model3dView( Internal::Model3dView& implementation );
142
143   /**
144    * @brief Allows the creation of this Control from an Internal::CustomActor pointer.
145    *
146    * @param[in]  internal  A pointer to the internal CustomActor.
147    */
148   DALI_INTERNAL Model3dView( Dali::Internal::CustomActor* internal );
149
150 };
151
152 } // namespace Toolkit
153
154 } // namespace Dali
155
156 #endif // __DALI_TOOLKIT_MODEL3D_VIEW_H__