mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-21 20:29:59 +01:00
Separate ceilings
This commit is contained in:
parent
5aa677563d
commit
8435ddadca
1 changed files with 11 additions and 1 deletions
12
raycastlib.h
12
raycastlib.h
|
@ -108,7 +108,8 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Vector2D position; ///< On-screen position.
|
Vector2D position; ///< On-screen position.
|
||||||
int8_t isWall; ///< Whether the pixel is a wall or a floor(/ceiling).
|
int8_t isWall; ///< Whether the pixel is a wall or a floor/ceiling.
|
||||||
|
int8_t isFloor; ///< Whether the pixel is floor or ceiling.
|
||||||
Unit depth; ///< Corrected depth.
|
Unit depth; ///< Corrected depth.
|
||||||
HitResult hit; ///< Corresponding ray hit.
|
HitResult hit; ///< Corresponding ray hit.
|
||||||
Unit textureCoordY; ///< Normalized (0 to UNITS_PER_SQUARE - 1) tex coord.
|
Unit textureCoordY; ///< Normalized (0 to UNITS_PER_SQUARE - 1) tex coord.
|
||||||
|
@ -691,6 +692,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
// draw floor until wall
|
// draw floor until wall
|
||||||
|
|
||||||
p.isWall = 0;
|
p.isWall = 0;
|
||||||
|
p.isFloor = 1;
|
||||||
|
|
||||||
Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY;
|
Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY;
|
||||||
|
|
||||||
|
@ -703,6 +705,8 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
|
|
||||||
// draw ceiling until wall
|
// draw ceiling until wall
|
||||||
|
|
||||||
|
p.isFloor = 0;
|
||||||
|
|
||||||
if (_ceilFunction != 0)
|
if (_ceilFunction != 0)
|
||||||
{
|
{
|
||||||
Unit ceilCameraDiff = absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY;
|
Unit ceilCameraDiff = absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY;
|
||||||
|
@ -719,6 +723,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
|
|
||||||
p.isWall = 1;
|
p.isWall = 1;
|
||||||
p.depth = dist;
|
p.depth = dist;
|
||||||
|
p.isFloor = 1;
|
||||||
|
|
||||||
int_maybe32_t iTo = y2 < zTop ? zTop : y2;
|
int_maybe32_t iTo = y2 < zTop ? zTop : y2;
|
||||||
|
|
||||||
|
@ -736,6 +741,8 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
|
|
||||||
// draw ceiling wall
|
// draw ceiling wall
|
||||||
|
|
||||||
|
p.isFloor = 0;
|
||||||
|
|
||||||
if (_ceilFunction != 0)
|
if (_ceilFunction != 0)
|
||||||
{
|
{
|
||||||
iTo = y > zBottomCeil ? zBottomCeil : y;
|
iTo = y > zBottomCeil ? zBottomCeil : y;
|
||||||
|
@ -767,6 +774,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
// draw floor until horizon
|
// draw floor until horizon
|
||||||
|
|
||||||
p.isWall = 0;
|
p.isWall = 0;
|
||||||
|
p.isFloor = 1;
|
||||||
|
|
||||||
Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY;
|
Unit floorCameraDiff = absVal(worldZPrev) * VERTICAL_DEPTH_MULTIPLY;
|
||||||
Unit horizon = (y2 < _middleRow || _ceilFunction == 0) ? _middleRow : y2;
|
Unit horizon = (y2 < _middleRow || _ceilFunction == 0) ? _middleRow : y2;
|
||||||
|
@ -783,6 +791,8 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
|
|
||||||
if (_ceilFunction != 0)
|
if (_ceilFunction != 0)
|
||||||
{
|
{
|
||||||
|
p.isFloor = 0;
|
||||||
|
|
||||||
Unit ceilCameraDiff = absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY;
|
Unit ceilCameraDiff = absVal(worldZPrevCeil) * VERTICAL_DEPTH_MULTIPLY;
|
||||||
horizon = y > _middleRow ? _middleRow : y;
|
horizon = y > _middleRow ? _middleRow : y;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue