mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-03 18:10:59 +00:00
Whitespace.
This commit is contained in:
parent
b3f842ba65
commit
6376ebb253
13 changed files with 571 additions and 643 deletions
|
@ -60,4 +60,3 @@ void TransformSample (vec3_t in, vec3_t out);
|
||||||
void RotateSample (vec3_t in, vec3_t out);
|
void RotateSample (vec3_t in, vec3_t out);
|
||||||
|
|
||||||
#endif// __light_h
|
#endif// __light_h
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,6 @@ MatchTargets (void)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < num_entities; i++) {
|
for (i = 0; i < num_entities; i++) {
|
||||||
if (!entities[i].target[0])
|
if (!entities[i].target[0])
|
||||||
continue;
|
continue;
|
||||||
|
@ -125,10 +124,10 @@ void
|
||||||
LoadEntities (void)
|
LoadEntities (void)
|
||||||
{
|
{
|
||||||
const char *data;
|
const char *data;
|
||||||
entity_t *entity;
|
|
||||||
char key[64];
|
char key[64];
|
||||||
epair_t *epair;
|
|
||||||
double vec[3];
|
double vec[3];
|
||||||
|
entity_t *entity;
|
||||||
|
epair_t *epair;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
data = dentdata;
|
data = dentdata;
|
||||||
|
|
|
@ -26,10 +26,10 @@
|
||||||
*/
|
*/
|
||||||
static const char rcsid[] =
|
static const char rcsid[] =
|
||||||
"$Id$";
|
"$Id$";
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -91,9 +91,8 @@ vec_t
|
||||||
CastRay (vec3_t p1, vec3_t p2)
|
CastRay (vec3_t p1, vec3_t p2)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
vec_t t;
|
|
||||||
qboolean trace;
|
qboolean trace;
|
||||||
|
vec_t t;
|
||||||
|
|
||||||
trace = TestLine (p1, p2);
|
trace = TestLine (p1, p2);
|
||||||
|
|
||||||
|
@ -141,7 +140,6 @@ CalcFaceVectors (lightinfo_t *l)
|
||||||
float distscale;
|
float distscale;
|
||||||
vec_t dist, len;
|
vec_t dist, len;
|
||||||
|
|
||||||
|
|
||||||
tex = &texinfo[l->face->texinfo];
|
tex = &texinfo[l->face->texinfo];
|
||||||
|
|
||||||
// convert from float to vec_t
|
// convert from float to vec_t
|
||||||
|
@ -177,7 +175,8 @@ CalcFaceVectors (lightinfo_t *l)
|
||||||
dist = DotProduct (l->worldtotex[i], l->facenormal);
|
dist = DotProduct (l->worldtotex[i], l->facenormal);
|
||||||
dist *= distscale;
|
dist *= distscale;
|
||||||
VectorMA (l->worldtotex[i], -dist, texnormal, l->textoworld[i]);
|
VectorMA (l->worldtotex[i], -dist, texnormal, l->textoworld[i]);
|
||||||
VectorScale (l->textoworld[i], (1 / len) * (1 / len), l->textoworld[i]);
|
VectorScale (l->textoworld[i], (1 / len) * (1 / len),
|
||||||
|
l->textoworld[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate texorg on the texture plane
|
// calculate texorg on the texture plane
|
||||||
|
@ -189,7 +188,6 @@ CalcFaceVectors (lightinfo_t *l)
|
||||||
dist = DotProduct (l->texorg, l->facenormal) - l->facedist - 1;
|
dist = DotProduct (l->texorg, l->facenormal) - l->facedist - 1;
|
||||||
dist *= distscale;
|
dist *= distscale;
|
||||||
VectorMA (l->texorg, -dist, texnormal, l->texorg);
|
VectorMA (l->texorg, -dist, texnormal, l->texorg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -202,11 +200,10 @@ void
|
||||||
CalcFaceExtents (lightinfo_t *l)
|
CalcFaceExtents (lightinfo_t *l)
|
||||||
{
|
{
|
||||||
dface_t *s;
|
dface_t *s;
|
||||||
vec_t mins[2], maxs[2], val;
|
|
||||||
int i, j, e;
|
|
||||||
dvertex_t *v;
|
dvertex_t *v;
|
||||||
|
int i, j, e;
|
||||||
texinfo_t *tex;
|
texinfo_t *tex;
|
||||||
|
vec_t mins[2], maxs[2], val;
|
||||||
|
|
||||||
s = l->face;
|
s = l->face;
|
||||||
|
|
||||||
|
@ -256,15 +253,11 @@ CalcFaceExtents (lightinfo_t *l)
|
||||||
void
|
void
|
||||||
CalcPoints (lightinfo_t *l)
|
CalcPoints (lightinfo_t *l)
|
||||||
{
|
{
|
||||||
int i;
|
int step, i, j , s, t, w, h;
|
||||||
int s, t, j;
|
vec_t mids, midt, starts, startt, us, ut;
|
||||||
int w, h, step;
|
|
||||||
vec_t starts, startt, us, ut;
|
|
||||||
vec_t *surf;
|
vec_t *surf;
|
||||||
vec_t mids, midt;
|
|
||||||
vec3_t facemid, move;
|
vec3_t facemid, move;
|
||||||
|
|
||||||
|
|
||||||
// fill in surforg
|
// fill in surforg
|
||||||
// the points are biased towards the center of the surface
|
// the points are biased towards the center of the surface
|
||||||
// to help avoid edge cases just inside walls
|
// to help avoid edge cases just inside walls
|
||||||
|
@ -345,20 +338,11 @@ CalcPoints (lightinfo_t *l)
|
||||||
void
|
void
|
||||||
SingleLightFace (entity_t *light, lightinfo_t *l)
|
SingleLightFace (entity_t *light, lightinfo_t *l)
|
||||||
{
|
{
|
||||||
vec_t dist;
|
int mapnum, size, c, i;
|
||||||
vec3_t incoming;
|
|
||||||
vec_t angle;
|
|
||||||
vec_t add;
|
|
||||||
vec_t *surf;
|
|
||||||
qboolean hit;
|
qboolean hit;
|
||||||
int mapnum;
|
vec3_t incoming, rel, spotvec;
|
||||||
int size;
|
vec_t add, angle, dist, falloff;
|
||||||
int c, i;
|
vec_t *lightsamp, *surf;
|
||||||
vec3_t rel;
|
|
||||||
vec3_t spotvec;
|
|
||||||
vec_t falloff;
|
|
||||||
vec_t *lightsamp;
|
|
||||||
|
|
||||||
|
|
||||||
VectorSubtract (light->origin, bsp_origin, rel);
|
VectorSubtract (light->origin, bsp_origin, rel);
|
||||||
dist = options.distance * (DotProduct (rel, l->facenormal) - l->facedist);
|
dist = options.distance * (DotProduct (rel, l->facenormal) - l->facedist);
|
||||||
|
@ -437,9 +421,8 @@ SingleLightFace (entity_t *light, lightinfo_t *l)
|
||||||
void
|
void
|
||||||
FixMinlight (lightinfo_t *l)
|
FixMinlight (lightinfo_t *l)
|
||||||
{
|
{
|
||||||
int i, j;
|
|
||||||
float minlight;
|
float minlight;
|
||||||
|
int i, j;
|
||||||
|
|
||||||
minlight = minlights[l->surfnum];
|
minlight = minlights[l->surfnum];
|
||||||
|
|
||||||
|
@ -468,17 +451,12 @@ FixMinlight (lightinfo_t *l)
|
||||||
void
|
void
|
||||||
LightFace (int surfnum)
|
LightFace (int surfnum)
|
||||||
{
|
{
|
||||||
dface_t *f;
|
|
||||||
lightinfo_t l;
|
|
||||||
int s, t;
|
|
||||||
int i, j, c;
|
|
||||||
vec_t total;
|
|
||||||
int size;
|
|
||||||
int lightmapwidth, lightmapsize;
|
|
||||||
byte *out;
|
byte *out;
|
||||||
|
dface_t *f;
|
||||||
|
int lightmapwidth, lightmapsize, size, c, i, j, s, t, w, h;
|
||||||
|
lightinfo_t l;
|
||||||
|
vec_t total;
|
||||||
vec_t *light;
|
vec_t *light;
|
||||||
int w, h;
|
|
||||||
|
|
||||||
|
|
||||||
f = dfaces + surfnum;
|
f = dfaces + surfnum;
|
||||||
|
|
||||||
|
@ -567,4 +545,3 @@ LightFace (int surfnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_STRINGS_H
|
#ifdef HAVE_STRINGS_H
|
||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -77,16 +76,17 @@ usage (int status)
|
||||||
{
|
{
|
||||||
printf ("%s - QuakeForge light tool\n", this_program);
|
printf ("%s - QuakeForge light tool\n", this_program);
|
||||||
printf ("Usage: %s [options] bspfile\n", this_program);
|
printf ("Usage: %s [options] bspfile\n", this_program);
|
||||||
printf ("Options:\n"
|
printf (
|
||||||
" -q, --quiet Inhibit usual output\n"
|
"Options:\n"
|
||||||
" -v, --verbose Display more output than usual\n"
|
" -q, --quiet Inhibit usual output\n"
|
||||||
" -h, --help Display this help and exit\n"
|
" -v, --verbose Display more output than usual\n"
|
||||||
" -V, --version Output version information and exit\n"
|
" -h, --help Display this help and exit\n"
|
||||||
" -t, --threads [num] Number of threads to use\n"
|
" -V, --version Output version information and exit\n"
|
||||||
" -e, --extra Apply extra sampling\n"
|
" -t, --threads [num] Number of threads to use\n"
|
||||||
" -d, --distance [scale] Scale distance\n"
|
" -e, --extra Apply extra sampling\n"
|
||||||
" -r, --range [scale] Scale range\n"
|
" -d, --distance [scale] Scale distance\n"
|
||||||
" -f, --file [bspfile] BSP file\n\n");
|
" -r, --range [scale] Scale range\n"
|
||||||
|
" -f, --file [bspfile] BSP file\n\n");
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -92,7 +91,6 @@ GetFileSpace (int size)
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
LightThread (void *junk)
|
LightThread (void *junk)
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -80,7 +79,6 @@ RunThreadsOn (threadfunc_t func)
|
||||||
pthread_attr_t attrib;
|
pthread_attr_t attrib;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
if (numthreads == 1) {
|
if (numthreads == 1) {
|
||||||
func (NULL);
|
func (NULL);
|
||||||
return;
|
return;
|
||||||
|
@ -92,7 +90,9 @@ RunThreadsOn (threadfunc_t func)
|
||||||
fprintf (stderr, "pthread_attr_setstacksize failed");
|
fprintf (stderr, "pthread_attr_setstacksize failed");
|
||||||
|
|
||||||
for (i = 0; i < numthreads; i++) {
|
for (i = 0; i < numthreads; i++) {
|
||||||
if (pthread_create (&work_threads[i], attrib, (pthread_startroutine_t) func, (pthread_addr_t) i) == -1)
|
if (pthread_create (&work_threads[i], attrib,
|
||||||
|
(pthread_startroutine_t) func,
|
||||||
|
(pthread_addr_t) i) == -1)
|
||||||
fprintf (stderr, "pthread_create failed");
|
fprintf (stderr, "pthread_create failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -85,11 +84,10 @@ by recursive subdivision of the line by the BSP tree.
|
||||||
void
|
void
|
||||||
MakeTnode (int nodenum)
|
MakeTnode (int nodenum)
|
||||||
{
|
{
|
||||||
tnode_t *t;
|
dnode_t *node;
|
||||||
dplane_t *plane;
|
dplane_t *plane;
|
||||||
int i;
|
int i;
|
||||||
dnode_t *node;
|
tnode_t *t;
|
||||||
|
|
||||||
|
|
||||||
t = tnode_p++;
|
t = tnode_p++;
|
||||||
|
|
||||||
|
@ -126,15 +124,12 @@ MakeTnodes (dmodel_t *bm)
|
||||||
qboolean
|
qboolean
|
||||||
TestLine (vec3_t start, vec3_t stop)
|
TestLine (vec3_t start, vec3_t stop)
|
||||||
{
|
{
|
||||||
int node;
|
float front, back, frontx, fronty, frontz, backx, backy, backz;
|
||||||
float front, back;
|
int node, side;
|
||||||
tracestack_t *tstack_p;
|
tracestack_t *tstack_p;
|
||||||
int side;
|
|
||||||
float frontx, fronty, frontz, backx, backy, backz;
|
|
||||||
tracestack_t tracestack[64];
|
tracestack_t tracestack[64];
|
||||||
tnode_t *tnode;
|
tnode_t *tnode;
|
||||||
|
|
||||||
|
|
||||||
frontx = start[0];
|
frontx = start[0];
|
||||||
fronty = start[1];
|
fronty = start[1];
|
||||||
frontz = start[2];
|
frontz = start[2];
|
||||||
|
@ -194,16 +189,14 @@ TestLine (vec3_t start, vec3_t stop)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (front > -ON_EPSILON && back > -ON_EPSILON)
|
if (front > -ON_EPSILON && back > -ON_EPSILON) {
|
||||||
// if (front > 0 && back > 0)
|
// if (front > 0 && back > 0) {
|
||||||
{
|
|
||||||
node = tnode->children[0];
|
node = tnode->children[0];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (front < ON_EPSILON && back < ON_EPSILON)
|
if (front < ON_EPSILON && back < ON_EPSILON) {
|
||||||
// if (front <= 0 && back <= 0)
|
// if (front <= 0 && back <= 0) {
|
||||||
{
|
|
||||||
node = tnode->children[1];
|
node = tnode->children[1];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -227,4 +220,3 @@ TestLine (vec3_t start, vec3_t stop)
|
||||||
node = tnode->children[side];
|
node = tnode->children[side];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -134,4 +134,3 @@ void PortalFlow (portal_t *portal);
|
||||||
void CalcAmbientSounds (void);
|
void CalcAmbientSounds (void);
|
||||||
|
|
||||||
#endif// __vis_h
|
#endif// __vis_h
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,6 @@ CheckStack (leaf_t *leaf, threaddata_t *thread)
|
||||||
{
|
{
|
||||||
pstack_t *p;
|
pstack_t *p;
|
||||||
|
|
||||||
|
|
||||||
for (p = thread->pstack_head.next; p; p = p->next)
|
for (p = thread->pstack_head.next; p; p = p->next)
|
||||||
if (p->leaf == leaf)
|
if (p->leaf == leaf)
|
||||||
fprintf (stderr, "CheckStack: leaf recursion");
|
fprintf (stderr, "CheckStack: leaf recursion");
|
||||||
|
@ -95,23 +94,22 @@ CheckStack (leaf_t *leaf, threaddata_t *thread)
|
||||||
*/
|
*/
|
||||||
winding_t *
|
winding_t *
|
||||||
ClipToSeperators (winding_t *source, winding_t *pass, winding_t *target,
|
ClipToSeperators (winding_t *source, winding_t *pass, winding_t *target,
|
||||||
qboolean flipclip)
|
qboolean flipclip)
|
||||||
{
|
{
|
||||||
int i, j, k, l;
|
|
||||||
plane_t plane;
|
|
||||||
vec3_t v1, v2;
|
|
||||||
float d;
|
float d;
|
||||||
vec_t length;
|
int i, j, k, l;
|
||||||
int counts[3];
|
int counts[3];
|
||||||
qboolean fliptest;
|
qboolean fliptest;
|
||||||
|
plane_t plane;
|
||||||
|
vec3_t v1, v2;
|
||||||
|
vec_t length;
|
||||||
|
|
||||||
// check all combinations
|
// check all combinations
|
||||||
for (i = 0; i < source->numpoints; i++) {
|
for (i = 0; i < source->numpoints; i++) {
|
||||||
l = (i + 1) % source->numpoints;
|
l = (i + 1) % source->numpoints;
|
||||||
VectorSubtract (source->points[l], source->points[i], v1);
|
VectorSubtract (source->points[l], source->points[i], v1);
|
||||||
|
|
||||||
// fing a vertex of pass that makes a plane that puts all of the
|
// find a vertex of pass that makes a plane that puts all of the
|
||||||
// vertexes of pass on the front side and all of the vertexes of
|
// vertexes of pass on the front side and all of the vertexes of
|
||||||
// source on the back side
|
// source on the back side
|
||||||
for (j = 0; j < pass->numpoints; j++) {
|
for (j = 0; j < pass->numpoints; j++) {
|
||||||
|
@ -212,14 +210,13 @@ void
|
||||||
RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
RecursiveLeafFlow (int leafnum, threaddata_t *thread, pstack_t *prevstack)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
|
leaf_t *leaf;
|
||||||
|
long *test, *might, *vis;
|
||||||
|
qboolean more;
|
||||||
pstack_t stack;
|
pstack_t stack;
|
||||||
portal_t *p;
|
portal_t *p;
|
||||||
plane_t backplane;
|
plane_t backplane;
|
||||||
winding_t *source, *target;
|
winding_t *source, *target;
|
||||||
leaf_t *leaf;
|
|
||||||
long *test, *might, *vis;
|
|
||||||
qboolean more;
|
|
||||||
|
|
||||||
|
|
||||||
c_chains++;
|
c_chains++;
|
||||||
|
|
||||||
|
@ -361,7 +358,6 @@ PortalFlow (portal_t *p)
|
||||||
{
|
{
|
||||||
threaddata_t data;
|
threaddata_t data;
|
||||||
|
|
||||||
|
|
||||||
if (p->status != stat_working)
|
if (p->status != stat_working)
|
||||||
fprintf (stderr, "PortalFlow: reflowed");
|
fprintf (stderr, "PortalFlow: reflowed");
|
||||||
p->status = stat_working;
|
p->status = stat_working;
|
||||||
|
@ -394,7 +390,6 @@ SimpleFlood (portal_t *srcportal, int leafnum)
|
||||||
leaf_t *leaf;
|
leaf_t *leaf;
|
||||||
portal_t *p;
|
portal_t *p;
|
||||||
|
|
||||||
|
|
||||||
if (srcportal->mightsee[leafnum >> 3] & (1 << (leafnum & 7)))
|
if (srcportal->mightsee[leafnum >> 3] & (1 << (leafnum & 7)))
|
||||||
return;
|
return;
|
||||||
srcportal->mightsee[leafnum >> 3] |= (1 << (leafnum & 7));
|
srcportal->mightsee[leafnum >> 3] |= (1 << (leafnum & 7));
|
||||||
|
@ -418,7 +413,6 @@ BasePortalVis (void)
|
||||||
portal_t *tp, *p;
|
portal_t *tp, *p;
|
||||||
winding_t *winding;
|
winding_t *winding;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0, p = portals; i < numportals * 2; i++, p++) {
|
for (i = 0, p = portals; i < numportals * 2; i++, p++) {
|
||||||
p->mightsee = malloc (bitbytes);
|
p->mightsee = malloc (bitbytes);
|
||||||
memset (p->mightsee, 0, bitbytes);
|
memset (p->mightsee, 0, bitbytes);
|
||||||
|
@ -459,4 +453,3 @@ BasePortalVis (void)
|
||||||
p->nummightsee = c_leafsee;
|
p->nummightsee = c_leafsee;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_STRING_H
|
#ifdef HAVE_STRING_H
|
||||||
# include <string.h>
|
# include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -68,22 +67,22 @@ static const char *short_options =
|
||||||
"f:" // file
|
"f:" // file
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
usage (int status)
|
usage (int status)
|
||||||
{
|
{
|
||||||
printf ("%s - QuakeForge PVS/PHS generation tool\n", this_program);
|
printf ("%s - QuakeForge PVS/PHS generation tool\n", this_program);
|
||||||
printf ("Usage: %s [options]\n", this_program);
|
printf ("Usage: %s [options]\n", this_program);
|
||||||
printf (
|
printf (
|
||||||
"Options:\n"
|
"Options:\n"
|
||||||
" -q, --quiet Inhibit usual output\n"
|
" -q, --quiet Inhibit usual output\n"
|
||||||
" -v, --verbose Display more output than usual\n"
|
" -v, --verbose Display more output than usual\n"
|
||||||
" -h, --help Display this help and exit\n"
|
" -h, --help Display this help and exit\n"
|
||||||
" -V, --version Output version information and exit\n"
|
" -V, --version Output version information and exit\n"
|
||||||
" -t, --threads [num] Number of threads to use\n"
|
" -t, --threads [num] Number of threads to use\n"
|
||||||
" -m, --minimal Perform minimal vis'ing\n"
|
" -m, --minimal Perform minimal vis'ing\n"
|
||||||
" -l, --level [level] Vis level to perform\n"
|
" -l, --level [level] Vis level to perform\n"
|
||||||
" -f, --file [bspfile] BSP file to vis\n\n"
|
" -f, --file [bspfile] BSP file to vis\n\n");
|
||||||
);
|
|
||||||
exit (status);
|
exit (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -94,7 +93,6 @@ NormalizePlane (plane_t *dp)
|
||||||
{
|
{
|
||||||
vec_t ax, ay, az;
|
vec_t ax, ay, az;
|
||||||
|
|
||||||
|
|
||||||
if (dp->normal[0] == -1.0) {
|
if (dp->normal[0] == -1.0) {
|
||||||
dp->normal[0] = 1.0;
|
dp->normal[0] = 1.0;
|
||||||
dp->dist = -dp->dist;
|
dp->dist = -dp->dist;
|
||||||
|
@ -143,7 +141,6 @@ PlaneFromWinding (winding_t *winding, plane_t *plane)
|
||||||
{
|
{
|
||||||
vec3_t v1, v2;
|
vec3_t v1, v2;
|
||||||
|
|
||||||
|
|
||||||
// calc plane
|
// calc plane
|
||||||
VectorSubtract (winding->points[2], winding->points[1], v1);
|
VectorSubtract (winding->points[2], winding->points[1], v1);
|
||||||
VectorSubtract (winding->points[0], winding->points[1], v2);
|
VectorSubtract (winding->points[0], winding->points[1], v2);
|
||||||
|
@ -158,7 +155,6 @@ NewWinding (int points)
|
||||||
winding_t *winding;
|
winding_t *winding;
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
|
||||||
if (points > MAX_POINTS_ON_WINDING)
|
if (points > MAX_POINTS_ON_WINDING)
|
||||||
fprintf (stderr, "NewWinding: %i points\n", points);
|
fprintf (stderr, "NewWinding: %i points\n", points);
|
||||||
|
|
||||||
|
@ -197,7 +193,6 @@ prl (leaf_t *leaf)
|
||||||
portal_t *portal;
|
portal_t *portal;
|
||||||
plane_t plane;
|
plane_t plane;
|
||||||
|
|
||||||
|
|
||||||
for (i = 0; i < leaf->numportals; i++) {
|
for (i = 0; i < leaf->numportals; i++) {
|
||||||
portal = leaf->portals[i];
|
portal = leaf->portals[i];
|
||||||
plane = portal->plane;
|
plane = portal->plane;
|
||||||
|
@ -214,7 +209,6 @@ CopyWinding (winding_t *winding)
|
||||||
int size;
|
int size;
|
||||||
winding_t *copy;
|
winding_t *copy;
|
||||||
|
|
||||||
|
|
||||||
size = (int) ((winding_t *) 0)->points[winding->numpoints];
|
size = (int) ((winding_t *) 0)->points[winding->numpoints];
|
||||||
copy = malloc (size);
|
copy = malloc (size);
|
||||||
memcpy (copy, winding, size);
|
memcpy (copy, winding, size);
|
||||||
|
@ -236,16 +230,14 @@ CopyWinding (winding_t *winding)
|
||||||
winding_t *
|
winding_t *
|
||||||
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
|
ClipWinding (winding_t *in, plane_t *split, qboolean keepon)
|
||||||
{
|
{
|
||||||
int i, j;
|
int maxpts, i, j;
|
||||||
vec_t dists[MAX_POINTS_ON_WINDING];
|
|
||||||
int sides[MAX_POINTS_ON_WINDING];
|
int sides[MAX_POINTS_ON_WINDING];
|
||||||
int counts[3];
|
int counts[3];
|
||||||
|
vec_t dists[MAX_POINTS_ON_WINDING];
|
||||||
vec_t dot;
|
vec_t dot;
|
||||||
vec_t *p1, *p2;
|
vec_t *p1, *p2;
|
||||||
vec3_t mid;
|
vec3_t mid;
|
||||||
winding_t *neww;
|
winding_t *neww;
|
||||||
int maxpts;
|
|
||||||
|
|
||||||
|
|
||||||
counts[0] = counts[1] = counts[2] = 0;
|
counts[0] = counts[1] = counts[2] = 0;
|
||||||
|
|
||||||
|
@ -337,7 +329,6 @@ GetNextPortal (void)
|
||||||
portal_t *p, *tp;
|
portal_t *p, *tp;
|
||||||
int min;
|
int min;
|
||||||
|
|
||||||
|
|
||||||
LOCK;
|
LOCK;
|
||||||
|
|
||||||
min = 99999;
|
min = 99999;
|
||||||
|
@ -358,11 +349,11 @@ GetNextPortal (void)
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
void *LeafThread (void *thread)
|
void *
|
||||||
|
LeafThread (void *thread)
|
||||||
{
|
{
|
||||||
portal_t *portal;
|
portal_t *portal;
|
||||||
|
|
||||||
|
|
||||||
do {
|
do {
|
||||||
portal = GetNextPortal ();
|
portal = GetNextPortal ();
|
||||||
if (!portal)
|
if (!portal)
|
||||||
|
@ -388,7 +379,6 @@ CompressRow (byte *vis, byte *dest)
|
||||||
int visrow;
|
int visrow;
|
||||||
byte *dest_p;
|
byte *dest_p;
|
||||||
|
|
||||||
|
|
||||||
dest_p = dest;
|
dest_p = dest;
|
||||||
visrow = (portalleafs + 7) >> 3;
|
visrow = (portalleafs + 7) >> 3;
|
||||||
|
|
||||||
|
@ -418,15 +408,12 @@ CompressRow (byte *vis, byte *dest)
|
||||||
void
|
void
|
||||||
LeafFlow (int leafnum)
|
LeafFlow (int leafnum)
|
||||||
{
|
{
|
||||||
int i, j;
|
byte *dest, *outbuffer;
|
||||||
leaf_t *leaf;
|
|
||||||
byte *outbuffer;
|
|
||||||
byte compressed[MAX_MAP_LEAFS / 8];
|
byte compressed[MAX_MAP_LEAFS / 8];
|
||||||
int numvis;
|
int numbvis, i, j;
|
||||||
byte *dest;
|
leaf_t *leaf;
|
||||||
portal_t *portal;
|
portal_t *portal;
|
||||||
|
|
||||||
|
|
||||||
// flow through all portals, collecting visible bits
|
// flow through all portals, collecting visible bits
|
||||||
outbuffer = uncompressed + leafnum * bitbytes;
|
outbuffer = uncompressed + leafnum * bitbytes;
|
||||||
leaf = &leafs[leafnum];
|
leaf = &leafs[leafnum];
|
||||||
|
@ -467,6 +454,7 @@ LeafFlow (int leafnum)
|
||||||
int d = dest - dvisdata;
|
int d = dest - dvisdata;
|
||||||
int p = vismap_p - dvisdata;
|
int p = vismap_p - dvisdata;
|
||||||
int e = vismap_end - dvisdata;
|
int e = vismap_end - dvisdata;
|
||||||
|
|
||||||
visdatasize = p;
|
visdatasize = p;
|
||||||
vismap = dvisdata = realloc (dvisdata, visdatasize);
|
vismap = dvisdata = realloc (dvisdata, visdatasize);
|
||||||
dest = dvisdata + d;
|
dest = dvisdata + d;
|
||||||
|
@ -485,7 +473,6 @@ CalcPortalVis (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
// fastvis just uses mightsee for a very loose bound
|
// fastvis just uses mightsee for a very loose bound
|
||||||
if (options.minimal) {
|
if (options.minimal) {
|
||||||
for (i = 0; i < numportals * 2; i++) {
|
for (i = 0; i < numportals * 2; i++) {
|
||||||
|
@ -507,8 +494,9 @@ CalcPortalVis (void)
|
||||||
my_mutex = malloc (sizeof (*my_mutex));
|
my_mutex = malloc (sizeof (*my_mutex));
|
||||||
if (pthread_mutexattr_init (&mattrib) == -1)
|
if (pthread_mutexattr_init (&mattrib) == -1)
|
||||||
fprintf (stderr, "pthread_mutex_attr_create failed\n");
|
fprintf (stderr, "pthread_mutex_attr_create failed\n");
|
||||||
//if (pthread_mutexattr_settype (&mattrib, PTHREAD_MUTEX_ADAPTIVE_NP) == -1)
|
// if (pthread_mutexattr_settype (&mattrib, PTHREAD_MUTEX_ADAPTIVE_NP)
|
||||||
// fprintf (stderr, "pthread_mutexattr_setkind_np failed\n");
|
// == -1)
|
||||||
|
// fprintf (stderr, "pthread_mutexattr_setkind_np failed\n");
|
||||||
if (pthread_mutex_init (my_mutex, &mattrib) == -1)
|
if (pthread_mutex_init (my_mutex, &mattrib) == -1)
|
||||||
fprintf (stderr, "pthread_mutex_init failed\n");
|
fprintf (stderr, "pthread_mutex_init failed\n");
|
||||||
if (pthread_attr_init (&attrib) == -1)
|
if (pthread_attr_init (&attrib) == -1)
|
||||||
|
@ -538,7 +526,6 @@ CalcPortalVis (void)
|
||||||
c_portalcheck, c_portaltest, c_portalpass);
|
c_portalcheck, c_portaltest, c_portalpass);
|
||||||
printf ("c_vistest: %i c_mighttest: %i\n", c_vistest, c_mighttest);
|
printf ("c_vistest: %i c_mighttest: %i\n", c_vistest, c_mighttest);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -546,9 +533,7 @@ CalcVis (void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
BasePortalVis ();
|
BasePortalVis ();
|
||||||
|
|
||||||
CalcPortalVis ();
|
CalcPortalVis ();
|
||||||
|
|
||||||
// assemble the leaf vis lists by oring and compressing the portal lists
|
// assemble the leaf vis lists by oring and compressing the portal lists
|
||||||
|
@ -564,7 +549,6 @@ PlaneCompare (plane_t *p1, plane_t *p2)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
|
||||||
if (fabs (p1->dist - p2->dist) > 0.01)
|
if (fabs (p1->dist - p2->dist) > 0.01)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -578,15 +562,14 @@ PlaneCompare (plane_t *p1, plane_t *p2)
|
||||||
sep_t *
|
sep_t *
|
||||||
Findpassages (winding_t *source, winding_t *pass)
|
Findpassages (winding_t *source, winding_t *pass)
|
||||||
{
|
{
|
||||||
|
double length;
|
||||||
|
float d;
|
||||||
|
int counts[3];
|
||||||
int i, j, k, l;
|
int i, j, k, l;
|
||||||
plane_t plane;
|
plane_t plane;
|
||||||
vec3_t v1, v2;
|
|
||||||
float d;
|
|
||||||
double length;
|
|
||||||
int counts[3];
|
|
||||||
qboolean fliptest;
|
qboolean fliptest;
|
||||||
sep_t *sep, *list;
|
sep_t *sep, *list;
|
||||||
|
vec3_t v1, v2;
|
||||||
|
|
||||||
list = NULL;
|
list = NULL;
|
||||||
|
|
||||||
|
@ -595,7 +578,7 @@ Findpassages (winding_t *source, winding_t *pass)
|
||||||
l = (i + 1) % source->numpoints;
|
l = (i + 1) % source->numpoints;
|
||||||
VectorSubtract (source->points[l], source->points[i], v1);
|
VectorSubtract (source->points[l], source->points[i], v1);
|
||||||
|
|
||||||
// fing a vertex of pass that makes a plane that puts all of the
|
// find a vertex of pass that makes a plane that puts all of the
|
||||||
// vertexes of pass on the front side and all of the vertexes of
|
// vertexes of pass on the front side and all of the vertexes of
|
||||||
// source on the back side
|
// source on the back side
|
||||||
for (j = 0; j < pass->numpoints; j++) {
|
for (j = 0; j < pass->numpoints; j++) {
|
||||||
|
@ -684,14 +667,12 @@ Findpassages (winding_t *source, winding_t *pass)
|
||||||
void
|
void
|
||||||
CalcPassages (void)
|
CalcPassages (void)
|
||||||
{
|
{
|
||||||
int i, j, k;
|
int count, count2, i, j, k;
|
||||||
int count, count2;
|
|
||||||
leaf_t *leaf;
|
leaf_t *leaf;
|
||||||
portal_t *p1, *p2;
|
portal_t *p1, *p2;
|
||||||
sep_t *sep;
|
sep_t *sep;
|
||||||
passage_t *passages;
|
passage_t *passages;
|
||||||
|
|
||||||
|
|
||||||
if (options.verbosity >= 0)
|
if (options.verbosity >= 0)
|
||||||
printf ("building passages...\n");
|
printf ("building passages...\n");
|
||||||
|
|
||||||
|
@ -740,16 +721,14 @@ CalcPassages (void)
|
||||||
void
|
void
|
||||||
LoadPortals (char *name)
|
LoadPortals (char *name)
|
||||||
{
|
{
|
||||||
int i, j;
|
|
||||||
portal_t *portal;
|
|
||||||
leaf_t *leaf;
|
|
||||||
winding_t *winding;
|
|
||||||
plane_t plane;
|
|
||||||
char magic[80];
|
char magic[80];
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int numpoints;
|
|
||||||
int leafnums[2];
|
int leafnums[2];
|
||||||
|
int numpoints, i, j;
|
||||||
|
leaf_t *leaf;
|
||||||
|
plane_t plane;
|
||||||
|
portal_t *portal;
|
||||||
|
winding_t *winding;
|
||||||
|
|
||||||
if (!strcmp (name, "-"))
|
if (!strcmp (name, "-"))
|
||||||
f = stdin;
|
f = stdin;
|
||||||
|
@ -792,7 +771,8 @@ LoadPortals (char *name)
|
||||||
&leafnums[1]) != 3)
|
&leafnums[1]) != 3)
|
||||||
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
|
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
|
||||||
if (numpoints > MAX_POINTS_ON_WINDING)
|
if (numpoints > MAX_POINTS_ON_WINDING)
|
||||||
fprintf (stderr, "LoadPortals: portal %i has too many points\n", i);
|
fprintf (stderr, "LoadPortals: portal %i has too many points\n",
|
||||||
|
i);
|
||||||
if ((unsigned) leafnums[0] > portalleafs
|
if ((unsigned) leafnums[0] > portalleafs
|
||||||
|| (unsigned) leafnums[1] > portalleafs)
|
|| (unsigned) leafnums[1] > portalleafs)
|
||||||
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
|
fprintf (stderr, "LoadPortals: reading portal %i\n", i);
|
||||||
|
@ -802,7 +782,6 @@ LoadPortals (char *name)
|
||||||
winding->numpoints = numpoints;
|
winding->numpoints = numpoints;
|
||||||
|
|
||||||
for (j = 0; j < numpoints; j++) {
|
for (j = 0; j < numpoints; j++) {
|
||||||
|
|
||||||
double v[3];
|
double v[3];
|
||||||
int k;
|
int k;
|
||||||
|
|
||||||
|
@ -864,7 +843,6 @@ main (int argc, char **argv)
|
||||||
usage (1);
|
usage (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
COM_StripExtension (options.bspfile, options.bspfile);
|
COM_StripExtension (options.bspfile, options.bspfile);
|
||||||
COM_DefaultExtension (options.bspfile, ".bsp");
|
COM_DefaultExtension (options.bspfile, ".bsp");
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,6 @@ static const char rcsid[] =
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#ifdef HAVE_UNISTD_H
|
#ifdef HAVE_UNISTD_H
|
||||||
|
@ -69,9 +68,7 @@ static const char rcsid[] =
|
||||||
void
|
void
|
||||||
SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs)
|
SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs)
|
||||||
{
|
{
|
||||||
int i, j;
|
int vi, e, i, j;
|
||||||
int e;
|
|
||||||
int vi;
|
|
||||||
float *v;
|
float *v;
|
||||||
|
|
||||||
mins[0] = mins[1] = 999999;
|
mins[0] = mins[1] = 999999;
|
||||||
|
@ -97,18 +94,15 @@ SurfaceBBox (dface_t *s, vec3_t mins, vec3_t maxs)
|
||||||
void
|
void
|
||||||
CalcAmbientSounds (void)
|
CalcAmbientSounds (void)
|
||||||
{
|
{
|
||||||
int i, j, k, l;
|
|
||||||
dleaf_t *leaf, *hit;
|
|
||||||
byte *vis;
|
byte *vis;
|
||||||
dface_t *surf;
|
dface_t *surf;
|
||||||
|
dleaf_t *leaf, *hit;
|
||||||
|
float maxd, vol, d;
|
||||||
|
float dists[NUM_AMBIENTS];
|
||||||
|
int ambient_type, ofs, i, j, k, l;
|
||||||
vec3_t mins, maxs;
|
vec3_t mins, maxs;
|
||||||
float d, maxd;
|
|
||||||
int ambient_type;
|
|
||||||
texinfo_t *info;
|
texinfo_t *info;
|
||||||
miptex_t *miptex;
|
miptex_t *miptex;
|
||||||
int ofs;
|
|
||||||
float dists[NUM_AMBIENTS];
|
|
||||||
float vol;
|
|
||||||
|
|
||||||
for (i = 0; i < portalleafs; i++) {
|
for (i = 0; i < portalleafs; i++) {
|
||||||
leaf = &dleafs[i + 1];
|
leaf = &dleafs[i + 1];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue