Rescaled maze

This commit is contained in:
Alexandre 2024-07-01 14:45:16 +02:00
parent 167615c1a8
commit 745149237a
4 changed files with 12 additions and 7 deletions

BIN
a.out

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -393,7 +393,7 @@ let draw_cube_p_rev (cube : pt_3d array) screen_wd screen_ht fov r g b =
set_line_width 5; set_line_width 5;
for i = 0 to 5 do for i = 0 to 5 do
if draw_faces.(i) then begin if draw_faces.(i) then begin
let light = max (0.) (1. -. (distances.(i)) /. 7.5) in let light = max (0.) (1. -. (distances.(i)) /. 10.) in
let face_R = int_of_float ((float_of_int r) *. light) let face_R = int_of_float ((float_of_int r) *. light)
and face_G = int_of_float ((float_of_int g) *. light) and face_G = int_of_float ((float_of_int g) *. light)
and face_B = int_of_float ((float_of_int b) *. light) in and face_B = int_of_float ((float_of_int b) *. light) in
@ -610,10 +610,10 @@ let get1char () =
Unix.tcsetattr Unix.stdin Unix.TCSADRAIN termio; Unix.tcsetattr Unix.stdin Unix.TCSADRAIN termio;
res ;; res ;;
(* ---------------------------------------------------- *) (* -------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------- *) (* -------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------- *) (* -------------------------------------------------------------------------------------------------------- *)
(* ---------------------------------------------------- *) (* -------------------------------------------------------------------------------------------------------- *)
type tile = Free | Wall | Crate | Exit | Craxit | Camera ;; type tile = Free | Wall | Crate | Exit | Craxit | Camera ;;
@ -623,11 +623,16 @@ and depth = 45 ;;
(* dimensions *) (* dimensions *)
let render_distance = 7 ;; let render_distance = 7 ;;
let chunk_dist = 1 ;; let chunk_dist = 2 ;;
let chunk_size = 4 ;; let chunk_size = 4 ;;
let chunk_size_f = float_of_int chunk_size ;; let chunk_size_f = float_of_int chunk_size ;;
(* -------------------------------------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------------------------------------- *)
(* -------------------------------------------------------------------------------------------------------- *)
let laby = Array.make width [|[||]|] ;; let laby = Array.make width [|[||]|] ;;
for i = 0 to width -1 do for i = 0 to width -1 do
laby.(i) <- Array.make_matrix height depth Wall laby.(i) <- Array.make_matrix height depth Wall
@ -865,7 +870,7 @@ let rec move_cam_hash (cubes : coloredCube dynamic) b c =(* Printf.printf "[%b]"
let play_dos laby = let play_dos laby =
try try
cheesify laby; cheesify laby;
let hash = chunkify laby 2 in let hash = chunkify laby 3 in
camera_xyz.z <- -. (1.5) ; camera_xyz.z <- -. (1.5) ;
camera_xyz.x <- -. (float_of_int width) /. 2. ; camera_xyz.x <- -. (float_of_int width) /. 2. ;