Luanti 5.16.0-dev
Loading...
Searching...
No Matches
mesh_compare.h File Reference
#include <array>
#include <vector>
#include <irrlichttypes.h>
#include <S3DVertex.h>
Include dependency graph for mesh_compare.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Typedefs

using Triangle = std::array<video::S3DVertex, 3>
 Represents a triangle as three vertices.
using Quad = std::array<video::S3DVertex, 4>
 Represents a quad as four vertices.

Functions

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.

Typedef Documentation

◆ Quad

using Quad = std::array<video::S3DVertex, 4>

Represents a quad as four vertices.

Vertices should be in the counter-clockwise order.

◆ Triangle

using Triangle = std::array<video::S3DVertex, 3>

Represents a triangle as three vertices.

“Smallest” (according to <) vertex is expected to be first, others should follow in the counter-clockwise order.

Function Documentation

◆ 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(), 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().

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

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