renderer_gl: Flip textures on load instead of shaders

This commit is contained in:
GPUCode 2023-08-15 00:14:46 +03:00
parent 45a07147ad
commit 377c8e9eed
2 changed files with 5 additions and 5 deletions

View file

@ -254,7 +254,7 @@ void Texture::decodeTexture(std::span<const u8> data) {
// Decode texels line by line
for (u32 v = 0; v < size.v(); v++) {
for (u32 u = 0; u < size.u(); u++) {
u32 colour = decodeTexel(u, v, format, data);
u32 colour = decodeTexel(u, size.v() - v - 1, format, data);
decoded.push_back(colour);
}
}

View file

@ -67,9 +67,9 @@ void main() {
v_colour = a_vertexColour;
// Flip y axis of UVs because OpenGL uses an inverted y for texture sampling compared to the PICA
v_texcoord0 = vec3(a_texcoord0.x, 1.0 - a_texcoord0.y, a_texcoord0_w);
v_texcoord1 = vec2(a_texcoord1.x, 1.0 - a_texcoord1.y);
v_texcoord2 = vec2(a_texcoord2.x, 1.0 - a_texcoord2.y);
v_texcoord0 = vec3(a_texcoord0.x, a_texcoord0.y, a_texcoord0_w);
v_texcoord1 = vec2(a_texcoord1.x, a_texcoord1.y);
v_texcoord2 = vec2(a_texcoord2.x, a_texcoord2.y);
v_view = a_view;
v_normal = normalize(rotateVec3ByQuaternion(vec3(0.0, 0.0, 1.0), a_quaternion));
@ -94,4 +94,4 @@ void main() {
// There's also another, always-on clipping plane based on vertex z
gl_ClipDistance[0] = -a_coords.z;
gl_ClipDistance[1] = dot(clipData, a_coords);
}
}