First cut of pulling out the relevant parts of my original game to make a little framework.

This commit is contained in:
Zed A. Shaw 2026-03-22 10:37:45 -04:00
commit 6a0c9e8d46
177 changed files with 18197 additions and 0 deletions

42
tests/lighting.cpp Normal file
View file

@ -0,0 +1,42 @@
#include <catch2/catch_test_macros.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;
TEST_CASE("lighting a map works", "[lighting]") {
GameDB::init();
auto& level = GameDB::current_level();
auto& map = *level.map;
Point light1, light2;
REQUIRE(map.place_entity(0, light1));
REQUIRE(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;
}