00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00027 #ifndef POLYMESH_HPP
00028 #define POLYMESH_HPP
00029
00030 #include "renderstack/rs.h"
00031 #include "renderstack/mesh.hpp"
00032 #include "mesh3d/geometry.h"
00033 #include <set>
00034
00035 namespace renderstack {
00036 namespace shapes {
00037
00038 class polymesh
00039 : public renderstack::mesh
00040 {
00041 public:
00042 class mesh *make_mesh_from_set_of_polygons(std::set<uint32> const &polygon_indices);
00043
00044 void push_point(float x, float y, float z);
00045 void push_point(double x, double y, double z);
00046 mesh3d::polygon *make_polygon(mesh3d::point *p0);
00047 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1);
00048 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2);
00049 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3);
00050 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4);
00051 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4, mesh3d::point *p5);
00052 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4, mesh3d::point *p5, mesh3d::point *p6);
00053 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4, mesh3d::point *p5, mesh3d::point *p6, mesh3d::point *p7);
00054 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4, mesh3d::point *p5, mesh3d::point *p6, mesh3d::point *p7, mesh3d::point *p8);
00055 mesh3d::polygon *make_polygon(mesh3d::point *p0, mesh3d::point *p1, mesh3d::point *p2, mesh3d::point *p3, mesh3d::point *p4, mesh3d::point *p5, mesh3d::point *p6, mesh3d::point *p7, mesh3d::point *p8, mesh3d::point *p9);
00056 mesh3d::polygon *make_polygon(size_t p0);
00057 mesh3d::polygon *make_polygon(size_t p0, size_t p1);
00058 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2);
00059 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3);
00060 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4);
00061 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5);
00062 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6);
00063 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7);
00064 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, size_t p8);
00065 mesh3d::polygon *make_polygon(size_t p0, size_t p1, size_t p2, size_t p3, size_t p4, size_t p5, size_t p6, size_t p7, size_t p8, size_t p9);
00066
00067 public:
00068 void fix_normals();
00069 void build_mesh_from_geometry(bool fix_convex_normals = true);
00070
00071 public:
00072 mesh3d::geometry m_geometry;
00073 };
00074
00075 class grid : public polymesh
00076 {
00077 public:
00078 grid(float cell_width, int positive_cell_count);
00079 };
00080
00081 class sphere : public polymesh
00082 {
00083 public:
00084 sphere(float radius, int stack_division, int slice_count);
00085
00086 mesh3d::point *make_point(
00087 double rel_slice,
00088 double rel_stack,
00089 double radius
00090 );
00091
00092 };
00093
00094
00095 class cube : public polymesh
00096 {
00097 public:
00098 cube(double r = 1.0);
00099 };
00100
00101 class cuboctahedron : public polymesh
00102 {
00103 public:
00104 cuboctahedron(double r = 1.0);
00105 };
00106
00107 class dodecahedron : public polymesh
00108 {
00109 public:
00110 dodecahedron(double r = 1.0);
00111 };
00112
00113 class icosahedron : public polymesh
00114 {
00115 public:
00116 icosahedron(double r = 1.0);
00117 };
00118
00119 class octahedron : public polymesh
00120 {
00121 public:
00122 octahedron(double r = 1.0);
00123 };
00124
00125 class tetrahedron : public polymesh
00126 {
00127 public:
00128 tetrahedron(double r = 1.0);
00129 };
00130
00131
00132 class truncated_cube : public polymesh
00133 {
00134 public:
00135 truncated_cube(double r = 1.0);
00136 };
00137
00138 #if 0 // this one is broken
00139 class truncated_cuboctahedron : public polymesh
00140 {
00141 public:
00142 truncated_cuboctahedron(double r = 1.0);
00143 };
00144
00145 #endif
00146 class truncated_octahedron : public polymesh
00147 {
00148 public:
00149 truncated_octahedron(double r = 1.0);
00150 };
00151
00152 class truncated_icosahedron : public polymesh
00153 {
00154 public:
00155 truncated_icosahedron();
00156 };
00157
00158 class great_rhombicosidodecahedron : public polymesh
00159 {
00160 public:
00161 great_rhombicosidodecahedron();
00162 };
00163
00164 class truncated_dodecahedron : public polymesh
00165 {
00166 public:
00167 truncated_dodecahedron();
00168 };
00169
00170
00171
00172 class johnson_solid : public polymesh
00173 {
00174 public:
00175 johnson_solid(int number);
00176 };
00177
00178
00179 class quad : public polymesh
00180 {
00181 public:
00182 quad();
00183 };
00184
00185 }
00186
00187 }
00188
00189 #endif
00190