|
Trace Engine
A Raycaster Engine in C
|
#include "raycaster.h"#include <stdlib.h>#include <math.h>#include <pthread.h>#include "log.h"#include "graphics.h"#include "game_state.h"#include "trigonometry.h"#include "render.h"#include "trc_camera.h"#include "map.h"Macros | |
| #define | NUM_THREADS 4 |
| #define | RATIO_ANGLE_RAYS (get_ammount_of_rays() / (float) FOV) /** Relation between AMMOUNT_OF_RAYS and FOV, for making the right steps between every ray */ |
| #define | RAY_COLOR (rgb_t) {80, 80, 80} /** Color of the rays represented as a line */ |
Functions | |
| int | get_ammount_of_rays (void) |
| void | cast_rays_from_to (int start, int end) |
| void * | multithreading_casting (void *arg) |
| void | cast_rays (void) |
| void | init_raycaster (void) |
| void | quit_raycaster (void) |
Variables | |
| ray_t * | rays |
| pthread_t | threads [NUM_THREADS] |
| int | threads_ids [NUM_THREADS] |
| #define NUM_THREADS 4 |
| #define RATIO_ANGLE_RAYS (get_ammount_of_rays() / (float) FOV) /** Relation between AMMOUNT_OF_RAYS and FOV, for making the right steps between every ray */ |
| void cast_rays | ( | void | ) |
Cast the 2D top-down vision rays for the player and calls the 3D render
| void cast_rays_from_to | ( | int | start, |
| int | end | ||
| ) |
| int get_ammount_of_rays | ( | void | ) |
Returns the current ammount of rays for current FOV and resolution
| void init_raycaster | ( | void | ) |
Initialize the raycaster
| void * multithreading_casting | ( | void * | arg | ) |
| void quit_raycaster | ( | void | ) |
Safely delete and disable the raycaster
| ray_t* rays |
| pthread_t threads[NUM_THREADS] |
| int threads_ids[NUM_THREADS] |