mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
A couple of miscellaneous cleanups.
defs.c: sync some dup'd code for 'definevoxel' and 'voxel' DEF tokens. engine.c: factor out PolymerProcessModels(). git-svn-id: https://svn.eduke32.com/eduke32@4835 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
3a6bcdc102
commit
bd93fd2aab
2 changed files with 54 additions and 38 deletions
|
@ -920,7 +920,7 @@ static int32_t defsparser(scriptfile *script)
|
|||
|
||||
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS))
|
||||
{
|
||||
initprintf("Maximum number of voxels already defined.\n");
|
||||
initprintf("Maximum number of voxels (%d) already defined.\n", MAXVOXELS);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1421,9 +1421,21 @@ static int32_t defsparser(scriptfile *script)
|
|||
{ "scale", T_SCALE },
|
||||
};
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(scriptfile_getstring(script,&fn))) break; //voxel filename
|
||||
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS)) { initprintf("Maximum number of voxels already defined.\n"); break; }
|
||||
if (EDUKE32_PREDICT_FALSE(qloadkvx(nextvoxid, fn))) { initprintf("Failure loading voxel file \"%s\"\n",fn); break; }
|
||||
if (EDUKE32_PREDICT_FALSE(scriptfile_getstring(script,&fn)))
|
||||
break; //voxel filename
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(nextvoxid == MAXVOXELS))
|
||||
{
|
||||
initprintf("Maximum number of voxels (%d) already defined.\n", MAXVOXELS);
|
||||
break;
|
||||
}
|
||||
|
||||
if (EDUKE32_PREDICT_FALSE(qloadkvx(nextvoxid, fn)))
|
||||
{
|
||||
initprintf("Failure loading voxel file \"%s\"\n",fn);
|
||||
break;
|
||||
}
|
||||
|
||||
lastvoxid = nextvoxid++;
|
||||
|
||||
if (scriptfile_getbraces(script,&modelend)) break;
|
||||
|
|
|
@ -17682,6 +17682,35 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
|
|||
}
|
||||
|
||||
|
||||
#ifdef POLYMER
|
||||
static void PolymerProcessModels(void)
|
||||
{
|
||||
// potentially deferred MD3 postprocessing
|
||||
for (int32_t i=0; i<nextmodelid; i++)
|
||||
{
|
||||
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
|
||||
{
|
||||
static int32_t warned=0;
|
||||
|
||||
if (!warned)
|
||||
{
|
||||
OSD_Printf("Post-processing MD3 models for Polymer. This may take a while...\n");
|
||||
nextpage();
|
||||
warned = 1;
|
||||
}
|
||||
|
||||
if (!md3postload_polymer((md3model_t *)models[i]))
|
||||
OSD_Printf("INTERNAL ERROR: mdmodel %s failed postprocessing!\n",
|
||||
((md3model_t *)models[i])->head.nam);
|
||||
|
||||
if (((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
|
||||
OSD_Printf("INTERNAL ERROR: wtf?\n");
|
||||
}
|
||||
// else
|
||||
// OSD_Printf("mdmodel %d already postprocessed.\n", i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
// setrendermode
|
||||
|
@ -17689,42 +17718,20 @@ int32_t screencapture(const char *filename, char inverseit, const char *versions
|
|||
int32_t setrendermode(int32_t renderer)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(renderer);
|
||||
|
||||
#ifdef USE_OPENGL
|
||||
if (bpp == 8) renderer = 0;
|
||||
if (bpp == 8)
|
||||
renderer = REND_CLASSIC;
|
||||
# ifdef POLYMER
|
||||
else renderer = min(4,max(3,renderer));
|
||||
else
|
||||
renderer = clamp(renderer, REND_POLYMOST, REND_POLYMER);
|
||||
|
||||
if (renderer == 4)
|
||||
if (renderer == REND_POLYMER)
|
||||
{
|
||||
int32_t i;
|
||||
|
||||
// potentially deferred MD3 postprocessing
|
||||
for (i=0; i<nextmodelid; i++)
|
||||
{
|
||||
if (models[i]->mdnum==3 && ((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
|
||||
{
|
||||
static int32_t warned=0;
|
||||
|
||||
if (!warned)
|
||||
{
|
||||
OSD_Printf("Post-processing MD3 models for Polymer. This can take a while...\n");
|
||||
nextpage();
|
||||
warned = 1;
|
||||
}
|
||||
|
||||
if (!md3postload_polymer((md3model_t *)models[i]))
|
||||
OSD_Printf("INTERNAL ERROR: mdmodel %s failed postprocessing!\n",
|
||||
((md3model_t *)models[i])->head.nam);
|
||||
|
||||
if (((md3model_t *)models[i])->head.surfs[0].geometry == NULL)
|
||||
OSD_Printf("INTERNAL ERROR: wtf?\n");
|
||||
}
|
||||
// else
|
||||
// OSD_Printf("mdmodel %d already postprocessed.\n", i);
|
||||
}
|
||||
PolymerProcessModels();
|
||||
|
||||
if (!polymer_init())
|
||||
renderer = 3;
|
||||
renderer = REND_POLYMOST;
|
||||
}
|
||||
else if (getrendermode() == REND_POLYMER) // going from Polymer to another renderer
|
||||
{
|
||||
|
@ -17732,8 +17739,6 @@ int32_t setrendermode(int32_t renderer)
|
|||
G_Polymer_UnInit();
|
||||
polymer_uninit();
|
||||
}
|
||||
# else
|
||||
else renderer = 3;
|
||||
# endif
|
||||
|
||||
basepalreset = 1;
|
||||
|
@ -17752,7 +17757,7 @@ int32_t setrendermode(int32_t renderer)
|
|||
#ifdef USE_OPENGL
|
||||
void setrollangle(int32_t rolla)
|
||||
{
|
||||
gtang = (float) rolla * PI * (1.f/1024.f);
|
||||
gtang = (float)rolla * PI * (1.f/1024.f);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -17796,7 +17801,6 @@ void invalidatetile(int16_t tilenume, int32_t pal, int32_t how)
|
|||
if (getrendermode() == REND_POLYMER)
|
||||
polymer_invalidateartmap(tilenume);
|
||||
#endif
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue