2020-04-03 13:53:54 +00:00
|
|
|
#ifndef DUST3D_DOCUMENT_SAVER_H
|
|
|
|
#define DUST3D_DOCUMENT_SAVER_H
|
|
|
|
#include <QString>
|
|
|
|
#include <QObject>
|
|
|
|
#include <QByteArray>
|
|
|
|
#include <map>
|
2020-04-12 02:05:39 +00:00
|
|
|
#include <set>
|
|
|
|
#include <QUuid>
|
2020-04-03 13:53:54 +00:00
|
|
|
#include "snapshot.h"
|
2020-11-17 14:31:51 +00:00
|
|
|
#include "object.h"
|
2020-04-03 13:53:54 +00:00
|
|
|
|
|
|
|
class DocumentSaver : public QObject
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2020-11-17 14:31:51 +00:00
|
|
|
class Textures
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
QImage *textureImage = nullptr;
|
|
|
|
QByteArray *textureImageByteArray = nullptr;
|
|
|
|
QImage *textureNormalImage = nullptr;
|
|
|
|
QByteArray *textureNormalImageByteArray = nullptr;
|
|
|
|
QImage *textureMetalnessImage = nullptr;
|
|
|
|
QByteArray *textureMetalnessImageByteArray = nullptr;
|
|
|
|
QImage *textureRoughnessImage = nullptr;
|
|
|
|
QByteArray *textureRoughnessImageByteArray = nullptr;
|
|
|
|
QImage *textureAmbientOcclusionImage = nullptr;
|
|
|
|
QByteArray *textureAmbientOcclusionImageByteArray = nullptr;
|
|
|
|
|
|
|
|
~Textures()
|
|
|
|
{
|
|
|
|
delete textureImage;
|
|
|
|
delete textureImageByteArray;
|
|
|
|
delete textureNormalImage;
|
|
|
|
delete textureNormalImageByteArray;
|
|
|
|
delete textureMetalnessImage;
|
|
|
|
delete textureMetalnessImageByteArray;
|
|
|
|
delete textureRoughnessImage;
|
|
|
|
delete textureRoughnessImageByteArray;
|
|
|
|
delete textureAmbientOcclusionImage;
|
|
|
|
delete textureAmbientOcclusionImageByteArray;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-04-03 13:53:54 +00:00
|
|
|
DocumentSaver(const QString *filename,
|
2020-11-17 14:31:51 +00:00
|
|
|
Snapshot *snapshot,
|
|
|
|
Object *object,
|
|
|
|
Textures *textures,
|
2020-04-03 13:53:54 +00:00
|
|
|
QByteArray *turnaroundPngByteArray,
|
|
|
|
QString *script,
|
|
|
|
std::map<QString, std::map<QString, QString>> *variables);
|
|
|
|
~DocumentSaver();
|
2020-04-07 23:15:20 +00:00
|
|
|
static bool save(const QString *filename,
|
2020-11-17 14:31:51 +00:00
|
|
|
Snapshot *snapshot,
|
|
|
|
const Object *object,
|
|
|
|
Textures *textures,
|
2020-04-07 23:15:20 +00:00
|
|
|
const QByteArray *turnaroundPngByteArray,
|
|
|
|
const QString *script,
|
|
|
|
const std::map<QString, std::map<QString, QString>> *variables);
|
2020-04-12 02:05:39 +00:00
|
|
|
static void collectUsedResourceIds(const Snapshot *snapshot,
|
|
|
|
std::set<QUuid> &imageIds,
|
|
|
|
std::set<QUuid> &fileIds);
|
2020-04-03 13:53:54 +00:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
public slots:
|
|
|
|
void process();
|
|
|
|
private:
|
|
|
|
const QString *m_filename = nullptr;
|
|
|
|
Snapshot *m_snapshot = nullptr;
|
2020-11-17 14:31:51 +00:00
|
|
|
Object *m_object = nullptr;
|
|
|
|
Textures *m_textures = nullptr;
|
2020-04-03 13:53:54 +00:00
|
|
|
QByteArray *m_turnaroundPngByteArray = nullptr;
|
|
|
|
QString *m_script = nullptr;
|
|
|
|
std::map<QString, std::map<QString, QString>> *m_variables = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|