Luanti 5.10.0-dev
 
Loading...
Searching...
No Matches
mesh_compare.cpp File Reference
#include "mesh_compare.h"
#include <algorithm>
#include <map>
#include <stdexcept>
+ Include dependency graph for mesh_compare.cpp:

Functions

static std::vector< TriangleexpandMesh (const std::vector< video::S3DVertex > &vertices, const std::vector< u16 > &indices)
 
static Triangle sortTriangle (Triangle t)
 Sorts triangle vertices, keeping winding order.
 
static std::vector< TrianglecanonicalizeMesh (const std::vector< video::S3DVertex > &vertices, const std::vector< u16 > &indices)
 
bool checkMeshEqual (const std::vector< video::S3DVertex > &vertices, const std::vector< u16 > &indices, const std::vector< Triangle > &expected)
 Compare two meshes for equality.
 

Function Documentation

◆ canonicalizeMesh()

static std::vector< Triangle > canonicalizeMesh ( const std::vector< video::S3DVertex > & vertices,
const std::vector< u16 > & indices )
static

References expandMesh(), and sortTriangle().

Referenced by checkMeshEqual().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ checkMeshEqual()

bool checkMeshEqual ( const std::vector< video::S3DVertex > & vertices,
const std::vector< u16 > & indices,
const std::vector< Triangle > & expected )
nodiscard

Compare two meshes for equality.

Parameters
verticesVertices of the first mesh. Order doesn’t matter.
indicesIndices of the first mesh. Triangle order doesn’t matter. Vertex order in a triangle only matters for winding.
expectedThe second mesh, in a quad form.
Returns
Whether the two meshes are equal.
Note
There are two ways to split a quad into 2 triangles; either is allowed.

References canonicalizeMesh().

Referenced by TestMeshCompare::testQuad(), and TestMeshCompare::testTriangle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ expandMesh()

static std::vector< Triangle > expandMesh ( const std::vector< video::S3DVertex > & vertices,
const std::vector< u16 > & indices )
static

Referenced by canonicalizeMesh().

+ Here is the caller graph for this function:

◆ sortTriangle()

static Triangle sortTriangle ( Triangle t)
static

Sorts triangle vertices, keeping winding order.

Referenced by canonicalizeMesh().

+ Here is the caller graph for this function: