1
// Copyright (C) 2008-2011 Colin MacDonald
2
// No rights reserved: this software is in the public domain.
11
/** Test the behaviour of makeColorKeyTexture() using both 16 bit (software)
12
and 32 bit (Burning) textures, with the new behaviour and the legacy
14
static bool doTestWith(E_DRIVER_TYPE driverType,
17
IrrlichtDevice *device = createDevice( driverType,
18
dimension2d<u32>(160, 120), 32);
22
IVideoDriver* driver = device->getVideoDriver();
23
ISceneManager * smgr = device->getSceneManager();
25
// Draw a cube background so that we can check that the keying is working.
26
ISceneNode * cube = smgr->addCubeSceneNode(50.f, 0, -1, vector3df(0, 0, 60));
27
cube->setMaterialTexture(0, driver->getTexture("../media/wall.bmp"));
28
cube->setMaterialFlag(video::EMF_LIGHTING, false);
30
ITexture * Texture = device->getVideoDriver()->getTexture("../media/portal2.bmp");
32
device->getVideoDriver()->makeColorKeyTexture(Texture,
33
position2d<s32>(64,64),
35
device->getVideoDriver()->makeColorKeyTexture(Texture,
36
position2d<s32>(64,64),
38
(void)smgr->addCameraSceneNode();
40
driver->beginScene(true, true, SColor(255,100,101,140));
43
driver->draw2DImage(Texture,
45
rect<s32>(0, 0, Texture->getSize().Width, Texture->getSize().Height),
47
SColor(255,255,255,255),
51
char screenshotName[256];
52
(void)snprintf(screenshotName, 256, "-makeColorKeyTexture-%s.png",
53
zeroTexels? "old" : "new");
55
bool result = takeScreenshotAndCompareAgainstReference(driver, screenshotName);
57
device->closeDevice();
64
bool makeColorKeyTexture(void)
68
result &= doTestWith(EDT_BURNINGSVIDEO, false);
69
result &= doTestWith(EDT_SOFTWARE, false);
70
result &= doTestWith(EDT_BURNINGSVIDEO, true);
71
result &= doTestWith(EDT_SOFTWARE, true);