Merge pull request #28 from devnexen/odr_fix
Resolve ODR conflict in mesh loaders via unique namespaces.
This commit is contained in:
@@ -43,10 +43,7 @@ const char* bmfHead = "BMF ";
|
|||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
struct UV {
|
namespace bmf {
|
||||||
float u, v;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct VertexIndex {
|
struct VertexIndex {
|
||||||
unsigned a, b, c;
|
unsigned a, b, c;
|
||||||
|
|
||||||
@@ -57,7 +54,14 @@ struct VertexIndex {
|
|||||||
return memcmp(this, &other, sizeof(unsigned) * 3) < 0;
|
return memcmp(this, &other, sizeof(unsigned) * 3) < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace bmf;
|
||||||
|
|
||||||
|
|
||||||
|
struct UV {
|
||||||
|
float u, v;
|
||||||
|
};
|
||||||
|
|
||||||
void loadBinaryMesh(const char* filename, Mesh& mesh) {
|
void loadBinaryMesh(const char* filename, Mesh& mesh) {
|
||||||
static_assert(sizeof(vec3f) == 12, "vec3f must be the size of 3 floats");
|
static_assert(sizeof(vec3f) == 12, "vec3f must be the size of 3 floats");
|
||||||
|
|||||||
@@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
namespace render {
|
namespace render {
|
||||||
|
|
||||||
|
namespace obj {
|
||||||
struct VertexIndex {
|
struct VertexIndex {
|
||||||
int a, b, c;
|
int a, b, c;
|
||||||
|
|
||||||
@@ -18,6 +19,9 @@ struct VertexIndex {
|
|||||||
return memcmp(this, &other, sizeof(int) * 3) < 0;
|
return memcmp(this, &other, sizeof(int) * 3) < 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
using namespace obj;
|
||||||
|
|
||||||
void loadMeshOBJ(const char* filename, Mesh& mesh) {
|
void loadMeshOBJ(const char* filename, Mesh& mesh) {
|
||||||
// Read all the appropriate separate data arrays
|
// Read all the appropriate separate data arrays
|
||||||
|
|||||||
Reference in New Issue
Block a user