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

Function wrapCoord

TheForceEngine/Shaders/textureSampleFunc.h:40–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40ivec2 wrapCoord(ivec2 uv, ivec2 edge)
41{
42 uv = imod(uv, edge);
43 uv.x += (uv.x < 0) ? edge.x : 0;
44 uv.y += (uv.y < 0) ? edge.y : 0;
45 return uv;
46}
47
48// Approximate the distortion that happens in software when floor and ceiling textures are not 64x64.
49ivec2 wrapCoordFlat(ivec2 uv, ivec2 edge)

Callers 2

wrapCoordFlatFunction · 0.85
sampleTextureFunction · 0.85

Calls 1

imodFunction · 0.85

Tested by

no test coverage detected