"anorms.h" - Both WinQuake and GLQuake use (I see no evidence of FitzQuake using this at all during rendering or light calculation). All the numbers are between 0 and 1, some negative. So these are angle vectors (the x,y,z slope) for each vertice?
Code: Select all
#define NUMVERTEXNORMALS 162
float r_avertexnormals[NUMVERTEXNORMALS][3]
...
{-0.525731f, 0.000000f, 0.850651f},
{-0.442863f, 0.238856f, 0.864188f},
Why are there 162 of these? Is some data compressed to a byte in the model? Can this be reduced to code instead of a header file?
"anorms_dots.h" - Only GLQuake use. I think MH said somewhere he has something that generates this in code.
Code: Select all
// precalculated dot products for quantized angles
#define SHADEDOT_QUANT 16
float r_avertexnormal_dots[SHADEDOT_QUANT][256] =
#include "anorm_dots.h"
;
float *shadedots = r_avertexnormal_dots[0];
shadedots = r_avertexnormal_dots[((int)(ent->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
And then the table is applied to each vertex during draw:
Code: Select all
vertcolor[0] = shadedots[verts1->lightnormalindex] * lightcolor[0];
vertcolor[1] = shadedots[verts1->lightnormalindex] * lightcolor[1];
vertcolor[2] = shadedots[verts1->lightnormalindex] * lightcolor[2];
glColor4fv (vertcolor);
Code: Select all
pframe[j].lightnormalindex = pinframe[j].lightnormalindex;