61 static const float sky_min = 1.0f / 512.0f;
62 static const float sky_max = 511.0f / 512.0f;
74 for (i = 0, vp = vecs; i < nump; i++, vp += 3) {
80 if (av[0] > av[1] && av[0] > av[2]) {
85 }
else if (av[1] > av[2] && av[1] > av[0]) {
98 for (i = 0; i < nump; i++, vecs += 3) {
108 s = -vecs[-j - 1] / dv;
110 s = vecs[j - 1] / dv;
113 t = -vecs[-j - 1] / dv;
115 t = vecs[j - 1] / dv;
128 #define ON_EPSILON 0.1 // point on plane side epsilon
129 #define MAX_CLIP_VERTS 64
139 qboolean front, back;
148 Com_DPrintf(
"%s: too many verts\n", __func__);
158 front = back = qfalse;
160 for (i = 0, v = vecs; i < nump; i++, v += 3) {
161 d = DotProduct(v, norm);
174 if (!front || !back) {
183 VectorCopy(vecs, (vecs + (i * 3)));
184 newc[0] = newc[1] = 0;
186 for (i = 0, v = vecs; i < nump; i++, v += 3) {
189 VectorCopy(v, newv[0][newc[0]]);
193 VectorCopy(v, newv[1][newc[1]]);
197 VectorCopy(v, newv[0][newc[0]]);
199 VectorCopy(v, newv[1][newc[1]]);
204 if (sides[i] ==
SIDE_ON || sides[i + 1] ==
SIDE_ON || sides[i + 1] == sides[i])
207 d = dists[i] / (dists[i] - dists[i + 1]);
208 for (j = 0; j < 3; j++) {
209 e = v[j] + d * (v[j + 3] - v[j]);
210 newv[0][newc[0]][j] = e;
211 newv[1][newc[1]][j] = e;
239 msurfedge_t *surfedge;
243 Com_DPrintf(
"%s: too many verts\n", __func__);
248 surfedge = fa->firstsurfedge;
253 for (i = 0; i < fa->numsurfedges; i++, surfedge++) {
254 vert = surfedge->edge->v[surfedge->vert];
255 VectorSubtract(vert->point,
glr.
fd.vieworg, temp);
259 for (i = 0; i < fa->numsurfedges; i++, surfedge++) {
260 vert = surfedge->edge->v[surfedge->vert];
261 VectorSubtract(vert->point,
glr.
fd.vieworg, verts[i]);
278 for (i = 0; i < 6; i++) {
286 static void MakeSkyVec(
float s,
float t,
int axis, vec_t *out)
295 for (j = 0; j < 3; j++) {
308 VectorAdd(v,
glr.
fd.vieworg, out);
328 #define SKY_VISIBLE(side) \
329 (skymins[0][side] < skymaxs[0][side] && \
330 skymins[1][side] < skymaxs[1][side])
339 static const int skytexorder[6] = {0, 2, 1, 3, 4, 5};
352 for (i = 0; i < 6; i++) {
372 for (i = 0; i < 6; i++) {
385 char pathname[MAX_QPATH];
389 static const char suf[6][3] = {
"rt",
"bk",
"lf",
"ft",
"up",
"dn" };
399 for (i = 0; i < 6; i++) {
400 len =
Q_concat(pathname,
sizeof(pathname),
401 "env/", name, suf[i],
".tga", NULL);
402 if (len >=
sizeof(pathname)) {
407 image =
IMG_Find(pathname, IT_SKY, IF_NONE);