Go to the documentation of this file.00001
00010 #ifndef TGSHAPECREATOR_H
00011 #define TGSHAPECREATOR_H
00012
00013 #include <vector>
00014
00015 #include <blort/TomGine/tgModel.h>
00016
00017 #define TETRAHEDRON 0
00018 #define OCTAHEDRON 1
00019 #define ICOSAHEDRON 2
00020
00021 namespace TomGine{
00022
00023 class tgShapeCreator{
00024 private:
00025 int n_vertices;
00026 int n_faces;
00027 int n_edges;
00028 int edge_walk;
00029 float *vertices;
00030 int *faces;
00031 int *start;
00032 int *end;
00033 int *midpoint;
00034
00035 void init_tetrahedron();
00036 void init_octahedron();
00037 void init_icosahedron();
00038
00039 int search_midpoint(int index_start, int index_end);
00040 void subdivide();
00041
00042 public:
00043 tgShapeCreator();
00044 ~tgShapeCreator();
00045
00046 void CreateSphere(tgModel& model, float radius, int subdevisions, int method=0);
00047 void CreateBox(tgModel& model, float x, float y, float z);
00048 void CreateCylinder(tgModel &model, float radius, float height, int slices, int stacks, bool closed);
00049 void CreateCone(tgModel &model, float radius, float height, int slices, int stacks, bool closed);
00050
00051 void CreateConvexHull(tgModel &model, std::vector<vec3> points);
00052
00053 void TriangulatePolygon(tgModel& model, std::vector<vec3> points);
00054
00055 };
00056
00057 }
00058
00059 #endif