mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-14 00:38:15 -05:00
chore: replace custom vector, quaternion, matrix implementation with eigen library
This commit is contained in:
@ -80,16 +80,16 @@ float AbstractGdtEntryReader::ReadFloatProperty(const std::string& propertyName,
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector2f AbstractGdtEntryReader::ReadVec2Property(const std::string& propertyName, const Vector2f defaultValue) const
|
||||
GdtVec2 AbstractGdtEntryReader::ReadVec2Property(const std::string& propertyName, const GdtVec2 defaultValue) const
|
||||
{
|
||||
const auto foundProperty = m_entry.m_properties.find(propertyName);
|
||||
if (foundProperty == m_entry.m_properties.end())
|
||||
return defaultValue;
|
||||
|
||||
std::istringstream iss(foundProperty->second);
|
||||
Vector2f result;
|
||||
GdtVec2 result;
|
||||
|
||||
iss >> result(0) >> result(1);
|
||||
iss >> result.x >> result.y;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
@ -101,16 +101,16 @@ Vector2f AbstractGdtEntryReader::ReadVec2Property(const std::string& propertyNam
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector3f AbstractGdtEntryReader::ReadVec3Property(const std::string& propertyName, const Vector3f defaultValue) const
|
||||
GdtVec3 AbstractGdtEntryReader::ReadVec3Property(const std::string& propertyName, const GdtVec3 defaultValue) const
|
||||
{
|
||||
const auto foundProperty = m_entry.m_properties.find(propertyName);
|
||||
if (foundProperty == m_entry.m_properties.end())
|
||||
return defaultValue;
|
||||
|
||||
std::istringstream iss(foundProperty->second);
|
||||
Vector3f result;
|
||||
GdtVec3 result;
|
||||
|
||||
iss >> result(0) >> result(1) >> result(2);
|
||||
iss >> result.x >> result.y >> result.z;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
@ -122,16 +122,16 @@ Vector3f AbstractGdtEntryReader::ReadVec3Property(const std::string& propertyNam
|
||||
return result;
|
||||
}
|
||||
|
||||
Vector4f AbstractGdtEntryReader::ReadVec4Property(const std::string& propertyName, const Vector4f defaultValue) const
|
||||
GdtVec4 AbstractGdtEntryReader::ReadVec4Property(const std::string& propertyName, const GdtVec4 defaultValue) const
|
||||
{
|
||||
const auto foundProperty = m_entry.m_properties.find(propertyName);
|
||||
if (foundProperty == m_entry.m_properties.end())
|
||||
return defaultValue;
|
||||
|
||||
std::istringstream iss(foundProperty->second);
|
||||
Vector4f result;
|
||||
GdtVec4 result;
|
||||
|
||||
iss >> result(0) >> result(1) >> result(2) >> result(3);
|
||||
iss >> result.x >> result.y >> result.z >> result.w;
|
||||
|
||||
if (iss.fail())
|
||||
{
|
||||
|
@ -1,6 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include "Math/Vector.h"
|
||||
#include "Obj/Gdt/GdtEntry.h"
|
||||
#include "Utils/ClassUtils.h"
|
||||
|
||||
@ -16,6 +15,27 @@ private:
|
||||
std::string m_message;
|
||||
};
|
||||
|
||||
struct GdtVec2
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
};
|
||||
|
||||
struct GdtVec3
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
};
|
||||
|
||||
struct GdtVec4
|
||||
{
|
||||
float x;
|
||||
float y;
|
||||
float z;
|
||||
float w;
|
||||
};
|
||||
|
||||
class AbstractGdtEntryReader
|
||||
{
|
||||
protected:
|
||||
@ -25,9 +45,9 @@ protected:
|
||||
_NODISCARD bool ReadBoolProperty(const std::string& propertyName, bool defaultValue = false) const;
|
||||
_NODISCARD int ReadIntegerProperty(const std::string& propertyName, int defaultValue = 0) const;
|
||||
_NODISCARD float ReadFloatProperty(const std::string& propertyName, float defaultValue = 0.0f) const;
|
||||
_NODISCARD Vector2f ReadVec2Property(const std::string& propertyName, Vector2f defaultValue = {}) const;
|
||||
_NODISCARD Vector3f ReadVec3Property(const std::string& propertyName, Vector3f defaultValue = {}) const;
|
||||
_NODISCARD Vector4f ReadVec4Property(const std::string& propertyName, Vector4f defaultValue = {}) const;
|
||||
_NODISCARD GdtVec2 ReadVec2Property(const std::string& propertyName, GdtVec2 defaultValue = {}) const;
|
||||
_NODISCARD GdtVec3 ReadVec3Property(const std::string& propertyName, GdtVec3 defaultValue = {}) const;
|
||||
_NODISCARD GdtVec4 ReadVec4Property(const std::string& propertyName, GdtVec4 defaultValue = {}) const;
|
||||
|
||||
const GdtEntry& m_entry;
|
||||
};
|
||||
|
Reference in New Issue
Block a user