1 #ifndef __DALI_MESH_ACTOR_H__
2 #define __DALI_MESH_ACTOR_H__
5 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
23 #include <dali/public-api/actors/renderable-actor.h>
25 namespace Dali DALI_IMPORT_API
32 namespace Internal DALI_INTERNAL
38 * @brief This actor is used to draw a mesh geometry with a material.
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.
43 class DALI_IMPORT_API MeshActor : public RenderableActor
48 * @brief Create an uninitialized MeshActor handle.
50 * This can be initialised with MeshActor::New().
51 * Calling member functions with an uninitialized Dali::Object is not allowed.
56 * @brief Create a MeshActor object.
57 * @return the newly allocated MeshActor object
59 static MeshActor New();
62 * @brief Create a MeshActor object.
64 * @param[in] mesh the Mesh the actor will use.
65 * @return the newly allocated MeshActor object
67 static MeshActor New( Mesh mesh );
70 * @brief 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 * @brief Downcast an Object handle to MeshActor.
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
85 static MeshActor DownCast( BaseHandle handle );
90 * This is non-virtual since derived Handle types must not contain data or virtual methods.
95 * @copydoc Dali::BaseHandle::operator=
97 using BaseHandle::operator=;
100 * @brief Set a custom material on the given actor or one of it's children.
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
108 static void SetMaterial(Actor actor, const std::string& actorName, Material material);
111 * @brief Set a custom material on this actor.
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.
117 void SetMaterial(Material material);
120 * @brief Get the material for this mesh actor.
122 * @pre the mesh is loaded
123 * @return The material
125 Material GetMaterial() const;
128 * @brief Set whether this mesh actor should be affected by lights in the scene.
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.
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.
140 void SetAffectedByLighting(bool affectedByLighting);
143 * @brief Get the lighting status.
145 * @return true if the actor is affected by the scene lighting, or false if its evenly lit.
147 bool IsAffectedByLighting();
150 * @brief Search the actor tree for all named bones in the mesh and connect them.
152 * @param[in] rootActor The root actor of the actor tree.
154 void BindBonesToMesh(Actor rootActor);
156 public: // Not intended for application developers
159 * @brief This constructor is used by Dali New() methods
161 * @param [in] actor A pointer to a newly allocated Dali resource
163 explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
168 #endif /* _MESH_ACTOR_H_ */