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.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
26 #include <mesh-builder.h>
35 MeshData::VertexContainer vertices;
36 MeshData::FaceIndices faces;
38 ConstructVertices(vertices, 60);
39 ConstructFaces(vertices, faces);
40 Material customMaterial = ConstructMaterial();
41 meshData.SetData(vertices, faces, bones, customMaterial);
42 Mesh mesh = Mesh::New(meshData);
49 int UtcDaliMeshActorNew02(void)
51 TestApplication application;
52 TestPlatformAbstraction& platform = application.GetPlatform();
54 tet_infoline("Testing Dali::MeshActor::New()");
56 std::string modelName("AModel");
57 Dali::ModelData modelData = Dali::ModelData::New(modelName);
58 Dali::Entity rootEntity = Dali::Entity::New("root");
59 modelData.SetRootEntity(rootEntity);
60 rootEntity.SetType(Dali::Entity::OBJECT);
62 Model model = Model::New("Fake model");
64 // Run Core - will query using TestPlatformAbstraction::GetResources().
65 application.SendNotification();
68 Integration::ResourceRequest* request = platform.GetRequest();
71 platform.SetResourceLoaded(request->GetId(), request->GetType()->id, Integration::ResourcePointer(&(modelData.GetBaseObject())));
75 application.SendNotification();
77 Actor actor = ModelActorFactory::BuildActorTree(model, ""); // model should be loaded
79 DALI_TEST_CHECK(model.GetLoadingState() == ResourceLoadingSucceeded);
80 DALI_TEST_CHECK(actor);
81 DALI_TEST_CHECK(actor.GetName().compare("root") == 0);
86 int UtcDaliMeshActorCreateNoMeshData(void)
88 TestApplication application;
89 tet_infoline("Testing Dali::Mesh::New() - Create with no mesh data");
94 Mesh mesh = Mesh::New(meshData);
95 MeshActor actor1 = MeshActor::New(mesh);
97 catch(Dali::DaliException& e)
99 DALI_TEST_PRINT_ASSERT( e );
100 DALI_TEST_ASSERT(e, "object", TEST_LOCATION);
106 int UtcDaliMeshActorCreateSetData01(void)
108 TestApplication application;
109 tet_infoline("Testing Dali::MeshData::SetData() - Create with no verts");
113 MeshData::VertexContainer vertices;
114 MeshData::FaceIndices faces;
116 Material customMaterial;
117 meshData.SetData(vertices, faces, bones, customMaterial);
118 Mesh mesh = Mesh::New(meshData);
119 MeshActor actor1 = MeshActor::New(mesh);
121 catch(Dali::DaliException& e)
123 DALI_TEST_PRINT_ASSERT( e );
124 DALI_TEST_ASSERT(e, "!vertices.empty()", TEST_LOCATION );
129 int UtcDaliMeshActorCreateSetData02(void)
131 TestApplication application;
132 tet_infoline("Testing Dali::MeshData::SetData - Create with no faces");
136 MeshData::VertexContainer vertices;
137 MeshData::FaceIndices faces;
139 Material customMaterial;
140 ConstructVertices(vertices, 60);
141 meshData.SetData(vertices, faces, bones, customMaterial);
142 Mesh mesh = Mesh::New(meshData);
143 MeshActor actor1 = MeshActor::New(mesh);
145 catch(Dali::DaliException& e)
147 DALI_TEST_PRINT_ASSERT( e );
148 DALI_TEST_ASSERT(e, "!faceIndices.empty", TEST_LOCATION );
153 int UtcDaliMeshActorCreateSetData03(void)
155 TestApplication application;
156 tet_infoline("Testing Dali::MeshData::SetData - Create with no mats");
160 MeshData::VertexContainer vertices;
161 MeshData::FaceIndices faces;
163 Material customMaterial;
164 ConstructVertices(vertices, 60);
165 ConstructFaces(vertices, faces);
166 meshData.SetData(vertices, faces, bones, customMaterial);
167 Mesh mesh = Mesh::New(meshData);
168 MeshActor actor1 = MeshActor::New(mesh);
170 catch(Dali::DaliException& e)
172 DALI_TEST_PRINT_ASSERT( e );
173 DALI_TEST_ASSERT(e, "material", TEST_LOCATION );
178 int UtcDaliMeshActorCreateSetData04(void)
180 TestApplication application;
181 tet_infoline("Testing Dali::MeshActor::SetData()");
184 MeshData::VertexContainer vertices;
185 MeshData::FaceIndices faces;
187 ConstructVertices(vertices, 60);
188 ConstructFaces(vertices, faces);
189 Material customMaterial = ConstructMaterial();
190 meshData.SetData(vertices, faces, bones, customMaterial);
192 Mesh mesh = Mesh::New(meshData);
193 MeshActor actor1 = MeshActor::New(mesh);
194 DALI_TEST_CHECK(actor1);
199 int UtcDaliMeshActorDownCast(void)
201 TestApplication application;
202 tet_infoline("Testing Dali::MeshActor::DownCast()");
205 MeshData::VertexContainer vertices;
206 MeshData::FaceIndices faces;
208 ConstructVertices(vertices, 60);
209 ConstructFaces(vertices, faces);
210 Material customMaterial = ConstructMaterial();
211 meshData.SetData(vertices, faces, bones, customMaterial);
212 Mesh mesh = Mesh::New(meshData);
214 MeshActor actor1 = MeshActor::New(mesh);
215 Actor anActor = Actor::New();
218 Actor child = anActor.GetChildAt(0);
219 MeshActor meshActor = MeshActor::DownCast(child);
221 DALI_TEST_CHECK(meshActor);
225 int UtcDaliMeshActorDownCast2(void)
227 TestApplication application;
228 tet_infoline("Testing Dali::MeshActor::DownCast()");
230 Actor actor1 = Actor::New();
231 Actor anActor = Actor::New();
234 Actor child = anActor.GetChildAt(0);
235 MeshActor meshActor = MeshActor::DownCast(child);
236 DALI_TEST_CHECK(!meshActor);
238 Actor unInitialzedActor;
239 meshActor = DownCast< MeshActor >( unInitialzedActor );
240 DALI_TEST_CHECK(!meshActor);
244 int UtcDaliMeshActorSetMaterial01(void)
246 TestApplication application;
247 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
249 Mesh mesh = NewMesh();
251 MeshActor actor = MeshActor::New(mesh);
252 std::string name = "AMeshActor";
253 Stage::GetCurrent().Add(actor);
255 application.SendNotification();
256 application.Render();
257 application.Render();
258 application.SendNotification();
260 Material customMaterial = Material::New("CustomMaterial");
261 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
263 MeshActor::SetMaterial(actor, name, customMaterial);
264 application.SendNotification();
265 application.Render();
266 application.Render();
267 application.SendNotification();
269 DALI_TEST_CHECK( actor.GetMaterial() == customMaterial );
273 int UtcDaliMeshActorSetMaterial01b(void)
275 TestApplication application;
276 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
278 Mesh mesh = NewMesh();
280 Actor rootActor = Actor::New();
281 MeshActor meshActor = MeshActor::New(mesh);
282 rootActor.Add(meshActor);
284 std::string name = "AMeshActor";
285 meshActor.SetName(name);
287 Stage::GetCurrent().Add(rootActor);
288 application.SendNotification();
289 application.Render();
290 application.Render();
291 application.SendNotification();
293 Material customMaterial = Material::New("CustomMaterial");
294 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
296 MeshActor::SetMaterial(rootActor, name, customMaterial);
297 application.SendNotification();
298 application.Render();
299 application.Render();
300 application.SendNotification();
302 DALI_TEST_CHECK(meshActor.GetMaterial() == customMaterial );
307 int UtcDaliMeshActorSetMaterial02(void)
309 TestApplication application;
310 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
312 Mesh mesh = NewMesh();
313 MeshActor actor = MeshActor::New(mesh);
315 std::string name = "AMeshActor";
317 Stage::GetCurrent().Add(actor);
318 application.SendNotification();
319 application.Render();
320 application.Render();
321 application.SendNotification();
323 Material baseMat = actor.GetMaterial();
324 Material customMaterial = Material::New("CustomMaterial");
325 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
327 MeshActor::SetMaterial(actor, "NoName", customMaterial);
328 application.SendNotification();
329 application.Render();
330 application.Render();
331 application.SendNotification();
333 DALI_TEST_CHECK( actor.GetMaterial() == baseMat );
334 DALI_TEST_CHECK( actor.GetMaterial() != customMaterial );
338 int UtcDaliMeshActorSetMaterial02b(void)
340 TestApplication application;
341 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
343 Mesh mesh = NewMesh();
345 MeshActor actor = MeshActor::New(mesh);
346 Stage::GetCurrent().Add(actor);
348 std::string name = "AMeshActor";
350 application.SendNotification();
351 application.Render();
352 application.Render();
353 application.SendNotification();
355 Material baseMat = actor.GetMaterial();
356 Material customMaterial = Material::New("CustomMaterial");
357 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
359 MeshActor::SetMaterial(actor, "NoName", customMaterial);
360 application.SendNotification();
361 application.Render();
362 application.Render();
363 application.SendNotification();
365 DALI_TEST_CHECK( actor.GetMaterial() == baseMat );
366 DALI_TEST_CHECK( actor.GetMaterial() != customMaterial );
371 int UtcDaliMeshActorSetMaterial03(void)
373 TestApplication application;
374 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
376 Mesh mesh = NewMesh();
378 MeshActor actor = MeshActor::New(mesh);
379 std::string name = "AMeshActor";
381 Stage::GetCurrent().Add(actor);
383 Material customMaterial = Material::New("CustomMaterial");
384 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
386 actor.SetMaterial(customMaterial);
387 application.SendNotification();
388 application.Render(0);
389 application.Render(16);
390 application.SendNotification();
392 DALI_TEST_CHECK(actor.GetMaterial() == customMaterial );
396 int UtcDaliMeshActorSetMaterial03b(void)
398 TestApplication application;
399 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
401 Mesh mesh = NewMesh();
403 MeshActor actor = MeshActor::New(mesh);
404 std::string name = "AMeshActor";
406 Stage::GetCurrent().Add(actor);
408 Material customMaterial = Material::New("CustomMaterial");
409 customMaterial.SetDiffuseColor(Vector4(1.0f, 0.0f, 0.0f, 1.0f));
411 actor.SetMaterial(customMaterial);
412 application.SendNotification();
413 application.Render(0);
414 application.Render(16);
415 application.SendNotification();
416 DALI_TEST_CHECK(actor.GetMaterial() == customMaterial );
422 int UtcDaliMeshActorGetMaterial01(void)
424 TestApplication application;
425 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
428 MeshData::VertexContainer vertices;
429 MeshData::FaceIndices faces;
431 ConstructVertices(vertices, 60);
432 ConstructFaces(vertices, faces);
433 Material material = ConstructMaterial();
434 meshData.SetData(vertices, faces, bones, material);
435 Mesh mesh = Mesh::New(meshData);
437 MeshActor actor = MeshActor::New(mesh);
438 std::string name = "AMeshActor";
440 application.SendNotification();
441 application.Render();
442 application.Render();
443 application.SendNotification();
445 Material gotMaterial = actor.GetMaterial();
447 DALI_TEST_EQUALS( material.GetOpacity(), gotMaterial.GetOpacity(), TEST_LOCATION );
448 DALI_TEST_EQUALS( material.GetAmbientColor(), gotMaterial.GetAmbientColor(), TEST_LOCATION );
449 DALI_TEST_EQUALS( material.GetDiffuseColor(), gotMaterial.GetDiffuseColor(), TEST_LOCATION );
450 DALI_TEST_EQUALS( material.GetSpecularColor(), gotMaterial.GetSpecularColor(), TEST_LOCATION );
455 int UtcDaliMeshActorGetMaterial02(void)
457 TestApplication application;
458 tet_infoline("Testing Dali::MeshActor::SetMaterial()");
461 MeshData::VertexContainer vertices;
462 MeshData::FaceIndices faces;
464 ConstructVertices(vertices, 60);
465 ConstructFaces(vertices, faces);
466 Material material = ConstructMaterial();
467 meshData.SetData(vertices, faces, bones, material);
468 Mesh mesh = Mesh::New(meshData);
470 MeshActor actor = MeshActor::New(mesh);
471 std::string name = "AMeshActor";
473 application.SendNotification();
474 application.Render();
475 application.Render();
476 application.SendNotification();
478 Material gotMaterial = actor.GetMaterial();
480 DALI_TEST_EQUALS( material.GetOpacity(), gotMaterial.GetOpacity(), TEST_LOCATION );
481 DALI_TEST_EQUALS( material.GetAmbientColor(), gotMaterial.GetAmbientColor(), TEST_LOCATION );
482 DALI_TEST_EQUALS( material.GetDiffuseColor(), gotMaterial.GetDiffuseColor(), TEST_LOCATION );
483 DALI_TEST_EQUALS( material.GetSpecularColor(), gotMaterial.GetSpecularColor(), TEST_LOCATION );
487 int UtcDaliMeshActorSetLighting01(void)
489 TestApplication application;
490 tet_infoline("Testing Dali::MeshActor::GetLighting()");
492 Mesh mesh = NewMesh();
494 MeshActor actor = MeshActor::New(mesh);
495 Stage::GetCurrent().Add(actor);
497 // Mesh actors should be lit by default
498 DALI_TEST_EQUALS(actor.IsAffectedByLighting(), true, TEST_LOCATION);
502 int UtcDaliMeshActorSetLighting02(void)
504 TestApplication application;
505 tet_infoline("Testing Dali::MeshActor::SetLighting()");
507 Mesh mesh = NewMesh();
508 MeshActor actor = MeshActor::New(mesh);
509 Stage::GetCurrent().Add(actor);
511 application.SendNotification();
512 application.Render();
513 application.Render();
514 application.SendNotification();
516 Light light = Light::New("KeyLight");
517 light.SetFallOff(Vector2(10000.0f, 10000.0f));
518 LightActor keyLightActor = LightActor::New();
519 keyLightActor.SetParentOrigin(ParentOrigin::CENTER);
520 keyLightActor.SetPosition(200.0f, 500.0f, 300.0f);
521 keyLightActor.SetName(light.GetName());
523 Stage::GetCurrent().Add(keyLightActor);
524 keyLightActor.SetLight(light);
525 keyLightActor.SetActive(true);
527 actor.SetAffectedByLighting(true);
528 DALI_TEST_EQUALS(actor.IsAffectedByLighting(), true, TEST_LOCATION);
530 // Test rendering to ensure that the correct shader setup is used in renderer
531 // (check in debugger or via coverage)
532 application.Render(1);
533 application.SendNotification();
534 application.Render(1);
535 application.SendNotification();
536 application.Render(1);
537 application.SendNotification();
538 application.Render(1);
539 application.SendNotification();
540 application.Render(1);
542 actor.SetAffectedByLighting(false);
543 DALI_TEST_EQUALS(actor.IsAffectedByLighting(), false, TEST_LOCATION);
545 // Test rendering to ensure that the correct shader setup is used in renderer
546 // (check in debugger or via coverage)
547 application.Render(1);
548 application.SendNotification();
549 application.Render(1);
550 application.SendNotification();
551 application.Render(1);
552 application.SendNotification();
553 application.Render(1);
554 application.SendNotification();
555 application.Render(1);
562 Material ConstructMaterial(float opacity, float diffuseOpacity)
564 Material customMaterial = Material::New("CustomMaterial");
565 customMaterial.SetOpacity(opacity);
566 customMaterial.SetDiffuseColor(Vector4(0.8f, 0.0f, 0.4f, diffuseOpacity));
567 customMaterial.SetAmbientColor(Vector4(0.2f, 1.0f, 0.6f, 1.0f));
568 customMaterial.SetSpecularColor(Vector4(0.5f, 0.6f, 0.7f, 1.0f));
569 return customMaterial;
572 static void TestBlending( TestApplication& application, Material material, float actorOpacity, BlendingMode::Type blendingMode, bool expectedBlend )
575 MeshData::VertexContainer vertices;
576 MeshData::FaceIndices faces;
578 ConstructVertices(vertices, 60);
579 ConstructFaces(vertices, faces);
580 meshData.SetData(vertices, faces, bones, material);
581 Mesh mesh = Mesh::New(meshData);
583 application.SendNotification();
584 application.Render(0);
585 application.Render();
586 application.SendNotification();
588 MeshActor actor = MeshActor::New(mesh);
589 Stage::GetCurrent().Add(actor);
591 actor.SetAffectedByLighting(false);
592 actor.SetBlendMode(blendingMode);
593 actor.SetOpacity(actorOpacity);
595 TraceCallStack& cullFaceTrace = application.GetGlAbstraction().GetCullFaceTrace();
596 cullFaceTrace.Enable(true);
597 application.SendNotification();
598 application.Render();
599 DALI_TEST_EQUALS( BlendEnabled( cullFaceTrace ), expectedBlend, TEST_LOCATION );
601 } //anonymous namespace
604 int UtcDaliMeshActorBlend01(void)
606 // Set Material with translucent color, actor color opaque, Set Use image alpha to true
609 TestApplication application;
610 tet_infoline("Testing Dali::MeshActor::Blend01()");
612 TestBlending( application, ConstructMaterial(0.5f, 0.5f), 1.0f, BlendingMode::AUTO, true );
617 int UtcDaliMeshActorBlend02(void)
619 // Set material to translucent, set use image alpha to false, set actor opacity to 1.0f
620 // Expect no blending
622 TestApplication application;
623 tet_infoline("Testing Dali::MeshActor::Blend02()");
624 TestBlending( application, ConstructMaterial(0.5f, 0.5f), 1.0f, BlendingMode::OFF, false );
628 int UtcDaliMeshActorBlend03(void)
630 // Set material to opaque, set use image alpha to true, set actor opacity to 1.0f
631 // Expect no blending
633 TestApplication application;
634 tet_infoline("Testing Dali::MeshActor::Blend03()");
635 TestBlending( application, ConstructMaterial(1.0f, 1.0f), 1.0f, BlendingMode::AUTO, false );
640 int UtcDaliMeshActorBlend04(void)
642 // Set material to have image with alpha, set use image alpha to true, set actor opacity to 1.0f
644 TestApplication application;
645 tet_infoline("Testing Dali::MeshActor::Blend04()");
647 Material material = ConstructMaterial(1.0f, 1.0f);
648 BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
649 material.SetDiffuseTexture( image );
650 application.SendNotification();
651 application.Render(0);
653 TestBlending( application, material, 1.0f, BlendingMode::AUTO, true );
657 int UtcDaliMeshActorBlend05(void)
659 // Set material to have image with alpha, set use image alpha to false, set actor opacity to 1.0f
660 // Expect no blending
662 TestApplication application;
663 tet_infoline("Testing Dali::MeshActor::Blend05()");
665 Material material = ConstructMaterial(1.0f, 1.0f);
666 BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
667 material.SetDiffuseTexture( image );
668 application.SendNotification();
669 application.Render(0);
671 TestBlending( application, material, 1.0f, BlendingMode::ON, true );
676 int UtcDaliMeshActorBlend06(void)
678 // Set material to have image without alpha, set use image alpha to true, set actor opacity to 1.0f
679 // Expect no blending
681 TestApplication application;
682 tet_infoline("Testing Dali::MeshActor::Blend()");
684 Material material = ConstructMaterial(1.0f, 1.0f);
685 BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGB888 );
686 material.SetDiffuseTexture( image );
687 application.SendNotification();
688 application.Render(0);
690 TestBlending( application, material, 1.0f, BlendingMode::AUTO, false );
694 int UtcDaliMeshActorBlend07(void)
696 // Set material to have framebuffer with alpha, set use image alpha to true, set actor opacity to 1.0f
698 TestApplication application;
699 tet_infoline("Testing Dali::MeshActor::Blend07()");
700 application.Render(0);
702 Material material = ConstructMaterial(1.0f, 1.0f);
703 FrameBufferImage image = FrameBufferImage::New( 100, 50, Pixel::RGBA8888 );
704 RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
705 RenderTask task = taskList.GetTask( 0u );
706 task.SetTargetFrameBuffer( image ); // To ensure frame buffer is connected
707 application.GetGlAbstraction().SetCheckFramebufferStatusResult( GL_FRAMEBUFFER_COMPLETE );
708 application.SendNotification();
709 application.Render();
711 material.SetDiffuseTexture( image ); // (to render from)
712 application.SendNotification();
713 application.Render();
714 application.Render();
715 application.SendNotification();
717 TestBlending( application, material, 1.0f, BlendingMode::AUTO, true );
721 int UtcDaliMeshActorBlend08(void)
723 // Set material to have image with alpha, set use image alpha to false, set actor opacity to 0.5f
725 TestApplication application;
726 tet_infoline("Testing Dali::MeshActor::Blend08()");
728 Material material = ConstructMaterial(1.0f, 1.0f);
729 BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGBA8888 );
730 material.SetDiffuseTexture( image );
731 application.SendNotification();
732 application.Render(0);
734 TestBlending( application, material, 0.5f, BlendingMode::AUTO, true );
738 int UtcDaliMeshActorBlend09(void)
740 // Set material to have image with no alpha, set material opacity to 0.5, set use image alpha to true, set actor opacity to 1.0f
742 TestApplication application;
743 tet_infoline("Testing Dali::MeshActor::Blend08()");
745 Material material = ConstructMaterial(0.5f, 1.0f);
746 BitmapImage image = BitmapImage::New( 100, 50, Pixel::RGB888 );
747 material.SetDiffuseTexture( image );
748 application.SendNotification();
749 application.Render(0);
751 TestBlending( application, material, 1.0f, BlendingMode::AUTO, true );
755 int UtcDaliMeshActorBoneUpdate01(void)
757 TestApplication application;
758 tet_infoline("Testing Dali::MeshActor::BoneUpdate01()");
760 // Set up a mesh with bones.
762 // ensure bone actor's world matrix is updated
764 Actor trunk = Actor::New();
765 trunk.SetName("trunk");
766 trunk.SetPosition(Vector3(100.0f, 200.0f, 300.0f));
767 trunk.SetRotation(Quaternion(M_PI*0.3f, Vector3::XAXIS));
768 Actor branch = Actor::New();
769 branch.SetName("branch");
770 branch.SetPosition(Vector3(10.0f, 100.0f, 0.0f));
771 branch.SetRotation(Quaternion(M_PI*0.2f, Vector3::YAXIS));
773 Actor twig = ImageActor::New(CreateBitmapImage());
774 twig.SetName("twig");
775 branch.SetPosition(Vector3(20.0f, 30.0f, 40.0f));
777 Actor bug = Actor::New(); // Not a bone
779 bug.SetPosition(Vector3(10.0f, 10.0f, 10.0f));
781 Stage::GetCurrent().Add(trunk);
787 CreateMeshData(meshData); // Created with named bones (as above)
788 Mesh mesh = Mesh::New(meshData);
789 MeshActor meshActor = MeshActor::New(mesh);
790 Stage::GetCurrent().Add(meshActor);
792 meshActor.BindBonesToMesh(Stage::GetCurrent().GetRootLayer());
794 application.SendNotification();
795 application.Render(0);
796 application.Render();
797 application.SendNotification();
800 // Need to see what bone actor's node has set as world matrix.
802 Animation anim = Animation::New(1.0f);
803 anim.RotateBy(trunk, Radian(M_PI*0.5f), Vector3::ZAXIS);
805 application.SendNotification();
806 application.Render(500);
807 application.SendNotification();
808 application.Render(500);
809 application.SendNotification();
810 application.Render(10);
812 // All bones have moved.
813 // Check that their world matrix has been updated: ( Isn't IDENTITY )
814 DALI_TEST_CHECK( ! application.GetGlAbstraction().CheckUniformValue("uModelMatrix", Matrix::IDENTITY ) );
817 GLuint programId, uniformId;
818 DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformIds("uModelMatrix", programId, uniformId) );
819 DALI_TEST_CHECK( application.GetGlAbstraction().GetUniformValue( programId, uniformId, worldMatrix) );
821 // But also check that property is calculated as needed:
822 Matrix calcWorldMatrix = twig.GetCurrentWorldMatrix();
823 DALI_TEST_CHECK( Matrix::IDENTITY != calcWorldMatrix );
824 DALI_TEST_CHECK( worldMatrix == calcWorldMatrix );
829 int UtcDaliMeshActorIndices(void)
831 TestApplication application;
832 Actor basicActor = Actor::New();
833 Mesh mesh = NewMesh();
834 MeshActor meshActor = MeshActor::New(mesh);
836 Property::IndexContainer indices;
837 meshActor.GetPropertyIndices( indices );
838 DALI_TEST_CHECK( indices.size() == basicActor.GetPropertyCount() ); // Mesh Actor does not have any properties
839 DALI_TEST_EQUALS( indices.size(), meshActor.GetPropertyCount(), TEST_LOCATION );