Commit 7260791e authored by hybrid's avatar hybrid

Add test for stencil shadows with normal projection matrix.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3206 dfc29bdd-3216-0410-991c-e03cc46cb475
parent a7b73dbf
......@@ -107,6 +107,7 @@ int main(int argumentCount, char * arguments[])
TEST(draw2DImage);
TEST(lights);
TEST(orthoCam);
TEST(stencilShadow)
// TODO: Needs to be fixed first.
// TEST(projectionMatrix);
// large scenes
......
tests/media/OpenGL-orthoStencil.png

1.72 KB | W: | H:

tests/media/OpenGL-orthoStencil.png

2.04 KB | W: | H:

tests/media/OpenGL-orthoStencil.png
tests/media/OpenGL-orthoStencil.png
tests/media/OpenGL-orthoStencil.png
tests/media/OpenGL-orthoStencil.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -26,6 +26,7 @@ static bool testOrthoCam(video::E_DRIVER_TYPE driverType)
device->getSceneManager()->addCubeSceneNode(20.f)->setPosition(core::vector3df(150,10,0));
scene::IAnimatedMeshSceneNode* node = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("../media/ninja.b3d"), 0, -1, core::vector3df(-50,2,-50), core::vector3df(),core::vector3df(5,5,5));
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
node->setAnimationSpeed(0.f);
scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(0,100,0));
......@@ -50,7 +51,7 @@ static bool testOrthoStencil(video::E_DRIVER_TYPE driverType)
if (!device)
return true; // No error if device does not exist
scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNodeFPS();
scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNode();
cam->setPosition(core::vector3df(300,250,-300));
cam->setTarget(core::vector3df(0,20,0));
cam->setProjectionMatrix(core::matrix4().buildProjectionMatrixOrthoLH(120,90,0.9f,2000.f), true);
......@@ -58,6 +59,7 @@ static bool testOrthoStencil(video::E_DRIVER_TYPE driverType)
device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->addHillPlaneMesh("plane", core::dimension2df(32,32), core::dimension2du(16,16)));//->setMaterialFlag(video::EMF_WIREFRAME, true);
scene::IAnimatedMeshSceneNode* node = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("../media/ninja.b3d"), 0, -1, core::vector3df(0,2,0), core::vector3df(),core::vector3df(5,5,5));
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
node->addShadowVolumeSceneNode();
node->setAnimationSpeed(0.f);
......
// Copyright (C) 2008-2010 Christian Stehno, Colin MacDonald
// No rights reserved: this software is in the public domain.
#include "testUtils.h"
using namespace irr;
static bool shadows(video::E_DRIVER_TYPE driverType)
{
IrrlichtDevice *device = createDevice (driverType, core::dimension2d<u32>(160,120), 16, false, true);
if (!device)
return true; // No error if device does not exist
scene::ICameraSceneNode* cam = device->getSceneManager()->addCameraSceneNodeFPS();
cam->setPosition(core::vector3df(-15,55,10));
cam->setTarget(core::vector3df(-5,-5,-15));
device->getSceneManager()->setAmbientLight(video::SColorf(.5f,.5f,.5f));
scene::IMeshSceneNode* cube = device->getSceneManager()->addCubeSceneNode(100, 0, -1, core::vector3df(0,50,0));
cube->setScale(core::vector3df(-1,-1,-1));
scene::IAnimatedMeshSceneNode* node = device->getSceneManager()->addAnimatedMeshSceneNode(device->getSceneManager()->getMesh("../media/ninja.b3d"), 0, -1, core::vector3df(0,2,0), core::vector3df(),core::vector3df(5,5,5));
node->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, true);
node->addShadowVolumeSceneNode();
node->setAnimationSpeed(0.f);
scene::ILightSceneNode* light = device->getSceneManager()->addLightSceneNode(0, core::vector3df(10,10,10));
light->setLightType(video::ELT_POINT);
light->setRadius(500.f);
light->getLightData().DiffuseColor.set(0,1,1);
device->getVideoDriver()->beginScene (true, true, 0);
device->getSceneManager()->drawAll();
device->getVideoDriver()->endScene();
const bool result = takeScreenshotAndCompareAgainstReference(device->getVideoDriver(), "-stencilShadow.png", 99.91f);
device->drop();
return result;
}
bool stencilShadow(void)
{
bool passed = true;
passed &= shadows(video::EDT_OPENGL);
// no shadows in these renderers
// passed &= shadows(video::EDT_SOFTWARE);
// passed &= shadows(video::EDT_BURNINGSVIDEO);
passed &= shadows(video::EDT_DIRECT3D9);
passed &= shadows(video::EDT_DIRECT3D8);
return passed;
}
Tests finished. 53 tests of 53 passed.
Tests finished. 54 tests of 54 passed.
Compiled as DEBUG
Test suite pass at GMT Sat Feb 06 23:27:05 2010
Test suite pass at GMT Sun Feb 07 11:52:13 2010
......@@ -327,6 +327,10 @@
RelativePath=".\softwareDevice.cpp"
>
</File>
<File
RelativePath=".\stencilshadow.cpp"
>
</File>
<File
RelativePath=".\terrainSceneNode.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