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>
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 * @brief Copy constructor
97 * @param [in] copy The actor to copy.
99 MeshActor(const MeshActor& copy);
102 * @brief Assignment operator
104 * @param [in] rhs The actor to copy.
106 MeshActor& operator=(const MeshActor& rhs);
109 * @brief Set a custom material on the given actor or one of it's children.
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
117 static void SetMaterial(Actor actor, const std::string& actorName, Material material);
120 * @brief Set a custom material on this actor.
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.
126 void SetMaterial(Material material);
129 * @brief Get the material for this mesh actor.
131 * @pre the mesh is loaded
132 * @return The material
134 Material GetMaterial() const;
137 * @brief Set whether this mesh actor should be affected by lights in the scene.
139 * If it is set to false, then the mesh will be unaffected by
140 * lighting, and will be drawn with flat lighting, applying
141 * the material's diffuse & ambient colors and the actor's color to the
142 * material texture. If it is set to true, and there are no lights in the
143 * scene, the mesh will not be drawn.
145 * @note This property is not inherited.
146 * @note The default value is true.
147 * @param[in] affectedByLighting Whether the actor should be lit by the scene lighting.
149 void SetAffectedByLighting(bool affectedByLighting);
152 * @brief Get the lighting status.
154 * @return true if the actor is affected by the scene lighting, or false if its evenly lit.
156 bool IsAffectedByLighting();
159 * @brief Search the actor tree for all named bones in the mesh and connect them.
161 * @param[in] rootActor The root actor of the actor tree.
163 void BindBonesToMesh(Actor rootActor);
165 public: // Not intended for application developers
168 * @brief This constructor is used by Dali New() methods
170 * @param [in] actor A pointer to a newly allocated Dali resource
172 explicit DALI_INTERNAL MeshActor(Internal::MeshActor* actor);
177 #endif /* _MESH_ACTOR_H_ */