Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions shader/main3d.vert.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ void main()
inputUV = geoModeSelect(G_TEX_GEN, inUV, normScreen.xy * 0.5 + 0.5);

inputUV *= material.texSize;
// invert Y
inputUV.y = material.texSize.y - inputUV.y;

// @TODO: uvgen (f3d + t3d)
// forward CC (@TODO: do part of this here? e.g. prim/env/shade etc.)
Expand Down
6 changes: 5 additions & 1 deletion shader/textures.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ vec4 wrappedMirrorSample(const sampler2D tex, vec2 uv, const vec2 mask, const ve
// clamp again (mask S/T), this is also done to avoid OOB texture access
uv = mod(uv, min(texSize, mask));

// invert Y again
uv.y = texSize.y - uv.y - 1;

return texelFetch(tex, ivec2(floor(uv)), 0);
}

Expand All @@ -48,7 +51,8 @@ vec4 sampleSampler(in const sampler2D tex, in const TileConf tileConf, in vec2 u
uvCoord = round(uvCoord * LOW_PRECISION) / LOW_PRECISION;
#endif

uvCoord -= tileConf.low;
// invert Y again, but only for applying tile low
uvCoord -= tileConf.low * vec2(1.0, -1.0);

const vec2 isClamp = step(tileConf.mask, vec2(1.0)); // if mask is negated, clamp
const vec2 isMirror = step(tileConf.high, vec2(0.0)); // if high is negated, mirror
Expand Down