Trace Engine
A Raycaster Engine in C
Loading...
Searching...
No Matches
textures.c File Reference
#include "textures.h"
#include <stdio.h>
#include "textures_info.h"
#include "log.h"

Macros

#define TEXTURE_FILE_PATH   "engine/data/structures.ted"
 
#define READ_MODE   "r"
 
#define TEXTURES_ARR_SIZE   (TEXTURE_SIZE * TEXTURE_SIZE * TEXTURE_COUNT)
 

Functions

void load_textures (void)
 
int get_texture_size (void)
 
rgb_t get_texture_pixel (const structures_t structure, const trc_world_position_t pixel_pos)
 
rgb_t apply_shade (const rgb_t original_pixel, const float shade)
 

Variables

rgb_t ALL_TEXTURES [TEXTURES_ARR_SIZE]
 

Macro Definition Documentation

◆ READ_MODE

#define READ_MODE   "r"

◆ TEXTURE_FILE_PATH

#define TEXTURE_FILE_PATH   "engine/data/structures.ted"

◆ TEXTURES_ARR_SIZE

#define TEXTURES_ARR_SIZE   (TEXTURE_SIZE * TEXTURE_SIZE * TEXTURE_COUNT)

Function Documentation

◆ apply_shade()

rgb_t apply_shade ( const rgb_t  original_pixel,
const float  shade 
)

Given an RGB and a shade, returns the same pixel but modified with the shade

◆ get_texture_pixel()

rgb_t get_texture_pixel ( const structures_t  structure,
const trc_world_position_t  pixel_pos 
)

Given an structure and a texture position, it returns the RGB info of the pixel in that position

◆ get_texture_size()

int get_texture_size ( void  )

Returns the size of the textures being used

Note
All the textures are square, so it only returns the length of one side

◆ load_textures()

void load_textures ( void  )

Loads the textures into engine structures (for faster performance)

Variable Documentation

◆ ALL_TEXTURES

rgb_t ALL_TEXTURES[TEXTURES_ARR_SIZE]