mirror of
https://git.coom.tech/drummyfish/raycastlib.git
synced 2024-11-21 20:29:59 +01:00
Fix texturing
This commit is contained in:
parent
0e7e756243
commit
6c8351f145
1 changed files with 4 additions and 5 deletions
|
@ -753,10 +753,9 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
int_maybe32_t z2Screen = _middleRow - perspectiveScale(
|
int_maybe32_t z2Screen = _middleRow - perspectiveScale(
|
||||||
(worldZ2 * _camera.resolution.y) / UNITS_PER_SQUARE,dist);
|
(worldZ2 * _camera.resolution.y) / UNITS_PER_SQUARE,dist);
|
||||||
|
|
||||||
int_maybe32_t wallScreenHeightNoClamp = z2Screen - z1ScreenNoClamp;
|
int_maybe32_t wallScreenHeightNoClamp = z1ScreenNoClamp - z2Screen + 1;
|
||||||
|
wallScreenHeightNoClamp = wallScreenHeightNoClamp == 0 ? 1 :
|
||||||
wallScreenHeightNoClamp = wallScreenHeightNoClamp != 0 ?
|
wallScreenHeightNoClamp;
|
||||||
wallScreenHeightNoClamp : 1;
|
|
||||||
|
|
||||||
z2Screen = clamp(z2Screen,0,_camResYLimit);
|
z2Screen = clamp(z2Screen,0,_camResYLimit);
|
||||||
z2Screen = z2Screen > y2 ? z2Screen : y2;
|
z2Screen = z2Screen > y2 ? z2Screen : y2;
|
||||||
|
@ -856,7 +855,7 @@ void _columnFunction(HitResult *hits, uint16_t hitCount, uint16_t x, Ray ray)
|
||||||
p.hit = hit;
|
p.hit = hit;
|
||||||
|
|
||||||
if (_computeTextureCoords)
|
if (_computeTextureCoords)
|
||||||
p.textureCoordY = UNITS_PER_SQUARE - 1 -((i - z1ScreenNoClamp) *
|
p.textureCoordY = UNITS_PER_SQUARE - 1 - ((z1ScreenNoClamp - i) *
|
||||||
UNITS_PER_SQUARE) / wallScreenHeightNoClamp;
|
UNITS_PER_SQUARE) / wallScreenHeightNoClamp;
|
||||||
|
|
||||||
_pixelFunction(p);
|
_pixelFunction(p);
|
||||||
|
|
Loading…
Reference in a new issue