AGL  0
3D graphics library
shapes.h
Go to the documentation of this file.
1 #ifndef BASIC_SHAPE_H
2 #define BASIC_SHAPE_H
3 
4 #include "entity.h"
5 
6 namespace agl {
19 Entity tetrahedron();
27 Entity cube(bool calcNorm=false, bool calcUV=false);
39 Entity cuboid(float x=2, float y=2, float z=2, bool calcNorm=false, bool calcUV=false);
45 Entity octahedron();
51 Entity dodecahedron();
58 Entity icosahedron();
71 Entity sphere(int lat=20, int lng=20, bool calcNorm=false, bool calcUV=false);
81 Entity icosphere(int subdivision=3, bool calcNorm=false);
88 Entity cylinder(float r=1, float h=2, int strips=20);
98 Entity plane(float x=2, float z=2, bool calcNorm=false, bool calcUV=false);
106 Entity tessellatedPlane(int l=10, int h=10);
108 
126 void normalizeVertices(Entity &e, float t=1);
135 void subdivideFaces(Entity &e);
144 void calcNormals(Entity &e, bool perFace=false);
157 void calcTextureCoords(Entity &e, glm::vec3 px=glm::vec3(.5,0,.5), glm::vec3 py=glm::vec3(.5,.5,0), bool normalize=false);
170 std::vector<GLuint> triangulatePolygon(const std::vector<GLuint> &polygon);
172 }
173 
174 #endif // BASIC_SHAPE_H
Entity sphere(int lat, int lng, bool calcNorm, bool calcUV)
Create a unit sphere.
Definition: shapes.cpp:141
Entity icosphere(int subdivision, bool calcNorm)
Create a unit sphere.
Definition: shapes.cpp:197
Definition: create_shader.cpp:4
void calcNormals(Entity &e, bool perFace)
Calculates the normals for the Entity algorithmically.
Definition: shapes.cpp:348
Entity icosahedron()
Create an icosahedron.
Definition: shapes.cpp:127
void subdivideFaces(Entity &e)
Subdivide all faces of e.
Definition: shapes.cpp:305
Entity tetrahedron()
Create a tetrahedron.
Definition: shapes.cpp:5
Entity tessellatedPlane(int l, int h)
Create a plane on the xz-plane.
Definition: shapes.cpp:267
void normalizeVertices(Entity &e, float t)
Normalize all vertices of e.
Definition: shapes.cpp:291
Entity cube(bool calcNorm, bool calcUV)
Create a cube.
Definition: shapes.cpp:20
Entity dodecahedron()
Create a dodecahedron.
Definition: shapes.cpp:88
Entity cuboid(float x, float y, float z, bool calcNorm, bool calcUV)
Create a cuboid.
Definition: shapes.cpp:64
Entity plane(float x, float z, bool calcNorm, bool calcUV)
Create a plane on the xz-plane.
Definition: shapes.cpp:247
void calcTextureCoords(Entity &e, glm::vec3 px, glm::vec3 py, bool normalize)
Calculates texture coordinates for the Entity algorithmically.
Definition: shapes.cpp:371
Entity octahedron()
Create an octahedron.
Definition: shapes.cpp:76
std::vector< GLuint > triangulatePolygon(const std::vector< GLuint > &polygon)
Triangulates polygons with 3+ vertices.
Definition: shapes.cpp:389
Entity cylinder(float r, float h, int strips)
Create a cylinder.
Definition: shapes.cpp:207