1 #ifndef __DALI_MESH_ACTOR_H__
2 #define __DALI_MESH_ACTOR_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.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
11 // http://floralicense.org/license/
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.
22 * @addtogroup CAPI_DALI_FRAMEWORK
27 #include <dali/public-api/actors/renderable-actor.h>
29 namespace Dali DALI_IMPORT_API
36 namespace Internal DALI_INTERNAL
42 * This actor is used to draw one or more mesh geometries, passed in on creation. It allows
43 * for a custom material to be drawn on the mesh.
45 * By default CullFaceMode is set to CullBack to enable back face culling.
47 class DALI_IMPORT_API MeshActor : public RenderableActor
52 * Create an uninitialized MeshActor handle. This can be initialised with MeshActor::New().
53 * Calling member functions with an uninitialized Dali::Object is not allowed.
58 * Create a MeshActor object.
59 * @return the newly allocated MeshActor object
61 static MeshActor New();
64 * Create a MeshActor object.
65 * @param[in] mesh the Mesh the actor will use.
66 * @return the newly allocated MeshActor object
68 static MeshActor New( Mesh mesh );
71 * Create a MeshActor object
72 * @param[in] mesh the Animated Mesh the actor will use.
73 * @return the newly allocated MeshActor object
75 static MeshActor New( AnimatableMesh mesh );
78 * Downcast an Object handle to MeshActor. If handle points to a MeshActor the
79 * downcast produces a valid handle. If not the returned handle is left uninitialized.
80 * @param[in] handle to an object
81 * @return handle to a MeshActor or an uninitialized handle
83 static MeshActor DownCast( BaseHandle handle );
87 * Dali::Object derived classes typically do not contain member data.
92 * @copydoc Dali::BaseHandle::operator=
94 using BaseHandle::operator=;
97 * Set a custom material on the given actor or one of it's children.
98 * @pre the mesh is loaded
99 * @param[in] actor The first actor in the tree of model actors
100 * @param[in] actorName The name of the actor to search for.
101 * @param[in] material The custom material.<br>Pass NULL to revert to the
104 static void SetMaterial(Actor actor, const std::string& actorName, Material material);
107 * Set a custom material on this actor
108 * @pre the mesh is loaded
109 * @param[in] material The custom material.@n
110 * Pass an uninitialised Material to revert to the original material.
112 void SetMaterial(Material material);
115 * Get the material for this mesh actor
116 * @pre the mesh is loaded
117 * @return The material
119 Material GetMaterial() const;
122 * Set whether this mesh actor should be affected by lights in the
123 * scene. If it set to false, then the mesh will be unaffected by
124 * lighting, and will be drawn with flat lighting, applying
125 * the material's diffuse & ambient colors and the actor's color to the
126 * material texture. If it is set to true, and there are no lights in the
127 * scene, the mesh will not be drawn.
129 * @note This property is not inherited.
130 * @note The default value is true.
131 * @param[in] affectedByLighting Whether the actor should be lit by the scene lighting.
133 void SetAffectedByLighting(bool affectedByLighting);
136 * Get the lighting status
137 * @return true if the actor is affected by the scene lighting, or false if its evenly lit.
139 bool IsAffectedByLighting();
142 * Search the actor tree for all named bones in the mesh and connect them.
143 * @param[in] rootActor The root actor of the actor tree.
145 void BindBonesToMesh(Actor rootActor);
147 public: // Not intended for application developers
150 * This constructor is used by Dali New() methods
151 * @param [in] actor A pointer to a newly allocated Dali resource
153 explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
161 #endif /* _MESH_ACTOR_H_ */