// Copyright (C) 2015 Jérôme Leclercq // This file is part of the "Nazara Engine - Utility module" // For conditions of distribution and use, see copyright notice in Config.hpp #pragma once #ifndef NAZARA_FORMATS_MD5MESHPARSER_HPP #define NAZARA_FORMATS_MD5MESHPARSER_HPP #include #include #include #include #include #include #include class NAZARA_UTILITY_API NzMD5MeshParser { public: struct Joint { NzQuaternionf bindOrient; NzString name; NzVector3f bindPos; int parent; }; typedef NzVector3ui Triangle; struct Vertex { NzVector2f uv; unsigned int startWeight; unsigned int weightCount; }; struct Weight { NzVector3f pos; float bias; unsigned int joint; }; struct Mesh { std::vector triangles; std::vector vertices; std::vector weights; NzString shader; }; NzMD5MeshParser(NzInputStream& stream); ~NzMD5MeshParser(); nzTernary Check(); const Joint* GetJoints() const; unsigned int GetJointCount() const; const Mesh* GetMeshes() const; unsigned int GetMeshCount() const; bool Parse(); private: bool Advance(bool required = true); void Error(const NzString& message); bool ParseJoints(); bool ParseMesh(); void Warning(const NzString& message); void UnrecognizedLine(bool error = false); std::vector m_joints; std::vector m_meshes; NzInputStream& m_stream; NzString m_currentLine; bool m_keepLastLine; unsigned int m_lineCount; unsigned int m_meshIndex; unsigned int m_streamFlags; }; #endif // NAZARA_FORMATS_MD5MESHPARSER_HPP