2 This file is part of the 3dengfx, realtime visualization system.
4 Copyright (c) 2004, 2005, 2006 John Tsiombikas <nuclear@siggraph.org>
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.
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.
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
21 /* geometry generation
23 * author: John Tsiombikas 2004
25 * Mihalis Georgoulopoulos 2004, 2005
26 * John Tsiombikas 2005
32 #include "n3dmath2/n3dmath2.hpp"
33 #include "gfx/3dgeom.hpp"
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);
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);
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);
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);
55 void create_teapot(TriMesh *mesh, scalar_t size, int subdiv);
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);