X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=src%2Froam.h;h=02d0beb487aef9aad51c671553deff9f32dfbfe8;hb=3812f4ecfc3894f0118ec6eb173a0cc705ec2ceb;hp=c4a08987456dfb2d329816c5bd36ef37c8e75e4f;hpb=ac7156bd84aef88b712f117f7e2f3d847d371719;p=grits diff --git a/src/roam.h b/src/roam.h index c4a0898..02d0beb 100644 --- a/src/roam.h +++ b/src/roam.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009 Andy Spencer + * Copyright (C) 2009-2010 Andy Spencer * * 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 @@ -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, elev; + + /* 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,17 +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, gboolean all, + gdouble n, gdouble s, gdouble e, gdouble w); void roam_sphere_free(RoamSphere *sphere); #endif