1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-12-25 01:46:19 +01:00

Add texture height level

This commit is contained in:
Miloslav Číž 2018-09-29 09:33:51 +02:00
parent e2fbbd36e8
commit 74bb0ac18a
2 changed files with 13 additions and 4 deletions

View file

@ -56,6 +56,14 @@
#define RCL_COMPUTE_FLOOR_TEXCOORDS 0
#endif
#ifndef RCL_FLOOR_TEXCOORDS_HEIGHT
#define RCL_FLOOR_TEXCOORDS_HEIGHT 0 /** If RCL_COMPUTE_FLOOR_TEXCOORDS == 1,
this says for what height level the
texture coords will be computed for
(for simplicity/performance only one
level is allowed). */
#endif
#ifndef RCL_USE_COS_LUT
#define RCL_USE_COS_LUT 0 /**< type of look up table for cos function:
0: none (compute)
@ -1325,7 +1333,8 @@ void _RCL_columnFunctionComplex(RCL_HitResult *hits, uint16_t hitCount, uint16_t
limit = _RCL_drawHorizontal(fPosY,fZ1Screen,cPosY + 1,
_RCL_camera.resolution.y,fZ1World,-1,RCL_COMPUTE_FLOOR_DEPTH,
// ^ purposfully allow outside screen bounds
RCL_COMPUTE_FLOOR_TEXCOORDS,1,&ray,&p);
RCL_COMPUTE_FLOOR_TEXCOORDS && p.height == RCL_FLOOR_TEXCOORDS_HEIGHT,
1,&ray,&p);
if (fPosY > limit)
fPosY = limit;

View file

@ -874,10 +874,10 @@ void pixelFunc(RCL_PixelInfo *pixel)
if (pixel->isWall)
c = sampleImage(textures[pixel->hit.type],pixel->texCoords.x,pixel->texCoords.y);
else
c = sampleImage(textures[0],pixel->texCoords.x,pixel->texCoords.y); //pixel->isFloor ? 0b00010001 : 0b00001010;
c = pixel->height == RCL_FLOOR_TEXCOORDS_HEIGHT ?
sampleImage(textures[0],pixel->texCoords.x,pixel->texCoords.y) : 0b00010001;
// int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
int intensity = pixel->depth - 8 * RCL_UNITS_PER_SQUARE;
intensity = intensity < 0 ? 0 : intensity;
intensity = (intensity * 32) / RCL_UNITS_PER_SQUARE;