#ifndef DUST3D_APPLICATION_TEXTURE_GENERATOR_H_ #define DUST3D_APPLICATION_TEXTURE_GENERATOR_H_ #include "model_mesh.h" #include #include #include #include #include #include #include class TextureGenerator : public QObject { Q_OBJECT public: TextureGenerator(const dust3d::Object& object, dust3d::Snapshot* snapshot = nullptr); ~TextureGenerator(); QImage* takeResultTextureColorImage(); QImage* takeResultTextureNormalImage(); QImage* takeResultTextureRoughnessImage(); QImage* takeResultTextureMetalnessImage(); QImage* takeResultTextureAmbientOcclusionImage(); dust3d::Object* takeObject(); ModelMesh* takeResultMesh(); bool hasTransparencySettings(); void addPartColorMap(dust3d::Uuid partId, const QImage* image, float tileScale); void addPartNormalMap(dust3d::Uuid partId, const QImage* image, float tileScale); void addPartMetalnessMap(dust3d::Uuid partId, const QImage* image, float tileScale); void addPartRoughnessMap(dust3d::Uuid partId, const QImage* image, float tileScale); void addPartAmbientOcclusionMap(dust3d::Uuid partId, const QImage* image, float tileScale); void generate(); static QImage* combineMetalnessRoughnessAmbientOcclusionImages(QImage* metalnessImage, QImage* roughnessImage, QImage* ambientOcclusionImage); signals: void finished(); public slots: void process(); public: static QColor m_defaultTextureColor; private: void prepare(); private: dust3d::Object* m_object = nullptr; QImage* m_resultTextureColorImage = nullptr; QImage* m_resultTextureNormalImage = nullptr; QImage* m_resultTextureRoughnessImage = nullptr; QImage* m_resultTextureMetalnessImage = nullptr; QImage* m_resultTextureAmbientOcclusionImage = nullptr; ModelMesh* m_resultMesh = nullptr; std::map> m_partColorTextureMap; std::map> m_partNormalTextureMap; std::map> m_partMetalnessTextureMap; std::map> m_partRoughnessTextureMap; std::map> m_partAmbientOcclusionTextureMap; std::set m_countershadedPartIds; dust3d::Snapshot* m_snapshot = nullptr; bool m_hasTransparencySettings = false; int m_textureSize = 1024; }; #endif