added 3dengfx into the repo, probably not the correct version for this
[summerhack] / src / 3dengfx / src / 3dengfx / ggen.hpp
1 /*
2 This file is part of the 3dengfx, realtime visualization system.
3
4 Copyright (c) 2004, 2005, 2006 John Tsiombikas <nuclear@siggraph.org>
5
6 3dengfx is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 3dengfx is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with 3dengfx; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 /* geometry generation
22  * 
23  * author: John Tsiombikas 2004
24  * modified: 
25  *              Mihalis Georgoulopoulos 2004, 2005
26  *              John Tsiombikas 2005
27  */
28
29 #ifndef _GGEN_HPP_
30 #define _GGEN_HPP_
31
32 #include "n3dmath2/n3dmath2.hpp"
33 #include "gfx/3dgeom.hpp"
34
35 // basic primitives
36 void create_cube(TriMesh *mesh, scalar_t size, int subdiv);
37 void create_plane(TriMesh *mesh, const Vector3 &normal, const Vector2 &size, int subdiv);
38 void create_cylinder(TriMesh *mesh, scalar_t rad, scalar_t len, bool caps, int udiv, int vdiv);
39 void create_sphere(TriMesh *mesh, scalar_t radius, int subdiv);
40 void create_torus(TriMesh *mesh, scalar_t circle_rad, scalar_t revolv_rad, int subdiv);
41
42 // surfaces of revolution
43 void create_revolution(TriMesh *mesh, const Curve &curve, int udiv, int vdiv);
44 void create_revolution(TriMesh *mesh, const Vector3 *data, int count, int udiv, int vdiv);
45
46 // path extrude
47 void create_extrusion(TriMesh *mesh, const Curve &shape, const Curve &path, int ssamples, int slices, scalar_t start_scale = 1.0, scalar_t end_scale = 1.0);
48
49 // bezier surface construction
50 void create_bezier_patch(TriMesh *mesh, const BezierSpline &u0, const BezierSpline &u1, const BezierSpline &u2, const BezierSpline &u3, int subdiv);
51 void create_bezier_patch(TriMesh *mesh, const Vector3 *cp, int subdiv);
52 void create_bezier_mesh(TriMesh *mesh, const Vector3 *cp, unsigned int *patches, int patch_count, int subdiv);
53
54 // oddities
55 void create_teapot(TriMesh *mesh, scalar_t size, int subdiv);
56
57 // fractal stuff
58 #define GGEN_NO_RESEED          (-1)
59 #define GGEN_RANDOM_SEED        (-2)
60 void create_landscape(TriMesh *mesh, const Vector2 &size, int mesh_detail, scalar_t max_height, int iter, scalar_t roughness = 0.5, int seed = -1);
61
62 #endif  // _GGEN_HPP_