Show relight times, cos why not. Fix hdr pre-relight levels.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6014 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-08-09 23:06:23 +00:00
parent 04849bce16
commit b76d139a58
2 changed files with 8 additions and 7 deletions

View file

@ -1950,7 +1950,7 @@ void Mod_LoadLighting (model_t *loadmodel, bspx_header_t *bspx, qbyte *mod_base,
if (lumdata) if (lumdata)
{ {
for (i = 0; i < samples; i++) for (i = 0; i < samples; i++)
ergb[i] = 15<<27 | lumdata[i]<<18 | lumdata[i]<<9 << lumdata[i]<<0; ergb[i] = (17u<<27) | (lumdata[i]<<18) | (lumdata[i]<<9) | (lumdata[i]<<0);
lumdata = NULL; lumdata = NULL;
} }
} }

View file

@ -23,6 +23,7 @@ struct relight_ctx_s
qboolean parsed; //ents have been parsed okay. qboolean parsed; //ents have been parsed okay.
qboolean loaded; //needed models are all loaded. qboolean loaded; //needed models are all loaded.
double starttime;
float minlight; float minlight;
qboolean skiplit; //lux only qboolean skiplit; //lux only
qboolean shadows; qboolean shadows;
@ -139,6 +140,7 @@ struct relight_ctx_s *LightStartup(struct relight_ctx_s *ctx, model_t *model, qb
} }
if (ctx->nummodels < countof(ctx->models)) if (ctx->nummodels < countof(ctx->models))
ctx->models[ctx->nummodels++] = model; ctx->models[ctx->nummodels++] = model;
ctx->starttime = Sys_DoubleTime();
return ctx; return ctx;
} }
void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles) void LightReloadEntities(struct relight_ctx_s *ctx, const char *entstring, qboolean ignorestyles)
@ -1132,17 +1134,16 @@ void RelightTerminate(model_t *mod)
qboolean RelightSetup (model_t *model, size_t lightsamples, qboolean generatelit) qboolean RelightSetup (model_t *model, size_t lightsamples, qboolean generatelit)
{ {
qboolean ret = false;
Sys_LockMutex(com_resourcemutex); //models can be loaded on different threads, so no race conditions please. Sys_LockMutex(com_resourcemutex); //models can be loaded on different threads, so no race conditions please.
if (!lightcontext) if (!lightcontext)
{ {
lightcontext = LightStartup(NULL, model, true, !generatelit); lightcontext = LightStartup(NULL, model, true, !generatelit);
lightcontext->lightmapsamples = lightsamples; lightcontext->lightmapsamples = lightsamples;
Sys_UnlockMutex(com_resourcemutex); ret = true;
return true;
} }
Sys_UnlockMutex(com_resourcemutex); Sys_UnlockMutex(com_resourcemutex);
return ret;
return false;
} }
const char *RelightGetProgress(float *progress) const char *RelightGetProgress(float *progress)
@ -1231,9 +1232,9 @@ void RelightThink (void)
#endif #endif
if (lightcontext->nextface >= lightmodel->numsurfaces) if (lightcontext->nextface >= lightmodel->numsurfaces)
{ {
Con_Printf("Finished lighting %s\n", lightmodel->name); double starttime = lightcontext->starttime;
RelightTerminate(lightmodel); RelightTerminate(lightmodel);
Con_Printf("Finished lighting %s, took %.1f seconds\n", lightmodel->name, Sys_DoubleTime()-starttime);
} }
} }
} }