Commit 4eeafca1 authored by hybrid's avatar hybrid

Enable test for projection matrix. I have removed the projection matrix tweak...

Enable test for projection matrix. I have removed the projection matrix tweak from OpenGL driver, as it does not seem to have any effect. At least no good one.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3501 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 6b183756
...@@ -113,7 +113,7 @@ int main(int argumentCount, char * arguments[]) ...@@ -113,7 +113,7 @@ int main(int argumentCount, char * arguments[])
TEST(viewPort); TEST(viewPort);
TEST(mrt); TEST(mrt);
// TODO: Needs to be fixed first. // TODO: Needs to be fixed first.
// TEST(projectionMatrix); TEST(projectionMatrix);
// large scenes/long rendering // large scenes/long rendering
// shadows are slow // shadows are slow
// TEST(orthoCam); // TEST(orthoCam);
......
...@@ -32,7 +32,7 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType) ...@@ -32,7 +32,7 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType)
driver->setMaterial(mat); driver->setMaterial(mat);
core::dimension2d<u32> dims = driver->getCurrentRenderTargetSize(); core::dimension2d<f32> dims(driver->getCurrentRenderTargetSize());
//apply custom projection, no offset //apply custom projection, no offset
core::matrix4 pmtx = matrix4().buildProjectionMatrixOrthoLH(dims.Width, dims.Height, 0, 100); core::matrix4 pmtx = matrix4().buildProjectionMatrixOrthoLH(dims.Width, dims.Height, 0, 100);
driver->setTransform(ETS_PROJECTION, pmtx); driver->setTransform(ETS_PROJECTION, pmtx);
...@@ -42,12 +42,12 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType) ...@@ -42,12 +42,12 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType)
//the red cross appears at center //the red cross appears at center
for (u32 i=0; i<10; ++i) for (u32 i=0; i<10; ++i)
{ {
driver->draw3DLine(vector3df(0+i,-50,1), vector3df(0+i,50,1), SColor(255,255,0,0)); driver->draw3DLine(vector3df(0.f+i,-50.f,1.f), vector3df(0.f+i,50.f,1.f), SColor(255,255,0,0));
driver->draw3DLine(vector3df(-50,0+i,1), vector3df(50,0+i,1), SColor(255,255,0,0)); driver->draw3DLine(vector3df(-50.f,0.f+i,1.f), vector3df(50.f,0.f+i,1.f), SColor(255,255,0,0));
} }
//apply custom projection, offset to right-top //apply custom projection, offset to right-top
pmtx.setTranslation(vector3df(0.7, 0.7, 0)); pmtx.setTranslation(vector3df(0.7f, 0.7f, 0.f));
driver->setTransform(ETS_PROJECTION, pmtx); driver->setTransform(ETS_PROJECTION, pmtx);
driver->setTransform(ETS_VIEW, matrix4()); driver->setTransform(ETS_VIEW, matrix4());
driver->setTransform(ETS_WORLD, matrix4()); driver->setTransform(ETS_WORLD, matrix4());
...@@ -55,14 +55,16 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType) ...@@ -55,14 +55,16 @@ static bool runTestWithDriver(E_DRIVER_TYPE driverType)
//The green cross must be in right-top corner. But for OpenGL driver it is in left-top corner //The green cross must be in right-top corner. But for OpenGL driver it is in left-top corner
for (u32 i=0; i<10; ++i) for (u32 i=0; i<10; ++i)
{ {
driver->draw3DLine(vector3df(0+i,-50,1), vector3df(0+i,50,1), SColor(255,0,255,0)); driver->draw3DLine(vector3df(0.f+i,-50,1), vector3df(0.f+i,50,1), SColor(255,0,255,0));
driver->draw3DLine(vector3df(-50,0+i,1), vector3df(50,0+i,1), SColor(255,0,255,0)); driver->draw3DLine(vector3df(-50,0.f+i,1), vector3df(50,0.f+i,1), SColor(255,0,255,0));
} }
driver->endScene(); driver->endScene();
result = takeScreenshotAndCompareAgainstReference(driver, "-projMat.png"); result = takeScreenshotAndCompareAgainstReference(driver, "-projMat.png");
device->closeDevice();
device->run();
device->drop(); device->drop();
return result; return result;
...@@ -73,7 +75,8 @@ bool projectionMatrix(void) ...@@ -73,7 +75,8 @@ bool projectionMatrix(void)
{ {
bool passed = true; bool passed = true;
passed &= runTestWithDriver(EDT_SOFTWARE); // TODO: Seems that software driver does not handle this projection matrix
// passed &= runTestWithDriver(EDT_SOFTWARE);
passed &= runTestWithDriver(EDT_BURNINGSVIDEO); passed &= runTestWithDriver(EDT_BURNINGSVIDEO);
passed &= runTestWithDriver(EDT_DIRECT3D9); passed &= runTestWithDriver(EDT_DIRECT3D9);
passed &= runTestWithDriver(EDT_DIRECT3D8); passed &= runTestWithDriver(EDT_DIRECT3D8);
...@@ -81,4 +84,3 @@ bool projectionMatrix(void) ...@@ -81,4 +84,3 @@ bool projectionMatrix(void)
return passed; return passed;
} }
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
<Unit filename="meshTransform.cpp" /> <Unit filename="meshTransform.cpp" />
<Unit filename="mrt.cpp" /> <Unit filename="mrt.cpp" />
<Unit filename="planeMatrix.cpp" /> <Unit filename="planeMatrix.cpp" />
<Unit filename="projectionMatrix.cpp" />
<Unit filename="removeCustomAnimator.cpp" /> <Unit filename="removeCustomAnimator.cpp" />
<Unit filename="sceneCollisionManager.cpp" /> <Unit filename="sceneCollisionManager.cpp" />
<Unit filename="sceneNodeAnimator.cpp" /> <Unit filename="sceneNodeAnimator.cpp" />
......
...@@ -118,6 +118,7 @@ ...@@ -118,6 +118,7 @@
<ClCompile Include="mrt.cpp" /> <ClCompile Include="mrt.cpp" />
<ClCompile Include="orthoCam.cpp" /> <ClCompile Include="orthoCam.cpp" />
<ClCompile Include="planeMatrix.cpp" /> <ClCompile Include="planeMatrix.cpp" />
<ClCompile Include="projectionMatrix.cpp" />
<ClCompile Include="removeCustomAnimator.cpp" /> <ClCompile Include="removeCustomAnimator.cpp" />
<ClCompile Include="renderTargetTexture.cpp" /> <ClCompile Include="renderTargetTexture.cpp" />
<ClCompile Include="sceneCollisionManager.cpp" /> <ClCompile Include="sceneCollisionManager.cpp" />
......
...@@ -284,6 +284,10 @@ ...@@ -284,6 +284,10 @@
RelativePath=".\planeMatrix.cpp" RelativePath=".\planeMatrix.cpp"
> >
</File> </File>
<File
RelativePath=".\projectionMatrix.cpp"
>
</File>
<File <File
RelativePath=".\removeCustomAnimator.cpp" RelativePath=".\removeCustomAnimator.cpp"
> >
......
...@@ -319,6 +319,10 @@ ...@@ -319,6 +319,10 @@
RelativePath=".\planeMatrix.cpp" RelativePath=".\planeMatrix.cpp"
> >
</File> </File>
<File
RelativePath=".\projectionMatrix.cpp"
>
</File>
<File <File
RelativePath=".\removeCustomAnimator.cpp" RelativePath=".\removeCustomAnimator.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