diff --git a/include/cbreader/rmesh.h b/include/cbreader/rmesh.h index 221417b..f26e5da 100644 --- a/include/cbreader/rmesh.h +++ b/include/cbreader/rmesh.h @@ -33,8 +33,8 @@ namespace rmesh struct Vertex { - Vector3 vertex; - Vector2 uv; + cbtypes::Vector3 vertex; + cbtypes::Vector2 uv; float unk1{}; float unk2{}; @@ -50,7 +50,7 @@ namespace rmesh std::vector vertices; - std::vector triangles; + std::vector triangles; }; /** @@ -76,9 +76,9 @@ namespace rmesh std::string className; /** This is read per entity. It would be ideal to read it in Entity, but EntityModel is special in that it has the model file name THEN the position. */ - Vector3 position; - Vector3 rotation; - Vector3 scale; + cbtypes::Vector3 position; + cbtypes::Vector3 rotation; + cbtypes::Vector3 scale; virtual ~Entity() = default; diff --git a/include/cbreader/types.h b/include/cbreader/types.h index d4a1e09..956b819 100644 --- a/include/cbreader/types.h +++ b/include/cbreader/types.h @@ -2,22 +2,25 @@ #include -struct Vector3 +namespace cbtypes { - float x = 0.f; - float y = 0.f; - float z = 0.f; -}; + struct Vector3 + { + float x = 0.f; + float y = 0.f; + float z = 0.f; + }; -struct Vector2 -{ - float x = 0.f; - float y = 0.f; -}; + struct Vector2 + { + float x = 0.f; + float y = 0.f; + }; -struct Triangle -{ - std::uint32_t index1 = 0; - std::uint32_t index2 = 0; - std::uint32_t index3 = 0; -}; \ No newline at end of file + struct Triangle + { + std::uint32_t index1 = 0; + std::uint32_t index2 = 0; + std::uint32_t index3 = 0; + }; +} diff --git a/src/rmesh.cpp b/src/rmesh.cpp index 47a287e..9bdcc6a 100644 --- a/src/rmesh.cpp +++ b/src/rmesh.cpp @@ -149,7 +149,7 @@ Mesh RMesh::ReadDrawnMesh(BufferStream& stream) std::uint32_t triangleCount = stream.read(); for (std::uint32_t j = 0; j < triangleCount; j++) { - Triangle& triangle = surf.triangles.emplace_back(); + cbtypes::Triangle& triangle = surf.triangles.emplace_back(); stream .read(triangle.index1) .read(triangle.index2) @@ -182,7 +182,7 @@ Mesh RMesh::ReadCollisionMesh(BufferStream& stream) std::uint32_t triangleCount = stream.read(); for (std::uint32_t j = 0; j < triangleCount; j++) { - Triangle triangle{}; + cbtypes::Triangle triangle{}; triangle.index1 = stream.read(); triangle.index2 = stream.read(); triangle.index3 = stream.read();