/*
- * Copyright (C) 2009 Andy Spencer <spenceal@rose-hulman.edu>
+ * Copyright (C) 2009-2010 Andy Spencer <andy753421@gmail.com>
*
* 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
float material_ambient[] = {0.2, 0.2, 0.2, 1.0};
float material_diffuse[] = {0.8, 0.8, 0.8, 1.0};
- float material_specular[] = {0.0, 0.0, 0.0, 1.0};
+ float material_specular[] = {0.1, 0.1, 0.1, 1.0};
float material_emission[] = {0.0, 0.0, 0.0, 1.0};
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, material_ambient);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, material_diffuse);
glRotatef(lat, 1, 0, 0);
glRotatef(-lon, 0, 1, 0);
- /* Misc */
- gdouble rg = MAX(0, 1-(elev/20000));
- gdouble blue = MAX(0, 1-(elev/50000));
- glClearColor(MIN(0.65,rg), MIN(0.65,rg), MIN(1,blue), 1.0f);
- glColor4f(1, 1, 1, 1);
-
glDisable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
/* Freeze depth buffer and draw transparent objects sorted */
/* TODO: sorting */
- glDepthMask(FALSE);
+ //glDepthMask(FALSE);
+ glAlphaFunc(GL_GREATER, 0.1);
for (cur = level->sorted.next; cur; cur = cur->next, nsorted++)
_draw_object(self, GIS_OBJECT(cur->data));
gdouble londist = e - w;
gdouble latdist = n - s;
- gdouble xy[][3] = {
+ gdouble xy[3][2] = {
{(lon[0]-w)/londist, 1-(lat[0]-s)/latdist},
{(lon[1]-w)/londist, 1-(lat[1]-s)/latdist},
{(lon[2]-w)/londist, 1-(lat[2]-s)/latdist},
};
+ //if ((lat[0] == 90 && (xy[0][0] < 0 || xy[0][0] > 1)) ||
+ // (lat[1] == 90 && (xy[1][0] < 0 || xy[1][0] > 1)) ||
+ // (lat[2] == 90 && (xy[2][0] < 0 || xy[2][0] > 1)))
+ // g_message("w,e=%4.f,%4.f "
+ // "lat,lon,x,y="
+ // "%4.1f,%4.0f,%4.2f,%4.2f "
+ // "%4.1f,%4.0f,%4.2f,%4.2f "
+ // "%4.1f,%4.0f,%4.2f,%4.2f ",
+ // w,e,
+ // lat[0], lon[0], xy[0][0], xy[0][1],
+ // lat[1], lon[1], xy[1][0], xy[1][1],
+ // lat[2], lon[2], xy[2][0], xy[2][1]);
+
+ /* Fix poles */
+ if (lat[0] == 90 || lat[0] == -90) xy[0][0] = 0.5;
+ if (lat[1] == 90 || lat[1] == -90) xy[1][0] = 0.5;
+ if (lat[2] == 90 || lat[2] == -90) xy[2][0] = 0.5;
+
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, *(guint*)tile->data);
glBegin(GL_TRIANGLES);
g_source_remove(self->sm_source[1]);
self->sm_source[1] = 0;
}
- if (self->sphere) {
- roam_sphere_free(self->sphere);
- self->sphere = NULL;
- }
/* TODO: Cleanup/free objects tree */
G_OBJECT_CLASS(gis_opengl_parent_class)->dispose(_self);
}
{
g_debug("GisViewer: finalize");
GisOpenGL *self = GIS_OPENGL(_self);
+ roam_sphere_free(self->sphere);
g_mutex_free(self->sphere_lock);
G_OBJECT_CLASS(gis_opengl_parent_class)->finalize(_self);
}
{
g_debug("GisOpenGL: class_init");
GObjectClass *gobject_class = G_OBJECT_CLASS(klass);
- gobject_class->dispose = gis_opengl_dispose;
+ gobject_class->dispose = gis_opengl_dispose;
GisViewerClass *viewer_class = GIS_VIEWER_CLASS(klass);
viewer_class->center_position = gis_opengl_center_position;