Split out the surface offset code.

This tidies up LightWorld a little.
This commit is contained in:
Bill Currie 2012-12-26 17:14:07 +09:00
parent 48809404b1
commit 5fc8d1eb26

View file

@ -134,17 +134,13 @@ LightThread (void *l)
}
static void
LightWorld (void)
FindFaceOffsets (void)
{
int i, j;
vec3_t org;
entity_t *ent;
vec3_t org;
const char *name;
lightdata = dstring_new ();
rgblightdata = dstring_new ();
surfacelightchain = (lightchain_t **) calloc (bsp->numfaces,
sizeof (lightchain_t *));
surfaceorgs = (vec3_t *) calloc (bsp->numfaces, sizeof (vec3_t));
for (i = 1; i < bsp->nummodels; i++) {
@ -156,8 +152,17 @@ LightWorld (void)
if (!strncmp (ValueForKey (ent, "classname"), "rotate_", 7))
GetVectorForKey (ent, "origin", org);
for (j = 0; j < bsp->models[i].numfaces; j++)
VectorCopy (org, surfaceorgs[i]);
VectorCopy (org, surfaceorgs[bsp->models[i].firstface]);
}
}
static void
LightWorld (void)
{
lightdata = dstring_new ();
rgblightdata = dstring_new ();
surfacelightchain = (lightchain_t **) calloc (bsp->numfaces,
sizeof (lightchain_t *));
VisThread (0); // not worth threading :/
VisStats ();
@ -205,6 +210,7 @@ main (int argc, char **argv)
MakeTnodes (&bsp->models[0]);
FindFaceOffsets ();
LightWorld ();
WriteEntitiesToString ();