31 uint32_t indexCount = 0;
32 uint32_t baseVertex = 0;
33 uint32_t baseIndex = 0;
34 uint32_t materialIndex = UINT32_MAX;
41 std::filesystem::path path;
42 std::filesystem::path baseFolderPath;
43 std::map<std::string, glm::mat4> tempOffsetMatrices;
44 std::map<std::string, unsigned int> boneMapping;
45 const aiScene* scene =
nullptr;
46 bool hasExtraWeights =
false;
47 bool isSkeletalMesh =
false;
51 glm::mat4 offsetMatrix;
52 glm::mat4 inverseModelMatrix;
54 BoneData(uint16_t parentIndex, glm::mat4& offsetMatrix, glm::mat4& inverseMatrix) {
55 this->parentIndex = parentIndex;
56 this->offsetMatrix = offsetMatrix;
57 this->inverseModelMatrix = inverseMatrix;
64 uint32_t vertexCount = 0;
65 uint16_t boneCount = 0;
67 std::vector<float> position;
68 std::vector<float> normal;
69 std::vector<float> tangent;
70 std::vector<uint16_t> boneIds;
71 std::vector<float> boneWeights;
72 std::vector<std::vector<float>> texCoordArray;
74 std::vector<uint16_t> indices;
75 std::vector<Submesh> submeshes;
76 std::vector<BoneData> bones;
77 std::vector<std::string> boneNames;
81 size_t parentNode = SIZE_MAX;
84 aiVector3D scale = aiVector3D(1.0f, 1.0f, 1.0f);
85 aiQuaternion rotation;
86 size_t meshIndex = SIZE_MAX;
87 aiLight* lightData =
nullptr;
88 aiCamera* cameraData =
nullptr;
91 std::vector<std::string> outputMaterialUuids;
92 std::vector<std::string> outputMeshUuids;
93 std::vector<OutputMesh> outputMeshes;
94 std::vector<OutputNode> outputNodes;
96 void ProcessLight(aiLight* light);
97 void ProcessCamera(aiCamera* camera);
98 void ProcessNodeTree(aiNode* node,
size_t parentIndex);
99 void ProcessMaterial(
size_t materialIndex, aiMaterial* inputMaterial);
100 void ProcessSkeleton(aiSkeleton* skeleton);
101 void ProcessVertexBoneWeights(aiMesh* inputMesh, OutputMesh& outputMesh);
102 void NormalizeBoneWeights(OutputMesh& outputMesh);
103 void ProcessAnimation(aiAnimation* animation);
104 void AddBoneData(OutputMesh& outputMesh,
unsigned int vertexId,
unsigned int boneId,
float vertexWeight);
105 void InitSubmeshes(aiMesh* inputMesh, OutputMesh& outputMesh,
bool hasBones);
106 void ProcessVertices(aiMesh* inputMesh, OutputMesh& outputMesh);
108 void WriteMesh(
size_t index,
const OutputMesh& mesh);
109 void WriteSkeleton(
size_t index)
const;