mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-06 10:20:41 +01:00
8310a3fbad
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
74 lines
1.9 KiB
C++
74 lines
1.9 KiB
C++
// Copyright (C) 2008-2012 Christian Stehno, Colin MacDonald
|
|
// 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 lightmaps under all drivers that support them
|
|
static bool runTestWithDriver(E_DRIVER_TYPE driverType)
|
|
{
|
|
IrrlichtDevice *device = createDevice( driverType, dimension2d<u32>(160, 120), 32);
|
|
if (!device)
|
|
return true; // Treat a failure to create a driver as benign; this saves a lot of #ifdefs
|
|
|
|
IVideoDriver* driver = device->getVideoDriver();
|
|
ISceneManager * smgr = device->getSceneManager();
|
|
|
|
logTestString("Testing driver %ls\n", driver->getName());
|
|
if (driver->getDriverAttributes().getAttributeAsInt("MaxTextures")<2)
|
|
{
|
|
device->closeDevice();
|
|
device->run();
|
|
device->drop();
|
|
return true;
|
|
}
|
|
|
|
stabilizeScreenBackground(driver);
|
|
|
|
bool result = true;
|
|
bool added = device->getFileSystem()->addFileArchive("../media/map-20kdm2.pk3");
|
|
assert_log(added);
|
|
|
|
if(added)
|
|
{
|
|
ISceneNode * node = smgr->addOctreeSceneNode(smgr->getMesh("20kdm2.bsp")->getMesh(0), 0, -1, 1024);
|
|
assert_log(node);
|
|
|
|
if (node)
|
|
{
|
|
node->setMaterialFlag(EMF_LIGHTING, false);
|
|
node->setPosition(core::vector3df(-1300,-820,-1249));
|
|
node->setScale(core::vector3df(1, 5, 1));
|
|
|
|
(void)smgr->addCameraSceneNode(0, core::vector3df(0,0,0), core::vector3df(40,100,30));
|
|
|
|
driver->beginScene(video::ECBF_COLOR | video::ECBF_DEPTH, video::SColor(255,255,255,0));
|
|
smgr->drawAll();
|
|
driver->endScene();
|
|
|
|
result = takeScreenshotAndCompareAgainstReference(driver, "-lightmaps.png", 96);
|
|
}
|
|
}
|
|
|
|
device->closeDevice();
|
|
device->run();
|
|
device->drop();
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
bool lightMaps(void)
|
|
{
|
|
bool result = true;
|
|
TestWithAllDrivers(runTestWithDriver);
|
|
return result;
|
|
}
|
|
|