mirror of
https://github.com/minetest/irrlicht.git
synced 2024-11-14 03:33:49 +01:00
8310a3fbad
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
48 lines
1.5 KiB
C++
48 lines
1.5 KiB
C++
#include "testUtils.h"
|
|
#include "irrlicht.h"
|
|
|
|
using namespace irr;
|
|
using namespace core;
|
|
using namespace video;
|
|
|
|
// S3DVertex has operators which are used sometimes in sorting for example on loading meshes
|
|
bool testSorting()
|
|
{
|
|
// Some test-values which did fail in the past.
|
|
// See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=33391&highlight=
|
|
core::map<video::S3DVertex, int> testmap;
|
|
video::S3DVertex v;
|
|
v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
|
|
v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
|
|
v.Color = SColor(255,204,204,204);
|
|
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
|
testmap.insert(v, 0);
|
|
|
|
v.Pos = core::vector3df(-1.000000f, -1.000000f, 1.000000f);
|
|
v.Normal = core::vector3df(-0.577350f, -0.577350f, 0.577350f);
|
|
v.Color = SColor(255,204,204,204);
|
|
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
|
testmap.insert(v, 1);
|
|
|
|
v.Pos = core::vector3df(1.000000f, 1.000000f, 1.000000f);
|
|
v.Normal = core::vector3df(0.577350f, 0.577350f, 0.577350f);
|
|
v.Color = SColor(255,204,204,204);
|
|
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
|
testmap.insert(v, 2);
|
|
|
|
v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
|
|
v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
|
|
v.Color = SColor(255,204,204,204);
|
|
v.TCoords = core::vector2d<f32>(0.f, 0.f);
|
|
|
|
core::map<video::S3DVertex, int>::Node* n = testmap.find(v); // look for the vertex just inserted
|
|
return n ? true : false;
|
|
}
|
|
|
|
bool testS3DVertex(void)
|
|
{
|
|
bool result = true;
|
|
result &= testSorting();
|
|
return result;
|
|
}
|