|
|
|
@ -123,6 +123,8 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) { |
|
|
|
|
if(drawEndY >= $height) drawEndY = $height - 1; |
|
|
|
|
|
|
|
|
|
int texX = int(textureWidth * (drawStartX - (-spriteWidth / 2 + spriteScreenX)) * textureWidth / spriteWidth) / textureWidth; |
|
|
|
|
int texRenderWidth = texX_end - texX; |
|
|
|
|
if(texRenderWidth <= 0) continue; |
|
|
|
|
|
|
|
|
|
float x = float(drawStartX + RAY_VIEW_X); |
|
|
|
|
float y = float(drawStartY + RAY_VIEW_Y); |
|
|
|
@ -133,7 +135,7 @@ void Raycaster::sprite_casting(sf::RenderTarget &target) { |
|
|
|
|
int texY = ((d * textureHeight) / spriteHeight) / textureHeight; |
|
|
|
|
|
|
|
|
|
sf_sprite->setScale({sprite_w, sprite_h}); |
|
|
|
|
$anim.step(*sf_sprite, texX, texY, texX_end - texX, textureHeight); |
|
|
|
|
$anim.step(*sf_sprite, texX, texY, texRenderWidth, textureHeight); |
|
|
|
|
sf_sprite->setPosition({x, y}); |
|
|
|
|
|
|
|
|
|
$brightness.setUniform("offsetFactor", sf::Glsl::Vec2{0.0f, 0.0f}); |
|
|
|
|