29 static void init_stuff(
void);
34 float Octo[6][3] = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0},
35 {-1.0, 0.0, 0.0}, {0.0, -1.0, 0.0}, {0.0, 0.0, -1.0}};
37 #define ONORM .57445626
63 {-1.0, -1.0, -1.0}, {1.0, -1.0, -1.0}, {1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0},
64 {-1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}, {1.0, 1.0, 1.0}, {-1.0, 1.0, 1.0}};
68 #define UP_NORM Octo[2]
69 #define DOWN_NORM Octo[5]
84 static void init_stuff(
void)
93 cos45 = cos(atan(1.0));
95 for (i = 0; i < 8; i++) {
117 Pi = 4.0 * atan(1.0);
141 v1[
Z] = v2[
Z] = center[
Z];
143 v1[
X] = v2[
X] = center[
X];
144 v1[
Y] = center[
Y] - siz;
145 v2[
Y] = center[
Y] + siz;
151 v1[
Y] = v2[
Y] = center[
Y];
152 v1[
X] = center[
X] - siz;
153 v2[
X] = center[
X] + siz;
182 for (i = 0; i < np; i++) {
194 v2[
Z] = pts[np - 1][
Z];
225 pdraw = n < np ? n : np;
229 for (i = 0; i < pdraw; i++) {
236 pt[
X] = pts[i - 1][
X];
237 pt[
Y] = pts[i - 1][
Y];
241 v2[
Z] = pts[np - 1][
Z];
270 v1[
Z] = v2[
Z] = center[
Z];
272 v1[
X] = center[
X] - siz;
273 v2[
X] = center[
X] + siz;
274 v1[
Y] = center[
Y] - siz;
275 v2[
Y] = center[
Y] + siz;
287 v1[
X] = center[
X] - siz;
288 v2[
X] = center[
X] + siz;
289 v1[
Y] = center[
Y] + siz;
290 v2[
Y] = center[
Y] - siz;
422 void gsd_cube(
float *center,
unsigned long colr,
float siz)
685 for (i = 0; i < 6; i++) {
779 float costheta, theta, adjacent;
787 if (dx == 0 && dy == 0) {
795 costheta = dx / sqrt(dx * dx + dy * dy);
796 theta = acos(costheta);
800 theta = (2 *
Pi) - theta;
811 else if (dx == 0 && dy == 0) {
815 adjacent = sqrt(dx * dx + dy * dy);
816 costheta = adjacent / sqrt(adjacent * adjacent + dz * dz);
817 theta = acos(costheta);
827 *aspect = *aspect * (180. /
Pi);
828 *slope = *slope * (180. /
Pi);
852 unsigned long arw_clr,
unsigned long text_clr)
857 float Ntop[] = {0.0, 0.0, 1.0};
859 base[0][
Z] = base[1][
Z] = base[2][
Z] = pos2[
Z];
860 v[0][
Z] = v[1][
Z] = v[2][
Z] = v[3][
Z] = pos2[
Z];
862 base[0][
X] = pos2[
X] - len / 16.;
863 base[1][
X] = pos2[
X] + len / 16.;
864 base[0][
Y] = base[1][
Y] = pos2[
Y] - len / 2.;
865 base[2][
X] = pos2[
X];
866 base[2][
Y] = pos2[
Y] + .45 * len;
868 v[0][
X] = v[2][
X] = pos2[
X];
869 v[1][
X] = pos2[
X] + len / 8.;
870 v[3][
X] = pos2[
X] - len / 8.;
871 v[0][
Y] = pos2[
Y] + .2 * len;
872 v[1][
Y] = v[3][
Y] = pos2[
Y] + .1 * len;
873 v[2][
Y] = pos2[
Y] + .5 * len;
885 glVertex3fv(base[0]);
886 glVertex3fv(base[1]);
887 glVertex3fv(base[2]);
916 glRasterPos3fv(base[0]);
917 glListBase(fontbase);
918 glCallLists(strlen(txt), GL_UNSIGNED_BYTE, (
const GLvoid *)txt);
948 int gsd_arrow(
float *center,
unsigned long colr,
float siz,
float *dir,
953 static int first = 1;
964 if (
NULL != onsurf) {
965 float base[3], tip[3], len;
972 tip[
X] = center[
X] + dir[
X] * len * siz;
973 tip[
Y] = center[
Y] + dir[
Y] * len * siz;
1025 static int first = 1;
1035 G_debug(3,
"gsd_arrow_onsurf");
1036 G_debug(3,
" %f %f -> %f %f", base[
X], base[
Y], tip[
X], tip[
Y]);
1040 #ifdef DO_SPHERE_BASE
1050 base[
Z] = tip[
Z] = 0.0;
1053 G_debug(3,
" dir0: %f %f %f", dir0[
X], dir0[
Y], dir0[
Z]);
1061 G_debug(3,
" a-dir1: %f %f %f", dir1[
X], dir1[
Y], dir1[
Z]);
1062 G_debug(3,
" a-dir2: %f %f %f", dir2[
X], dir2[
Y], dir2[
Z]);
1069 G_debug(3,
" b-dir1: %f %f %f", dir1[
X], dir1[
Y], dir1[
Z]);
1070 G_debug(3,
" b-dir2: %f %f %f", dir2[
X], dir2[
Y], dir2[
Z]);
1076 G_debug(3,
" %f %f -> ", tmp[
X], tmp[
Y]);
1084 G_debug(3,
" dir1: %f %f %f", dir1[
X], dir1[
Y], dir1[
Z]);
1085 G_debug(3,
" dir2: %f %f %f", dir2[
X], dir2[
Y], dir2[
Z]);
1111 void gsd_3darrow(
float *center,
unsigned long colr,
float siz1,
float siz2,
1112 float *dir,
float sz)
1114 float slope, aspect;
1116 static int first = 1;
1118 static int debugint = 1;
1125 if (debugint > 100) {
1127 G_debug(3,
" pt: %f,%f,%f dir: %f,%f,%f slope: %f aspect: %f",
1128 center[
X], center[
Y], center[
Z], dir[
X], dir[
Y], dir[
Z], slope,
1193 int gsd_scalebar(
float *pos2,
float len, GLuint fontbase,
unsigned long bar_clr,
1194 unsigned long text_clr)
1198 float Ntop[] = {0.0, 0.0, 1.0};
1200 base[0][
Z] = base[1][
Z] = base[2][
Z] = base[3][
Z] = pos2[
Z];
1203 base[0][
X] = base[1][
X] = pos2[
X] - len / 2.;
1204 base[2][
X] = base[3][
X] = pos2[
X] + len / 2.;
1206 base[0][
Y] = base[3][
Y] = pos2[
Y] - len / 16.;
1207 base[1][
Y] = base[2][
Y] = pos2[
Y] + len / 16.;
1220 glVertex3fv(base[0]);
1221 glVertex3fv(base[1]);
1222 glVertex3fv(base[2]);
1223 glVertex3fv(base[3]);
1224 glVertex3fv(base[0]);
1236 snprintf(txt,
sizeof(txt),
"%g km", len / 1000);
1238 snprintf(txt,
sizeof(txt),
"%g meters", len);
1242 snprintf(txt,
sizeof(txt),
"%g miles", len / 5280);
1243 else if (len == 5280)
1244 snprintf(txt,
sizeof(txt),
"1 mile");
1246 snprintf(txt,
sizeof(txt),
"%g feet", len);
1256 glRasterPos3fv(base[0]);
1257 glListBase(fontbase);
1258 glCallLists(strlen(txt), GL_BYTE, (GLubyte *)txt);
1283 unsigned long bar_clr,
unsigned long text_clr
UNUSED)
1286 float Ntop[] = {0.0, 0.0, 1.0};
1288 base[0][
Z] = base[1][
Z] = base[2][
Z] = pos[
Z];
1289 base[3][
Z] = base[4][
Z] = base[5][
Z] = pos[
Z];
1292 base[0][
X] = base[2][
X] = base[3][
X] = pos[
X] - len / 2.;
1293 base[1][
X] = base[4][
X] = base[5][
X] = pos[
X] + len / 2.;
1294 base[0][
Y] = base[1][
Y] = pos[
Y];
1295 base[2][
Y] = base[4][
Y] = pos[
Y] - len / 12;
1296 base[3][
Y] = base[5][
Y] = pos[
Y] + len / 12;
1348 static int first = 1;
1355 tip[
X] = tip[
Y] = 0.0;
1384 static int first = 1;
1455 float Box[8][3] = {{1.0, 1.0, -1.0}, {-1.0, 1.0, -1.0}, {-1.0, 1.0, 1.0},
1456 {1.0, 1.0, 1.0}, {1.0, -1.0, -1.0}, {-1.0, -1.0, -1.0},
1457 {-1.0, -1.0, 1.0}, {1.0, -1.0, 1.0}};
const char * G_database_unit_name(int)
Get units (localized) name for the current location.
int G_debug(int, const char *,...) __attribute__((format(printf
void gsd_endlist(void)
End list.
int GS_v3norm(float *)
Change v1 so that it is a unit vector (3D)
void GS_v3mult(float *, float)
Multiple vectors.
void gsd_endtfan(void)
ADD.
void gsd_endtmesh(void)
ADD.
void gsd_swaptmesh(void)
ADD.
void gsd_pushmatrix(void)
Push the current matrix stack.
void gsd_backface(int)
ADD.
void GS_set_draw(int)
Sets which buffer to draw to.
void gsd_scale(float, float, float)
Multiply the current matrix by a general scaling matrix.
void gsd_do_scale(int)
Set current scale.
void gsd_bgnqstrip(void)
ADD.
void GS_v3mag(float *, float *)
Magnitude of vector.
void gsd_shademodel(int)
Set shaded model.
float GS_P2distance(float *, float *)
Calculate distance in plane.
void gsd_sphere(float *, float)
ADD.
void gsd_circ(float, float, float)
ADD.
void gsd_bgnpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
void GS_v3add(float *, float *)
Sum vectors.
void gsd_bgnlist(int, int)
ADD.
int gsd_getshademodel(void)
Get shaded model.
int gsd_makelist(void)
ADD.
void gsd_calllist(int)
ADD.
void GS_v3eq(float *, float *)
Copy vector values.
int gsd_get_txtwidth(const char *, int)
Get text width.
void gsd_endqstrip(void)
ADD.
int gsd_get_txtheight(int size)
Get text height.
void gsd_color_func(unsigned int)
Set current color.
Point3 * gsdrape_get_segments(geosurf *, float *, float *, int *)
ADD.
void gsd_translate(float, float, float)
Multiply the current matrix by a translation matrix.
void gsd_popmatrix(void)
Pop the current matrix stack.
void gsd_flush(void)
Mostly for flushing drawing commands across a network.
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
void gsd_linewidth(short)
Set width of rasterized lines.
void gsd_endline(void)
End line.
void gsd_bgntfan(void)
ADD.
void gsd_disc(float, float, float, float)
ADD.
int GS_v3dir(float *, float *, float *)
Get a normalized direction from v1 to v2, store in v3.
void gsd_bgnline(void)
Begin line.
void GS_done_draw(void)
Draw done, swap buffers.
void gsd_rot(float, char)
ADD.
void gsd_vert_func(float *)
ADD.
void gsd_bgntmesh(void)
ADD.
void gsd_litvert_func2(float *, unsigned long, float *)
ADD.
void gsd_endpolygon(void)
Delimit the vertices of a primitive or a group of like primitives.
void gsd_litvert_func(float *, unsigned long, float *)
Set the current normal vector & specify vertex.
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
void gsd_3dcursor(float *pt)
Draw 3d cursor.
void gsd_diamond(float *center, unsigned long colr, float siz)
Draws a diamond symbol at the specified center location.
float Box[8][3]
Vertices for box.
void gsd_draw_box(float *center, unsigned long colr, float siz)
Draws a box symbol at the specified center location.
void gsd_3darrow(float *center, unsigned long colr, float siz1, float siz2, float *dir, float sz)
Draw 3d north arrow.
void gsd_line_onsurf(geosurf *gs, float *v1, float *v2)
Line on surface, fix z-values.
void primitive_cylinder(unsigned long colr, int caps)
Primitives only called after transforms.
int gsd_arrow(float *center, unsigned long colr, float siz, float *dir, float sz, geosurf *onsurf)
Draws an arrow.
void gsd_x(geosurf *gs, float *center, int colr, float siz)
Draws a X symbol at the specified center location.
void gsd_drawsphere(float *center, unsigned long colr, float siz)
Draws a sphere at the specified center location.
int gsd_north_arrow(float *pos2, float len, GLuint fontbase, unsigned long arw_clr, unsigned long text_clr)
Draw North Arrow.
float ogverts[8][3]
vertices & normals for octagon in xy plane
void gsd_cube(float *center, unsigned long colr, float siz)
Draws a cube symbol at the specified center location.
int gsd_nline_onsurf(geosurf *gs, float *v1, float *v2, float *pt, int n)
Multiline on surface, fix z-values.
void gsd_diamond_lines(void)
Draw diamond lines.
int gsd_arrow_onsurf(float *base, float *tip, unsigned long colr, int wid, geosurf *gs)
Draw north arrow on surface.
int gsd_scalebar(float *pos2, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr)
Draw Scalebar takes OpenGL coords and size.
float OctoN[8][3]
normals for flat-shaded octahedron
float ogvertsplus[8][3]
vertices for octagon in xy plane, z=1
void dir_to_slope_aspect(float *dir, float *slope, float *aspect, int degrees)
Converts a direction vector to slope and aspect angles.
float Octo[6][3]
vertices for octahedron
int gsd_scalebar_v2(float *pos, float len, GLuint fontbase, unsigned long bar_clr, unsigned long text_clr)
Draw Scalebar (as lines)
void gsd_draw_asterisk(float *center, unsigned long colr, float siz)
Draws an asterisk symbol at the specified center location.
void primitive_cone(unsigned long colr)
Primitives only called after transforms.
void gsd_box(float *center, int colr, float *siz)
Draws a box at the specified center location.
void gsd_draw_gyro(float *center, unsigned long colr, float siz)
Draws a gyro symbol at the specified center location.
void gsd_plus(float *center, int colr, float siz)
Draws a plus sign symbol at the specified center location.
OGSF header file (structures)