Circle adjusted to work better but now I think hirdrac was right that it's easier to just calculate a distance from center and use that to determine light levels rather than a whole dpath.
This commit is contained in:
parent
8a94108874
commit
9ac8da30ea
7 changed files with 23 additions and 22 deletions
|
@ -7,7 +7,7 @@ using std::vector;
|
|||
namespace lighting {
|
||||
|
||||
void LightRender::render_circle_light(LightSource source, Point at, PointList &has_light) {
|
||||
for(matrix::circle it{$lightmap, at, source.distance + 1}; it.next();) {
|
||||
for(matrix::circle it{$lightmap, at, source.radius}; it.next();) {
|
||||
for(int x = it.left; x < it.right; x++) {
|
||||
$lightmap[it.y][x] = light_level(source.strength, x, it.y);
|
||||
has_light.push_back({(size_t)x, (size_t)it.y});
|
||||
|
@ -25,7 +25,7 @@ namespace lighting {
|
|||
}
|
||||
|
||||
void LightRender::render_square_light(LightSource source, Point at, PointList &has_light) {
|
||||
for(matrix::in_box it{$lightmap, at.x, at.y, (size_t)source.distance}; it.next();) {
|
||||
for(matrix::in_box it{$lightmap, at.x, at.y, (size_t)floor(source.radius)}; it.next();) {
|
||||
if($paths.$paths[it.y][it.x] != WALL_PATH_LIMIT) {
|
||||
$lightmap[it.y][it.x] = light_level(source.strength, it.x, it.y);
|
||||
has_light.push_back({it.x, it.y});
|
||||
|
@ -38,9 +38,9 @@ namespace lighting {
|
|||
clear_light_target(at);
|
||||
PointList has_light;
|
||||
|
||||
if(source.distance == 0) {
|
||||
if(source.radius < 1.5f) {
|
||||
render_compass_light(source, at, has_light);
|
||||
} else if(source.distance == 1) {
|
||||
} else if(source.radius < 2.0f) {
|
||||
render_square_light(source, at, has_light);
|
||||
} else {
|
||||
render_circle_light(source, at, has_light);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue