mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-23 20:49:57 +01:00
Improve horizon
This commit is contained in:
parent
2c77b6d728
commit
99a29e9d57
1 changed files with 7 additions and 6 deletions
13
raycastlib.h
13
raycastlib.h
|
@ -815,7 +815,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
|||
int_maybe32_t z1ScreenCeilNoClamp = 0;
|
||||
int_maybe32_t z2ScreenCeil = 0;
|
||||
int_maybe32_t wallScreenHeightCeilNoClamp = 0;
|
||||
int_maybe32_t zBottomCeil;
|
||||
int_maybe32_t zBottomCeil = y2;
|
||||
int8_t skipCeilingWall = 1;
|
||||
|
||||
if (_ceilFunction != 0)
|
||||
|
@ -959,13 +959,17 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
|||
Unit horizon = (y2 < _middleRow || _ceilFunction == 0) ? _middleRow : y2;
|
||||
horizon = clamp(horizon,0,_camera.resolution.y);
|
||||
|
||||
for (int_maybe32_t i = y; i >= horizon + (horizon > y2 ? 0 : 1); --i)
|
||||
horizon += horizon > y2 ? 0 : 1; // bug workaround
|
||||
|
||||
for (int_maybe32_t i = y; i >= horizon; --i)
|
||||
{
|
||||
p.position.y = i;
|
||||
p.depth = (_fogStartYBottom - i) * _floorDepthStep + floorCameraDiff;
|
||||
_pixelFunction(&p);
|
||||
}
|
||||
|
||||
y = horizon < y ? horizon : y;
|
||||
|
||||
// draw ceiling until horizon
|
||||
|
||||
p.isFloor = 0;
|
||||
|
@ -974,10 +978,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
|||
_ceilFunction != 0 ?
|
||||
absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY : UNITS_PER_SQUARE;
|
||||
|
||||
horizon = y > _middleRow ? _middleRow : y;
|
||||
horizon = clamp(horizon,0,_camResYLimit);
|
||||
|
||||
for (int_maybe32_t i = y2; i < horizon; ++i)
|
||||
for (int_maybe32_t i = y2; i < y; ++i)
|
||||
{
|
||||
p.position.y = i;
|
||||
p.depth = (i - _fogStartYTop) * _floorDepthStep + ceilCameraDiff;
|
||||
|
|
Loading…
Reference in a new issue