// 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_MD5ANIMPARSER_HPP #define NAZARA_FORMATS_MD5ANIMPARSER_HPP #include #include #include #include #include #include #include namespace Nz { class NAZARA_UTILITY_API MD5AnimParser { public: struct FrameJoint { Quaternionf orient; Vector3f pos; }; struct Frame { std::vector joints; Boxf bounds; }; struct Joint { Quaternionf bindOrient; String name; Vector3f bindPos; int parent; unsigned int flags; unsigned int index; }; MD5AnimParser(Stream& stream); ~MD5AnimParser(); Ternary Check(); unsigned int GetAnimatedComponentCount() const; const Frame* GetFrames() const; unsigned int GetFrameCount() const; unsigned int GetFrameRate() const; const Joint* GetJoints() const; unsigned int GetJointCount() const; bool Parse(); private: bool Advance(bool required = true); void Error(const String& message); bool ParseBaseframe(); bool ParseBounds(); bool ParseFrame(); bool ParseHierarchy(); void Warning(const String& message); void UnrecognizedLine(bool error = false); std::vector m_animatedComponents; std::vector m_frames; std::vector m_joints; Stream& m_stream; String m_currentLine; bool m_keepLastLine; unsigned int m_frameIndex; unsigned int m_frameRate; unsigned int m_lineCount; unsigned int m_streamFlags; }; } #endif // NAZARA_FORMATS_MD5ANIMPARSER_HPP