#pragma once #include #include #include #include "rlgl.h" #include "memory-arena.hpp" #define ARRAY_LEN(arr) (sizeof(arr)/sizeof(arr[0])) #define LogTrace(...) TraceLog(LOG_TRACE, __VA_ARGS__) #ifdef DEBUG #define DEBUG_ASSERT(...) assert(__VA_ARGS__) #else #define DEBUG_ASSERT(...) #endif typedef uint16_t uboid_t; #define MAX_BOIDS (1 << (sizeof(uboid_t)*8)) struct Boid { Vector2 pos; Vector2 dir; float speed; }; struct Obstacle { Vector2 center; std::vector points; }; struct World { Vector2 size; std::vector boids; std::vector obstacles; MemoryArena frame_arena; float view_radius = 10; float view_angle = PI*1.5; float min_speed = 10; float max_speed = 40; float max_steer_speed = 200; float separation_radius = 4; float alignment_strength = 1; float cohesion_strength = 1; float separation_strength = 5; float collision_avoidance_strength = 50; float collision_avoidance_distance = 30; float collision_avoidance_ray_angle = PI/1.5; int collision_avoidance_ray_count = 3; // TODO: Function `get_boids_in_view_cone` doesn't work as expected with looping walls bool looping_walls = true; bool freeze = false; }; struct Visuals { float boid_edge_size = 5; Color boid_color = BLACK; Color bg_color = RAYWHITE; Camera2D camera; bool show_control_panel = true; bool draw_boid_direction = false; bool draw_view_cone = false; bool draw_collision_avoidance_rays = false; bool draw_separation_radius = false; bool draw_pulling_forces = false; }; struct UI { float target_boid_count; bool min_speed_edit = false; bool max_speed_edit = false; bool steer_speed_edit = false; bool alignment_strength_edit = false; bool cohesion_strength_edit = false; bool separation_strength_edit = false; bool collision_avoidance_strength_edit = false; };