Merge "Size negotiation patch 3: Scope size negotiation enums" into tizen
[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
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    * @brief Copy constructor
96    *
97    * @param [in] copy The actor to copy.
98    */
99   MeshActor(const MeshActor& copy);
100
101   /**
102    * @brief Assignment operator
103    *
104    * @param [in] rhs The actor to copy.
105    */
106   MeshActor& operator=(const MeshActor& rhs);
107
108   /**
109    * @brief Set a custom material on the given actor or one of it's children.
110    *
111    * @pre the mesh is loaded
112    * @param[in] actor      The first actor in the tree of model actors
113    * @param[in] actorName  The name of the actor to search for.
114    * @param[in] material   The custom material.<br>Pass NULL to revert to the
115    *                       original material.
116    */
117   static void SetMaterial(Actor actor, const std::string& actorName, Material material);
118
119   /**
120    * @brief Set a custom material on this actor.
121    *
122    * @pre the mesh is loaded
123    * @param[in] material   The custom material.@n
124    *                       Pass an uninitialised Material to revert to the original material.
125    */
126   void SetMaterial(Material material);
127
128   /**
129    * @brief Get the material for this mesh actor.
130    *
131    * @pre the mesh is loaded
132    * @return The material
133    */
134   Material GetMaterial() const;
135
136   /**
137    * @brief Search the actor tree for all named bones in the mesh and connect them.
138    *
139    * @param[in] rootActor The root actor of the actor tree.
140    */
141   void BindBonesToMesh(Actor rootActor);
142
143 public: // Not intended for application developers
144
145   /**
146    * @brief This constructor is used by Dali New() methods
147    *
148    * @param [in] actor A pointer to a newly allocated Dali resource
149    */
150   explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
151 };
152
153 } // namespace Dali
154
155 #endif /* _MESH_ACTOR_H_ */