CAPI removal
[platform/core/uifw/dali-core.git] / dali / public-api / actors / mesh-actor.h
1 #ifndef __DALI_MESH_ACTOR_H__
2 #define __DALI_MESH_ACTOR_H__
3
4 /*
5  * Copyright (c) 2014 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
22 // INTERNAL INCLUDES
23 #include <dali/public-api/actors/renderable-actor.h>
24
25 namespace Dali DALI_IMPORT_API
26 {
27 class Material;
28 class Mesh;
29 class Model;
30 class AnimatableMesh;
31
32 namespace Internal DALI_INTERNAL
33 {
34 class MeshActor;
35 }
36
37 /**
38  * @brief This actor is used to draw a mesh geometry with a material.
39  *
40  * It allows for a custom material to be drawn on the mesh.
41  * By default CullFaceMode is set to CullBack to enable back face culling.
42  */
43 class DALI_IMPORT_API MeshActor : public RenderableActor
44 {
45 public:
46
47   /**
48    * @brief Create an uninitialized MeshActor handle.
49    *
50    * This can be initialised with MeshActor::New().
51    * Calling member functions with an uninitialized Dali::Object is not allowed.
52    */
53   MeshActor();
54
55   /**
56    * @brief Create a MeshActor object.
57    * @return the newly allocated MeshActor object
58    */
59   static MeshActor New();
60
61   /**
62    * @brief Create a MeshActor object.
63    *
64    * @param[in] mesh the Mesh the actor will use.
65    * @return the newly allocated MeshActor object
66    */
67   static MeshActor New( Mesh mesh );
68
69   /**
70    * @brief Create a MeshActor object
71    *
72    * @param[in] mesh the Animated Mesh the actor will use.
73    * @return the newly allocated MeshActor object
74    */
75   static MeshActor New( AnimatableMesh mesh );
76
77   /**
78    * @brief Downcast an Object handle to MeshActor.
79    *
80    * If handle points to a MeshActor the downcast produces a valid
81    * handle. If not the returned handle is left uninitialized.
82    * @param[in] handle to an object
83    * @return handle to a MeshActor or an uninitialized handle
84    */
85   static MeshActor DownCast( BaseHandle handle );
86
87   /**
88    * @brief Destructor
89    *
90    * This is non-virtual since derived Handle types must not contain data or virtual methods.
91    */
92   ~MeshActor();
93
94   /**
95    * @copydoc Dali::BaseHandle::operator=
96    */
97   using BaseHandle::operator=;
98
99   /**
100    * @brief Set a custom material on the given actor or one of it's children.
101    *
102    * @pre the mesh is loaded
103    * @param[in] actor      The first actor in the tree of model actors
104    * @param[in] actorName  The name of the actor to search for.
105    * @param[in] material   The custom material.<br>Pass NULL to revert to the
106    *                       original material.
107    */
108   static void SetMaterial(Actor actor, const std::string& actorName, Material material);
109
110   /**
111    * @brief Set a custom material on this actor.
112    *
113    * @pre the mesh is loaded
114    * @param[in] material   The custom material.@n
115    *                       Pass an uninitialised Material to revert to the original material.
116    */
117   void SetMaterial(Material material);
118
119   /**
120    * @brief Get the material for this mesh actor.
121    *
122    * @pre the mesh is loaded
123    * @return The material
124    */
125   Material GetMaterial() const;
126
127   /**
128    * @brief Set whether this mesh actor should be affected by lights in the scene.
129    *
130    * If it is set to false, then the mesh will be unaffected by
131    * lighting, and will be drawn with flat lighting, applying
132    * the material's diffuse & ambient colors and the actor's color to the
133    * material texture. If it is set to true, and there are no lights in the
134    * scene, the mesh will not be drawn.
135    *
136    * @note This property is not inherited.
137    * @note The default value is true.
138    * @param[in] affectedByLighting Whether the actor should be lit by the scene lighting.
139    */
140   void SetAffectedByLighting(bool affectedByLighting);
141
142   /**
143    * @brief Get the lighting status.
144    *
145    * @return true if the actor is affected by the scene lighting, or false if its evenly lit.
146    */
147   bool IsAffectedByLighting();
148
149   /**
150    * @brief Search the actor tree for all named bones in the mesh and connect them.
151    *
152    * @param[in] rootActor The root actor of the actor tree.
153    */
154   void BindBonesToMesh(Actor rootActor);
155
156 public: // Not intended for application developers
157
158   /**
159    * @brief This constructor is used by Dali New() methods
160    *
161    * @param [in] actor A pointer to a newly allocated Dali resource
162    */
163   explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
164 };
165
166 } // namespace Dali
167
168 #endif /* _MESH_ACTOR_H_ */