Lots of dumb little edits to sort out what I'm aiming at. I'll next clean out most of this in a refactor.

This commit is contained in:
Zed A. Shaw 2025-04-06 15:32:19 -04:00
parent 1f90367f51
commit c7c48658bd
13 changed files with 60 additions and 29 deletions

View file

@ -165,13 +165,13 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) {
sf_sprite->setScale(scale);
sf_sprite->setTextureRect(in_texture);
sf_sprite->setPosition(position);
$brightness.setUniform("offsetFactor", sf::Glsl::Vec2{0.0f, 0.0f});
// the SpatialMap.distance_sorted only calculates the
// (x1-x2)^2 + (y1-y2)^2 portion of distance, so to get
// the actual distance we need to sqrt that.
// float level = sqrt(rec.first);
float level = lights[sprite_pos.location.y][sprite_pos.location.x] * PERCENT;
if(rec.second == aiming_at) level += 0.2;
$brightness.setUniform("darkness", level);
target.draw(*sf_sprite, &$brightness);
}