Refactor storing of ray-casted distances.

The ray-casting is done when camera_update() is called, and distances
are stored in the Camera struct.
This commit is contained in:
2023-04-20 00:28:17 +01:00
parent 33f673741b
commit 2c06859473
7 changed files with 145 additions and 100 deletions
+10
View File
@@ -3,14 +3,24 @@
#include <SFML/Graphics.hpp>
typedef struct
{
float direction;
float distance;
} CameraRay;
typedef struct
{
sf::Vector2f pos;
float direction;
unsigned int resolution;
float fov;
CameraRay* rays;
} Camera;
int camera_init(Camera* camera, sf::Vector2f pos, float direction, unsigned int resolution, float fov);
void camera_update(Camera* camera, float t);
void camera_destroy(Camera* camera);
#endif