1 // Copyright (C) 2008-2012 Colin MacDonald
\r
2 // No rights reserved: this software is in the public domain.
\r
4 #include "testUtils.h"
\r
8 // Tests skinned meshes.
\r
9 bool skinnedMesh(void)
\r
11 // Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
\r
12 IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO, core::dimension2d<u32>(160, 120), 32);
\r
16 scene::ISceneManager * smgr = device->getSceneManager();
\r
18 logTestString("Testing setMesh()\n");
\r
20 scene::ISkinnedMesh* mesh = (scene::ISkinnedMesh*)smgr->getMesh("../media/ninja.b3d");
\r
23 logTestString("Could not load ninja.\n");
\r
27 scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode(mesh);
\r
30 logTestString("Could not add ninja node.\n");
\r
34 // test if certain joint is found
\r
35 bool result = (node->getJointNode("Joint1") != 0);
\r
37 logTestString("Could not find joint in ninja.\n");
\r
39 mesh = (scene::ISkinnedMesh*)smgr->getMesh("../media/dwarf.x");
\r
42 logTestString("Could not load dwarf.\n");
\r
45 node->setMesh(mesh);
\r
47 // make sure old joint is non-existant anymore
\r
48 logTestString("Ignore error message in log, this is intended.\n");
\r
49 result &= (node->getJointNode("Joint1")==0);
\r
51 logTestString("Found non-existing joint in dwarf.\n");
\r
53 // and check that a new joint can be found
\r
54 // we use a late one, in order to see also inconsistencies in the joint cache
\r
55 result &= (node->getJointNode("hit") != 0);
\r
57 logTestString("Could not find joint in dwarf.\n");
\r
59 node = smgr->addAnimatedMeshSceneNode(mesh);
\r
62 logTestString("Could not add dwarf node.\n");
\r
65 // check that a joint can really be found
\r
66 result &= (node->getJointNode("hit") != 0);
\r
68 logTestString("Could not find joint in dwarf.\n");
\r
70 device->closeDevice();
\r