diff --git a/src/graphics/core/vertex.h b/src/graphics/core/vertex.h index 6843e8b8..50b65a9b 100644 --- a/src/graphics/core/vertex.h +++ b/src/graphics/core/vertex.h @@ -37,13 +37,6 @@ namespace Gfx { -enum VertexType -{ - VERTEX_TYPE_NORMAL, - VERTEX_TYPE_TEX2, - VERTEX_TYPE_COL, -}; - /** * \struct Vertex * \brief Vertex of a primitive @@ -57,8 +50,6 @@ enum VertexType */ struct Vertex { - static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_NORMAL; - glm::vec3 coord = { 0, 0, 0 }; glm::vec3 normal = { 0, 0, 0 }; glm::vec2 texCoord = { 0, 0 }; @@ -74,8 +65,6 @@ struct Vertex */ struct VertexCol { - static constexpr VertexType VERTEX_TYPE = VERTEX_TYPE_COL; - glm::vec3 coord = { 0, 0, 0 }; Color color = Color(); }; @@ -102,32 +91,6 @@ struct Vertex3D glm::vec2 uv = { 0.0f, 0.0f }; glm::vec2 uv2 = { 0.0f, 0.0f }; glm::vec3 normal = { 0.0f, 0.0f, 1.0f }; - - Vertex3D() = default; - - Vertex3D(const glm::vec3& position, - glm::u8vec4 color = { 255, 255, 255, 255 }, - glm::vec2 uv = { 0.0f, 0.0f }, - glm::vec2 uv2 = { 0.0f, 0.0f }, - glm::vec3 normal = { 0.0f, 0.0f, 1.0f }) - : position(position) - , color(color) - , uv(uv) - , uv2(uv2) - , normal(normal) {} - - Vertex3D(const Vertex& vertex) - : position(vertex.coord) - , uv(vertex.texCoord) - , normal(vertex.normal) - { - - } - - operator Vertex() const - { - return Vertex{ position, normal, uv }; - } }; } // namespace Gfx diff --git a/src/graphics/model/model_input.cpp b/src/graphics/model/model_input.cpp index e173bbe5..edffc6c4 100644 --- a/src/graphics/model/model_input.cpp +++ b/src/graphics/model/model_input.cpp @@ -56,7 +56,7 @@ namespace ModelInput std::vector ReadOldModelV2(std::istream &stream, int totalTriangles); std::vector ReadOldModelV3(std::istream &stream, int totalTriangles); - Vertex ReadBinaryVertex(std::istream& stream); + Vertex3D ReadBinaryVertex(std::istream& stream); Vertex3D ReadBinaryVertexTex2(std::istream& stream); Material ReadBinaryMaterial(std::istream& stream); @@ -638,20 +638,20 @@ void ModelInput::ConvertFromOldRenderState(ModelTriangle& triangle, int state) triangle.doubleSided = (state & static_cast(ModelRenderState::TwoFace)) != 0; } -Vertex ModelInput::ReadBinaryVertex(std::istream& stream) +Vertex3D ModelInput::ReadBinaryVertex(std::istream& stream) { - Vertex vertex; + Vertex3D vertex; - vertex.coord.x = ReadBinaryFloat(stream); - vertex.coord.y = ReadBinaryFloat(stream); - vertex.coord.z = ReadBinaryFloat(stream); + vertex.position.x = ReadBinaryFloat(stream); + vertex.position.y = ReadBinaryFloat(stream); + vertex.position.z = ReadBinaryFloat(stream); vertex.normal.x = ReadBinaryFloat(stream); vertex.normal.y = ReadBinaryFloat(stream); vertex.normal.z = ReadBinaryFloat(stream); - vertex.texCoord.x = ReadBinaryFloat(stream); - vertex.texCoord.y = ReadBinaryFloat(stream); + vertex.uv.x = ReadBinaryFloat(stream); + vertex.uv.y = ReadBinaryFloat(stream); return vertex; } diff --git a/src/graphics/model/model_io_structs.h b/src/graphics/model/model_io_structs.h index 813074ed..603a7ab5 100644 --- a/src/graphics/model/model_io_structs.h +++ b/src/graphics/model/model_io_structs.h @@ -180,9 +180,9 @@ struct OldModelTriangleV1 { char used = 0; char selected = 0; - Vertex p1; - Vertex p2; - Vertex p3; + Vertex3D p1; + Vertex3D p2; + Vertex3D p3; char texName[21] = {'\0'}; float min = 0; float max = 0; @@ -198,9 +198,9 @@ struct OldModelTriangleV2 { char used = 0; char selected = 0; - Vertex p1; - Vertex p2; - Vertex p3; + Vertex3D p1; + Vertex3D p2; + Vertex3D p3; char texName[21] = {'\0'}; float min = 0.0f; float max = 0.0f;