Iterators are now working far more reliably and have more extensive tests that randomize inputs and fuzz them to check they keep working.
This commit is contained in:
parent
8e470df554
commit
70cd963e5c
11 changed files with 318 additions and 84 deletions
23
lights.cpp
23
lights.cpp
|
@ -7,19 +7,24 @@ using std::vector;
|
|||
namespace lighting {
|
||||
void LightRender::render_light(LightSource source, Point at) {
|
||||
Point min, max;
|
||||
light_box(source, at, min, max);
|
||||
clear_light_target(at);
|
||||
vector<Point> has_light;
|
||||
|
||||
for(size_t y = min.y; y <= max.y; ++y) {
|
||||
auto &light_row = $lightmap[y];
|
||||
auto &path_row = $paths.$paths[y];
|
||||
matrix::in_box it{$lightmap, at.x, at.y, (size_t)source.distance};
|
||||
light_box(source, at, min, max);
|
||||
|
||||
for(size_t x = min.x; x <= max.x; ++x) {
|
||||
if(path_row[x] != WALL_PATH_LIMIT) {
|
||||
light_row[x] = light_level(source.strength, x, y);
|
||||
has_light.push_back({x,y});
|
||||
}
|
||||
dbc::check(it.x+1 == min.x, "box min x different");
|
||||
dbc::check(it.y == min.y, "box min y different");
|
||||
dbc::check(it.right == max.x + 1, "box max.x/right different");
|
||||
dbc::check(it.bottom == max.y + 1, "box max.y/bottom different");
|
||||
|
||||
while(it.next()) {
|
||||
auto &light_row = $lightmap[it.y];
|
||||
auto &path_row = $paths.$paths[it.y];
|
||||
|
||||
if(path_row[it.x] != WALL_PATH_LIMIT) {
|
||||
light_row[it.x] = light_level(source.strength, it.x, it.y);
|
||||
has_light.push_back({it.x, it.y});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue