v0.9.1: fixed rare cases of artifacting in the shadowcaster
This commit is contained in:
parent
348acd23ac
commit
0f6c06002f
|
@ -80,9 +80,6 @@ public final class ShadowCaster {
|
|||
int x, int y, double lSlope, double rSlope,
|
||||
int mX, int mY, boolean mXY){
|
||||
|
||||
//if we have negative space to traverse, just quit.
|
||||
if (rSlope < lSlope) return;
|
||||
|
||||
boolean inBlocking = false;
|
||||
int start, end;
|
||||
int col;
|
||||
|
@ -91,6 +88,9 @@ public final class ShadowCaster {
|
|||
|
||||
//for each row, starting with the current one
|
||||
for (; row <= distance; row++){
|
||||
|
||||
//if we have negative space to traverse, just quit.
|
||||
if (rSlope < lSlope) return;
|
||||
|
||||
//we offset by slightly less than 0.5 to account for slopes just touching a cell
|
||||
if (lSlope == 0) start = 0;
|
||||
|
@ -109,6 +109,13 @@ public final class ShadowCaster {
|
|||
|
||||
//for each column in this row, which
|
||||
for (col = start; col <= end; col++){
|
||||
|
||||
|
||||
//handles the error case of the slope value at the end of a cell being 1 farther
|
||||
// along then at the beginning of the cell, and that earlier cell is vision blocking
|
||||
if (col == end && inBlocking && (int)Math.ceil((row - 0.5) * rSlope - 0.499) != end){
|
||||
break;
|
||||
}
|
||||
|
||||
fov[cell] = true;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user