refac: clean working raycasting

This commit is contained in:
Floriansylvain
2025-12-28 17:44:13 +01:00
parent 763a236882
commit 37f22cad70
4 changed files with 116 additions and 95 deletions
+2 -13
View File
@@ -9,6 +9,7 @@
#include "DebugUI.hpp"
#include "GridLines.hpp"
#include "Lighting.hpp"
#include "Player.hpp"
#include "Walls.hpp"
@@ -18,11 +19,6 @@ constexpr int HEIGHT = 1080;
constexpr int DEBUG_REFRESH_RATE_IN_MS = 250;
constexpr float ASPECT = 16.f / 9.f;
struct Ray {
sf::Vector2f origin;
sf::Vector2f direction;
};
class Game {
public:
Game();
@@ -36,14 +32,7 @@ private:
DebugUI debug;
GridLines gridLines;
Walls walls;
sf::VertexArray rayVertices;
std::vector<sf::Vector2f> hitPoints;
sf::Color lightColor;
float intersects(Ray ray, Wall wall);
sf::Vector2f updateRay(sf::Vector2f &origin, sf::Vector2f &targetPoint,
float offset);
Lighting lighting;
void onResize();
void processEvents();