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

Fix mapping bug

This commit is contained in:
Miloslav Číž 2020-10-31 17:56:04 +01:00
parent 7afece182c
commit 0d4eabc93c
3 changed files with 143 additions and 106 deletions

View file

@ -13,88 +13,89 @@
#include <sys/time.h> #include <sys/time.h>
static const char renderSimpleExpect[] = static const char renderSimpleExpect[] =
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DD,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,EEEEEDD,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeee,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "ddddddddddddddde,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffff,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "dddddddddddddddeeeeeeeeeeeeeeee,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggg,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffg,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiii,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhi,,,,,FFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,," "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDD,,,,,,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhii....FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhi.....FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhh.........FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhh..........FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggg...............FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggg...............FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffg.....................FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffg.....................FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeeffffffff...........................FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffff..........................FFFFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeeeeeeff.....................................FFEEEEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeeeeeffff.................................FFFFEEEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeeeeeeee..............................................EEEEEEEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeeeeeeee............................................EEEEEEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeeeeeeeeee........................................................EEEEEEEEDDDDDDDDDDD"
"dddddddddddddddeeeeeeeeeee.....................................................EEEEEEEEEEDDDDDDDDDDD" "dddddddddddddddeee....................................................................EEEDDDDDDDDDDD"
"dddddddddddddddeeeeee..............................................................EEEEEEDDDDDDDDDDD" "ddddddddddddd.............................................................................DDDDDDDDDD"
"ddddddddddddddde.......................................................................EEDDDDDDDDDDD" "ddddddd........................................................................................DDDDD"
"ddddddddddd.................................................................................DDDDDDDD" "dd.................................................................................................D"
"ddddddd........................................................................................DDDDD"; "....................................................................................................";
static const char renderComplexExpect[] = static const char renderComplexExpect[] =
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,DD,,,,,,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,"
",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,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,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,,"
"ddddddddd,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,," ",,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,,"
"dddddddddddddddeeeeeeee,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,," "ddddddddddddddd,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeeffff,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,," "dddddddddddddddeeeeeeeeeeeeeee,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffgggggg,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,GGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffff,,,,,,,,,,,,,,,,,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeef,,,,"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiii,FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhh,,,,,,FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhiiiiiiFFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhii....FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhhhhhhi.....FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhh..........FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffggggggggghhh..........FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffgggggg................FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG"
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffgggggg................FFFFFFEEEEEEEEEEEEEEEDDeeeefGGGG" "dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffg.....................FFFFFFEEEEEEEEEEEEEEEDDeeeef...."
"dddddddddddddddeeeeeeeeeeeeeeeeeefffffffffffffg.....................FFFFFFEEEEEEEEEEEEEEEDDeeeef...." "dddddddddddddddeeeeeeeeeeeeeeeeeefffffff............................FFFFFFEEEEEEEEEEEEEEEDDeeeef...."
"dddddddddddddddeeeeeeeeeeeeeeeeeeffffffff...........................FFFFFFEEEEEEEEEEEEEEEDDeeeef...." "dddddddddddddddeeeeeeeeeeeeeeeeeeff.....................................FFEEEEEEEEEEEEEEEDDeeeefF..."
"dddddddddddddddeeeeeeeeeeeeeeeeeefff...................................FFFEEEEEEEEEEEEEEEDDeeeef...." "dddddddddddddddeeeeeeeeeeeeee................................................EEEEEEEEEEEEDDeeeefFFFE"
"dddddddddddddddeeeeeeeeeeeeeeee............................................EEEEEEEEEEEEEEDDeeeefFFFE" "dddddddddddddddeeeeeeee...........................................................EEEEEEEDDeeeefFFFE"
"dddddddddddddddeeeeeeeeeee.....................................................EEEEEEEEEEDDeeeefFFFE" "dddddddddddddddeee....................................................................EEEDDeeee....."
"dddddddddddddddeeeee................................................................EEEEEDDeeee....E" "ddddddddddd.................................................................................ee......"
"ddddddddddddddd..........................................................................DDeee......" "ddddddd............................................................................................."
"ddddddddddd.................................................................................e......." "...................................................................................................."
"dddd................................................................................................"; "....................................................................................................";
RCL_Unit testArrayFunc(int16_t x, int16_t y) RCL_Unit testArrayFunc(int16_t x, int16_t y)
{ {
@ -530,7 +531,7 @@ int main()
RCL_UNITS_PER_SQUARE / 4, RCL_UNITS_PER_SQUARE / 4,
(RCL_UNITS_PER_SQUARE * 5) / 6, (RCL_UNITS_PER_SQUARE * 5) / 6,
287, 287,
370, 365,
2027 2027
)) ))
return 1; return 1;

