Rotate the skybox -90 degrees on the z axis (gl)

Now gl and glsl match again, and quake's skies are now "correct" (assuming
fitzquake is the standard).
This commit is contained in:
Bill Currie 2012-09-13 08:36:28 +09:00
parent 14f089d08e
commit 709da6e7d7
2 changed files with 37 additions and 33 deletions

View file

@ -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}
}
};

View file

@ -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;
}
}