~baltix/+junk/irrlicht-test

« back to all changes in this revision

Viewing changes to tests/testS3DVertex.cpp

  • Committer: Mantas Kriaučiūnas
  • Date: 2011-07-18 13:06:25 UTC
  • Revision ID: mantas@akl.lt-20110718130625-c5pvifp61e7kj1ol
Included whole irrlicht SVN libraries to work around launchpad recipe issue with quilt, see https://answers.launchpad.net/launchpad/+question/165193

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "testUtils.h"
 
2
#include "irrlicht.h"
 
3
#include <assert.h>
 
4
 
 
5
using namespace irr;
 
6
using namespace core;
 
7
using namespace video;
 
8
 
 
9
// S3DVertex has operators which are used sometimes in sorting for example on loading meshes
 
10
bool testSorting()
 
11
{
 
12
        // Some test-values which did fail in the past.
 
13
        // See http://irrlicht.sourceforge.net/phpBB2/viewtopic.php?t=33391&highlight=
 
14
        core::map<video::S3DVertex, int> testmap;
 
15
        video::S3DVertex v;
 
16
        v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
 
17
        v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
 
18
        v.Color = SColor(255,204,204,204);
 
19
        v.TCoords = core::vector2d<f32>(0.f, 0.f);
 
20
        testmap.insert(v, 0);
 
21
 
 
22
        v.Pos = core::vector3df(-1.000000f, -1.000000f, 1.000000f);
 
23
        v.Normal = core::vector3df(-0.577350f, -0.577350f, 0.577350f);
 
24
        v.Color = SColor(255,204,204,204);
 
25
        v.TCoords = core::vector2d<f32>(0.f, 0.f);
 
26
        testmap.insert(v, 1);
 
27
 
 
28
        v.Pos = core::vector3df(1.000000f, 1.000000f, 1.000000f);
 
29
        v.Normal = core::vector3df(0.577350f, 0.577350f, 0.577350f);
 
30
        v.Color = SColor(255,204,204,204);
 
31
        v.TCoords = core::vector2d<f32>(0.f, 0.f);
 
32
        testmap.insert(v, 2);
 
33
 
 
34
        v.Pos = core::vector3df(1.000000f, -1.000000f, 1.000000f);
 
35
        v.Normal = core::vector3df(0.577350f, -0.577350f, 0.577350f);
 
36
        v.Color = SColor(255,204,204,204);
 
37
        v.TCoords = core::vector2d<f32>(0.f, 0.f);
 
38
 
 
39
        core::map<video::S3DVertex, int>::Node* n = testmap.find(v);    // look for the vertex just inserted
 
40
        return n ? true : false;
 
41
}
 
42
 
 
43
bool testS3DVertex(void)
 
44
{
 
45
        bool result = true;
 
46
        result &= testSorting();
 
47
        return result;
 
48
}