1
0
Fork 0
mirror of https://git.coom.tech/drummyfish/raycastlib.git synced 2024-11-21 20:29:59 +01:00

Fix texture coords

This commit is contained in:
Miloslav Číž 2018-09-06 10:15:23 +02:00
parent aa88bdaa3e
commit f186330cf2

View file

@ -501,22 +501,26 @@ void castRayMultiHit(Ray ray, ArrayFunction arrayFunc, ArrayFunction typeFunc,
if (no.y > 0) if (no.y > 0)
{ {
h.direction = 0; h.direction = 0;
h.textureCoord = co.x; h.textureCoord = constraints.computeTextureCoords ?
wrap(currentPos.x,UNITS_PER_SQUARE) : 0;
} }
else if (no.x > 0) else if (no.x > 0)
{ {
h.direction = 1; h.direction = 1;
h.textureCoord = co.y; h.textureCoord = constraints.computeTextureCoords ?
wrap(UNITS_PER_SQUARE - currentPos.y,UNITS_PER_SQUARE) : 0;
} }
else if (no.y < 0) else if (no.y < 0)
{ {
h.direction = 2; h.direction = 2;
h.textureCoord = co.x; h.textureCoord = constraints.computeTextureCoords ?
wrap(UNITS_PER_SQUARE - currentPos.x,UNITS_PER_SQUARE) : 0;
} }
else else
{ {
h.direction = 3; h.direction = 3;
h.textureCoord = co.y; h.textureCoord = constraints.computeTextureCoords ?
wrap(currentPos.y,UNITS_PER_SQUARE) : 0;
} }
hitResults[*hitResultsLen] = h; hitResults[*hitResultsLen] = h;