]> Pileus Git - grits/blobdiff - src/roam.h
Reorganize BMNG and SRTM into plugins
[grits] / src / roam.h
index 3d2fced0a3e11cbf16ce271ad8094bbdc7222063..c4a08987456dfb2d329816c5bd36ef37c8e75e4f 100644 (file)
@@ -1,16 +1,16 @@
 /*
  * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
- * 
+ *
  * This program is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 3 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  * GNU General Public License for more details.
- * 
+ *
  * You should have received a copy of the GNU General Public License
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
@@ -27,14 +27,14 @@ typedef struct _RoamPoint    RoamPoint;
 typedef struct _RoamTriangle RoamTriangle;
 typedef struct _RoamDiamond  RoamDiamond;
 typedef struct _RoamSphere   RoamSphere;
-typedef void (*RoamTriFunc)(RoamTriangle *triangle, gpointer user_data);
 typedef void (*RoamHeightFunc)(RoamPoint *point, gpointer user_data);
 
 /* Misc */
 struct _RoamView {
        gdouble model[16];
-       gdouble proj[16]; 
-       gint view[4]; 
+       gdouble proj[16];
+       gint view[4];
+       gint version;
 };
 
 /*************
@@ -43,8 +43,7 @@ struct _RoamView {
 struct _RoamPoint {
        gdouble  x,y,z;     // Model coordinates
        gdouble  px,py,pz;  // Projected coordinates
-
-       gboolean cached;    // Height/projection cached
+       gint     pversion;  // Version of cached projection
 
        gint     tris;      // Associated triangles
        gdouble  norm[3];   // Vertex normal
@@ -54,8 +53,8 @@ struct _RoamPoint {
 RoamPoint *roam_point_new(double x, double y, double z);
 void roam_point_add_triangle(RoamPoint *point, RoamTriangle *triangle);
 void roam_point_remove_triangle(RoamPoint *point, RoamTriangle *triangle);
-void roam_point_update(RoamPoint *point, RoamSphere *sphere, gboolean do_height);
-void roam_point_clear(RoamPoint *self);
+void roam_point_update_height(RoamPoint *point, RoamSphere *sphere);
+void roam_point_update_projection(RoamPoint *point, RoamSphere *sphere);
 
 /****************
  * RoamTriangle *
@@ -63,6 +62,7 @@ void roam_point_clear(RoamPoint *self);
 struct _RoamTriangle {
        struct { RoamPoint    *l,*m,*r; } p;
        struct { RoamTriangle *l,*b,*r; } t;
+       RoamPoint *split;
        RoamDiamond *parent;
        double norm[3];
        double error;
@@ -75,7 +75,7 @@ void roam_triangle_add(RoamTriangle *triangle,
                RoamTriangle *left, RoamTriangle *base, RoamTriangle *right,
                RoamSphere *sphere);
 void roam_triangle_remove(RoamTriangle *triangle, RoamSphere *sphere);
-void roam_triangle_update(RoamTriangle *triangle, RoamSphere *sphere);
+void roam_triangle_update_errors(RoamTriangle *triangle, RoamSphere *sphere);
 void roam_triangle_split(RoamTriangle *triangle, RoamSphere *sphere);
 void roam_triangle_draw_normal(RoamTriangle *triangle);
 
@@ -96,7 +96,7 @@ RoamDiamond *roam_diamond_new(
 void roam_diamond_add(RoamDiamond *diamond, RoamSphere *sphere);
 void roam_diamond_remove(RoamDiamond *diamond, RoamSphere *sphere);
 void roam_diamond_merge(RoamDiamond *diamond, RoamSphere *sphere);
-void roam_diamond_update(RoamDiamond *self, RoamSphere *sphere);
+void roam_diamond_update_errors(RoamDiamond *self, RoamSphere *sphere);
 
 /**************
  * RoamSphere *
@@ -105,13 +105,12 @@ struct _RoamSphere {
        GPQueue *triangles;
        GPQueue *diamonds;
        RoamView *view;
-       RoamTriFunc tri_func;
        RoamHeightFunc height_func;
        gpointer user_data;
        gint polys;
 };
-RoamSphere *roam_sphere_new(RoamTriFunc tri_func, RoamHeightFunc height_func, gpointer user_data);
-void roam_sphere_update(RoamSphere *sphere);
+RoamSphere *roam_sphere_new(gpointer user_data);
+void roam_sphere_update_errors(RoamSphere *sphere);
 void roam_sphere_split_one(RoamSphere *sphere);
 void roam_sphere_merge_one(RoamSphere *sphere);
 gint roam_sphere_split_merge(RoamSphere *sphere);