Rename and move loaders, expose parsers
Former-commit-id: 932ae2aab020f956d3fdb91107f6842ff292aa08
This commit is contained in:
79
include/Nazara/Utility/Formats/MD5AnimParser.hpp
Normal file
79
include/Nazara/Utility/Formats/MD5AnimParser.hpp
Normal file
@@ -0,0 +1,79 @@
|
||||
// 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 <Nazara/Prerequesites.hpp>
|
||||
#include <Nazara/Core/InputStream.hpp>
|
||||
#include <Nazara/Math/Box.hpp>
|
||||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Utility/Animation.hpp>
|
||||
#include <vector>
|
||||
|
||||
class NAZARA_API NzMD5AnimParser
|
||||
{
|
||||
public:
|
||||
struct FrameJoint
|
||||
{
|
||||
NzQuaternionf orient;
|
||||
NzVector3f pos;
|
||||
};
|
||||
|
||||
struct Frame
|
||||
{
|
||||
std::vector<FrameJoint> joints;
|
||||
NzBoxf bounds;
|
||||
};
|
||||
|
||||
struct Joint
|
||||
{
|
||||
NzQuaternionf bindOrient;
|
||||
NzString name;
|
||||
NzVector3f bindPos;
|
||||
int parent;
|
||||
unsigned int flags;
|
||||
unsigned int index;
|
||||
};
|
||||
|
||||
NzMD5AnimParser(NzInputStream& stream);
|
||||
~NzMD5AnimParser();
|
||||
|
||||
nzTernary 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 NzString& message);
|
||||
bool ParseBaseframe();
|
||||
bool ParseBounds();
|
||||
bool ParseFrame();
|
||||
bool ParseHierarchy();
|
||||
void Warning(const NzString& message);
|
||||
void UnrecognizedLine(bool error = false);
|
||||
|
||||
std::vector<float> m_animatedComponents;
|
||||
std::vector<Frame> m_frames;
|
||||
std::vector<Joint> m_joints;
|
||||
NzInputStream& m_stream;
|
||||
NzString 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
|
||||
Reference in New Issue
Block a user