diff --git a/src/Primitives/Square.cpp b/src/Primitives/Square.cpp index 57c601237..fe2dcd971 100644 --- a/src/Primitives/Square.cpp +++ b/src/Primitives/Square.cpp @@ -16,14 +16,26 @@ #include "Square.h" #include "Math/Point2D.h" +#include "Trade/MeshData2D.h" namespace Magnum { namespace Primitives { -Square::Square(): MeshData2D(Mesh::Primitive::TriangleStrip, nullptr, {new std::vector{ - {1.0f, -1.0f}, - {1.0f, 1.0f}, - {-1.0f, -1.0f}, - {-1.0f, 1.0f} -}}, {}) {} +Trade::MeshData2D Square::solid() { + return Trade::MeshData2D(Mesh::Primitive::TriangleStrip, nullptr, {new std::vector{ + {1.0f, -1.0f}, + {1.0f, 1.0f}, + {-1.0f, -1.0f}, + {-1.0f, 1.0f} + }}, {}); +} + +Trade::MeshData2D Square::wireframe() { + return Trade::MeshData2D(Mesh::Primitive::LineLoop, nullptr, {new std::vector{ + {-1.0f, -1.0f}, + {1.0f, -1.0f}, + {1.0f, 1.0f}, + {-1.0f, 1.0f} + }}, {}); +} }} diff --git a/src/Primitives/Square.h b/src/Primitives/Square.h index 7d3f96754..6bd77a172 100644 --- a/src/Primitives/Square.h +++ b/src/Primitives/Square.h @@ -19,19 +19,32 @@ * @brief Class Magnum::Primitives::Square */ -#include "Trade/MeshData2D.h" +#include "Trade/Trade.h" namespace Magnum { namespace Primitives { /** @brief 2D square primitive -2x2 square as triangle strip, non-indexed. +2x2 square. */ -class Square: public Trade::MeshData2D { +class Square { public: - /** @brief Constructor */ - explicit Square(); + /** + * @brief Solid square + * + * Non-indexed @ref Mesh::Primitive "TriangleStrip". + */ + static Trade::MeshData2D solid(); + + /** + * @brief Wireframe square + * + * Non-indexed @ref Mesh::Primitive "LineLoop." + */ + static Trade::MeshData2D wireframe(); + + Square() = delete; }; }}