Luanti 5.19.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< Triangle > expandMesh (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< Triangle > canonicalizeMesh (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.
bool checkMeshEqual (const std::vector< video::S3DVertex > &vertices, const std::vector< u16 > &indices, const std::vector< Quad > &expected)
 Compare two meshes for equality.

Function Documentation

◆ canonicalizeMesh()

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

References canonicalizeMesh(), expandMesh(), and sortTriangle().

Referenced by canonicalizeMesh(), checkMeshEqual(), and checkMeshEqual().

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

◆ checkMeshEqual() [1/2]

bool checkMeshEqual ( const std::vector< video::S3DVertex > & vertices,
const std::vector< u16 > & indices,
const std::vector< Quad > & 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(), checkMeshEqual(), and sortTriangle().

Here is the call graph for this function:

◆ checkMeshEqual() [2/2]

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 an expanded form. Must be sorted.
Returns
Whether the two meshes are equal.

References canonicalizeMesh(), and checkMeshEqual().

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

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

◆ expandMesh()

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

References expandMesh().

Referenced by canonicalizeMesh(), and expandMesh().

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

◆ sortTriangle()

Triangle sortTriangle ( Triangle t)
static

Sorts triangle vertices, keeping winding order.

References sortTriangle().

Referenced by canonicalizeMesh(), checkMeshEqual(), and sortTriangle().

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