1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-21 20:29:59 +01:00

Fix empty pixels

This commit is contained in:
Miloslav Číž 2018-09-29 08:13:00 +02:00
parent 228a247800
commit c903d801f8
2 changed files with 8 additions and 8 deletions

View file

@ -1191,7 +1191,6 @@ static inline int16_t _RCL_drawWall(
i += increment)
{
// more expensive texture coord computing
pixelInfo->position.y = i;
#if RCL_COMPUTE_WALL_TEXCOORDS == 1
@ -1523,7 +1522,7 @@ void _RCL_columnFunctionSimple(RCL_HitResult *hits, uint16_t hitCount,
-1,_RCL_camResYLimit,p.hit.arrayValue,1,&p);
y = RCL_max(y,limit); // take max, in case no wall was drawn
y = RCL_max(y,_RCL_middleRow + 1);
y = RCL_max(y,wallStart);
// draw floor

13
test.c
View file

@ -17,9 +17,9 @@
RCL_Unit testArrayFunc(int16_t x, int16_t y)
{
if (x > 12 || y > 12)
return x * y;
return x * y * RCL_UNITS_PER_SQUARE;
return (x < 0 || y < 0 || x > 9 || y > 9) ? 1 : 0;
return (x < 0 || y < 0 || x > 9 || y > 9) ? RCL_UNITS_PER_SQUARE : 0;
}
RCL_Unit testArrayFunc2(int16_t x, int16_t y)
@ -206,6 +206,7 @@ int testPixelCount(RCL_Unit camX, RCL_Unit camY, RCL_Unit camZ,
RCL_Camera c;
RCL_initRayConstraints(&constraints);
constraints.maxSteps = 32;
RCL_initCamera(&c);
c.position.x = camX;
c.position.y = camY;
@ -338,11 +339,11 @@ int main()
if (!testPixelCount(
3 * RCL_UNITS_PER_SQUARE + 100,
4 * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 3,
RCL_UNITS_PER_SQUARE,
312,
RCL_UNITS_PER_SQUARE / 2,
512,
0,
200,
63,
120,
60,
0))
return 1;