- Added a PrecacheTexture virtual function to DFrameBuffer because it's the

renderer which should decide how to precache a texture.


SVN r723 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-28 10:23:18 +00:00
parent ebbe9c84f8
commit 465bcfd199
5 changed files with 29 additions and 14 deletions

View file

@ -1,4 +1,6 @@
January 27, 2008 (Changes by Graf Zahl) January 27, 2008 (Changes by Graf Zahl)
- Added a PrecacheTexture virtual function to DFrameBuffer because it's the
renderer which should decide how to precache a texture.
- Added SnowKate709's APROP_MaxHealth submission. - Added SnowKate709's APROP_MaxHealth submission.
- Fixed: FTexture::GetScaledWidth/Height always rounded down which could result in - Fixed: FTexture::GetScaledWidth/Height always rounded down which could result in
imprecisions (e.g. when scaling from 128 to 96.) imprecisions (e.g. when scaling from 128 to 96.)

View file

@ -485,18 +485,7 @@ void R_PrecacheLevel (void)
for (i = TexMan.NumTextures() - 1; i >= 0; i--) for (i = TexMan.NumTextures() - 1; i >= 0; i--)
{ {
FTexture *tex = TexMan[i]; screen->PrecacheTexture(TexMan[i], !!hitlist[i]);
if (tex != NULL)
{
if (hitlist[i])
{
tex->GetPixels ();
}
else
{
tex->Unload ();
}
}
} }
delete[] hitlist; delete[] hitlist;

View file

@ -844,8 +844,6 @@ private:
TArray<WORD> Translation; TArray<WORD> Translation;
WORD HashFirst[HASH_SIZE]; WORD HashFirst[HASH_SIZE];
int DefaultTexture; int DefaultTexture;
friend void R_InitData ();
}; };
extern FTextureManager TexMan; extern FTextureManager TexMan;

View file

@ -1316,6 +1316,27 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
} }
} }
//===========================================================================
//
// Texture precaching
//
//===========================================================================
void DFrameBuffer::PrecacheTexture(FTexture *tex, bool cache)
{
if (tex != NULL)
{
if (cache)
{
tex->GetPixels ();
}
else
{
tex->Unload ();
}
}
}
//=========================================================================== //===========================================================================
// //
// Render the view // Render the view

View file

@ -49,6 +49,8 @@
extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac; extern int CleanWidth, CleanHeight, CleanXfac, CleanYfac;
extern int DisplayWidth, DisplayHeight, DisplayBits; extern int DisplayWidth, DisplayHeight, DisplayBits;
bool V_DoModeSetup (int width, int height, int bits);
class FTexture; class FTexture;
// TagItem definitions for DrawTexture. As far as I know, tag lists // TagItem definitions for DrawTexture. As far as I know, tag lists
@ -375,6 +377,9 @@ public:
const BYTE *patch, int pix_width, int pix_height, const BYTE *patch, int pix_width, int pix_height,
int step_x, int step_y, PalEntry * palette); int step_x, int step_y, PalEntry * palette);
// Precaches or unloads a texture
virtual void PrecacheTexture(FTexture *tex, bool cache);
// Screen wiping // Screen wiping
virtual bool WipeStartScreen(int type); virtual bool WipeStartScreen(int type);
virtual void WipeEndScreen(); virtual void WipeEndScreen();