diff --git a/TODO.txt b/TODO.txt index 5ae6bf1..e32a0a9 100644 --- a/TODO.txt +++ b/TODO.txt @@ -4,7 +4,5 @@ - Replace hashmap.c with glib HashTable - Improve atmosphere shader - Clean up multithreading sync functions -- Ensure all GObjects are correctly ref'd and unref'd -- Re-implement timeline (maybe) - Improve settings menu - Web build? (broadway) diff --git a/res/ui/ui.glade~ b/res/ui/ui.glade~ deleted file mode 100644 index 31b56be..0000000 --- a/res/ui/ui.glade~ +++ /dev/null @@ -1,1005 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - False - Catalog - 480 - - - - True - True - - - - True - False - vertical - - - True - True - edit-find-symbolic - False - False - - - - False - True - 0 - - - - - True - True - never - always - in - False - - - True - True - 0 - True - both - - - - - - fixed - Select - True - - - - - - fixed - ID - True - True - - - - - - fixed - Name - True - descending - - - - - - fixed - Intl Des - True - - - - - - fixed - Status - True - - - - - - fixed - Owner - True - - - - - - fixed - Launch Date - True - - - - - - fixed - Period (min) - True - - - - - - fixed - Incl (°) - True - - - - - - fixed - Apo (km) - True - - - - - - fixed - Peri (km) - True - - - - - - - - True - True - 1 - - - - - - - True - False - Catalog - - - False - - - - - True - False - vertical - - - True - False - 0 - none - - - True - False - 12 - - - - True - False - True - - - True - False - Name - - - 0 - 0 - - - - - True - False - ID - - - 0 - 1 - - - - - True - False - Payload - - - 0 - 3 - - - - - True - False - Intl Des - - - 0 - 2 - - - - - True - False - Launch Site - - - 2 - 0 - - - - - True - False - Launch Date - - - 2 - 1 - - - - - True - False - Owner - - - 2 - 2 - - - - - True - False - Decay Date - - - 2 - 3 - - - - - True - False - Period (min) - - - 4 - 0 - - - - - True - False - Incl (°) - - - 4 - 1 - - - - - True - False - Apogee (km) - - - 4 - 2 - - - - - True - False - Perigee (km) - - - 4 - 3 - - - - - True - False - Status - - - 0 - 4 - - - - - True - False - Radar Cross Section (m²) - - - 4 - 4 - - - - - True - False - 24 - - - 1 - 0 - - - - - True - False - 5 - - - 1 - 1 - - - - - True - False - 11 - - - 1 - 2 - - - - - True - False - 21 - - - 1 - 4 - - - - - True - False - 52 - - - 3 - 0 - - - - - True - False - 10 - - - 3 - 1 - - - - - True - False - 66 - - - 3 - 2 - - - - - True - False - 10 - - - 3 - 3 - - - - - True - False - 7 - - - 5 - 0 - - - - - True - False - 5 - - - 5 - 1 - - - - - True - False - 6 - - - 5 - 2 - - - - - True - False - 21 - - - 5 - 3 - - - - - True - False - 8 - - - 5 - 4 - - - - - True - False - Orbital Status - - - 2 - 4 - - - - - True - False - 3 - - - 3 - 4 - - - - - True - False - 3 - - - 1 - 3 - - - - - - - - - True - False - Info - - - - - True - True - 0 - - - - - True - False - 0 - none - - - True - False - 12 - - - - True - False - True - True - - - True - False - Position (TEME) (km) - - - 0 - 0 - - - - - True - False - Position (ECEF) (km) - - - 0 - 1 - - - - - True - False - Velocity (km/s) - - - 2 - 0 - - - - - True - False - Position (LLH) (°,km) - - - 2 - 1 - - - - - True - False - 24 - - - 1 - 0 - - - - - True - False - 24 - - - 1 - 1 - - - - - True - False - 24 - - - 3 - 1 - - - - - True - False - 24 - - - 3 - 0 - - - - - - - - - True - False - Motion - - - - - True - True - 1 - - - - - 1 - - - - - True - False - Details - - - 1 - False - - - - - - - False - Orbit Visualizer - 1024 - 768 - - - - - True - False - vertical - - - True - False - both-horiz - 4 - - - True - False - - - True - True - 28 - True - - - - - - False - True - - - - - True - False - - - False - True - - - - - True - False - toolbutton - True - media-playback-start - True - - - - False - True - - - - - True - False - Realtime - True - - - - False - True - - - - - True - False - - - False - True - - - - - True - False - __glade_unnamed_11 - True - media-seek-backward - - - - False - True - - - - - True - False - - - True - True - 6 - - - - - - False - True - - - - - True - False - __glade_unnamed_13 - True - media-seek-forward - - - - False - True - - - - - True - False - - - False - True - - - - - True - False - - - True - True - - - - - True - False - Catalog - True - - - - False - True - - - - - True - False - - - True - True - - - - - True - False - __glade_unnamed_17 - True - emblem-system - - - - False - True - - - - - False - True - 0 - - - - - True - True - True - GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_SCROLL_MASK | GDK_SMOOTH_SCROLL_MASK - - - - - - - - True - True - False - True - True - True - - - - - - - - True - True - 1 - - - - - True - False - 10 - 10 - 10 - 10 - 6 - 6 - vertical - 2 - - - False - True - 2 - - - - - - - False - Settings - - - - True - False - vertical - - - Lighting - True - True - False - True - True - - - - False - True - 1 - - - - - Clouds - True - True - False - True - True - - - - False - True - 2 - - - - - Local Time - True - True - False - True - True - - - - False - True - 3 - - - - - - diff --git a/src/core/error.h b/src/core/error.h index 507f84e..e12e462 100644 --- a/src/core/error.h +++ b/src/core/error.h @@ -1,8 +1,8 @@ #ifndef __ERROR_H__ #define __ERROR_H__ -#include "type.h" #include "system.h" +#include "type.h" #define error(...) \ do { \ diff --git a/src/core/type.h b/src/core/type.h index d1f7ef9..b845cc6 100644 --- a/src/core/type.h +++ b/src/core/type.h @@ -19,6 +19,4 @@ #define sgn(x) (signbit(x) ? -1 : 1) -#define PI 3.1415927f - #endif /* __TYPE_H__ */ diff --git a/src/gfx/gfx.c b/src/gfx/gfx.c index 0041c23..2553ec3 100644 --- a/src/gfx/gfx.c +++ b/src/gfx/gfx.c @@ -2,10 +2,10 @@ #include "camera.h" #include "error.h" +#include "info.h" #include "render.h" #include "thread.h" #include "timemgr.h" -#include "info.h" struct GLCtx e_gl_ctx; static GtkGLArea *glarea; diff --git a/src/gfx/render.c b/src/gfx/render.c index 48b533b..a3c7c2a 100644 --- a/src/gfx/render.c +++ b/src/gfx/render.c @@ -23,7 +23,7 @@ void render_init(void) glm_vec3_copy((vec3){ 0, 0, 1 }, e_camera.up); e_camera.rad = 5.f; - e_camera.fov = PI / 2.f; + e_camera.fov = (float)G_PI / 2.f; e_camera.near = 0.05f; e_camera.far = 100.f; diff --git a/src/phys/phys.c b/src/phys/phys.c index 37325d5..75bded4 100644 --- a/src/phys/phys.c +++ b/src/phys/phys.c @@ -40,13 +40,13 @@ void phys_phys(void) double n = fmod(jd_epoch, 365.25); /* Days elapsed since Jan 1 Midnight */ glm_vec2_copy((vec2){ 1.0 - modf(jd_epoch, &temp), /* Omitted Equation of Time */ - ((float)asin(0.39779 * cos(0.017203 * (n + 10) + 0.0334 * sin(0.017203 * (n - 2)))) + PI) / (2.f * PI), + ((float)asin(0.39779 * cos(0.017203 * (n + 10) + 0.0334 * sin(0.017203 * (n - 2)))) + (float)G_PI) / (2.f * (float)G_PI), }, phys_ctx_sync.sun_uv); glm_vec3_copy((vec3){ - -cosf(phys_ctx_sync.sun_uv[0] * 2.f * PI) * sinf(phys_ctx_sync.sun_uv[1] * PI), - -sinf(phys_ctx_sync.sun_uv[0] * 2.f * PI) * sinf(phys_ctx_sync.sun_uv[1] * PI), - cosf(phys_ctx_sync.sun_uv[1] * PI), + -cosf(phys_ctx_sync.sun_uv[0] * 2.f * (float)G_PI) * sinf(phys_ctx_sync.sun_uv[1] * (float)G_PI), + -sinf(phys_ctx_sync.sun_uv[0] * 2.f * (float)G_PI) * sinf(phys_ctx_sync.sun_uv[1] * (float)G_PI), + cosf(phys_ctx_sync.sun_uv[1] * (float)G_PI), }, phys_ctx_sync.sun_dir); } diff --git a/src/ui/catalog.c b/src/ui/catalog.c index e385c92..f7fdd50 100644 --- a/src/ui/catalog.c +++ b/src/ui/catalog.c @@ -1,7 +1,7 @@ #include "catalog.h" -#include "satcat_code.h" #include "info.h" +#include "satcat_code.h" enum Column { COL_SELECT = 0u, @@ -150,8 +150,7 @@ void on_catalog_notebook_switch_page(GtkNotebook *notebook, GtkWidget *page, gui -1); info_show(satellite); } - } - break; + } break; } } @@ -340,7 +339,7 @@ void catalog_init(GtkBuilder *builder) "on_window_catalog_delete_event", G_CALLBACK(on_window_catalog_delete_event), "on_catalog_search_search_changed", G_CALLBACK(on_catalog_search_search_changed), "on_col_clicked", G_CALLBACK(on_col_clicked), - "on_catalog_notebook_switch_page", G_CALLBACK(on_catalog_notebook_switch_page), + "on_catalog_notebook_switch_page", G_CALLBACK(on_catalog_notebook_switch_page), NULL); window_catalog = GTK_WINDOW(gtk_builder_get_object(builder, "window_catalog")); diff --git a/src/ui/info.c b/src/ui/info.c index 6d13533..04acfc9 100644 --- a/src/ui/info.c +++ b/src/ui/info.c @@ -5,10 +5,10 @@ #include "TLE.h" #include "satcat_code.h" -#include -#include #include #include +#include +#include #include @@ -140,7 +140,7 @@ void info_tic(void) glm_vec3_norm(t[1]); vec3 rf, recef; - glm_vec3_copy((vec3){r[0], r[1], r[2]}, rf); + glm_vec3_copy((vec3){ r[0], r[1], r[2] }, rf); glm_mat3_mulv(t, rf, recef); fmt_coords(buf, 48, recef[0], recef[1], recef[2]); gtk_label_set_text(info_items[INFO_POSITION_ECEF], buf); @@ -151,9 +151,9 @@ void info_tic(void) float alat = fabsf(lat); float tmp; g_snprintf(buf, 48, "%02u\u00B0%02u'%c\n%03u\u00B0%02u'%c\n%011.3f", - (unsigned)alat, (unsigned)(modff(alat, &tmp) * 60.f), ((signbit(lat)) ? 'S' : 'N'), - (unsigned)algt, (unsigned)(modff(algt, &tmp) * 60.f), ((signbit(lgt)) ? 'W' : 'E'), - (double)glm_vec3_norm(recef)); + (unsigned)alat, (unsigned)(modff(alat, &tmp) * 60.f), ((signbit(lat)) ? 'S' : 'N'), + (unsigned)algt, (unsigned)(modff(algt, &tmp) * 60.f), ((signbit(lgt)) ? 'W' : 'E'), + (double)glm_vec3_norm(recef)); gtk_label_set_text(info_items[INFO_POSITION_LLH], buf); } } diff --git a/src/ui/info.h b/src/ui/info.h index c117efc..7b37e85 100644 --- a/src/ui/info.h +++ b/src/ui/info.h @@ -1,8 +1,8 @@ #ifndef __INFO_H__ #define __INFO_H__ -#include "ui.h" #include "satellite.h" +#include "ui.h" void info_init(GtkBuilder *builder); diff --git a/src/ui/input.c b/src/ui/input.c index 023781b..30c9ad3 100644 --- a/src/ui/input.c +++ b/src/ui/input.c @@ -87,8 +87,8 @@ gboolean on_glarea_motion_notify_event(GtkWidget *widget, GdkEvent *event, gpoin (void)user_data; GdkEventMotion *motion = &event->motion; if (cursor_pressed) { - float d_ang_x = (2.f * PI / e_gl_ctx.res_x); - float d_ang_y = (PI / e_gl_ctx.res_y); + float d_ang_x = (2.f * (float)G_PI / e_gl_ctx.res_x); + float d_ang_y = ((float)G_PI / e_gl_ctx.res_y); float ang_x = (float)(cursor_xpos - motion->x) * d_ang_x; float ang_y = (float)(cursor_ypos - motion->y) * d_ang_y; @@ -96,7 +96,7 @@ gboolean on_glarea_motion_notify_event(GtkWidget *widget, GdkEvent *event, gpoin glm_vec3_sub(e_camera.target, e_camera.pos, view_dir); glm_vec3_normalize(view_dir); float cam_ang = acosf(glm_vec3_dot(view_dir, e_camera.up)); - ang_y = glm_clamp(1e-2f, cam_ang + ang_y, PI - 1e-2f) - cam_ang; + ang_y = glm_clamp(1e-2f, cam_ang + ang_y, (float)G_PI - 1e-2f) - cam_ang; vec3 right; glm_vec3_cross(e_camera.up, view_dir, right); diff --git a/src/ui/ui.c b/src/ui/ui.c index 3b3a95f..5d019b8 100644 --- a/src/ui/ui.c +++ b/src/ui/ui.c @@ -4,6 +4,7 @@ #include "entity.h" #include "error.h" #include "gfx.h" +#include "info.h" #include "input.h" #include "render.h" #include "setting.h" @@ -11,7 +12,6 @@ #include "system.h" #include "thread.h" #include "timemgr.h" -#include "info.h" const gchar *FILENAME_GUI = "res/ui/ui.glade"; diff --git a/src/util/icosphere.c b/src/util/icosphere.c index 4b30a54..00ae5d6 100644 --- a/src/util/icosphere.c +++ b/src/util/icosphere.c @@ -182,8 +182,8 @@ void icosphere_generate(const unsigned n_sub, vec3 **verts, guint32 **faces, vec /* Generate UVs */ for (i = 0; i < *n_verts; i++) { glm_vec2_copy((vec2){ - (atan2f((*verts)[i][1], (*verts)[i][0]) + PI) * (1.f / (2.f * PI)), - acosf(-((*verts)[i][2])) * (1.f / PI) }, + (atan2f((*verts)[i][1], (*verts)[i][0]) + (float)G_PI) * (1.f / (2.f * (float)G_PI)), + acosf(-((*verts)[i][2])) * (1.f / (float)G_PI) }, (*uv)[i]); }