irrlicht/tests/testS3DVertex.cpp
cutealien 8310a3fbad Avoid warning and make local variable lower-case.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@6000 dfc29bdd-3216-0410-991c-e03cc46cb475
2019-12-12 16:32:41 +00:00

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;
}