Commit ad82f725 authored by hybrid's avatar hybrid

Add billboard test, which shows also why the non-uniform billboards fail at a certain point.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4003 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6d9a31a0
// Copyright (C) 2008-2011 Colin MacDonald
// No rights reserved: this software is in the public domain.
#include "testUtils.h"
using namespace irr;
// Test billboards
bool billboards(void)
{
// Use EDT_BURNINGSVIDEO since it is not dependent on (e.g.) OpenGL driver versions.
IrrlichtDevice *device = createDevice(video::EDT_BURNINGSVIDEO, core::dimension2d<u32>(160, 120), 32);
assert(device);
if (!device)
return false;
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager * smgr = device->getSceneManager();
scene::ICameraSceneNode* cam = smgr->addCameraSceneNode();
scene::IBillboardSceneNode* bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(0,0,50));
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(-30,0,50));
bill->getMaterial(0).Lighting=false;
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(30,0,50));
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).Wireframe=true;
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(30,0,50));
bill->setSize(2,2,2);
bill = smgr->addBillboardSceneNode();
bill->setSize(10,20,2);
bill->setPosition(core::vector3df(0,30,50));
bill = smgr->addBillboardSceneNode();
bill->setSize(10,2,20);
bill->setPosition(core::vector3df(-30,30,50));
bill->getMaterial(0).Lighting=false;
bill = smgr->addBillboardSceneNode();
bill->setSize(10,2,20);
bill->setPosition(core::vector3df(30,30,50));
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).Wireframe=true;
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(30,30,50));
bill->setSize(2,2,2);
video::ITexture* tex = driver->getTexture("../media/fireball.bmp");
bill = smgr->addBillboardSceneNode();
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).TextureLayer[0].AnisotropicFilter=true;
bill->getMaterial(0).setTexture(0, tex);
bill->setSize(10,20,2);
bill->setPosition(core::vector3df(0,-30,50));
bill = smgr->addBillboardSceneNode();
bill->setSize(10,2,20);
bill->setPosition(core::vector3df(-30,-30,50));
bill->getMaterial(0).TextureLayer[0].AnisotropicFilter=true;
bill->getMaterial(0).setTexture(0, tex);
bill->getMaterial(0).Lighting=false;
bill = smgr->addBillboardSceneNode();
bill->setSize(10,2,20);
bill->setPosition(core::vector3df(30,-30,50));
bill->getMaterial(0).TextureLayer[0].AnisotropicFilter=true;
bill->getMaterial(0).setTexture(0, tex);
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).Wireframe=true;
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(30,-30,50));
bill->setSize(2,2,2);
bill = smgr->addBillboardSceneNode();
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).setTexture(0, tex);
bill->setSize(10,20,14);
bill->setPosition(core::vector3df(0,-15,50));
bill = smgr->addBillboardSceneNode();
bill->setSize(10,14,20);
bill->setPosition(core::vector3df(-30,-15,50));
bill->getMaterial(0).setTexture(0, tex);
bill->getMaterial(0).Lighting=false;
bill = smgr->addBillboardSceneNode();
bill->setSize(10,14,20);
bill->setPosition(core::vector3df(30,-15,50));
bill->getMaterial(0).setTexture(0, tex);
bill->getMaterial(0).Lighting=false;
bill->getMaterial(0).Wireframe=true;
bill = smgr->addBillboardSceneNode();
bill->setPosition(core::vector3df(30,-15,50));
bill->setSize(2,2,2);
bool result = false;
device->run();
driver->beginScene(true, true, video::SColor(255, 60, 60, 60));
smgr->drawAll();
driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-billboard.png");
device->closeDevice();
device->run();
device->drop();
return result;
}
......@@ -90,6 +90,7 @@ int main(int argumentCount, char * arguments[])
TEST(softwareDevice);
TEST(b3dAnimation);
TEST(burningsVideo);
TEST(billboards);
TEST(createImage);
TEST(cursorSetVisible);
TEST(flyCircleAnimator);
......
......@@ -44,6 +44,7 @@
<Unit filename="anti-aliasing.cpp" />
<Unit filename="archiveReader.cpp" />
<Unit filename="b3dAnimation.cpp" />
<Unit filename="billboards.cpp" />
<Unit filename="burningsVideo.cpp" />
<Unit filename="collisionResponseAnimator.cpp" />
<Unit filename="color.cpp" />
......
......@@ -85,6 +85,7 @@
<ClCompile Include="anti-aliasing.cpp" />
<ClCompile Include="archiveReader.cpp" />
<ClCompile Include="b3dAnimation.cpp" />
<ClCompile Include="billboards.cpp" />
<ClCompile Include="burningsVideo.cpp" />
<ClCompile Include="collisionResponseAnimator.cpp" />
<ClCompile Include="color.cpp" />
......
......@@ -188,6 +188,10 @@
RelativePath=".\b3dAnimation.cpp"
>
</File>
<File
RelativePath=".\billboards.cpp"
>
</File>
<File
RelativePath=".\burningsVideo.cpp"
>
......
......@@ -187,6 +187,10 @@
RelativePath=".\b3dAnimation.cpp"
>
</File>
<File
RelativePath=".\billboards.cpp"
>
</File>
<File
RelativePath=".\burningsVideo.cpp"
>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment