pass though indent, correct a comment and change vertexen to vertices

This commit is contained in:
Bill Currie 2000-12-02 06:09:18 +00:00
parent c90adba9dc
commit bd47fcf241

View file

@ -41,7 +41,8 @@ extern qboolean skyloaded;
extern vec5_t skyvec[6][4]; extern vec5_t skyvec[6][4];
/* cube face to sky texture offset conversion */ /* cube face to sky texture offset conversion */
static const int skytex_offs[] = {3, 0, 4, 1, 2, 5}; static const int skytex_offs[] = { 3, 0, 4, 1, 2, 5 };
/* clockwise loop through the cube faces adjoining the current face */ /* clockwise loop through the cube faces adjoining the current face */
static const int face_loop[6][5] = { static const int face_loop[6][5] = {
{1, 2, 4, 5, 1}, {1, 2, 4, 5, 1},
@ -51,18 +52,22 @@ static const int face_loop[6][5] = {
{0, 2, 3, 5, 0}, {0, 2, 3, 5, 0},
{0, 4, 3, 1, 0}, {0, 4, 3, 1, 0},
}; };
/* convert axis and face distance into face */ /* convert axis and face distance into face */
static const int faces_table[3][6] = { static const int faces_table[3][6] = {
{-1, 0, 0, -1, 3, 3}, {-1, 0, 0, -1, 3, 3},
{-1, 4, 4, -1, 1, 1}, {-1, 4, 4, -1, 1, 1},
{-1, 2, 2, -1, 5, 5}, {-1, 2, 2, -1, 5, 5},
}; };
/* convert face magic bit mask to index into visit array */ /* convert face magic bit mask to index into visit array */
static const int faces_bit_magic[] = {2, 1, -1, 0, 3, -1, 4, -1}; static const int faces_bit_magic[] = { 2, 1, -1, 0, 3, -1, 4, -1 };
/* axis the cube face cuts (also index into vec3_t and n % 3 for 0 <= n < 6) */ /* axis the cube face cuts (also index into vec3_t and n % 3 for 0 <= n < 6) */
static const int face_axis[] = {0, 1, 2, 0, 1, 2}; static const int face_axis[] = { 0, 1, 2, 0, 1, 2 };
/* offset on the axis the cube face cuts */ /* offset on the axis the cube face cuts */
static const vec_t face_offset[] = {1024, 1024, 1024, -1024, -1024, -1024}; static const vec_t face_offset[] = { 1024, 1024, 1024, -1024, -1024, -1024 };
/* cube face */ /* cube face */
struct face_def { struct face_def {
@ -79,8 +84,8 @@ struct visit_def {
/* our cube */ /* our cube */
struct box_def { struct box_def {
/* keep track of which cube faces we visit and in what order */ /* keep track of which cube faces we visit and in what order */
struct visit_def visited_faces [9]; struct visit_def visited_faces[9];
int face_visits [6]; int face_visits[6];
int face_count; int face_count;
/* the cube faces */ /* the cube faces */
struct face_def face[6]; struct face_def face[6];
@ -103,7 +108,7 @@ determine_face (vec3_t v)
{ {
float a[3]; float a[3];
float m; float m;
int i=0; int i = 0;
m = a[0] = fabs (v[0]); m = a[0] = fabs (v[0]);
a[1] = fabs (v[1]); a[1] = fabs (v[1]);
@ -121,7 +126,7 @@ determine_face (vec3_t v)
} }
if (v[i] < 0) if (v[i] < 0)
i += 3; i += 3;
VectorScale (v, 1024/m, v); VectorScale (v, 1024 / m, v);
return i; return i;
} }
@ -152,11 +157,15 @@ determine_face (vec3_t v)
static int static int
find_intersect (int face1, vec3_t x1, int face2, vec3_t x2, vec3_t y) find_intersect (int face1, vec3_t x1, int face2, vec3_t x2, vec3_t y)
{ {
vec3_t n; // normal to the plane formed by the eye and vec3_t n; // normal to the plane formed by the
// the two points on the cube. // eye and the two points on the cube.
vec3_t x = {0, 0, 0}; // point on cube edge of adjoining faces.
// always on an axis plane. vec3_t x = { 0, 0, 0 }; // point on cube edge of adjoining
vec3_t v = {0, 0, 0}; // direction vector of cube edge. always +ve // faces. always on an axis plane.
vec3_t v = { 0, 0, 0 }; // direction vector of cube edge.
// always +ve
vec_t x_n, v_n; // x.n and v.n vec_t x_n, v_n; // x.n and v.n
int axis; int axis;
vec3_t t; vec3_t t;
@ -247,13 +256,14 @@ add_vertex (struct box_def *box, int face, vec3_t v)
} }
/* /*
insert_cube_vertexen insert_cube_vertices
insert the given cube vertexen into the vertex list of the poly in the insert the given cube vertices into the vertex list of the poly in the
correct location. correct location.
*/ */
static void static void
insert_cube_vertexen (struct box_def *box, struct visit_def visit, int count, ...) insert_cube_vertices (struct box_def *box, struct visit_def visit, int count,
...)
{ {
int i; int i;
vec3_t **v; vec3_t **v;
@ -262,24 +272,26 @@ insert_cube_vertexen (struct box_def *box, struct visit_def visit, int count, ..
int ind = visit.leave + 1; int ind = visit.leave + 1;
va_start (args, count); va_start (args, count);
v = (vec3_t**)alloca (count * sizeof (vec3_t*)); v = (vec3_t **) alloca (count * sizeof (vec3_t *));
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
v[i] = va_arg (args, vec3_t*); v[i] = va_arg (args, vec3_t *);
} }
va_end (args); va_end (args);
if (ind == box->face[face].poly.numverts) { if (ind == box->face[face].poly.numverts) {
// the vertex the sky poly left this cube fase through is very // the vertex the sky poly left this cube fase through is very
// conveniently the last vertex of the face poly. this means we // conveniently the last vertex of the face poly. this means we
// can just append the two vetexen // can just append the vetexen
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
add_vertex (box, face, *v[i]); add_vertex (box, face, *v[i]);
} else { } else {
// we have to insert the cube vertexen into the face poly // we have to insert the cube vertices into the face poly
// vertex list // vertex list
glpoly_t *p = &box->face[face].poly; glpoly_t *p = &box->face[face].poly;
int c = p->numverts - ind; int c = p->numverts - ind;
const int vert_size = sizeof (p->verts[0]); const int vert_size = sizeof (p->verts[0]);
memmove (p->verts[ind + count], p->verts[ind], c * vert_size); memmove (p->verts[ind + count], p->verts[ind], c * vert_size);
p->numverts += count; p->numverts += count;
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
@ -310,19 +322,21 @@ cross_cube_edge (struct box_def *box, int face1, vec3_t v1, int face2,
face = axis + 3; face = axis + 3;
if (face > 0) { if (face > 0) {
vec3_t x; vec3_t x;
VectorAdd (v1, v2, x); VectorAdd (v1, v2, x);
VectorScale (x, 0.5, x); VectorScale (x, 0.5, x);
cross_cube_edge (box, face1, v1, face, x); cross_cube_edge (box, face1, v1, face, x);
cross_cube_edge (box, face, x, face2, v2); cross_cube_edge (box, face, x, face2, v2);
} else { } else {
struct visit_def *visit = box->visited_faces; struct visit_def *visit = box->visited_faces;
visit[box->face_count - 1].leave = box->face[face1].poly.numverts; visit[box->face_count - 1].leave = box->face[face1].poly.numverts;
visit[box->face_count].face = face2; visit[box->face_count].face = face2;
box->face_count++; box->face_count++;
box->face_visits[face2]++; box->face_visits[face2]++;
add_vertex(box, face1, l); add_vertex (box, face1, l);
add_vertex(box, face2, l); add_vertex (box, face2, l);
} }
} }
@ -360,10 +374,11 @@ process_corners (struct box_def *box)
// one corner, no edges // one corner, no edges
{ {
vec3_t v; vec3_t v;
find_cube_vertex (visit[0].face, visit[1].face, visit[2].face, v); find_cube_vertex (visit[0].face, visit[1].face, visit[2].face, v);
insert_cube_vertexen (box, visit[0], 1, v); insert_cube_vertices (box, visit[0], 1, v);
insert_cube_vertexen (box, visit[1], 1, v); insert_cube_vertices (box, visit[1], 1, v);
insert_cube_vertexen (box, visit[2], 1, v); insert_cube_vertices (box, visit[2], 1, v);
} }
break; break;
case 4: case 4:
@ -371,7 +386,7 @@ process_corners (struct box_def *box)
return; return;
if (abs (visit[2].face - visit[0].face) == 3 if (abs (visit[2].face - visit[0].face) == 3
&& abs (visit[3].face - visit[1].face) == 3) { && abs (visit[3].face - visit[1].face) == 3) {
// 4 vertexen // 4 vertices
int sum, diff; int sum, diff;
vec3_t v[4]; vec3_t v[4];
@ -381,14 +396,15 @@ process_corners (struct box_def *box)
diff = (diff + 6) % 6; diff = (diff + 6) % 6;
center = faces_table[sum][diff]; center = faces_table[sum][diff];
for (i=0; i < 4; i++) { for (i = 0; i < 4; i++) {
find_cube_vertex (visit[i].face, visit[(i + 1) & 3].face, center, v[i]); find_cube_vertex (visit[i].face, visit[(i + 1) & 3].face,
center, v[i]);
add_vertex (box, center, v[i]); add_vertex (box, center, v[i]);
} }
for (i=0; i < 4; i++) for (i = 0; i < 4; i++)
insert_cube_vertexen (box, visit[i], 2, v[i], v[(i - 1) & 3]); insert_cube_vertices (box, visit[i], 2, v[i], v[(i - 1) & 3]);
} else { } else {
// 2 vertexen // 2 vertices
int l_f, t_f, r_f, b_f; int l_f, t_f, r_f, b_f;
vec3_t v_l, v_r; vec3_t v_l, v_r;
@ -405,45 +421,54 @@ process_corners (struct box_def *box)
} else { } else {
return; return;
} }
find_cube_vertex (visit[l_f].face, visit[t_f].face, visit[b_f].face, v_l); find_cube_vertex (visit[l_f].face, visit[t_f].face, visit[b_f].face,
find_cube_vertex (visit[r_f].face, visit[t_f].face, visit[b_f].face, v_r); v_l);
find_cube_vertex (visit[r_f].face, visit[t_f].face, visit[b_f].face,
v_r);
insert_cube_vertexen (box, visit[t_f], 2, v_r, v_l); insert_cube_vertices (box, visit[t_f], 2, v_r, v_l);
insert_cube_vertexen (box, visit[b_f], 2, v_l, v_r); insert_cube_vertices (box, visit[b_f], 2, v_l, v_r);
insert_cube_vertexen (box, visit[l_f], 1, v_l); insert_cube_vertices (box, visit[l_f], 1, v_l);
insert_cube_vertexen (box, visit[r_f], 1, v_r); insert_cube_vertices (box, visit[r_f], 1, v_r);
} }
break; break;
case 5: case 5:
if (max_visit > 1) { if (max_visit > 1) {
// one vertex // one vertex
vec3_t v; vec3_t v;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
// don't need to check the 5th visit // don't need to check the 5th visit
if (visit[(i + 2) % 5].face == visit[(i + 4) % 5].face) if (visit[(i + 2) % 5].face == visit[(i + 4) % 5].face)
break; break;
} }
find_cube_vertex (visit[i].face, visit[(i + 1) % 5].face, visit[(i + 2) % 5].face, v); find_cube_vertex (visit[i].face, visit[(i + 1) % 5].face,
insert_cube_vertexen (box, visit[i], 1, v); visit[(i + 2) % 5].face, v);
insert_cube_vertexen (box, visit[(i + 1) % 5], 1, v); insert_cube_vertices (box, visit[i], 1, v);
insert_cube_vertexen (box, visit[(i + 4) % 5], 1, v); insert_cube_vertices (box, visit[(i + 1) % 5], 1, v);
insert_cube_vertices (box, visit[(i + 4) % 5], 1, v);
} else { } else {
// 3 vertexen // 3 vertices
unsigned int sel = (((abs (visit[2].face - visit[0].face) == 3) << 2) unsigned int sel =
| ((abs (visit[3].face - visit[1].face) == 3) << 1) (((abs (visit[2].face - visit[0].face) == 3) << 2) |
((abs (visit[3].face - visit[1].face) == 3) << 1)
| ((abs (visit[4].face - visit[2].face) == 3) << 0)); | ((abs (visit[4].face - visit[2].face) == 3) << 0));
vec3_t v[3]; vec3_t v[3];
center = faces_bit_magic[sel]; center = faces_bit_magic[sel];
printf ("%02o %d %d %d %d %d %d\n", sel, center, visit[0].face, visit[1].face, visit[2].face, visit[3].face, visit[4].face); printf ("%02o %d %d %d %d %d %d\n", sel, center, visit[0].face,
visit[1].face, visit[2].face, visit[3].face, visit[4].face);
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
find_cube_vertex (visit[center].face, visit[(center + 1 + i) % 5].face, visit[(center + 2 + i) % 5].face, v[i]); find_cube_vertex (visit[center].face,
insert_cube_vertexen (box, visit[center], 3, v[0], v[1], v[2]); visit[(center + 1 + i) % 5].face,
insert_cube_vertexen (box, visit[(center + 1) % 5], 1, v[0]); visit[(center + 2 + i) % 5].face, v[i]);
insert_cube_vertexen (box, visit[(center + 2) % 5], 2, v[1], v[0]); insert_cube_vertices (box, visit[center], 3, v[0], v[1], v[2]);
insert_cube_vertexen (box, visit[(center + 3) % 5], 2, v[2], v[1]); insert_cube_vertices (box, visit[(center + 1) % 5], 1, v[0]);
insert_cube_vertexen (box, visit[(center + 4) % 5], 1, v[2]); insert_cube_vertices (box, visit[(center + 2) % 5], 2, v[1], v[0]);
insert_cube_vertices (box, visit[(center + 3) % 5], 2, v[2], v[1]);
insert_cube_vertices (box, visit[(center + 4) % 5], 1, v[2]);
} }
break; break;
case 6: case 6:
@ -456,32 +481,36 @@ process_corners (struct box_def *box)
break; break;
} }
if (visit[(i + 3) % 6].face == visit[(i + 5) % 6].face) { if (visit[(i + 3) % 6].face == visit[(i + 5) % 6].face) {
// adjacant vertexen // adjacant vertices
vec3_t v[2]; vec3_t v[2];
find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face, visit[(i + 2) % 6].face, v[0]); find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face,
find_cube_vertex (visit[(i + 1) % 6].face, visit[(i + 2) % 6].face, visit[(i + 3) % 6].face, v[1]); visit[(i + 2) % 6].face, v[0]);
find_cube_vertex (visit[(i + 1) % 6].face, visit[(i + 2) % 6].face,
visit[(i + 3) % 6].face, v[1]);
insert_cube_vertexen (box, visit[(i + 5) % 6], 2, v[2], v[1]); insert_cube_vertices (box, visit[(i + 5) % 6], 2, v[2], v[1]);
insert_cube_vertexen (box, visit[i], 1, v[0]); insert_cube_vertices (box, visit[i], 1, v[0]);
insert_cube_vertexen (box, visit[(i + 1) % 6], 2, v[1], v[0]); insert_cube_vertices (box, visit[(i + 1) % 6], 2, v[1], v[0]);
insert_cube_vertexen (box, visit[(i + 2) % 6], 1, v[1]); insert_cube_vertices (box, visit[(i + 2) % 6], 1, v[1]);
} else { } else {
// opposing vertexen // opposing vertices
vec3_t v[2]; vec3_t v[2];
find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face, visit[(i + 2) % 6].face, v[0]); find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face,
find_cube_vertex (visit[(i + 3) % 6].face, visit[(i + 4) % 6].face, visit[(i + 5) % 6].face, v[1]); visit[(i + 2) % 6].face, v[0]);
find_cube_vertex (visit[(i + 3) % 6].face, visit[(i + 4) % 6].face,
visit[(i + 5) % 6].face, v[1]);
insert_cube_vertexen (box, visit[i], 1, v[0]); insert_cube_vertices (box, visit[i], 1, v[0]);
insert_cube_vertexen (box, visit[(i + 1) % 6], 1, v[0]); insert_cube_vertices (box, visit[(i + 1) % 6], 1, v[0]);
insert_cube_vertexen (box, visit[(i + 3) % 6], 1, v[1]); insert_cube_vertices (box, visit[(i + 3) % 6], 1, v[1]);
insert_cube_vertexen (box, visit[(i + 4) % 6], 1, v[1]); insert_cube_vertices (box, visit[(i + 4) % 6], 1, v[1]);
insert_cube_vertexen (box, visit[(i + 2) % 6], 1, v[1]); insert_cube_vertices (box, visit[(i + 2) % 6], 1, v[1]);
insert_cube_vertexen (box, visit[(i + 5) % 6], 1, v[0]); insert_cube_vertices (box, visit[(i + 5) % 6], 1, v[0]);
} }
break; break;
case 7: case 7:
@ -493,11 +522,13 @@ process_corners (struct box_def *box)
} }
{ {
vec3_t v; vec3_t v;
find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face, visit[(i + 2) % 6].face, v);
insert_cube_vertexen (box, visit[i], 1, v); find_cube_vertex (visit[i].face, visit[(i + 1) % 6].face,
insert_cube_vertexen (box, visit[(i + 1) % 7], 1, v); visit[(i + 2) % 6].face, v);
insert_cube_vertexen (box, visit[(i + 6) % 7], 1, v);
insert_cube_vertices (box, visit[i], 1, v);
insert_cube_vertices (box, visit[(i + 1) % 7], 1, v);
insert_cube_vertices (box, visit[(i + 6) % 7], 1, v);
} }
break; break;
} }
@ -506,20 +537,20 @@ process_corners (struct box_def *box)
/* /*
render_box render_box
draws all faces of the cube with 3 or more vertexen. draws all faces of the cube with 3 or more vertices.
*/ */
static void static void
render_box (struct box_def *box) render_box (struct box_def *box)
{ {
int i,j; int i, j;
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
if (box->face[i].poly.numverts <= 2) if (box->face[i].poly.numverts <= 2)
continue; continue;
glBindTexture (GL_TEXTURE_2D, box->face[i].tex); glBindTexture (GL_TEXTURE_2D, box->face[i].tex);
glBegin (GL_POLYGON); glBegin (GL_POLYGON);
for (j=0; j < box->face[i].poly.numverts; j++) { for (j = 0; j < box->face[i].poly.numverts; j++) {
glTexCoord2fv (box->face[i].poly.verts[j]+3); glTexCoord2fv (box->face[i].poly.verts[j] + 3);
glVertex3fv (box->face[i].poly.verts[j]); glVertex3fv (box->face[i].poly.verts[j]);
} }
glEnd (); glEnd ();
@ -531,9 +562,11 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
{ {
int i; int i;
struct box_def box; struct box_def box;
/* projected vertex and face of the previous sky poly vertex */ /* projected vertex and face of the previous sky poly vertex */
vec3_t last_v; vec3_t last_v;
int prev_face; int prev_face;
/* projected vertex and face of the current sky poly vertex */ /* projected vertex and face of the current sky poly vertex */
vec3_t v; vec3_t v;
int face; int face;
@ -543,7 +576,7 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
box.face[i].tex = SKY_TEX + skytex_offs[i]; box.face[i].tex = SKY_TEX + skytex_offs[i];
} }
if (poly->numverts>=32) { if (poly->numverts >= 32) {
Sys_Error ("too many verts!"); Sys_Error ("too many verts!");
} }
@ -553,7 +586,7 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
box.visited_faces[0].face = prev_face; box.visited_faces[0].face = prev_face;
box.face_count = 1; box.face_count = 1;
for (i=0; i< poly->numverts; i++) { for (i = 0; i < poly->numverts; i++) {
VectorSubtract (poly->verts[i], r_refdef.vieworg, v); VectorSubtract (poly->verts[i], r_refdef.vieworg, v);
face = determine_face (v); face = determine_face (v);
if (face != prev_face) { if (face != prev_face) {
@ -571,7 +604,7 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
cross_cube_edge (&box, prev_face, last_v, face, v); cross_cube_edge (&box, prev_face, last_v, face, v);
} }
} }
add_vertex(&box, face, v); add_vertex (&box, face, v);
VectorCopy (v, last_v); VectorCopy (v, last_v);
prev_face = face; prev_face = face;
@ -591,7 +624,7 @@ R_DrawSkyDomePoly (glpoly_t *poly)
glDisable (GL_TEXTURE_2D); glDisable (GL_TEXTURE_2D);
glColor3f (0, 0, 0); glColor3f (0, 0, 0);
glBegin (GL_POLYGON); glBegin (GL_POLYGON);
for (i=0; i<poly->numverts; i++) { for (i = 0; i < poly->numverts; i++) {
glVertex3fv (poly->verts[i]); glVertex3fv (poly->verts[i]);
} }
glEnd (); glEnd ();
@ -603,10 +636,12 @@ void
R_DrawSkyChain (msurface_t *sky_chain) R_DrawSkyChain (msurface_t *sky_chain)
{ {
msurface_t *sc = sky_chain; msurface_t *sc = sky_chain;
if (skyloaded) { if (skyloaded) {
glDepthRange (gldepthmax, gldepthmax); glDepthRange (gldepthmax, gldepthmax);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
R_DrawSkyBoxPoly (p); R_DrawSkyBoxPoly (p);
p = p->next; p = p->next;
@ -617,6 +652,7 @@ R_DrawSkyChain (msurface_t *sky_chain)
} else { } else {
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
R_DrawSkyDomePoly (p); R_DrawSkyDomePoly (p);
p = p->next; p = p->next;
@ -630,13 +666,15 @@ R_DrawSkyChain (msurface_t *sky_chain)
glColor3f (1, 1, 1); glColor3f (1, 1, 1);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
int i; int i;
glBegin (GL_LINE_LOOP); glBegin (GL_LINE_LOOP);
for (i=0; i<p->numverts; i++) { for (i = 0; i < p->numverts; i++) {
glVertex3fv (p->verts[i]); glVertex3fv (p->verts[i]);
} }
glEnd(); glEnd ();
p = p->next; p = p->next;
} }
sc = sc->texturechain; sc = sc->texturechain;
@ -646,14 +684,16 @@ R_DrawSkyChain (msurface_t *sky_chain)
glBegin (GL_POINTS); glBegin (GL_POINTS);
while (sc) { while (sc) {
glpoly_t *p = sc->polys; glpoly_t *p = sc->polys;
while (p) { while (p) {
int i; int i;
vec3_t x, c = {0, 0, 0}; vec3_t x, c = { 0, 0, 0 };
for (i=0; i<p->numverts; i++) {
for (i = 0; i < p->numverts; i++) {
VectorSubtract (p->verts[i], r_refdef.vieworg, x); VectorSubtract (p->verts[i], r_refdef.vieworg, x);
VectorAdd (x, c, c); VectorAdd (x, c, c);
} }
VectorScale (c, 1.0/p->numverts, c); VectorScale (c, 1.0 / p->numverts, c);
VectorAdd (c, r_refdef.vieworg, c); VectorAdd (c, r_refdef.vieworg, c);
glVertex3fv (c); glVertex3fv (c);
p = p->next; p = p->next;
@ -662,13 +702,15 @@ R_DrawSkyChain (msurface_t *sky_chain)
} }
glEnd (); glEnd ();
if (skyloaded) { if (skyloaded) {
int i,j; int i, j;
glColor3f (1, 0, 0); glColor3f (1, 0, 0);
for (i=0; i<6; i++) { for (i = 0; i < 6; i++) {
vec3_t v; vec3_t v;
glBegin (GL_LINE_LOOP); glBegin (GL_LINE_LOOP);
for (j=0; j<4; j++) { for (j = 0; j < 4; j++) {
memcpy (v, &skyvec[i][j][2], sizeof(v)); memcpy (v, &skyvec[i][j][2], sizeof (v));
VectorAdd (v, r_refdef.vieworg, v); VectorAdd (v, r_refdef.vieworg, v);
glVertex3fv (v); glVertex3fv (v);
} }