Software raycasting now works, but has some major problems / is extremely
slow. Perhaps it will only be useful in debugging the kernel via emulation
This commit is contained in:
@@ -40,6 +40,7 @@ protected:
|
||||
Old_Map * map = nullptr;
|
||||
Camera *camera = nullptr;
|
||||
std::vector<Light> lights;
|
||||
int light_count = 0;
|
||||
sf::Uint8 *viewport_image = nullptr;
|
||||
sf::Vector4f *viewport_matrix = nullptr;
|
||||
sf::Vector2i viewport_resolution;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "RayCaster.h"
|
||||
#include <thread>
|
||||
|
||||
class Software_Caster : public RayCaster
|
||||
{
|
||||
@@ -26,6 +27,9 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void cast_rays();
|
||||
|
||||
void cast_viewport();
|
||||
void cast_thread(int start_id, int end_id);
|
||||
void cast_ray(int id);
|
||||
void blit_pixel(sf::Color color, sf::Vector2i position, sf::Vector3i mask);
|
||||
sf::Color global_light(sf::Color in, sf::Vector3i mask);
|
||||
};
|
||||
|
||||
@@ -10,14 +10,13 @@ const double PI = 3.141592653589793238463;
|
||||
const float PI_F = 3.14159265358979f;
|
||||
|
||||
struct Light {
|
||||
#pragma pack(1)
|
||||
sf::Vector4f rgbi;
|
||||
|
||||
// I believe that Vector3's get padded to Vector4's. Give them a non-garbage value
|
||||
sf::Vector3f position;
|
||||
const float padding_1 = -1;
|
||||
|
||||
sf::Vector3f direction_cartesian;
|
||||
const float padding_2 = -2;
|
||||
};
|
||||
|
||||
struct fps_counter {
|
||||
|
||||
Reference in New Issue
Block a user