mirror of
https://git.code.sf.net/p/quake/newtree
synced 2024-11-22 12:11:34 +00:00
this should take care of the case of a cube vertex being enclosed by a sky
polygon. If not, oh well, I won't know till tonight :/ (at least it compiles)
This commit is contained in:
parent
602912aeb2
commit
d251d03252
1 changed files with 28 additions and 5 deletions
|
@ -387,6 +387,21 @@ set_vertex (glpoly_t *p, vec3_t v, int face)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
find_cube_vertex
|
||||
|
||||
get the coords of the vertex common to the three specified faces of the
|
||||
cube. NOTE: this WILL break if the three faces are do not share a
|
||||
common vertex.
|
||||
*/
|
||||
static void
|
||||
find_cube_vertex (int face1, int face2, int face3, vec3_t v)
|
||||
{
|
||||
v[face1 % 3] = 1024 * (1 - 2 * (face1 / 3));
|
||||
v[face2 % 3] = 1024 * (1 - 2 * (face2 / 3));
|
||||
v[face3 % 3] = 1024 * (1 - 2 * (face3 / 3));
|
||||
}
|
||||
|
||||
void
|
||||
R_DrawSkyBoxPoly (glpoly_t *poly)
|
||||
{
|
||||
|
@ -421,18 +436,26 @@ R_DrawSkyBoxPoly (glpoly_t *poly)
|
|||
if (face != prev_face) {
|
||||
if (face % 3 == prev_face % 3) {
|
||||
} else {
|
||||
vec3_t l, t;
|
||||
vec3_t l;
|
||||
find_intersect (prev_face, last_v, face, v, l);
|
||||
|
||||
set_vertex(&box[prev_face].poly, l, prev_face);
|
||||
if (box[prev_face].enter >= 0 && box[prev_face].leave == -1) {
|
||||
if (box[prev_face].enter >=0 && box[prev_face].enter != face) {
|
||||
vec3_t t;
|
||||
find_cube_vertex (prev_face, face, box[face].enter, t);
|
||||
set_vertex(&box[prev_face].poly, t, prev_face);
|
||||
} else {
|
||||
box[prev_face].enter = -1;
|
||||
box[prev_face].leave = face;
|
||||
}
|
||||
box[prev_face].leave = face;
|
||||
if (box[face].enter == -1 && box[face].leave >= 0) {
|
||||
if (box[face].leave >=0 && box[face].leave != prev_face) {
|
||||
vec3_t t;
|
||||
find_cube_vertex (prev_face, face, box[face].leave, t);
|
||||
set_vertex(&box[face].poly, t, face);
|
||||
} else {
|
||||
box[face].enter = prev_face;
|
||||
box[face].leave = -1;
|
||||
}
|
||||
box[prev_face].leave = face;
|
||||
set_vertex(&box[face].poly, l, face);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue