Fix build

master
Jeremy Hu 2019-12-15 09:27:51 +09:30
parent edff9b0b35
commit 0f7735e93a
7 changed files with 45 additions and 47 deletions

View File

@ -471,8 +471,8 @@ HEADERS += src/boxmesh.h
SOURCES += src/meshrecombiner.cpp
HEADERS += src/meshrecombiner.h
SOURCES += src/triangulate.cpp
HEADERS += src/triangulate.h
SOURCES += src/triangulatefaces.cpp
HEADERS += src/triangulatefaces.h
SOURCES += src/booleanmesh.cpp
HEADERS += src/booleanmesh.h

View File

@ -1,34 +1,32 @@
#include "boxmesh.h"
#include "strokemeshbuilder.h"
#include "triangulate.h"
static const std::vector<QVector3D> subdivedBoxObjVertices = {
{-0.025357, -0.025357, 0.025357},
{-0.025357, 0.025357, 0.025357},
{-0.025357, 0.025357, -0.025357},
{-0.025357, -0.025357, -0.025357},
{0.025357, -0.025357, 0.025357},
{0.025357, -0.025357, -0.025357},
{0.025357, 0.025357, 0.025357},
{0.025357, 0.025357, -0.025357},
{-0.030913, -0.030913, -0.000000},
{-0.030913, -0.000000, 0.030913},
{-0.030913, 0.030913, 0.000000},
{-0.030913, 0.000000, -0.030913},
{0.030913, -0.030913, -0.000000},
{0.000000, -0.030913, 0.030913},
{-0.000000, -0.030913, -0.030913},
{0.030913, -0.000000, 0.030913},
{-0.000000, 0.030913, 0.030913},
{0.030913, 0.030913, 0.000000},
{0.030913, 0.000000, -0.030913},
{-0.000000, 0.030913, -0.030913},
{-0.042574, 0.000000, -0.000000},
{-0.000000, -0.042574, -0.000000},
{0.000000, -0.000000, 0.042574},
{0.042574, -0.000000, -0.000000},
{-0.000000, 0.000000, -0.042574},
{0.000000, 0.042574, 0.000000},
{-0.025357f, -0.025357f, 0.025357f},
{-0.025357f, 0.025357f, 0.025357f},
{-0.025357f, 0.025357f, -0.025357f},
{-0.025357f, -0.025357f, -0.025357f},
{0.025357f, -0.025357f, 0.025357f},
{0.025357f, -0.025357f, -0.025357f},
{0.025357f, 0.025357f, 0.025357f},
{0.025357f, 0.025357f, -0.025357f},
{-0.030913f, -0.030913f, -0.000000f},
{-0.030913f, -0.000000f, 0.030913f},
{-0.030913f, 0.030913f, 0.000000f},
{-0.030913f, 0.000000f, -0.030913f},
{0.030913f, -0.030913f, -0.000000f},
{0.000000f, -0.030913f, 0.030913f},
{-0.000000f, -0.030913f, -0.030913f},
{0.030913f, -0.000000f, 0.030913f},
{-0.000000f, 0.030913f, 0.030913f},
{0.030913f, 0.030913f, 0.000000f},
{0.030913f, 0.000000f, -0.030913f},
{-0.000000f, 0.030913f, -0.030913f},
{-0.042574f, 0.000000f, -0.000000f},
{-0.000000f, -0.042574f, -0.000000f},
{0.000000f, -0.000000f, 0.042574f},
{0.042574f, -0.000000f, -0.000000f},
{-0.000000f, 0.000000f, -0.042574f},
{0.000000f, 0.042574f, 0.000000f},
};
static const std::vector<std::vector<size_t>> subdivedBoxObjFaces = {

View File

@ -15,7 +15,7 @@
#include "partbase.h"
#include "imageforever.h"
#include "gridmeshbuilder.h"
#include "triangulate.h"
#include "triangulatefaces.h"
MeshGenerator::MeshGenerator(Snapshot *snapshot) :
m_snapshot(snapshot)
@ -770,7 +770,7 @@ MeshCombiner::Mesh *MeshGenerator::combinePartMesh(const QString &partIdString,
}
if (partCache.previewTriangles.empty()) {
partPreviewVertices = partCache.vertices;
triangulate(partPreviewVertices, partCache.faces, partCache.previewTriangles);
triangulateFacesWithoutKeepVertices(partPreviewVertices, partCache.faces, partCache.previewTriangles);
#ifdef IN_DEVELOPMENT
{
QFile file("/Users/jeremy/Desktop/dust3d_debug.obj");

View File

@ -123,16 +123,16 @@ private:
std::map<size_t, size_t> m_weldMap;
std::set<size_t> m_swallowedEdges;
std::set<size_t> m_swallowedNodes;
float m_deformThickness = 1.0;
float m_deformWidth = 1.0;
float m_cutRotation = 0.0;
float m_deformThickness = 1.0f;
float m_deformWidth = 1.0f;
float m_cutRotation = 0.0f;
bool m_baseNormalOnX = true;
bool m_baseNormalOnY = true;
bool m_baseNormalOnZ = true;
bool m_baseNormalAverageEnabled = false;
const QImage *m_deformMapImage = nullptr;
float m_deformMapScale = 0.0;
float m_hollowThickness = 0.2;
float m_deformMapScale = 0.0f;
float m_hollowThickness = 0.2f;
std::vector<std::vector<size_t>> m_endCuts;
void sortNodeIndices();

View File

@ -1,8 +0,0 @@
#ifndef DUST3D_TRIANGULATE_H
#define DUST3D_TRIANGULATE_H
#include <QVector3D>
#include <vector>
bool triangulate(std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles);
#endif

View File

@ -4,13 +4,13 @@
#include <QVector2D>
#include <QVector3D>
#include "booleanmesh.h"
#include "triangulate.h"
#include "triangulatefaces.h"
#include "util.h"
typedef CGAL::Exact_predicates_inexact_constructions_kernel InexactKernel;
typedef CGAL::Surface_mesh<InexactKernel::Point_3> InexactMesh;
bool triangulate(std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles)
bool triangulateFacesWithoutKeepVertices(std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles)
{
auto cgalMesh = buildCgalMesh<InexactKernel>(vertices, faces);
bool isSucceed = CGAL::Polygon_mesh_processing::triangulate_faces(*cgalMesh);

8
src/triangulatefaces.h Normal file
View File

@ -0,0 +1,8 @@
#ifndef DUST3D_TRIANGULATE_FACES_H
#define DUST3D_TRIANGULATE_FACES_H
#include <QVector3D>
#include <vector>
bool triangulateFacesWithoutKeepVertices(std::vector<QVector3D> &vertices, const std::vector<std::vector<size_t>> &faces, std::vector<std::vector<size_t>> &triangles);
#endif