2022-10-02 19:45:46 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_MESH_PREVIEW_IMAGES_GENERATOR_H_
|
|
|
|
#define DUST3D_APPLICATION_MESH_PREVIEW_IMAGES_GENERATOR_H_
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
#include "model_offscreen_render.h"
|
2022-10-02 19:45:46 +00:00
|
|
|
#include <QImage>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <QObject>
|
2022-10-02 19:45:46 +00:00
|
|
|
#include <dust3d/base/uuid.h>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
2022-10-02 19:45:46 +00:00
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
class MeshPreviewImagesGenerator : public QObject {
|
2022-10-02 19:45:46 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-10-18 09:35:04 +00:00
|
|
|
MeshPreviewImagesGenerator(ModelOffscreenRender* modelOffscreenRender)
|
|
|
|
: m_offscreenRender(modelOffscreenRender)
|
2022-10-02 19:45:46 +00:00
|
|
|
{
|
|
|
|
}
|
2022-10-18 09:35:04 +00:00
|
|
|
|
|
|
|
struct PreviewInput {
|
2022-10-02 19:45:46 +00:00
|
|
|
std::unique_ptr<ModelMesh> mesh;
|
|
|
|
bool useFrontView = false;
|
|
|
|
};
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2022-10-02 19:45:46 +00:00
|
|
|
~MeshPreviewImagesGenerator()
|
|
|
|
{
|
|
|
|
delete m_offscreenRender;
|
|
|
|
}
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
void addInput(const dust3d::Uuid& inputId, std::unique_ptr<ModelMesh> previewMesh, bool useFrontView = false);
|
2022-10-02 19:45:46 +00:00
|
|
|
void generate();
|
2022-10-18 09:35:04 +00:00
|
|
|
std::map<dust3d::Uuid, QImage>* takeImages();
|
2022-10-02 19:45:46 +00:00
|
|
|
signals:
|
|
|
|
void finished();
|
|
|
|
public slots:
|
|
|
|
void process();
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2022-10-02 19:45:46 +00:00
|
|
|
private:
|
|
|
|
std::map<dust3d::Uuid, PreviewInput> m_previewInputMap;
|
2022-10-18 09:35:04 +00:00
|
|
|
ModelOffscreenRender* m_offscreenRender = nullptr;
|
2022-10-02 19:45:46 +00:00
|
|
|
std::unique_ptr<std::map<dust3d::Uuid, QImage>> m_partImages;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|