2018-10-25 00:19:38 +00:00
|
|
|
#ifndef DUST3D_TEXTURE_GENERATOR_H
|
|
|
|
#define DUST3D_TEXTURE_GENERATOR_H
|
2018-05-07 16:08:19 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <vector>
|
|
|
|
#include <QImage>
|
2019-02-26 13:24:58 +00:00
|
|
|
#include <QColor>
|
2019-11-03 14:31:13 +00:00
|
|
|
#include <QPixmap>
|
2020-11-17 14:31:51 +00:00
|
|
|
#include "object.h"
|
2020-04-07 23:15:20 +00:00
|
|
|
#include "model.h"
|
2018-10-26 23:04:45 +00:00
|
|
|
#include "snapshot.h"
|
2018-05-07 16:08:19 +00:00
|
|
|
|
|
|
|
class TextureGenerator : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-11-17 14:31:51 +00:00
|
|
|
TextureGenerator(const Object &object, Snapshot *snapshot=nullptr);
|
2018-05-07 16:08:19 +00:00
|
|
|
~TextureGenerator();
|
2018-05-10 09:16:22 +00:00
|
|
|
QImage *takeResultTextureColorImage();
|
2018-10-09 02:19:12 +00:00
|
|
|
QImage *takeResultTextureNormalImage();
|
2018-11-28 03:00:03 +00:00
|
|
|
QImage *takeResultTextureRoughnessImage();
|
|
|
|
QImage *takeResultTextureMetalnessImage();
|
|
|
|
QImage *takeResultTextureAmbientOcclusionImage();
|
2020-11-17 14:31:51 +00:00
|
|
|
Object *takeObject();
|
2020-04-07 23:15:20 +00:00
|
|
|
Model *takeResultMesh();
|
2020-02-27 09:57:09 +00:00
|
|
|
bool hasTransparencySettings();
|
2019-11-03 00:15:20 +00:00
|
|
|
void addPartColorMap(QUuid partId, const QImage *image, float tileScale);
|
|
|
|
void addPartNormalMap(QUuid partId, const QImage *image, float tileScale);
|
|
|
|
void addPartMetalnessMap(QUuid partId, const QImage *image, float tileScale);
|
|
|
|
void addPartRoughnessMap(QUuid partId, const QImage *image, float tileScale);
|
|
|
|
void addPartAmbientOcclusionMap(QUuid partId, const QImage *image, float tileScale);
|
2018-10-09 02:19:12 +00:00
|
|
|
void generate();
|
2020-11-17 14:31:51 +00:00
|
|
|
static QImage *combineMetalnessRoughnessAmbientOcclusionImages(QImage *metalnessImage,
|
|
|
|
QImage *roughnessImage,
|
|
|
|
QImage *ambientOcclusionImage);
|
2018-05-07 16:08:19 +00:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
public slots:
|
|
|
|
void process();
|
|
|
|
public:
|
2019-02-26 13:24:58 +00:00
|
|
|
static QColor m_defaultTextureColor;
|
2018-10-09 02:19:12 +00:00
|
|
|
private:
|
2018-10-09 09:17:44 +00:00
|
|
|
void prepare();
|
2018-05-07 16:08:19 +00:00
|
|
|
private:
|
2020-11-17 14:31:51 +00:00
|
|
|
Object *m_object;
|
2018-05-10 09:16:22 +00:00
|
|
|
QImage *m_resultTextureColorImage;
|
2018-10-09 02:19:12 +00:00
|
|
|
QImage *m_resultTextureNormalImage;
|
|
|
|
QImage *m_resultTextureRoughnessImage;
|
|
|
|
QImage *m_resultTextureMetalnessImage;
|
|
|
|
QImage *m_resultTextureAmbientOcclusionImage;
|
2020-04-07 23:15:20 +00:00
|
|
|
Model *m_resultMesh;
|
2019-11-03 00:15:20 +00:00
|
|
|
std::map<QUuid, std::pair<QImage, float>> m_partColorTextureMap;
|
|
|
|
std::map<QUuid, std::pair<QImage, float>> m_partNormalTextureMap;
|
|
|
|
std::map<QUuid, std::pair<QImage, float>> m_partMetalnessTextureMap;
|
|
|
|
std::map<QUuid, std::pair<QImage, float>> m_partRoughnessTextureMap;
|
|
|
|
std::map<QUuid, std::pair<QImage, float>> m_partAmbientOcclusionTextureMap;
|
2019-11-07 12:08:47 +00:00
|
|
|
std::set<QUuid> m_countershadedPartIds;
|
2018-10-25 00:19:38 +00:00
|
|
|
Snapshot *m_snapshot;
|
2020-02-27 09:57:09 +00:00
|
|
|
bool m_hasTransparencySettings;
|
2020-02-27 10:53:50 +00:00
|
|
|
int m_textureSize;
|
2018-05-07 16:08:19 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|