Browse Source

Square primitive.

vectorfields
Vladimír Vondruš 14 years ago
parent
commit
b43a6ee586
  1. 2
      src/Primitives/CMakeLists.txt
  2. 31
      src/Primitives/Square.cpp
  3. 39
      src/Primitives/Square.h

2
src/Primitives/CMakeLists.txt

@ -4,6 +4,7 @@ set(MagnumPrimitives_SRCS
Cylinder.cpp
Icosphere.cpp
Plane.cpp
Square.cpp
UVSphere.cpp)
set(MagnumPrimitives_HEADERS
Capsule.h
@ -11,6 +12,7 @@ set(MagnumPrimitives_HEADERS
Cylinder.h
Icosphere.h
Plane.h
Square.h
UVSphere.h)
add_library(MagnumPrimitives STATIC ${MagnumPrimitives_SRCS})

31
src/Primitives/Square.cpp

@ -0,0 +1,31 @@
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
#include "Square.h"
#include "Math/Point2D.h"
using namespace std;
namespace Magnum { namespace Primitives {
Square::Square(): MeshData2D("", Mesh::Primitive::TriangleStrip, nullptr, {new vector<Point2D>{
{1.0f, -1.0f},
{1.0f, 1.0f},
{-1.0f, -1.0f},
{-1.0f, 1.0f}
}}, {}) {}
}}

39
src/Primitives/Square.h

@ -0,0 +1,39 @@
#ifndef Magnum_Primitives_Square_h
#define Magnum_Primitives_Square_h
/*
Copyright © 2010, 2011, 2012 Vladimír Vondruš <mosra@centrum.cz>
This file is part of Magnum.
Magnum is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License version 3
only, as published by the Free Software Foundation.
Magnum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License version 3 for more details.
*/
/** @file
* @brief Class Magnum::Primitives::Square
*/
#include "Trade/MeshData2D.h"
namespace Magnum { namespace Primitives {
/**
@brief %Square primitive
2x2 square.
*/
class Square: public Trade::MeshData2D {
public:
/** @brief Constructor */
Square();
};
}}
#endif
Loading…
Cancel
Save