Did a full code review to identify things to fix and either fixed them or noted BUG where I should come back.
This commit is contained in:
parent
ae43dad499
commit
9abb39a3bf
14 changed files with 72 additions and 35 deletions
12
lights.cpp
12
lights.cpp
|
@ -15,7 +15,7 @@ namespace lighting {
|
|||
|
||||
for(size_t y = min.y; y <= max.y; ++y) {
|
||||
auto &light_row = $lightmap[y];
|
||||
auto &path_row = $light.$paths[y];
|
||||
auto &path_row = $paths.$paths[y];
|
||||
|
||||
for(size_t x = min.x; x <= max.x; ++x) {
|
||||
if(path_row[x] != UNPATH) {
|
||||
|
@ -28,7 +28,7 @@ namespace lighting {
|
|||
const int wall_light = source.strength + WALL_LIGHT_LEVEL;
|
||||
for(auto point : has_light) {
|
||||
for(int j = -1;point.y+j >= 0 && j <= 1 && point.y+j < $height; j++) {
|
||||
auto &path_row = $light.$paths[point.y+j];
|
||||
auto &path_row = $paths.$paths[point.y+j];
|
||||
auto &light_row = $lightmap[point.y+j];
|
||||
|
||||
for(int i = -1; point.x+i >= 0 && i <= 1 && point.x+i < $width; i++) {
|
||||
|
@ -41,7 +41,7 @@ namespace lighting {
|
|||
}
|
||||
|
||||
int LightRender::light_level(int level, size_t x, size_t y) {
|
||||
size_t at = level + $light.$paths[y][x];
|
||||
size_t at = level + $paths.$paths[y][x];
|
||||
int cur_level = $lightmap[y][x];
|
||||
int new_level = at < lighting::LEVELS.size() ? lighting::LEVELS[at] : lighting::MIN;
|
||||
return cur_level < new_level ? new_level : cur_level;
|
||||
|
@ -55,15 +55,15 @@ namespace lighting {
|
|||
}
|
||||
|
||||
void LightRender::clear_light_target(const Point &at) {
|
||||
$light.clear_target(at);
|
||||
$paths.clear_target(at);
|
||||
}
|
||||
|
||||
void LightRender::set_light_target(const Point &at, int value) {
|
||||
$light.set_target(at, value);
|
||||
$paths.set_target(at, value);
|
||||
}
|
||||
|
||||
void LightRender::path_light(Matrix &walls) {
|
||||
$light.compute_paths(walls);
|
||||
$paths.compute_paths(walls);
|
||||
}
|
||||
|
||||
void LightRender::light_box(LightSource source, Point from, Point &min_out, Point &max_out) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue