mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-25 05:31:00 +00:00
- moved the material class to 'common' as well.
This commit is contained in:
parent
580e463498
commit
65f15e1147
7 changed files with 53 additions and 59 deletions
|
@ -973,7 +973,6 @@ set (PCH_SOURCES
|
|||
rendering/hwrenderer/postprocessing/hw_postprocess.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocess_cvars.cpp
|
||||
rendering/hwrenderer/postprocessing/hw_postprocessshader.cpp
|
||||
rendering/hwrenderer/textures/hw_material.cpp
|
||||
rendering/hwrenderer/textures/hw_precache.cpp
|
||||
rendering/hwrenderer/utility/hw_clock.cpp
|
||||
rendering/hwrenderer/utility/hw_cvars.cpp
|
||||
|
@ -1080,6 +1079,7 @@ set (PCH_SOURCES
|
|||
common/audio/music/music_config.cpp
|
||||
common/thirdparty/sfmt/SFMT.cpp
|
||||
common/textures/hw_ihwtexture.cpp
|
||||
common/textures/hw_material.cpp
|
||||
common/textures/bitmap.cpp
|
||||
common/textures/m_png.cpp
|
||||
common/textures/texture.cpp
|
||||
|
|
|
@ -22,14 +22,14 @@
|
|||
|
||||
#include "filesystem.h"
|
||||
#include "m_png.h"
|
||||
#include "sbar.h"
|
||||
#include "stats.h"
|
||||
#include "r_utility.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "v_video.h"
|
||||
#include "hw_ihwtexture.h"
|
||||
#include "hw_material.h"
|
||||
#include "texturemanager.h"
|
||||
#include "c_cvars.h"
|
||||
|
||||
EXTERN_CVAR(Bool, gl_texture_usehires)
|
||||
IHardwareTexture* CreateHardwareTexture();
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
|
@ -302,7 +302,7 @@ IHardwareTexture *FMaterial::GetLayer(int i, int translation, FTexture **pLayer)
|
|||
IHardwareTexture *hwtex = layer->SystemTextures.GetHardwareTexture(translation, mExpanded);
|
||||
if (hwtex == nullptr)
|
||||
{
|
||||
hwtex = screen->CreateHardwareTexture();
|
||||
hwtex = CreateHardwareTexture();
|
||||
layer->SystemTextures.AddHardwareTexture(translation, mExpanded, hwtex);
|
||||
}
|
||||
return hwtex;
|
||||
|
@ -310,29 +310,6 @@ IHardwareTexture *FMaterial::GetLayer(int i, int translation, FTexture **pLayer)
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
void FMaterial::Precache()
|
||||
{
|
||||
screen->PrecacheMaterial(this, 0);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
void FMaterial::PrecacheList(SpriteHits &translations)
|
||||
{
|
||||
tex->SystemTextures.CleanUnused(translations, mExpanded);
|
||||
SpriteHits::Iterator it(translations);
|
||||
SpriteHits::Pair *pair;
|
||||
while(it.NextPair(pair)) screen->PrecacheMaterial(this, pair->Key);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
|
@ -399,6 +376,12 @@ FMaterial * FMaterial::ValidateTexture(FTextureID no, bool expand, bool translat
|
|||
}
|
||||
|
||||
|
||||
void DeleteMaterial(FMaterial* mat)
|
||||
{
|
||||
delete mat;
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Make sprite offset adjustment user-configurable per renderer.
|
||||
|
@ -425,26 +408,3 @@ CUSTOM_CVAR(Int, r_spriteadjust, 2, CVAR_ARCHIVE | CVAR_GLOBALCONFIG)
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// this must be copied back to textures.cpp later.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
||||
{
|
||||
Width = w;
|
||||
Height = h;
|
||||
Format = bits;
|
||||
UseType = ETextureType::SWCanvas;
|
||||
bNoCompress = true;
|
||||
auto hwtex = screen->CreateHardwareTexture();
|
||||
// todo: Initialize here.
|
||||
SystemTextures.AddHardwareTexture(0, false, hwtex);
|
||||
}
|
||||
|
||||
void DeleteMaterial(FMaterial* mat)
|
||||
{
|
||||
delete mat;
|
||||
}
|
|
@ -5,10 +5,7 @@
|
|||
#include "m_fixed.h"
|
||||
#include "textures.h"
|
||||
|
||||
#include "r_defs.h"
|
||||
|
||||
struct FRemapTable;
|
||||
class FTextureShader;
|
||||
class IHardwareTexture;
|
||||
|
||||
enum
|
||||
|
@ -56,8 +53,6 @@ public:
|
|||
FMaterial(FTexture *tex, bool forceexpand);
|
||||
~FMaterial();
|
||||
void SetSpriteRect();
|
||||
void Precache();
|
||||
void PrecacheList(SpriteHits &translations);
|
||||
int GetShaderIndex() const { return mShaderIndex; }
|
||||
void AddTextureLayer(FTexture *tex)
|
||||
{
|
|
@ -51,6 +51,7 @@
|
|||
// Wrappers to keep the definitions of these classes out of here.
|
||||
void DeleteMaterial(FMaterial* mat);
|
||||
void DeleteSoftwareTexture(FSoftwareTexture *swtex);
|
||||
IHardwareTexture* CreateHardwareTexture();
|
||||
|
||||
|
||||
FTexture *CreateBrightmapTexture(FImageSource*);
|
||||
|
@ -846,3 +847,21 @@ void FTexCoordInfo::GetFromTexture(FTexture *tex, float x, float y, bool forcewo
|
|||
}
|
||||
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// this must be copied back to textures.cpp later.
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
FWrapperTexture::FWrapperTexture(int w, int h, int bits)
|
||||
{
|
||||
Width = w;
|
||||
Height = h;
|
||||
Format = bits;
|
||||
UseType = ETextureType::SWCanvas;
|
||||
bNoCompress = true;
|
||||
auto hwtex = CreateHardwareTexture();
|
||||
// todo: Initialize here.
|
||||
SystemTextures.AddHardwareTexture(0, false, hwtex);
|
||||
}
|
||||
|
||||
|
|
|
@ -51,10 +51,23 @@ static void PrecacheTexture(FTexture *tex, int cache)
|
|||
if (cache & (FTextureManager::HIT_Wall | FTextureManager::HIT_Flat | FTextureManager::HIT_Sky))
|
||||
{
|
||||
FMaterial * gltex = FMaterial::ValidateTexture(tex, false);
|
||||
if (gltex) gltex->Precache();
|
||||
if (gltex) screen->PrecacheMaterial(gltex, 0);
|
||||
}
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//===========================================================================
|
||||
static void PrecacheList(FMaterial *gltex, SpriteHits& translations)
|
||||
{
|
||||
gltex->tex->SystemTextures.CleanUnused(translations, gltex->isExpanded());
|
||||
SpriteHits::Iterator it(translations);
|
||||
SpriteHits::Pair* pair;
|
||||
while (it.NextPair(pair)) screen->PrecacheMaterial(gltex, pair->Key);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
// DFrameBuffer :: PrecacheSprite
|
||||
|
@ -64,7 +77,7 @@ static void PrecacheTexture(FTexture *tex, int cache)
|
|||
static void PrecacheSprite(FTexture *tex, SpriteHits &hits)
|
||||
{
|
||||
FMaterial * gltex = FMaterial::ValidateTexture(tex, true);
|
||||
if (gltex) gltex->PrecacheList(hits);
|
||||
if (gltex) PrecacheList(gltex, hits);
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
|
|
|
@ -15,6 +15,7 @@ class FCanvasTexture;
|
|||
class FileWriter;
|
||||
class DCanvas;
|
||||
struct FLevelLocals;
|
||||
class PClassActor;
|
||||
|
||||
struct FRenderer
|
||||
{
|
||||
|
|
|
@ -567,3 +567,9 @@ DEFINE_GLOBAL(CleanYfac_1)
|
|||
DEFINE_GLOBAL(CleanWidth_1)
|
||||
DEFINE_GLOBAL(CleanHeight_1)
|
||||
DEFINE_GLOBAL(generic_ui)
|
||||
|
||||
IHardwareTexture* CreateHardwareTexture()
|
||||
{
|
||||
return screen->CreateHardwareTexture();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue