mirror of
https://github.com/Floriansylvain/whateversfml.git
synced 2026-08-19 11:43:22 +02:00
refac: clean working raycasting
This commit is contained in:
+2
-13
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user