dust3d/src/meshstroketifier.h

53 lines
1.6 KiB
C
Raw Normal View History

#ifndef DUST3D_MESH_STROKETIFIER_H
#define DUST3D_MESH_STROKETIFIER_H
#include <QObject>
#include <QVector3D>
#include <QMatrix4x4>
#include <vector>
class MeshStroketifier : public QObject
{
Q_OBJECT
public:
struct Node
{
QVector3D position;
float radius;
};
void setCutRotation(float cutRotation);
2020-04-08 12:46:46 +00:00
void setDeformThickness(float deformThickness);
void setDeformWidth(float deformWidth);
bool prepare(const std::vector<Node> &strokeNodes,
const std::vector<QVector3D> &vertices);
void stroketify(std::vector<QVector3D> *vertices);
void stroketify(std::vector<Node> *nodes);
private:
float m_cutRotation = 0.0;
2020-04-08 12:46:46 +00:00
float m_deformThickness = 1.0;
float m_deformWidth = 1.0;
QVector3D m_modelOrigin;
float m_modelLength = 0.0;
float m_scaleAmount = 1.0;
QVector3D m_modelAlignDirection;
2020-04-08 12:46:46 +00:00
QVector3D m_modelBaseNormal;
std::vector<QVector3D> m_modelJointPositions;
std::vector<QMatrix4x4> m_modelTransforms;
2020-04-08 12:46:46 +00:00
QMatrix4x4 m_modelRotation;
static float calculateStrokeLengths(const std::vector<Node> &strokeNodes,
std::vector<float> *lengths);
static void calculateBoundingBox(const std::vector<QVector3D> &vertices,
float *minX, float *maxX,
float *minY, float *maxY,
float *minZ, float *maxZ);
void translate(std::vector<QVector3D> *vertices);
void scale(std::vector<QVector3D> *vertices);
2020-04-08 12:46:46 +00:00
void transform(std::vector<QVector3D> *vertices);
void rotate(std::vector<QVector3D> *vertices);
void deform(std::vector<QVector3D> *vertices);
};
#endif