raycaster/tests/lighting.cpp
2026-06-16 13:58:10 -04:00

54 lines
1 KiB
C++

#include <fuc2/testing.hpp>
#include <fmt/core.h>
#include <nlohmann/json.hpp>
#include <fstream>
#include "game/map.hpp"
#include "game/level.hpp"
#include "graphics/lights.hpp"
#include "algos/point.hpp"
using namespace lighting;
using namespace fuc2;
namespace lighting_tests {
void test_lighting_a_map_works() {
GameDB::init();
auto& level = GameDB::current_level();
auto& map = *level.map;
Point light1, light2;
CHECK(map.place_entity(0, light1));
CHECK(map.place_entity(0, light1));
LightSource source1{6, 1.0};
LightSource source2{4,3};
LightRender lr(map.walls());
lr.reset_light();
lr.set_light_target(light1);
lr.set_light_target(light2);
lr.path_light(map.walls());
lr.render_light(source1, light1);
lr.render_light(source2, light2);
lr.clear_light_target(light1);
lr.clear_light_target(light2);
Matrix &lighting = lr.lighting();
(void)lighting;
}
fuc2::Set TESTS{
.name="lighting",
.tests={
TEST(test_lighting_a_map_works),
}
};
}