2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/public-api/actors/mesh-actor.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/internal/event/actors/mesh-actor-impl.h>
24 #include <dali/internal/event/modeling/model-impl.h>
25 #include <dali/internal/event/modeling/mesh-impl.h>
26 #include <dali/internal/event/modeling/animatable-mesh-impl.h>
31 MeshActor::MeshActor()
35 MeshActor MeshActor::New()
37 Internal::MeshActorPtr internal = Internal::MeshActor::New();
38 return MeshActor(internal.Get());
41 MeshActor MeshActor::New( Mesh mesh)
43 Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
44 return MeshActor(internal.Get());
47 MeshActor MeshActor::New( AnimatableMesh mesh)
49 Internal::MeshActorPtr internal = Internal::MeshActor::New(mesh);
50 return MeshActor(internal.Get());
53 MeshActor MeshActor::DownCast( BaseHandle handle )
55 return MeshActor( dynamic_cast<Dali::Internal::MeshActor*>(handle.GetObjectPtr()) );
58 MeshActor::~MeshActor()
62 MeshActor::MeshActor(const MeshActor& copy)
63 : RenderableActor(copy)
67 MeshActor& MeshActor::operator=(const MeshActor& rhs)
69 BaseHandle::operator=(rhs);
73 void MeshActor::SetMaterial(
75 const std::string& actorName,
78 Actor child = actor.FindChildByName(actorName);
81 Internal::MeshActor* meshActor = dynamic_cast<Internal::MeshActor*>(&GetImplementation(child));
84 meshActor->SetMaterial(material);
89 DALI_LOG_ERROR("MeshActor::SetMaterial() - Can't find mesh actor\n");
93 void MeshActor::SetMaterial(Material material)
95 GetImplementation(*this).SetMaterial(material);
98 Material MeshActor::GetMaterial() const
100 return GetImplementation(*this).GetMaterial();
103 void MeshActor::SetAffectedByLighting(bool affectedByLighting)
105 GetImplementation(*this).SetAffectedByLighting(affectedByLighting);
108 bool MeshActor::IsAffectedByLighting()
110 return GetImplementation(*this).IsAffectedByLighting();
113 void MeshActor::BindBonesToMesh(Actor rootActor)
115 Internal::ActorPtr root(&GetImplementation(rootActor));
117 GetImplementation(*this).BindBonesToMesh(root);
120 MeshActor::MeshActor(Internal::MeshActor* internal)
121 : RenderableActor(internal)