Sprite rendering cleanup started.

This commit is contained in:
Zed A. Shaw 2025-01-16 11:21:49 -05:00
parent 033d5cdfec
commit c9d4b7ed1e
2 changed files with 96 additions and 93 deletions

View file

@ -23,8 +23,11 @@ using matrix::Matrix;
struct Sprite {
double x;
double y;
double elevation;
int texture;
// ZED: this should be a separate transform parameter
double elevation=0;
int uDiv=1;
int vDiv=1;
};
#define RAY_VIEW_WIDTH 960
@ -36,7 +39,7 @@ using RGBA = uint32_t;
struct TexturePack {
std::vector<uint32_t> texture[NUM_TEXTURES];
std::vector<Sprite> SPRITE{{4.0, 3.55, 0, 8}};
std::vector<Sprite> SPRITE{{4.0, 3.55, 8}};
const int floor = 3;
const int ceiling = 6;
@ -47,6 +50,8 @@ struct TexturePack {
};
struct Raycaster {
int $width=RAY_VIEW_WIDTH;
int $height=RAY_VIEW_HEIGHT;
TexturePack textures;
double posX = 0;
double posY = 0;
@ -80,6 +85,7 @@ struct Raycaster {
void draw_pixel_buffer();
void clear();
void cast_rays();
void sprite_casting();
void draw_ceiling_floor();
void render();
bool empty_space(int new_x, int new_y);