@@ -20,9 +20,9 @@ static AppConfig cfg = {
2020};
2121
2222static Font customFont ;
23- static Texture2D satIcon , markerIcon , earthTexture , moonTexture ;
24- static Texture2D periMark , apoMark ; // New textures
25- static Model earthModel , moonModel ;
23+ static Texture2D satIcon , markerIcon , earthTexture , moonTexture , cloudTexture ;
24+ static Texture2D periMark , apoMark ;
25+ static Model earthModel , moonModel , cloudModel ;
2626
2727// safely modifies the alpha channel without relying on raylib's Fade()
2828static Color ApplyAlpha (Color c , float alpha ) {
@@ -187,6 +187,12 @@ int main(void) {
187187 earthTexture = LoadTexture ("resources/earth.png" );
188188 earthModel .materials [0 ].maps [MATERIAL_MAP_DIFFUSE ].texture = earthTexture ;
189189
190+ float draw_cloud_radius = (EARTH_RADIUS_KM + 25.0f ) / DRAW_SCALE ;
191+ Mesh cloudMesh = GenEarthMesh (draw_cloud_radius , 64 , 64 );
192+ cloudModel = LoadModelFromMesh (cloudMesh );
193+ cloudTexture = LoadTexture ("resources/clouds.png" );
194+ cloudModel .materials [0 ].maps [MATERIAL_MAP_DIFFUSE ].texture = cloudTexture ;
195+
190196 float draw_moon_radius = MOON_RADIUS_KM / DRAW_SCALE ;
191197 Mesh moonMesh = GenEarthMesh (draw_moon_radius , 32 , 32 );
192198 moonModel = LoadModelFromMesh (moonMesh );
@@ -340,11 +346,11 @@ int main(void) {
340346 }
341347 }
342348
343- // defining a hitbox area to cover the UI checkbox + its text
344- Rectangle cbHitbox = { 10 * cfg .ui_scale , (10 + 104 ) * cfg .ui_scale , 200 * cfg .ui_scale , 24 * cfg .ui_scale };
349+ // defining a hitbox area to cover the UI checkboxes + texts
350+ Rectangle cbHitbox = { 10 * cfg .ui_scale , (10 + 104 ) * cfg .ui_scale , 200 * cfg .ui_scale , 50 * cfg .ui_scale };
345351
346352 if (IsMouseButtonPressed (MOUSE_BUTTON_LEFT )) {
347- // only update selection if the mouse is not clicking on the UI Checkbox
353+ // only update selection if the mouse is not clicking on the UI Checkboxes
348354 if (!CheckCollisionPointRec (GetMousePosition (), cbHitbox )) {
349355 selected_sat = hovered_sat ;
350356
@@ -585,6 +591,14 @@ int main(void) {
585591 earthModel .transform = MatrixRotateY ((gmst_deg + cfg .earth_rotation_offset ) * DEG2RAD );
586592 DrawModel (earthModel , Vector3Zero (), 1.0f , WHITE );
587593
594+ if (show_clouds ) {
595+ double continuous_cloud_angle = fmod (gmst_deg + cfg .earth_rotation_offset + (current_epoch * 360.0 * 0.04 ), 360.0 );
596+ cloudModel .transform = MatrixRotateY ((float )(continuous_cloud_angle * DEG2RAD ));
597+ // BeginBlendMode(BLEND_ADDITIVE); // garbage tint, dont use it
598+ DrawModel (cloudModel , Vector3Zero (), 1.0f , WHITE );
599+ EndBlendMode ();
600+ }
601+
588602 // render Moon (not sure what for tbh but I'm sure someone will appreciate it :3)
589603 DrawModel (moonModel , draw_moon_pos , 1.0f , WHITE );
590604
@@ -708,6 +722,9 @@ int main(void) {
708722 Rectangle cbRec = { 10 * cfg .ui_scale , (10 + 104 ) * cfg .ui_scale , 20 * cfg .ui_scale , 20 * cfg .ui_scale };
709723 GuiCheckBox (cbRec , "Hide Unselected" , & hide_unselected );
710724
725+ Rectangle cbRec2 = { 10 * cfg .ui_scale , (10 + 128 ) * cfg .ui_scale , 20 * cfg .ui_scale , 20 * cfg .ui_scale };
726+ GuiCheckBox (cbRec2 , "Show Clouds" , & show_clouds );
727+
711728 if (active_sat ) {
712729 Vector2 screenPos ;
713730 if (is_2d_view ) {
@@ -812,6 +829,8 @@ int main(void) {
812829 UnloadTexture (apoMark );
813830 UnloadTexture (earthTexture );
814831 UnloadModel (earthModel );
832+ UnloadTexture (cloudTexture );
833+ UnloadModel (cloudModel );
815834 UnloadTexture (moonTexture );
816835 UnloadModel (moonModel );
817836 UnloadFont (customFont );
0 commit comments