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

Add inlines

This commit is contained in:
Miloslav Číž 2018-09-17 10:54:22 +02:00
parent 4cb6c381bf
commit f994666817
2 changed files with 8 additions and 7 deletions

View file

@ -420,7 +420,7 @@ Unit clamp(Unit value, Unit valueMin, Unit valueMax)
return valueMin; return valueMin;
} }
Unit absVal(Unit value) static inline Unit absVal(Unit value)
{ {
profileCall(absVal); profileCall(absVal);
@ -428,7 +428,7 @@ Unit absVal(Unit value)
} }
/// Like mod, but behaves differently for negative values. /// Like mod, but behaves differently for negative values.
Unit wrap(Unit value, Unit mod) static inline Unit wrap(Unit value, Unit mod)
{ {
profileCall(wrap); profileCall(wrap);
@ -436,7 +436,7 @@ Unit wrap(Unit value, Unit mod)
} }
/// Performs division, rounding down, NOT towards zero. /// Performs division, rounding down, NOT towards zero.
Unit divRoundDown(Unit value, Unit divisor) static inline Unit divRoundDown(Unit value, Unit divisor)
{ {
profileCall(divRoundDown); profileCall(divRoundDown);
@ -619,7 +619,7 @@ Unit len(Vector2D v)
return dist(zero,v); return dist(zero,v);
} }
int8_t pointIsLeftOfRay(Vector2D point, Ray ray) static inline int8_t pointIsLeftOfRay(Vector2D point, Ray ray)
{ {
profileCall(pointIsLeftOfRay); profileCall(pointIsLeftOfRay);

View file

@ -20,6 +20,8 @@
#define HORIZONTAL_FOV (UNITS_PER_SQUARE / 5) #define HORIZONTAL_FOV (UNITS_PER_SQUARE / 5)
#define VERTICAL_FOV UNITS_PER_SQUARE // redefine camera vertical FOV #define VERTICAL_FOV UNITS_PER_SQUARE // redefine camera vertical FOV
#define PIXEL_FUNCTION pixelFunc
#include "raycastlib.h" #include "raycastlib.h"
#define LEVEL_X_RES 29 #define LEVEL_X_RES 29
@ -874,7 +876,7 @@ void pixelFunc(PixelInfo *pixel)
uint8_t c; uint8_t c;
if (pixel->isWall) if (pixel->isWall)
c = sampleImage(textures[pixel->hit.type],pixel->hit.textureCoord,pixel->textureCoordY); c = sampleImage(textures[pixel->hit.type],pixel->texCoords.x,pixel->texCoords.y);
else else
c = pixel->isFloor ? 0b00010001 : 0b00001010; c = pixel->isFloor ? 0b00010001 : 0b00001010;
@ -922,8 +924,7 @@ void draw()
c.maxHits = 32; c.maxHits = 32;
c.maxSteps = 32; c.maxSteps = 32;
c.computeTextureCoords = 1; render(camera,floorHeightAt,ceilingHeightAt,textureAt,c);
render(camera,floorHeightAt,ceilingHeightAt,textureAt,pixelFunc,c);
Unit previousDepth; Unit previousDepth;