diff --git a/libs/video/renderer/gl/gl_sky.c b/libs/video/renderer/gl/gl_sky.c index 210e4ef25..a4d325f09 100644 --- a/libs/video/renderer/gl/gl_sky.c +++ b/libs/video/renderer/gl/gl_sky.c @@ -55,6 +55,9 @@ #include "compat.h" #include "r_internal.h" +// Note that the cube face names are from the perspective of looking at the +// cube from the outside on the -ve y axis with +x to the right, +y going in, +// +z up, and front is the nearest face. static const char *suf[6] = { "rt", "bk", "lf", "ft", "up", "dn" }; int gl_solidskytexture; int gl_alphaskytexture; @@ -65,46 +68,46 @@ qboolean gl_skyloaded = false; vec5_t gl_skyvec[6][4] = { { - // right +y - {1, 0, 1024, 1024, 1024}, - {1, 1, 1024, 1024, -1024}, - {0, 1, -1024, 1024, -1024}, - {0, 0, -1024, 1024, 1024} + // right +x + {0, 0, 1024, 1024, 1024}, + {0, 1, 1024, 1024, -1024}, + {1, 1, 1024, -1024, -1024}, + {1, 0, 1024, -1024, 1024} }, { - // back -x - {1, 0, -1024, 1024, 1024}, - {1, 1, -1024, 1024, -1024}, + // back +y + {0, 0, -1024, 1024, 1024}, + {0, 1, -1024, 1024, -1024}, + {1, 1, 1024, 1024, -1024}, + {1, 0, 1024, 1024, 1024} + }, + { + // left -x + {0, 0, -1024, -1024, 1024}, {0, 1, -1024, -1024, -1024}, - {0, 0, -1024, -1024, 1024} + {1, 1, -1024, 1024, -1024}, + {1, 0, -1024, 1024, 1024} }, { - // left -y - {1, 0, -1024, -1024, 1024}, + // front -y + {0, 0, 1024, -1024, 1024}, + {0, 1, 1024, -1024, -1024}, {1, 1, -1024, -1024, -1024}, - {0, 1, 1024, -1024, -1024}, - {0, 0, 1024, -1024, 1024} - }, - { - // front +x - {1, 0, 1024, -1024, 1024}, - {1, 1, 1024, -1024, -1024}, - {0, 1, 1024, 1024, -1024}, - {0, 0, 1024, 1024, 1024} + {1, 0, -1024, -1024, 1024} }, { // up +z - {1, 0, 1024, -1024, 1024}, - {1, 1, 1024, 1024, 1024}, - {0, 1, -1024, 1024, 1024}, - {0, 0, -1024, -1024, 1024} + {0, 0, -1024, 1024, 1024}, + {0, 1, 1024, 1024, 1024}, + {1, 1, 1024, -1024, 1024}, + {1, 0, -1024, -1024, 1024} }, { // down -z - {1, 0, 1024, 1024, -1024}, - {1, 1, 1024, -1024, -1024}, - {0, 1, -1024, -1024, -1024}, - {0, 0, -1024, 1024, -1024} + {0, 0, 1024, 1024, -1024}, + {0, 1, -1024, 1024, -1024}, + {1, 1, -1024, -1024, -1024}, + {1, 0, 1024, -1024, -1024} } }; diff --git a/libs/video/renderer/gl/gl_sky_clip.c b/libs/video/renderer/gl/gl_sky_clip.c index 3ab792c2b..755a00e8d 100644 --- a/libs/video/renderer/gl/gl_sky_clip.c +++ b/libs/video/renderer/gl/gl_sky_clip.c @@ -64,7 +64,8 @@ #define BOX_WIDTH 2056 /* cube face to sky texture offset conversion */ -static const int skytex_offs[] = { 3, 0, 4, 1, 2, 5 }; +// see gl_sky.c for naming: rt bk up lf ft dn +static const int skytex_offs[] = { 0, 1, 4, 2, 3, 5 }; /* convert axis and face distance into face */ static const int faces_table[3][6] = { @@ -238,8 +239,8 @@ set_vertex (struct box_def *box, int face, int ind, const vec3_t v) box->face[face].poly.verts[ind][4] = (1024 - v[2] + 4) / BOX_WIDTH; break; case 2: - box->face[face].poly.verts[ind][3] = (1024 + v[0] + 4) / BOX_WIDTH; - box->face[face].poly.verts[ind][4] = (1024 + v[1] + 4) / BOX_WIDTH; + box->face[face].poly.verts[ind][3] = (1024 - v[1] + 4) / BOX_WIDTH; + box->face[face].poly.verts[ind][4] = (1024 + v[0] + 4) / BOX_WIDTH; break; case 3: box->face[face].poly.verts[ind][3] = (1024 + v[1] + 4) / BOX_WIDTH; @@ -250,8 +251,8 @@ set_vertex (struct box_def *box, int face, int ind, const vec3_t v) box->face[face].poly.verts[ind][4] = (1024 - v[2] + 4) / BOX_WIDTH; break; case 5: - box->face[face].poly.verts[ind][3] = (1024 + v[0] + 4) / BOX_WIDTH; - box->face[face].poly.verts[ind][4] = (1024 - v[1] + 4) / BOX_WIDTH; + box->face[face].poly.verts[ind][3] = (1024 - v[1] + 4) / BOX_WIDTH; + box->face[face].poly.verts[ind][4] = (1024 - v[0] + 4) / BOX_WIDTH; break; } }