2 * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 typedef struct _RoamPoint RoamPoint;
25 typedef struct _RoamTriangle RoamTriangle;
26 typedef struct _RoamDiamond RoamDiamond;
27 typedef struct _RoamSphere RoamSphere;
28 typedef void (*RoamTriFunc)(RoamTriangle *triangle, gpointer user_data);
29 typedef void (*RoamHeightFunc)(RoamPoint *point, gpointer user_data);
36 double coords; // Texture coordinantes
37 double norm[3]; // Vertex normal
38 int refs; // Reference count
40 RoamPoint *roam_point_new(double x, double y, double z);
41 void roam_point_add_triangle(RoamPoint *point, RoamTriangle *triangle);
42 void roam_point_remove_triangle(RoamPoint *point, RoamTriangle *triangle);
47 struct _RoamTriangle {
48 struct { RoamPoint *l,*m,*r; } p;
49 struct { RoamTriangle *l,*b,*r; } t;
55 RoamTriangle *roam_triangle_new(RoamPoint *l, RoamPoint *m, RoamPoint *r);
56 void roam_triangle_add(RoamTriangle *triangle,
57 RoamTriangle *left, RoamTriangle *base, RoamTriangle *right,
59 void roam_triangle_remove(RoamTriangle *triangle, RoamSphere *sphere);
60 void roam_triangle_update_error(RoamTriangle *triangle, RoamSphere *sphere, GPQueue *triangles);
61 void roam_triangle_split(RoamTriangle *triangle, RoamSphere *sphere);
62 void roam_triangle_draw_normal(RoamTriangle *triangle);
69 RoamTriangle *parent[2];
74 RoamDiamond *roam_diamond_new(
75 RoamTriangle *parent0, RoamTriangle *parent1,
76 RoamTriangle *kid0, RoamTriangle *kid1,
77 RoamTriangle *kid2, RoamTriangle *kid3);
78 void roam_diamond_add(RoamDiamond *diamond, RoamSphere *sphere);
79 void roam_diamond_remove(RoamDiamond *diamond, RoamSphere *sphere);
80 void roam_diamond_merge(RoamDiamond *diamond, RoamSphere *sphere);
81 void roam_diamond_update_error(RoamDiamond *self, RoamSphere *sphere, GPQueue *diamonds);
90 RoamHeightFunc height_func;
94 RoamSphere *roam_sphere_new(RoamTriFunc tri_func, RoamHeightFunc height_func, gpointer user_data);
95 void roam_sphere_update_errors(RoamSphere *sphere);
96 void roam_sphere_update_point(RoamSphere *sphere, RoamPoint *point);
97 void roam_sphere_split_one(RoamSphere *sphere);
98 void roam_sphere_merge_one(RoamSphere *sphere);
99 gint roam_sphere_split_merge(RoamSphere *sphere);
100 void roam_sphere_draw(RoamSphere *sphere);
101 void roam_sphere_draw_normals(RoamSphere *sphere);
102 void roam_sphere_free(RoamSphere *sphere);