mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-21 20:29:59 +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
|
#endif
|
||||||
|
|
||||||
#ifndef USE_DIST_APPROX
|
#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)
|
0: none (compute full Euclidean distance)
|
||||||
1: accurate approximation
|
1: accurate approximation
|
||||||
2: octagonal approximation (LQ) */
|
2: octagonal approximation (LQ) */
|
||||||
#endif
|
#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
|
#ifndef VERTICAL_FOV
|
||||||
#define VERTICAL_FOV (UNITS_PER_SQUARE / 2)
|
#define VERTICAL_FOV (UNITS_PER_SQUARE / 2)
|
||||||
#endif
|
#endif
|
||||||
|
@ -1027,11 +1033,9 @@ void _columnFunctionSimple(HitResult *hits, uint16_t hitCount, uint16_t x,
|
||||||
{
|
{
|
||||||
// normal hit, check the door roll
|
// normal hit, check the door roll
|
||||||
|
|
||||||
Unit doorRoll = hit.doorRoll;
|
int8_t unrolled = hit.doorRoll >= 0 ?
|
||||||
|
hit.doorRoll > hit.textureCoord :
|
||||||
int8_t unrolled = doorRoll >= 0 ?
|
hit.textureCoord > UNITS_PER_SQUARE + hit.doorRoll;
|
||||||
doorRoll > hit.textureCoord :
|
|
||||||
hit.textureCoord > UNITS_PER_SQUARE + doorRoll;
|
|
||||||
|
|
||||||
if (unrolled)
|
if (unrolled)
|
||||||
{
|
{
|
||||||
|
@ -1105,6 +1109,10 @@ void _columnFunctionSimple(HitResult *hits, uint16_t hitCount, uint16_t x,
|
||||||
p.isFloor = 1;
|
p.isFloor = 1;
|
||||||
p.depth = dist;
|
p.depth = dist;
|
||||||
|
|
||||||
|
#if ROLL_TEXTURE_COORDS == 1
|
||||||
|
p.hit.textureCoord -= p.hit.doorRoll;
|
||||||
|
#endif
|
||||||
|
|
||||||
while (y < wallEnd)
|
while (y < wallEnd)
|
||||||
{
|
{
|
||||||
p.position.y = y;
|
p.position.y = y;
|
||||||
|
|
Loading…
Reference in a new issue