2009-01-14 04:37:51 -08:00
|
|
|
// Copyright (C) 2008-2009 Colin MacDonald
|
2008-12-15 06:18:11 -08:00
|
|
|
// No rights reserved: this software is in the public domain.
|
|
|
|
|
|
|
|
#include "testUtils.h"
|
|
|
|
|
|
|
|
using namespace irr;
|
|
|
|
using namespace core;
|
|
|
|
using namespace scene;
|
|
|
|
using namespace video;
|
|
|
|
using namespace io;
|
|
|
|
using namespace gui;
|
|
|
|
|
|
|
|
// Tests B3D animations.
|
|
|
|
/** Verify that two skinned animated mesh scene nodes can use different frames of the skinned mesh */
|
|
|
|
bool b3dAnimation(void)
|
|
|
|
{
|
|
|
|
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
|
2009-01-19 05:48:22 -08:00
|
|
|
IrrlichtDevice *device = createDevice( EDT_BURNINGSVIDEO, dimension2d<u32>(160, 120), 32);
|
2008-12-15 06:18:11 -08:00
|
|
|
assert(device);
|
|
|
|
if (!device)
|
|
|
|
return false;
|
2009-01-14 04:37:51 -08:00
|
|
|
|
2008-12-15 06:18:11 -08:00
|
|
|
IVideoDriver* driver = device->getVideoDriver();
|
|
|
|
ISceneManager * smgr = device->getSceneManager();
|
|
|
|
|
|
|
|
IAnimatedMesh* mesh = smgr->getMesh("../media/ninja.b3d");
|
|
|
|
IAnimatedMeshSceneNode* node1;
|
|
|
|
IAnimatedMeshSceneNode* node2;
|
|
|
|
assert(mesh);
|
|
|
|
|
|
|
|
bool result = false;
|
|
|
|
if(mesh)
|
|
|
|
{
|
|
|
|
node1 = smgr->addAnimatedMeshSceneNode(mesh);
|
|
|
|
assert(node1);
|
|
|
|
|
|
|
|
if(node1)
|
|
|
|
{
|
|
|
|
node1->setPosition(vector3df(-3, -3, 10));
|
|
|
|
node1->setMaterialFlag(EMF_LIGHTING, false);
|
|
|
|
node1->setAnimationSpeed(0.f);
|
2009-08-24 02:12:27 -07:00
|
|
|
node1->setCurrentFrame(10.f);
|
2009-10-28 08:56:14 -07:00
|
|
|
node1->setDebugDataVisible(irr::scene::EDS_BBOX_BUFFERS);
|
2008-12-15 06:18:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
node2 = smgr->addAnimatedMeshSceneNode(mesh);
|
|
|
|
assert(node2);
|
|
|
|
if(node2)
|
|
|
|
{
|
|
|
|
node2->setPosition(vector3df(3, -3, 10));
|
|
|
|
node2->setMaterialFlag(EMF_LIGHTING, false);
|
|
|
|
node2->setAnimationSpeed(0.f);
|
|
|
|
node2->setCurrentFrame(62.f);
|
2009-10-28 08:56:14 -07:00
|
|
|
node2->setDebugDataVisible(irr::scene::EDS_BBOX_BUFFERS);
|
2008-12-15 06:18:11 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
(void)smgr->addCameraSceneNode();
|
|
|
|
|
|
|
|
// Just jump to the last frame since that's all we're interested in.
|
|
|
|
device->run();
|
2009-10-28 08:56:14 -07:00
|
|
|
driver->beginScene(true, true, SColor(255, 60, 60, 60));
|
2008-12-15 06:18:11 -08:00
|
|
|
smgr->drawAll();
|
|
|
|
driver->endScene();
|
|
|
|
|
|
|
|
result = takeScreenshotAndCompareAgainstReference(driver, "-b3dAnimation.png");
|
|
|
|
}
|
|
|
|
|
|
|
|
device->drop();
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|