|
Trace Engine
A Raycaster Engine in C
|
#include "render.h"#include <math.h>#include "map.h"#include "raycaster.h"#include "trigonometry.h"#include "window_manager.h"#include "graphics.h"#include "trc_camera.h"#include "textures.h"Macros | |
| #define | RENDER_CHUNK_SIZE (4) /** How many blocks away can the camera see */ |
| #define | RENDER_DISTANCE (MAP_CELL_SIZE * RENDER_CHUNK_SIZE) /** Distance between the camera and the further object visible */ |
| #define | MAX_WALL_HEIGHT (VIEWPORT_HEIGHT) /** A rename for VIEWPORT_HEIGHT, for easier code reading */ |
| #define | LINES_WIDTH ((int) (VIEWPORT_WIDTH / get_ammount_of_rays())) /** Ammount of pixels each ray will draw on screen */ |
| #define | X_CORRECTION (LINES_WIDTH / 2.0) /** Correction for X axis to get the screen centered */ |
| #define | Y_CORRECTION (VIEWPORT_HEIGHT / 2.0) /** Correction for Y axis to get the screen centered */ |
| #define | DISTANCE_CORRECTION (((float) VIEWPORT_WIDTH) / ((float) VIEWPORT_HEIGHT)) /** To see the walls square */ |
| #define | FLOOR_CORRECTION ((VIEWPORT_WIDTH / 2.0) - 4) /** The floor (and also the ceiling) stops sliding with this one */ |
| #define | CEILEING_CORRECTION (8.0 / get_actual_resolution()) /** The ceiling stops covering the walls */ |
Functions | |
| void | render_line (const ray_t ray) |
| #define CEILEING_CORRECTION (8.0 / get_actual_resolution()) /** The ceiling stops covering the walls */ |
| #define DISTANCE_CORRECTION (((float) VIEWPORT_WIDTH) / ((float) VIEWPORT_HEIGHT)) /** To see the walls square */ |
| #define FLOOR_CORRECTION ((VIEWPORT_WIDTH / 2.0) - 4) /** The floor (and also the ceiling) stops sliding with this one */ |
| #define LINES_WIDTH ((int) (VIEWPORT_WIDTH / get_ammount_of_rays())) /** Ammount of pixels each ray will draw on screen */ |
| #define MAX_WALL_HEIGHT (VIEWPORT_HEIGHT) /** A rename for VIEWPORT_HEIGHT, for easier code reading */ |
| #define RENDER_CHUNK_SIZE (4) /** How many blocks away can the camera see */ |
| #define RENDER_DISTANCE (MAP_CELL_SIZE * RENDER_CHUNK_SIZE) /** Distance between the camera and the further object visible */ |
| #define X_CORRECTION (LINES_WIDTH / 2.0) /** Correction for X axis to get the screen centered */ |
| #define Y_CORRECTION (VIEWPORT_HEIGHT / 2.0) /** Correction for Y axis to get the screen centered */ |