mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-21 20:29:59 +01:00
Make use of present function
This commit is contained in:
parent
f75b7b7201
commit
b682f37048
1 changed files with 9 additions and 14 deletions
21
raycastlib.h
21
raycastlib.h
|
@ -987,7 +987,7 @@ RCL_Unit RCL_adjustDistance(RCL_Unit distance, RCL_Camera *camera,
|
||||||
// ^ prevent division by zero
|
// ^ prevent division by zero
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper for drawing floor or ceiling.
|
/// Helper for drawing floor or ceiling. Returns the last drawn pixel position.
|
||||||
static inline int16_t _RCL_drawHorizontal(
|
static inline int16_t _RCL_drawHorizontal(
|
||||||
RCL_Unit yCurrent,
|
RCL_Unit yCurrent,
|
||||||
RCL_Unit yTo,
|
RCL_Unit yTo,
|
||||||
|
@ -1031,6 +1031,7 @@ static inline int16_t _RCL_drawHorizontal(
|
||||||
return limit;
|
return limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Helper for drawing walls. Returns the last drawn pixel position.
|
||||||
static inline int16_t _RCL_drawWall(
|
static inline int16_t _RCL_drawWall(
|
||||||
RCL_Unit yCurrent,
|
RCL_Unit yCurrent,
|
||||||
RCL_Unit yFrom,
|
RCL_Unit yFrom,
|
||||||
|
@ -1360,16 +1361,8 @@ void _RCL_columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||||
RCL_Unit limit = RCL_min(wallStart,_RCL_middleRow);
|
RCL_Unit limit = RCL_min(wallStart,_RCL_middleRow);
|
||||||
// ^ in case there is no wall
|
// ^ in case there is no wall
|
||||||
|
|
||||||
while (y < limit)
|
y = _RCL_drawHorizontal(-1,wallStart,-1,_RCL_middleRow,_RCL_camera.height,1,
|
||||||
{
|
RCL_COMPUTE_CEILING_DEPTH,&p);
|
||||||
p.position.y = y;
|
|
||||||
RCL_PIXEL_FUNCTION(&p);
|
|
||||||
++y;
|
|
||||||
|
|
||||||
#if RCL_COMPUTE_CEILING_DEPTH == 1
|
|
||||||
p.depth += _RCL_horizontalDepthStep;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
// draw wall
|
// draw wall
|
||||||
|
|
||||||
|
@ -1383,8 +1376,10 @@ void _RCL_columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount, uint16_t
|
||||||
|
|
||||||
p.texCoords.x = p.hit.textureCoord;
|
p.texCoords.x = p.hit.textureCoord;
|
||||||
|
|
||||||
y = _RCL_drawWall(y - 1,wallStart,wallStart + wallHeightScreen - 1,-1,
|
limit = _RCL_drawWall(y,wallStart,wallStart + wallHeightScreen - 1,-1,
|
||||||
_RCL_camera.resolution.y,p.hit.arrayValue,1,&p) + 1;
|
_RCL_camera.resolution.y,p.hit.arrayValue,1,&p);
|
||||||
|
|
||||||
|
y = RCL_max(y,limit) + 1; // take max, in case no wall was drawn
|
||||||
|
|
||||||
// draw floor
|
// draw floor
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue