chore: move xmodel packages

This commit is contained in:
Jan
2024-03-30 15:19:11 +01:00
parent abc3003b5b
commit d4ef9fa3d9
22 changed files with 18 additions and 18 deletions

View File

@ -0,0 +1,54 @@
#include "ObjCommon.h"
#include <cmath>
#include <limits>
#include <tuple>
bool operator==(const ObjVertex& lhs, const ObjVertex& rhs)
{
return std::fabs(lhs.coordinates[0] - rhs.coordinates[0]) < std::numeric_limits<float>::epsilon()
&& std::fabs(lhs.coordinates[1] - rhs.coordinates[1]) < std::numeric_limits<float>::epsilon()
&& std::fabs(lhs.coordinates[2] - rhs.coordinates[2]) < std::numeric_limits<float>::epsilon();
}
bool operator!=(const ObjVertex& lhs, const ObjVertex& rhs)
{
return !(lhs == rhs);
}
bool operator<(const ObjVertex& lhs, const ObjVertex& rhs)
{
return std::tie(lhs.coordinates[0], lhs.coordinates[1], lhs.coordinates[2]) < std::tie(rhs.coordinates[0], rhs.coordinates[1], rhs.coordinates[2]);
}
bool operator==(const ObjNormal& lhs, const ObjNormal& rhs)
{
return std::fabs(lhs.normal[0] - rhs.normal[0]) < std::numeric_limits<float>::epsilon()
&& std::fabs(lhs.normal[1] - rhs.normal[1]) < std::numeric_limits<float>::epsilon()
&& std::fabs(lhs.normal[2] - rhs.normal[2]) < std::numeric_limits<float>::epsilon();
}
bool operator!=(const ObjNormal& lhs, const ObjNormal& rhs)
{
return !(lhs == rhs);
}
bool operator<(const ObjNormal& lhs, const ObjNormal& rhs)
{
return std::tie(lhs.normal[0], lhs.normal[1], lhs.normal[2]) < std::tie(rhs.normal[0], rhs.normal[1], rhs.normal[2]);
}
bool operator==(const ObjUv& lhs, const ObjUv& rhs)
{
return std::fabs(lhs.uv[0] - rhs.uv[0]) < std::numeric_limits<float>::epsilon() && std::fabs(lhs.uv[1] - rhs.uv[1]) < std::numeric_limits<float>::epsilon();
}
bool operator!=(const ObjUv& lhs, const ObjUv& rhs)
{
return !(lhs == rhs);
}
bool operator<(const ObjUv& lhs, const ObjUv& rhs)
{
return std::tie(lhs.uv[0], lhs.uv[1]) < std::tie(rhs.uv[0], rhs.uv[1]);
}

View File

@ -0,0 +1,51 @@
#pragma once
#include <string>
struct ObjObject
{
std::string name;
int materialIndex;
};
struct ObjVertex
{
float coordinates[3];
friend bool operator==(const ObjVertex& lhs, const ObjVertex& rhs);
friend bool operator!=(const ObjVertex& lhs, const ObjVertex& rhs);
friend bool operator<(const ObjVertex& lhs, const ObjVertex& rhs);
};
struct ObjNormal
{
float normal[3];
friend bool operator==(const ObjNormal& lhs, const ObjNormal& rhs);
friend bool operator!=(const ObjNormal& lhs, const ObjNormal& rhs);
friend bool operator<(const ObjNormal& lhs, const ObjNormal& rhs);
};
struct ObjUv
{
float uv[2];
friend bool operator==(const ObjUv& lhs, const ObjUv& rhs);
friend bool operator!=(const ObjUv& lhs, const ObjUv& rhs);
friend bool operator<(const ObjUv& lhs, const ObjUv& rhs);
};
struct ObjFace
{
int vertexIndex[3];
int normalIndex[3];
int uvIndex[3];
};
struct MtlMaterial
{
std::string materialName;
std::string colorMapName;
std::string normalMapName;
std::string specularMapName;
};