Skip to content

Commit

Permalink
Global edge color
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlesAverill committed Oct 11, 2023
1 parent 1269656 commit 217dc8e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ let input_dispatch key =
(* Roll *)
| 'q' -> update_euler 2 (-.rotation_incr)
| 'e' -> update_euler 2 rotation_incr
(* Reset scene *)
| 'r' -> euler := (0., 0., 0.)
(* Escape *)
| x when x = char_of_int 27 -> break_mainloop := true
| _ ->
Expand All @@ -45,7 +47,6 @@ let input_dispatch key =

let draw_scene () =
clear_window black;
set_color white;
draw_mesh !to_draw !euler;
let input = wait_next_event [ Poll ] in
synchronize ();
Expand Down
1 change: 1 addition & 0 deletions lib/config.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ let rotation_incr = 7.5
let draw_verts = false
let vert_radius = 5
let vert_color = red
let edge_color = green
4 changes: 2 additions & 2 deletions lib/render.ml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ let project_mesh mesh euler_rot =

let draw_mesh mesh euler_rot =
let c = foreground in
set_color white;
set_color Config.edge_color;
let verts, edges = project_mesh mesh euler_rot in
let _ =
List.fold_left
Expand All @@ -217,7 +217,7 @@ let draw_mesh mesh euler_rot =
if not (List.exists (fun x -> x = v2) visited_verts) then
fill_circle (int_of_float v2.x) (int_of_float v2.y)
Config.vert_radius;
set_color white);
set_color Config.edge_color);
v1 :: v2 :: visited_verts)
[] edges
in
Expand Down

0 comments on commit 217dc8e

Please sign in to comment.