dust3d/src/meshcombiner.h

47 lines
1.0 KiB
C
Raw Normal View History

2019-12-14 13:28:14 +00:00
#ifndef DUST3D_COMBINER_H
#define DUST3D_COMBINER_H
#include <QVector3D>
#include <vector>
2019-12-14 13:28:14 +00:00
class MeshCombiner
{
public:
enum class Method
{
Union,
Diff
};
enum class Source
{
None,
First,
Second
};
class Mesh
{
public:
Mesh() = default;
Mesh(const std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, bool disableSelfIntersects=false);
Mesh(const Mesh &other);
~Mesh();
void fetch(std::vector<QVector3D> &vertices, std::vector<std::vector<size_t>> &faces) const;
bool isNull() const;
bool isCombinable() const;
2019-12-14 13:28:14 +00:00
friend MeshCombiner;
private:
void *m_privateData = nullptr;
bool m_isCombinable = false;
void validate();
};
static Mesh *combine(const Mesh &firstMesh, const Mesh &secondMesh, Method method,
std::vector<std::pair<Source, size_t>> *combinedVerticesComeFrom=nullptr);
};
#endif