From 1612d60a5f6b4dc5e50ec503895ce219ce4dd808 Mon Sep 17 00:00:00 2001 From: Kevin Shanahan Date: Sun, 18 Aug 2013 16:52:19 +0930 Subject: [PATCH] light: keep debug helper for dumping face info Used this to help with debugging, but may as well keep it around for future debugging rather than implement it all over again next time. Signed-off-by: Kevin Shanahan --- light/ltface.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/light/ltface.c b/light/ltface.c index 030c0312..e172633d 100644 --- a/light/ltface.c +++ b/light/ltface.c @@ -316,6 +316,35 @@ WorldToTexCoord(const vec3_t world, const texinfo_t *tex, vec_t coord[2]) world[2] * tex->vecs[i][2] + tex->vecs[i][3]; } +#if 0 +/* Debug helper - move elsewhere? */ +static void +PrintFaceInfo(const dface_t *face) +{ + const texinfo_t *tex = &texinfo[face->texinfo]; + const int offset = dtexdata.header->dataofs[tex->miptex]; + const miptex_t *miptex = (const miptex_t *)(dtexdata.base + offset); + int i; + + logprint("face %d, texture %s, %d edges...\n" + " vectors (%3.3f, %3.3f, %3.3f) (%3.3f)\n" + " (%3.3f, %3.3f, %3.3f) (%3.3f)\n", + (int)(face - dfaces), miptex->name, face->numedges, + tex->vecs[0][0], tex->vecs[0][1], tex->vecs[0][2], tex->vecs[0][3], + tex->vecs[1][0], tex->vecs[1][1], tex->vecs[1][2], tex->vecs[1][3]); + + for (i = 0; i < face->numedges; i++) { + int edge = dsurfedges[face->firstedge + i]; + int vert = (edge >= 0) ? dedges[edge].v[0] : dedges[-edge].v[1]; + const float *point = dvertexes[vert].point; + + logprint("%s %3d (%3.3f, %3.3f, %3.3f) :: edge %d\n", + i ? " " : " verts ", vert, + point[0], point[1], point[2], edge); + } +} +#endif + /* * ================ * CalcFaceExtents