MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / wrapCoordFlat

Function wrapCoordFlat

TheForceEngine/Shaders/textureSampleFunc.h:49–56  ·  view source on GitHub ↗

Approximate the distortion that happens in software when floor and ceiling textures are not 64x64.

Source from the content-addressed store, hash-verified

47
48// Approximate the distortion that happens in software when floor and ceiling textures are not 64x64.
49ivec2 wrapCoordFlat(ivec2 uv, ivec2 edge)
50{
51 int coord = (uv.x & 63) * 64 + (uv.y & 63);
52 uv = wrapCoord(ivec2(coord / edge.y, coord), edge);
53 uv.x += (uv.x < 0) ? edge.x : 0;
54 uv.y += (uv.y < 0) ? edge.y : 0;
55 return uv;
56}
57
58vec2 wrapCoordF(vec2 uv, vec2 edge)
59{

Callers 1

sampleTextureFunction · 0.85

Calls 1

wrapCoordFunction · 0.85

Tested by

no test coverage detected