mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-28 04:20:45 +00:00
- make sure voxels are being precached.
In Blood's case it also needs to check the game-side array to find everything.
This commit is contained in:
parent
32250f704f
commit
e5e23cd63c
1 changed files with 24 additions and 27 deletions
|
@ -32,13 +32,19 @@
|
||||||
**---------------------------------------------------------------------------
|
**---------------------------------------------------------------------------
|
||||||
**
|
**
|
||||||
*/
|
*/
|
||||||
|
#include "ns.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "palette.h"
|
#include "palette.h"
|
||||||
#include "v_video.h"
|
#include "v_video.h"
|
||||||
#include "hw_material.h"
|
#include "hw_material.h"
|
||||||
|
#include "gamestruct.h"
|
||||||
|
#include "gamecontrol.h"
|
||||||
#include "glbackend/gl_models.h"
|
#include "glbackend/gl_models.h"
|
||||||
|
|
||||||
|
BEGIN_BLD_NS
|
||||||
|
extern short voxelIndex[MAXTILES];
|
||||||
|
END_BLD_NS
|
||||||
|
|
||||||
static void PrecacheTex(FGameTexture* tex, int palid)
|
static void PrecacheTex(FGameTexture* tex, int palid)
|
||||||
{
|
{
|
||||||
if (!tex || !tex->isValid()) return;
|
if (!tex || !tex->isValid()) return;
|
||||||
|
@ -49,31 +55,29 @@ static void PrecacheTex(FGameTexture* tex, int palid)
|
||||||
screen->PrecacheMaterial(mat, palid);
|
screen->PrecacheMaterial(mat, palid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void doprecache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
static void doprecache(int picnum, int palette)
|
||||||
{
|
{
|
||||||
// dapicnum and dapalnum are like you'd expect
|
if ((palette < (MAXPALOOKUPS - RESERVEDPALS)) && (!lookups.checkTable(palette))) return;
|
||||||
// datype is 0 for a wall/floor/ceiling and 1 for a sprite
|
|
||||||
// basically this just means walls are repeating
|
|
||||||
// while sprites are clamped
|
|
||||||
|
|
||||||
if ((dapalnum < (MAXPALOOKUPS - RESERVEDPALS)) && (!lookups.checkTable(dapalnum))) return;//dapalnum = 0;
|
int palid = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||||
|
auto tex = tileGetTexture(picnum);
|
||||||
//Printf("precached %d %d type %d\n", dapicnum, dapalnum, datype);
|
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
|
||||||
auto tex = tileGetTexture(dapicnum);
|
|
||||||
PrecacheTex(tex, palid);
|
PrecacheTex(tex, palid);
|
||||||
|
|
||||||
if (datype == 0 || !hw_models) return;
|
if (!hw_models) return;
|
||||||
|
|
||||||
int const mid = md_tilehasmodel(dapicnum, dapalnum);
|
int const mid = md_tilehasmodel(picnum, palette);
|
||||||
|
|
||||||
if (mid < 0 || models[mid]->mdnum < 2)
|
if (mid < 0 || models[mid]->mdnum < 2)
|
||||||
{
|
{
|
||||||
int vox = tiletovox[dapicnum];
|
if (r_voxels)
|
||||||
if (vox != -1 && voxmodels[vox] && voxmodels[vox]->model)
|
|
||||||
{
|
{
|
||||||
FHWModelRenderer mr(*screen->RenderState(), 0);
|
int vox = tiletovox[picnum];
|
||||||
voxmodels[vox]->model->BuildVertexBuffer(&mr);
|
if (vox == -1 && isBlood()) vox = Blood::voxelIndex[picnum];
|
||||||
|
if (vox != -1 && voxmodels[vox] && voxmodels[vox]->model)
|
||||||
|
{
|
||||||
|
FHWModelRenderer mr(*screen->RenderState(), 0);
|
||||||
|
voxmodels[vox]->model->BuildVertexBuffer(&mr);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -82,19 +86,12 @@ static void doprecache(int32_t dapicnum, int32_t dapalnum, int32_t datype)
|
||||||
|
|
||||||
for (int i = 0; i <= surfaces; i++)
|
for (int i = 0; i <= surfaces; i++)
|
||||||
{
|
{
|
||||||
auto tex = mdloadskin((md2model_t *)models[mid], 0, dapalnum, i, nullptr);
|
auto tex = mdloadskin((md2model_t *)models[mid], 0, palette, i, nullptr);
|
||||||
int palid = TRANSLATION(Translation_Remap + curbasepal, dapalnum);
|
int palid = TRANSLATION(Translation_Remap + curbasepal, palette);
|
||||||
if (tex) PrecacheTex(tex, palid);
|
if (tex) PrecacheTex(tex, palid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrecacheHardwareTextures(int nTile)
|
|
||||||
{
|
|
||||||
// PRECACHE
|
|
||||||
// This really *really* needs improvement on the game side - the entire precaching logic has no clue about the different needs of a hardware renderer.
|
|
||||||
doprecache(nTile, 0, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
TMap<int64_t, bool> cachemap;
|
TMap<int64_t, bool> cachemap;
|
||||||
|
|
||||||
|
@ -128,7 +125,7 @@ void precacheMarkedTiles()
|
||||||
{
|
{
|
||||||
int dapicnum = pair->Key & 0x7fffffff;
|
int dapicnum = pair->Key & 0x7fffffff;
|
||||||
int dapalnum = pair->Key >> 32;
|
int dapalnum = pair->Key >> 32;
|
||||||
doprecache(dapicnum, dapalnum, 0);
|
doprecache(dapicnum, dapalnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue