diff --git a/src/Magnum/Primitives/Cube.cpp b/src/Magnum/Primitives/Cube.cpp index 769b26203..28611ac02 100644 --- a/src/Magnum/Primitives/Cube.cpp +++ b/src/Magnum/Primitives/Cube.cpp @@ -102,6 +102,48 @@ Trade::MeshData3D Cube::solid() { }}, {}); } +Trade::MeshData3D Cube::solidStrip() { + /* Sources: + https://twitter.com/Donzanoid/status/436843034966507520 + http://www.asmcommunity.net/forums/topic/?id=6284#post-45209 + https://gist.github.com/cdwfs/2cab675b333632d940cf + + 0---2---3---1 + |E /|\ A|H /| + | / | \ | / | + |/ D|B \|/ I| + 4---7---6---5 + |C /| + | / | + |/ J| + 4---5 + |\ K| + | \ | + |L \| + 0---1 + |\ G| + | \ | + |F \| + 2---3 + */ + return Trade::MeshData3D(MeshPrimitive::TriangleStrip, {}, {{ + { 1.0f, 1.0f, 1.0f}, /* 3 */ + {-1.0f, 1.0f, 1.0f}, /* 2 */ + { 1.0f, -1.0f, 1.0f}, /* 6 */ + {-1.0f, -1.0f, 1.0f}, /* 7 */ + {-1.0f, -1.0f, -1.0f}, /* 4 */ + {-1.0f, 1.0f, 1.0f}, /* 2 */ + {-1.0f, 1.0f, -1.0f}, /* 0 */ + { 1.0f, 1.0f, 1.0f}, /* 3 */ + { 1.0f, 1.0f, -1.0f}, /* 1 */ + { 1.0f, -1.0f, 1.0f}, /* 6 */ + { 1.0f, -1.0f, -1.0f}, /* 5 */ + {-1.0f, -1.0f, -1.0f}, /* 4 */ + { 1.0f, 1.0f, -1.0f}, /* 1 */ + {-1.0f, 1.0f, -1.0f} /* 0 */ + }}, {}, {}); +} + Trade::MeshData3D Cube::wireframe() { return Trade::MeshData3D(MeshPrimitive::Lines, { 0, 1, 1, 2, 2, 3, 3, 0, /* +Z */ diff --git a/src/Magnum/Primitives/Cube.h b/src/Magnum/Primitives/Cube.h index 964df9a84..568eb887f 100644 --- a/src/Magnum/Primitives/Cube.h +++ b/src/Magnum/Primitives/Cube.h @@ -48,6 +48,14 @@ class MAGNUM_PRIMITIVES_EXPORT Cube { */ static Trade::MeshData3D solid(); + /** + * @brief Solid cube as a single strip + * + * Non-indexed @ref MeshPrimitive::TriangleStrip. Just positions, no + * normals or anything else. + */ + static Trade::MeshData3D solidStrip(); + /** * @brief Wireframe cube *