#ifndef APP_H #define APP_H #include #include #include #include #include #include #include #include "camera.h" #include "noise.h" #include "chunk.h" #define SPEED 5 #define VIEWPORT_RATIO (16.0 / 9.0) #define VIEWPORT_ASPECT 50.0 typedef unsigned int uint; #define CHUNK_MAX_X 16 #define CHUNK_MAX_Y 16 #define CHUNK_MAX_Z 128 #define MAX_PARTICLE_GROUPS 10 #define PARTICLES_PER_GROUP 50 typedef struct { vec3f pos[PARTICLES_PER_GROUP]; unsigned int time; } ParticleGroup; typedef struct { bool is_running; SDL_Window *window; SDL_GLContext context; Camera camera; double frame_time; ChunkManager *cm; Type_surface *surfaces; unsigned int surface_count; ParticleGroup particles[MAX_PARTICLE_GROUPS]; unsigned char particle_count; } App; void app_generate_world(App *app, int a); void app_load_textures(App *app); int check_intersection_block(App *app, vec3i *retv, int *chunk_index); void app_break_block(App *app); void app_place_block(App *app); bool app_check_collision(vec3f camera_pos, ChunkManager *cm); void init_app(App *app, uint w, uint h); void init_opengl(); void handle_events(App *app); void reshape(GLsizei width, GLsizei height); void update_app(App* app); float calc_frame_time(struct timespec *start, struct timespec *end); void app_draw_particles(App *app, vec3i b); void app_update_particles(App *app); #endif