mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-12-23 01:26:19 +01:00
Roll texture coords
This commit is contained in:
parent
fe5617e168
commit
691942dfbe
1 changed files with 14 additions and 6 deletions
20
raycastlib.h
20
raycastlib.h
|
@ -46,12 +46,18 @@
|
|||
#endif
|
||||
|
||||
#ifndef USE_DIST_APPROX
|
||||
#define USE_DIST_APPROX 0 /** What distance approximation to use:
|
||||
#define USE_DIST_APPROX 0 /**< What distance approximation to use:
|
||||
0: none (compute full Euclidean distance)
|
||||
1: accurate approximation
|
||||
2: octagonal approximation (LQ) */
|
||||
#endif
|
||||
|
||||
#ifndef ROLL_TEXTURE_COORDS
|
||||
#define ROLL_TEXTURE_COORDS 1 /**< Says whether rolling doors should also roll
|
||||
the texture coordinates along (mostly
|
||||
desired for doors). */
|
||||
#endif
|
||||
|
||||
#ifndef VERTICAL_FOV
|
||||
#define VERTICAL_FOV (UNITS_PER_SQUARE / 2)
|
||||
#endif
|
||||
|
@ -1027,11 +1033,9 @@ void _columnFunctionSimple(HitResult *hits, uint16_t hitCount, uint16_t x,
|
|||
{
|
||||
// normal hit, check the door roll
|
||||
|
||||
Unit doorRoll = hit.doorRoll;
|
||||
|
||||
int8_t unrolled = doorRoll >= 0 ?
|
||||
doorRoll > hit.textureCoord :
|
||||
hit.textureCoord > UNITS_PER_SQUARE + doorRoll;
|
||||
int8_t unrolled = hit.doorRoll >= 0 ?
|
||||
hit.doorRoll > hit.textureCoord :
|
||||
hit.textureCoord > UNITS_PER_SQUARE + hit.doorRoll;
|
||||
|
||||
if (unrolled)
|
||||
{
|
||||
|
@ -1105,6 +1109,10 @@ void _columnFunctionSimple(HitResult *hits, uint16_t hitCount, uint16_t x,
|
|||
p.isFloor = 1;
|
||||
p.depth = dist;
|
||||
|
||||
#if ROLL_TEXTURE_COORDS == 1
|
||||
p.hit.textureCoord -= p.hit.doorRoll;
|
||||
#endif
|
||||
|
||||
while (y < wallEnd)
|
||||
{
|
||||
p.position.y = y;
|
||||
|
|
Loading…
Reference in a new issue