Browse Source

Additional debugging output

master
Nico de Poel 3 years ago
parent
commit
f5ffefce4c
  1. 7
      lighting.cpp
  2. 9
      main.cpp

7
lighting.cpp

@ -399,7 +399,12 @@ unsigned char compute_faceVertex_light5(const world_t* world, const face_t* refF
} }
if (!numSamples) if (!numSamples)
return 0; // Shouldn't happen
{
// This really shouldn't happen. At the very least we should get a sample from the reference face, which this point originates from.
// The most common cause of issues here are floating point rounding errors in world->facesWithPoint
printf("Couldn't get any light samples for point (%.2f, %.2f, %.2f)! This is definitely a bug and should be looked at!\n", point.x, point.y, point.z);
return 0;
}
// We should always end up with at least one sample (that from refFace itself), so if we divide by zero here something is very much wrong // We should always end up with at least one sample (that from refFace itself), so if we divide by zero here something is very much wrong
return (unsigned char)(light / numSamples); return (unsigned char)(light / numSamples);

9
main.cpp

@ -430,6 +430,15 @@ int process_faces(const world_t* world, const TextureList& textures)
int process_bsp(const world_t *world) int process_bsp(const world_t *world)
{ {
FILE* fents;
sprintf_s(path, _MAX_PATH, "%s.ents", world->name);
fopen_s(&fents, path, "w");
if (fents)
{
fwrite(world->entities, sizeof(char), world->entitiesLength, fents);
fclose(fents);
}
// Test exporting texture data // Test exporting texture data
TextureList textures; TextureList textures;
if (!process_textures(world, textures)) if (!process_textures(world, textures))

Loading…
Cancel
Save