add scale transformation support to the metadata file
This commit is contained in:
parent
c5bbb03d00
commit
9329ca02ac
|
@ -7,16 +7,19 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
MetadataFile::MetadataFile()
|
MetadataFile::MetadataFile()
|
||||||
{
|
{
|
||||||
m_isLoaded = FALSE;
|
m_isLoaded = FALSE;
|
||||||
|
m_scale = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void MetadataFile::Release()
|
void MetadataFile::Release()
|
||||||
{
|
{
|
||||||
m_isLoaded = FALSE;
|
m_isLoaded = FALSE;
|
||||||
|
m_scale = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL MetadataFile::Load(const std::string &file)
|
BOOL MetadataFile::Load(const std::string &file)
|
||||||
|
@ -109,6 +112,21 @@ BOOL MetadataFile::Load(const std::string &file)
|
||||||
m_groupInfo.push_back(groupInfo);
|
m_groupInfo.push_back(groupInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pugi::xml_node transformationsNode = rootNode.child("transformations");
|
||||||
|
for (pugi::xml_node transformation = transformationsNode.first_child(); transformation; transformation = transformation.next_sibling())
|
||||||
|
{
|
||||||
|
std::string name = transformation.name();
|
||||||
|
if (name == "scale")
|
||||||
|
{
|
||||||
|
if (strlen(transformation.value()) == 0)
|
||||||
|
{
|
||||||
|
printf("Metadata XML error: no scale factor provided\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
m_scale = atof(transformation.value());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m_isLoaded = TRUE;
|
m_isLoaded = TRUE;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@ public:
|
||||||
void Release();
|
void Release();
|
||||||
BOOL Load(const std::string &file);
|
BOOL Load(const std::string &file);
|
||||||
|
|
||||||
|
float GetScale() const { return m_scale; }
|
||||||
uint32_t GetNumAnimations() const { return m_animations.size(); }
|
uint32_t GetNumAnimations() const { return m_animations.size(); }
|
||||||
const AnimationSequence* GetAnimations() const { return &m_animations[0]; }
|
const AnimationSequence* GetAnimations() const { return &m_animations[0]; }
|
||||||
uint32_t GetNumGroupInfo() const { return m_groupInfo.size(); }
|
uint32_t GetNumGroupInfo() const { return m_groupInfo.size(); }
|
||||||
|
@ -26,6 +27,7 @@ public:
|
||||||
private:
|
private:
|
||||||
BOOL m_isLoaded;
|
BOOL m_isLoaded;
|
||||||
|
|
||||||
|
float m_scale;
|
||||||
std::vector<AnimationSequence> m_animations;
|
std::vector<AnimationSequence> m_animations;
|
||||||
std::vector<ExtraGroupInfo> m_groupInfo;
|
std::vector<ExtraGroupInfo> m_groupInfo;
|
||||||
};
|
};
|
||||||
|
|
Reference in a new issue