Gave up on adding a buffer and I'll just let rooms be near eachother. Seems to produce interesting results anyway.

This commit is contained in:
Zed A. Shaw 2026-03-09 11:12:26 -04:00
parent 8b129aea6b
commit 74f92dfe2c
5 changed files with 45 additions and 32 deletions

View file

@ -127,14 +127,16 @@ void Raycaster::sprite_casting() {
$level.collision->distance_sorted($sprite_order, {(size_t)$pos_x, (size_t)$pos_y}, RENDER_DISTANCE);
$sprites_to_render.clear();
// BUG: shaders are shared between sprites
// BUG: sprites seem to be shared too? Put a torch on the floor in a room then another to its left and only one is visible at a time.
// after sorting the sprites, do the projection
for(auto& rec : $sprite_order) {
if(!$sprites.contains(rec.entity)) continue;
auto& sprite_texture = $sprites.at(rec.entity);
int texture_width = (float)sprite_texture.frame_size.x;
int texture_height =(float)sprite_texture.frame_size.y;
int texture_width = float(sprite_texture.frame_size.x);
int texture_height = float(sprite_texture.frame_size.y);
int half_height = texture_height / 2;
auto sf_sprite = sprite_texture.sprite;