View file

@ -10,8 +10,8 @@
#include <time.h> #include <time.h>
#define RCL_COMPUTE_FLOOR_TEXCOORDS 1 #define RCL_COMPUTE_FLOOR_TEXCOORDS 1
#define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 5) //#define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 5)
#define RCL_VERTICAL_FOV RCL_UNITS_PER_SQUARE // redefine camera vertical FOV #define RCL_VERTICAL_FOV 380 // redefine camera vertical FOV
#define RCL_TEXTURE_VERTICAL_STRETCH 1 #define RCL_TEXTURE_VERTICAL_STRETCH 1

View file

@ -111,7 +111,7 @@
#endif #endif
#ifndef RCL_VERTICAL_FOV #ifndef RCL_VERTICAL_FOV
#define RCL_VERTICAL_FOV (RCL_UNITS_PER_SQUARE / 5) #define RCL_VERTICAL_FOV (RCL_UNITS_PER_SQUARE / 3)
#endif #endif
#define RCL_VERTICAL_FOV_TAN (RCL_VERTICAL_FOV * 4) ///< tan approximation #define RCL_VERTICAL_FOV_TAN (RCL_VERTICAL_FOV * 4) ///< tan approximation
@ -120,7 +120,7 @@
#define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 4) #define RCL_HORIZONTAL_FOV (RCL_UNITS_PER_SQUARE / 4)
#endif #endif
#define RCL_HORIZONTAL_FOV_TAN (RCL_VERTICAL_FOV * 4) #define RCL_HORIZONTAL_FOV_TAN (RCL_HORIZONTAL_FOV * 4)
#define RCL_HORIZONTAL_FOV_HALF (RCL_HORIZONTAL_FOV / 2) #define RCL_HORIZONTAL_FOV_HALF (RCL_HORIZONTAL_FOV / 2)
@ -517,6 +517,7 @@ RCL_Unit _RCL_cHorizontalDepthStart = 0;
int16_t _RCL_cameraHeightScreen = 0; int16_t _RCL_cameraHeightScreen = 0;
RCL_ArrayFunction _RCL_rollFunction = 0; // says door rolling RCL_ArrayFunction _RCL_rollFunction = 0; // says door rolling
RCL_Unit *_RCL_floorPixelDistances = 0; RCL_Unit *_RCL_floorPixelDistances = 0;
RCL_Unit _RCL_fovCorrectionFactors[2] = {0,0}; //correction for hor/vert fov
RCL_Unit RCL_clamp(RCL_Unit value, RCL_Unit valueMin, RCL_Unit valueMax) RCL_Unit RCL_clamp(RCL_Unit value, RCL_Unit valueMin, RCL_Unit valueMax)
{ {
@ -620,7 +621,10 @@ RCL_Unit RCL_sin(RCL_Unit input)
RCL_Unit RCL_tan(RCL_Unit input) RCL_Unit RCL_tan(RCL_Unit input)
{ {
return (RCL_sin(input) * RCL_UNITS_PER_SQUARE) / RCL_cos(input); return (RCL_sin(input) * RCL_UNITS_PER_SQUARE) / RCL_nonZero(RCL_cos(input)
);
return (RCL_sin(input) * RCL_UNITS_PER_SQUARE) / RCL_nonZero(RCL_cos(input));
} }
RCL_Unit RCL_ctg(RCL_Unit input) RCL_Unit RCL_ctg(RCL_Unit input)
@ -937,15 +941,15 @@ void RCL_castRayMultiHit(RCL_Ray ray, RCL_ArrayFunction arrayFunc,
RCL_HitResult RCL_castRay(RCL_Ray ray, RCL_ArrayFunction arrayFunc) RCL_HitResult RCL_castRay(RCL_Ray ray, RCL_ArrayFunction arrayFunc)
{ {
RCL_HitResult result; RCL_HitResult result;
uint16_t RCL_len; uint16_t len;
RCL_RayConstraints c; RCL_RayConstraints c;
c.maxSteps = 1000; c.maxSteps = 1000;
c.maxHits = 1; c.maxHits = 1;
RCL_castRayMultiHit(ray,arrayFunc,0,&result,&RCL_len,c); RCL_castRayMultiHit(ray,arrayFunc,0,&result,&len,c);
if (RCL_len == 0) if (len == 0)
result.distance = -1; result.distance = -1;
return result; return result;
@ -1652,6 +1656,7 @@ RCL_Unit RCL_vectorsAngleCos(RCL_Vector2D v1, RCL_Vector2D v2)
return (v1.x * v2.x + v1.y * v2.y) / RCL_UNITS_PER_SQUARE; return (v1.x * v2.x + v1.y * v2.y) / RCL_UNITS_PER_SQUARE;
} }
RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height, RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height,
RCL_Camera camera) RCL_Camera camera)
{ {
@ -1676,14 +1681,15 @@ RCL_PixelInfo RCL_mapToScreen(RCL_Vector2D worldPosition, RCL_Unit height,
result.depth = toPoint.x; result.depth = toPoint.x;
result.position.x = result.position.x = middleColumn -
middleColumn + (-1 * toPoint.y * middleColumn) / RCL_nonZero(result.depth); (RCL_perspectiveScaleHorizontal(toPoint.y,result.depth) * middleColumn) /
RCL_UNITS_PER_SQUARE;
result.position.y = result.position.y =
camera.resolution.y / 2 -
(RCL_perspectiveScaleVertical(height - camera.height,result.depth) (RCL_perspectiveScaleVertical(height - camera.height,result.depth)
* camera.resolution.y) / RCL_UNITS_PER_SQUARE * camera.resolution.y) / RCL_UNITS_PER_SQUARE;
+ camera.shear;
result.position.y = camera.resolution.y / 2 - result.position.y + camera.shear;
return result; return result;
} }
@ -1693,36 +1699,65 @@ RCL_Unit RCL_degreesToUnitsAngle(int16_t degrees)
return (degrees * RCL_UNITS_PER_SQUARE) / 360; return (degrees * RCL_UNITS_PER_SQUARE) / 360;
} }
/**
Ugly temporary hack to solve mapping to screen. This function computes
(approximately, usin a table) a divisor needed for FOV correction.
*/
RCL_Unit _RCL_fovCorrectionFactor(RCL_Unit fov)
{
uint16_t table[9] =
{1,208,408,692,1024,1540,2304,5376,30000};
fov = RCL_min(RCL_UNITS_PER_SQUARE / 2 - 1,fov);
uint8_t index = fov / 64;
uint32_t t = ((fov - index * 64) * RCL_UNITS_PER_SQUARE) / 64;
uint32_t v1 = table[index];
uint32_t v2 = table[index + 1];
return v1 + ((v2 - v1) * t) / RCL_UNITS_PER_SQUARE;
}
RCL_Unit RCL_perspectiveScaleVertical(RCL_Unit originalSize, RCL_Unit distance) RCL_Unit RCL_perspectiveScaleVertical(RCL_Unit originalSize, RCL_Unit distance)
{ {
return distance != 0 ? if (_RCL_fovCorrectionFactors[1] == 0)
(originalSize * RCL_UNITS_PER_SQUARE) / _RCL_fovCorrectionFactors[1] = _RCL_fovCorrectionFactor(RCL_VERTICAL_FOV);
((RCL_VERTICAL_FOV_TAN * 2 * distance) / RCL_UNITS_PER_SQUARE)
: 0; return distance != 0 ? ((originalSize * RCL_UNITS_PER_SQUARE) /
RCL_nonZero((_RCL_fovCorrectionFactors[1] * distance) / RCL_UNITS_PER_SQUARE)
) : 0;
} }
RCL_Unit RCL_perspectiveScaleVerticalInverse(RCL_Unit originalSize, RCL_Unit RCL_perspectiveScaleVerticalInverse(RCL_Unit originalSize,
RCL_Unit scaledSize) RCL_Unit scaledSize)
{ {
if (_RCL_fovCorrectionFactors[1] == 0)
_RCL_fovCorrectionFactors[1] = _RCL_fovCorrectionFactor(RCL_VERTICAL_FOV);
return scaledSize != 0 ? return scaledSize != 0 ?
(originalSize * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2) /
// ^ take the middle ((originalSize * RCL_UNITS_PER_SQUARE) /
((RCL_VERTICAL_FOV_TAN * 2 * scaledSize) / RCL_UNITS_PER_SQUARE) RCL_nonZero((_RCL_fovCorrectionFactors[1] * scaledSize)
: RCL_INFINITY; / RCL_UNITS_PER_SQUARE)) : RCL_INFINITY;
} }
RCL_Unit RCL_Unit
RCL_perspectiveScaleHorizontal(RCL_Unit originalSize, RCL_Unit distance) RCL_perspectiveScaleHorizontal(RCL_Unit originalSize, RCL_Unit distance)
{ {
if (_RCL_fovCorrectionFactors[0] == 0)
_RCL_fovCorrectionFactors[0] = _RCL_fovCorrectionFactor(RCL_HORIZONTAL_FOV);
return distance != 0 ? return distance != 0 ?
(originalSize * RCL_UNITS_PER_SQUARE) / ((originalSize * RCL_UNITS_PER_SQUARE) /
((RCL_HORIZONTAL_FOV_TAN * 2 * distance) / RCL_UNITS_PER_SQUARE) RCL_nonZero((_RCL_fovCorrectionFactors[0] * distance) / RCL_UNITS_PER_SQUARE)
: 0; ) : 0;
} }
RCL_Unit RCL_perspectiveScaleHorizontalInverse(RCL_Unit originalSize, RCL_Unit RCL_perspectiveScaleHorizontalInverse(RCL_Unit originalSize,
RCL_Unit scaledSize) RCL_Unit scaledSize)
{ {
// TODO: probably doesn't work
return scaledSize != 0 ? return scaledSize != 0 ?
(originalSize * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2) / (originalSize * RCL_UNITS_PER_SQUARE + RCL_UNITS_PER_SQUARE / 2) /
((RCL_HORIZONTAL_FOV_TAN * 2 * scaledSize) / RCL_UNITS_PER_SQUARE) ((RCL_HORIZONTAL_FOV_TAN * 2 * scaledSize) / RCL_UNITS_PER_SQUARE)
@ -1805,10 +1840,11 @@ void RCL_moveCameraWithCollision(RCL_Camera *camera, RCL_Vector2D planeOffset,
RCL_ArrayFunction ceilingHeightFunc, int8_t computeHeight, int8_t force) RCL_ArrayFunction ceilingHeightFunc, int8_t computeHeight, int8_t force)
{ {
int8_t movesInPlane = planeOffset.x != 0 || planeOffset.y != 0; int8_t movesInPlane = planeOffset.x != 0 || planeOffset.y != 0;
int16_t xSquareNew, ySquareNew;
if (movesInPlane || force) if (movesInPlane || force)
{ {
int16_t xSquareNew, ySquareNew;
RCL_Vector2D corner; // BBox corner in the movement direction RCL_Vector2D corner; // BBox corner in the movement direction
RCL_Vector2D cornerNew; RCL_Vector2D cornerNew;