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/>.
25 typedef struct _RoamView RoamView;
26 typedef struct _RoamPoint RoamPoint;
27 typedef struct _RoamTriangle RoamTriangle;
28 typedef struct _RoamDiamond RoamDiamond;
29 typedef struct _RoamSphere RoamSphere;
30 typedef void (*RoamHeightFunc)(RoamPoint *point, gpointer user_data);
44 gdouble x,y,z; // Model coordinates
45 gdouble px,py,pz; // Projected coordinates
46 gint pversion; // Version of cached projection
48 gint tris; // Associated triangles
49 gdouble norm[3]; // Vertex normal
51 WmsCacheNode *node; // TODO: don't depend on wms
53 RoamPoint *roam_point_new(double x, double y, double z);
54 void roam_point_add_triangle(RoamPoint *point, RoamTriangle *triangle);
55 void roam_point_remove_triangle(RoamPoint *point, RoamTriangle *triangle);
56 void roam_point_update_height(RoamPoint *point, RoamSphere *sphere);
57 void roam_point_update_projection(RoamPoint *point, RoamSphere *sphere);
62 struct _RoamTriangle {
63 struct { RoamPoint *l,*m,*r; } p;
64 struct { RoamTriangle *l,*b,*r; } t;
71 WmsCacheNode *nodes[5]; // TODO: don't depend on wms
73 RoamTriangle *roam_triangle_new(RoamPoint *l, RoamPoint *m, RoamPoint *r);
74 void roam_triangle_add(RoamTriangle *triangle,
75 RoamTriangle *left, RoamTriangle *base, RoamTriangle *right,
77 void roam_triangle_remove(RoamTriangle *triangle, RoamSphere *sphere);
78 void roam_triangle_update_errors(RoamTriangle *triangle, RoamSphere *sphere);
79 void roam_triangle_split(RoamTriangle *triangle, RoamSphere *sphere);
80 void roam_triangle_draw_normal(RoamTriangle *triangle);
86 RoamTriangle *kids[4];
87 RoamTriangle *parents[2];
92 RoamDiamond *roam_diamond_new(
93 RoamTriangle *parent0, RoamTriangle *parent1,
94 RoamTriangle *kid0, RoamTriangle *kid1,
95 RoamTriangle *kid2, RoamTriangle *kid3);
96 void roam_diamond_add(RoamDiamond *diamond, RoamSphere *sphere);
97 void roam_diamond_remove(RoamDiamond *diamond, RoamSphere *sphere);
98 void roam_diamond_merge(RoamDiamond *diamond, RoamSphere *sphere);
99 void roam_diamond_update_errors(RoamDiamond *self, RoamSphere *sphere);
108 RoamHeightFunc height_func;
112 RoamSphere *roam_sphere_new(gpointer user_data);
113 void roam_sphere_update_errors(RoamSphere *sphere);
114 void roam_sphere_split_one(RoamSphere *sphere);
115 void roam_sphere_merge_one(RoamSphere *sphere);
116 gint roam_sphere_split_merge(RoamSphere *sphere);
117 void roam_sphere_draw(RoamSphere *sphere);
118 void roam_sphere_draw_normals(RoamSphere *sphere);
119 void roam_sphere_free(RoamSphere *sphere);