X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Froam.h;h=38457005f735e8ec1dd3231221d35158308371af;hb=1ccb2426332856ef04f0bfb35716520a94e0d32c;hp=ebcc3a3c0a1380e7d82ae0be56ebbff10c34af15;hpb=49726a9c5be3b5868c443b1fca7f8e18515b795b;p=grits diff --git a/src/roam.h b/src/roam.h index ebcc3a3..3845700 100644 --- a/src/roam.h +++ b/src/roam.h @@ -19,7 +19,6 @@ #define __ROAM_H__ #include "gpqueue.h" -#include "wms.h" /* Roam */ typedef struct _RoamView RoamView; @@ -27,7 +26,7 @@ typedef struct _RoamPoint RoamPoint; typedef struct _RoamTriangle RoamTriangle; typedef struct _RoamDiamond RoamDiamond; typedef struct _RoamSphere RoamSphere; -typedef void (*RoamHeightFunc)(RoamPoint *point, gpointer user_data); +typedef gdouble (*RoamHeightFunc)(gdouble lat, gdouble lon, gpointer user_data); /* Misc */ struct _RoamView { @@ -48,12 +47,17 @@ struct _RoamPoint { gint tris; // Associated triangles gdouble norm[3]; // Vertex normal - WmsCacheNode *node; // TODO: don't depend on wms + /* For get_intersect */ + gdouble lat, lon; + + /* For terrain */ + RoamHeightFunc height_func; + gpointer height_data; }; 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_height(RoamPoint *point, RoamSphere *sphere); +void roam_point_update_height(RoamPoint *point); void roam_point_update_projection(RoamPoint *point, RoamSphere *sphere); /**************** @@ -68,7 +72,9 @@ struct _RoamTriangle { double error; GPQueueHandle handle; - WmsCacheNode *nodes[5]; // TODO: don't depend on wms + /* For get_intersect */ + struct { gdouble n,s,e,w; } edge; + RoamTriangle *kids[2]; }; RoamTriangle *roam_triangle_new(RoamPoint *l, RoamPoint *m, RoamPoint *r); void roam_triangle_add(RoamTriangle *triangle, @@ -105,20 +111,21 @@ struct _RoamSphere { GPQueue *triangles; GPQueue *diamonds; RoamView *view; - RoamHeightFunc height_func; - gpointer user_data; gint polys; /* For get_intersect */ RoamTriangle *roots[8]; }; -RoamSphere *roam_sphere_new(gpointer user_data); +RoamSphere *roam_sphere_new(); +void roam_sphere_update_view(RoamSphere *sphere); 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); void roam_sphere_draw(RoamSphere *sphere); void roam_sphere_draw_normals(RoamSphere *sphere); +GList *roam_sphere_get_intersect(RoamSphere *sphere, + gdouble n, gdouble s, gdouble e, gdouble w); void roam_sphere_free(RoamSphere *sphere); #endif