mirror of
https://github.com/minetest/irrlicht.git
synced 2025-06-30 23:30:27 +02:00
Remove irrMap and use std::map instead
This commit is contained in:
@ -8,8 +8,8 @@
|
||||
#include "CMeshBuffer.h"
|
||||
#include "SAnimatedMesh.h"
|
||||
#include "os.h"
|
||||
#include "irrMap.h"
|
||||
#include "triangle3d.h"
|
||||
#include <map>
|
||||
|
||||
namespace irr
|
||||
{
|
||||
@ -1789,8 +1789,8 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
buf->Vertices.reallocate(vcount);
|
||||
buf->Indices.reallocate(icount);
|
||||
|
||||
core::map<const video::S3DVertex, const u16> sind; // search index for fast operation
|
||||
typedef core::map<const video::S3DVertex, const u16>::Node snode;
|
||||
std::map<const video::S3DVertex, const u16> sind; // search index for fast operation
|
||||
typedef std::map<const video::S3DVertex, const u16>::iterator snode;
|
||||
|
||||
// Main algorithm
|
||||
u32 highest = 0;
|
||||
@ -1820,45 +1820,45 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
// Output the best triangle
|
||||
u16 newind = buf->Vertices.size();
|
||||
|
||||
snode *s = sind.find(v[tc[highest].ind[0]]);
|
||||
snode s = sind.find(v[tc[highest].ind[0]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[0]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[0]], newind);
|
||||
sind.emplace(v[tc[highest].ind[0]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[1]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[1]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[1]], newind);
|
||||
sind.emplace(v[tc[highest].ind[1]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[2]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[2]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[2]], newind);
|
||||
sind.emplace(v[tc[highest].ind[2]], newind);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
vc[tc[highest].ind[0]].NumActiveTris--;
|
||||
@ -1901,8 +1901,8 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
buf->Vertices.reallocate(vcount);
|
||||
buf->Indices.reallocate(icount);
|
||||
|
||||
core::map<const video::S3DVertex2TCoords, const u16> sind; // search index for fast operation
|
||||
typedef core::map<const video::S3DVertex2TCoords, const u16>::Node snode;
|
||||
std::map<const video::S3DVertex2TCoords, const u16> sind; // search index for fast operation
|
||||
typedef std::map<const video::S3DVertex2TCoords, const u16>::iterator snode;
|
||||
|
||||
// Main algorithm
|
||||
u32 highest = 0;
|
||||
@ -1932,45 +1932,45 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
// Output the best triangle
|
||||
u16 newind = buf->Vertices.size();
|
||||
|
||||
snode *s = sind.find(v[tc[highest].ind[0]]);
|
||||
snode s = sind.find(v[tc[highest].ind[0]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[0]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[0]], newind);
|
||||
sind.emplace(v[tc[highest].ind[0]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[1]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[1]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[1]], newind);
|
||||
sind.emplace(v[tc[highest].ind[1]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[2]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[2]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[2]], newind);
|
||||
sind.emplace(v[tc[highest].ind[2]], newind);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
vc[tc[highest].ind[0]].NumActiveTris--;
|
||||
@ -2014,8 +2014,8 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
buf->Vertices.reallocate(vcount);
|
||||
buf->Indices.reallocate(icount);
|
||||
|
||||
core::map<const video::S3DVertexTangents, const u16> sind; // search index for fast operation
|
||||
typedef core::map<const video::S3DVertexTangents, const u16>::Node snode;
|
||||
std::map<const video::S3DVertexTangents, const u16> sind; // search index for fast operation
|
||||
typedef std::map<const video::S3DVertexTangents, const u16>::iterator snode;
|
||||
|
||||
// Main algorithm
|
||||
u32 highest = 0;
|
||||
@ -2045,45 +2045,45 @@ IMesh* CMeshManipulator::createForsythOptimizedMesh(const IMesh *mesh) const
|
||||
// Output the best triangle
|
||||
u16 newind = buf->Vertices.size();
|
||||
|
||||
snode *s = sind.find(v[tc[highest].ind[0]]);
|
||||
snode s = sind.find(v[tc[highest].ind[0]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[0]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[0]], newind);
|
||||
sind.emplace(v[tc[highest].ind[0]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[1]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[1]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[1]], newind);
|
||||
sind.emplace(v[tc[highest].ind[1]], newind);
|
||||
newind++;
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
s = sind.find(v[tc[highest].ind[2]]);
|
||||
|
||||
if (!s)
|
||||
if (s == sind.end())
|
||||
{
|
||||
buf->Vertices.push_back(v[tc[highest].ind[2]]);
|
||||
buf->Indices.push_back(newind);
|
||||
sind.insert(v[tc[highest].ind[2]], newind);
|
||||
sind.emplace(v[tc[highest].ind[2]], newind);
|
||||
}
|
||||
else
|
||||
{
|
||||
buf->Indices.push_back(s->getValue());
|
||||
buf->Indices.push_back(s->second);
|
||||
}
|
||||
|
||||
vc[tc[highest].ind[0]].NumActiveTris--;
|
||||
|
Reference in New Issue
Block a user