Add the solid-sky option from Jardrup's light tool.

However, actual sky tracing is not yet implemented.
This commit is contained in:
Bill Currie 2013-01-02 16:46:40 +09:00
parent 32127d3ec7
commit 7cd1894a6d
5 changed files with 37 additions and 3 deletions

View file

@ -122,6 +122,8 @@ extern vec3_t *surfaceorgs;
extern struct entity_s **novislights;
extern int num_novislights;
const char *get_tex_name (int texindex);
//@}
#endif// __light_h

View file

@ -41,6 +41,7 @@ typedef struct {
int novis;
int extrabit;
int attenuation;
int solid_sky;
vec_t extrascale;
vec_t distance;
vec_t range;

View file

@ -61,6 +61,24 @@
int c_bad;
int c_culldistplane, c_proper;
const char *
get_tex_name (int texindex)
{
dmiptexlump_t *mtl;
miptex_t *mt;
int miptex;
if (bsp->texdatasize) {
mtl = (dmiptexlump_t *) bsp->texdata;
miptex = bsp->texinfo[texindex].miptex;
if (mtl->dataofs[miptex] != -1) {
mt = (miptex_t *) (bsp->texdata + mtl->dataofs[miptex]);
return mt->name;
}
}
return "notex";
}
/*
SAMPLE POINT DETERMINATION

View file

@ -65,6 +65,7 @@ static struct option const long_options[] = {
{"distance", required_argument, 0, 'd'},
{"range", required_argument, 0, 'r'},
{"file", required_argument, 0, 'f'},
{"solid-sky", no_argument, 0, 'S'},
{NULL, 0, NULL, 0}
};
@ -83,6 +84,7 @@ static const char *short_options =
"r:" // scale range
"P:" // properties file
"f:"
"S" // solid-sky
;
void
@ -106,7 +108,9 @@ usage (int status)
" -n, --noise [factor] Scale noise. 0 (default) to disable\n"
" -c, --cutoff [scale] Scale cutoff. 0 to disable\n"
" -P, --properties [file] Properties file\n"
" -f, --file [bspfile] BSP file\n\n");
" -f, --file [bspfile] BSP file\n"
" -S, --solid-sky Enable solid sky brushes\n"
"\n");
exit (status);
}
@ -188,6 +192,8 @@ DecodeArgs (int argc, char **argv)
case 'P':
options.properties_filename = strdup (optarg);
break;
case 'S':
options.solid_sky = true;
default:
usage (1);
}

View file

@ -49,7 +49,9 @@
#include "QF/dstring.h"
#include "QF/quakefs.h"
#include "QF/sys.h"
#include "light.h"
#include "options.h"
typedef struct {
int type;
@ -98,9 +100,14 @@ MakeTnode (int nodenum)
t->dist = plane->dist;
for (i = 0; i < 2; i++) {
if (node->children[i] < 0)
if (node->children[i] < 0) {
t->children[i] = bsp->leafs[-node->children[i] - 1].contents;
else {
if (options.solid_sky && t->children[i] == CONTENTS_SOLID) {
dface_t *face = &bsp->faces[node->firstface];
if (!strncmp (get_tex_name (face->texinfo), "sky", 3))
t->children[i] = CONTENTS_SKY; // Simulate real sky
}
} else {
t->children[i] = tnode_p - tnodes;
MakeTnode (node->children[i]);
}