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

Update tests

This commit is contained in:
Miloslav Číž 2020-06-18 17:56:43 +02:00
parent 867ff32c6b
commit a18264c2a6
2 changed files with 17 additions and 14 deletions

View file

@ -74,6 +74,8 @@ int testSingleMapping(RCL_Unit posX, RCL_Unit posY, RCL_Unit posZ, uint32_t resX
RCL_Camera c;
RCL_initCamera(&c);
c.resolution.x = resX;
c.resolution.y = resY;
c.position.x = camX;
@ -316,8 +318,8 @@ int main()
RCL_Unit size = i * 3;
RCL_Unit distance = i * 6 + 200;
RCL_Unit scaled = RCL_perspectiveScale(size,distance);
RCL_Unit distance2 = RCL_perspectiveScaleInverse(size,scaled);
RCL_Unit scaled = RCL_perspectiveScaleHorizontal(size,distance);
RCL_Unit distance2 = RCL_perspectiveScaleHorizontalInverse(size,scaled);
if (RCL_absVal(distance - distance2 > 2))
printf("ERROR: distance: %d, distance inverse: %d\n",distance,distance2);
@ -360,23 +362,22 @@ int main()
printf("OK\n");
/*
if (!testSingleMapping(
-RCL_UNITS_PER_SQUARE,
RCL_UNITS_PER_SQUARE,
RCL_UNITS_PER_SQUARE * 2,
0,
RCL_UNITS_PER_SQUARE / 2,
1280,
800,
640,
0,
0,
0,
RCL_UNITS_PER_SQUARE / 2,
640,
0,
1024
RCL_UNITS_PER_SQUARE / 4,
(RCL_UNITS_PER_SQUARE * 5) / 6,
287,
370,
2027
))
return -1;
*/
return 1;
printf("benchmark:\n");
long t;
@ -392,5 +393,7 @@ int main()
printf("\n");
printProfile();
printf("\n===== all OK =====\n");
return 0;
}

View file

@ -1712,7 +1712,7 @@ RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height,
RCL_Unit middleColumn = camera.resolution.x / 2;
// rotate the point
// rotate the point to camera space (y left/right, x forw/backw)
RCL_Unit cos = RCL_cosInt(camera.direction);
RCL_Unit sin = RCL_sinInt(camera.direction);