-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMeshWorker.cpp
59 lines (47 loc) · 1.55 KB
/
MeshWorker.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
//-----------------------------------------------------------
// Copyright (C) 2021 Piotr (Peter) Beben <pdbcas2@gmail.com>
// See LICENSE included with this distribution.
#include "MeshWorker.h"
#include "Mesh.h"
#include "constants.h"
#include <QVector3D>
//-------------------------------------------------------------------------
MeshWorker::MeshWorker(Mesh& mesh, QObject *parent) :
QObject(parent)
{
m_mesh = &mesh;
}
//-------------------------------------------------------------------------
MeshWorker::~MeshWorker()
{
}
//-------------------------------------------------------------------------
void MeshWorker::generateMesh(
QVector3D norm, size_t ndim,
const std::function<float(float xu, float xv)> heightFun)
{
m_mesh->fromPlaneHeight(norm[0], norm[1], norm[2], ndim, heightFun);
emit finished();
}
//-------------------------------------------------------------------------
void MeshWorker::approxMeshNorms()
{
if (m_mesh->vertCount() == 0) return;
m_mesh->approxMeshNorms();
emit finished();
}
//-------------------------------------------------------------------------
void MeshWorker::noiseMesh(int nSweeps)
{
if (m_mesh->vertCount() == 0) return;
m_mesh->noiseMesh(nSweeps);
emit finished();
}
//-------------------------------------------------------------------------
void MeshWorker::smoothMesh(int nSweeps)
{
if (m_mesh->vertCount() == 0) return;
m_mesh->smoothMesh(nSweeps);
emit finished();
}
//-------------------------------------------------------------------------