2021-11-18 14:58:01 +00:00
|
|
|
#ifndef DUST3D_APPLICATION_FBX_FILE_H_
|
|
|
|
#define DUST3D_APPLICATION_FBX_FILE_H_
|
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
#include "fbxdocument.h"
|
|
|
|
#include <QImage>
|
2018-10-21 23:29:01 +00:00
|
|
|
#include <QMatrix4x4>
|
2018-10-28 05:22:10 +00:00
|
|
|
#include <QQuaternion>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <QString>
|
2021-11-18 14:58:01 +00:00
|
|
|
#include <dust3d/base/object.h>
|
2022-10-18 09:35:04 +00:00
|
|
|
#include <map>
|
2018-10-17 03:06:45 +00:00
|
|
|
|
2022-10-18 09:35:04 +00:00
|
|
|
class FbxFileWriter : public QObject {
|
2018-10-17 03:06:45 +00:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2022-10-18 09:35:04 +00:00
|
|
|
FbxFileWriter(dust3d::Object& object,
|
|
|
|
const QString& filename,
|
|
|
|
QImage* textureImage = nullptr,
|
|
|
|
QImage* normalImage = nullptr,
|
|
|
|
QImage* metalnessImage = nullptr,
|
|
|
|
QImage* roughnessImage = nullptr,
|
|
|
|
QImage* ambientOcclusionImage = nullptr);
|
2018-10-17 03:06:45 +00:00
|
|
|
bool save();
|
|
|
|
|
|
|
|
private:
|
|
|
|
void createFbxHeader();
|
2018-10-20 05:07:11 +00:00
|
|
|
void createCreationTime();
|
|
|
|
void createFileId();
|
|
|
|
void createCreator();
|
|
|
|
void createGlobalSettings();
|
|
|
|
void createDocuments();
|
|
|
|
void createReferences();
|
2018-10-28 05:22:10 +00:00
|
|
|
void createDefinitions(size_t deformerCount,
|
2022-10-18 09:35:04 +00:00
|
|
|
size_t textureCount = 0,
|
|
|
|
size_t videoCount = 0,
|
|
|
|
bool hasAnimtion = false,
|
|
|
|
size_t animationStackCount = 0,
|
|
|
|
size_t animationLayerCount = 0,
|
|
|
|
size_t animationCurveNodeCount = 0,
|
|
|
|
size_t animationCurveCount = 0);
|
2018-10-20 05:07:11 +00:00
|
|
|
void createTakes();
|
2022-10-18 09:35:04 +00:00
|
|
|
std::vector<double> matrixToVector(const QMatrix4x4& matrix);
|
2018-10-28 05:22:10 +00:00
|
|
|
int64_t secondsToKtime(double seconds);
|
2022-10-18 09:35:04 +00:00
|
|
|
|
2018-10-20 05:07:11 +00:00
|
|
|
int64_t m_next64Id = 612150000;
|
2018-10-17 03:06:45 +00:00
|
|
|
QString m_filename;
|
2018-11-28 01:49:22 +00:00
|
|
|
QString m_baseName;
|
2018-10-17 03:06:45 +00:00
|
|
|
fbx::FBXDocument m_fbxDocument;
|
2018-10-20 05:07:11 +00:00
|
|
|
std::map<QString, int64_t> m_uuidTo64Map;
|
2018-10-21 23:29:01 +00:00
|
|
|
static std::vector<double> m_identityMatrix;
|
2018-10-17 03:06:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|