2020-05-24 19:19:33 +00:00
|
|
|
|
|
|
|
#ifndef __GL_MATERIAL_H
|
|
|
|
#define __GL_MATERIAL_H
|
|
|
|
|
|
|
|
#include "m_fixed.h"
|
|
|
|
#include "textures.h"
|
|
|
|
|
|
|
|
struct FRemapTable;
|
|
|
|
class IHardwareTexture;
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
struct MaterialLayerInfo
|
2020-05-24 19:19:33 +00:00
|
|
|
{
|
2020-05-25 21:59:07 +00:00
|
|
|
FTexture* layerTexture;
|
|
|
|
int scaleFlags;
|
2020-05-31 10:23:35 +00:00
|
|
|
int clampflags;
|
2020-05-24 19:19:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
//===========================================================================
|
|
|
|
//
|
|
|
|
// this is the material class for OpenGL.
|
|
|
|
//
|
|
|
|
//===========================================================================
|
|
|
|
|
|
|
|
class FMaterial
|
|
|
|
{
|
2020-05-25 21:59:07 +00:00
|
|
|
private:
|
|
|
|
TArray<MaterialLayerInfo> mTextureLayers; // the only layers allowed to scale are the brightmap and the glowmap.
|
2020-05-24 19:19:33 +00:00
|
|
|
int mShaderIndex;
|
2020-05-25 21:59:07 +00:00
|
|
|
int mLayerFlags = 0;
|
|
|
|
int mScaleFlags;
|
2020-05-24 19:19:33 +00:00
|
|
|
|
|
|
|
public:
|
2020-05-25 21:59:07 +00:00
|
|
|
FGameTexture *sourcetex; // the owning texture.
|
2020-05-24 19:19:33 +00:00
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
FMaterial(FGameTexture *tex, int scaleflags);
|
|
|
|
virtual ~FMaterial();
|
|
|
|
int GetLayerFlags() const { return mLayerFlags; }
|
|
|
|
int GetShaderIndex() const { return mShaderIndex; }
|
|
|
|
int GetScaleFlags() const { return mScaleFlags; }
|
|
|
|
virtual void DeleteDescriptors() { }
|
2020-05-31 10:23:35 +00:00
|
|
|
FVector2 GetDetailScale() const
|
|
|
|
{
|
|
|
|
return sourcetex->GetDetailScale();
|
|
|
|
}
|
2020-05-24 19:19:33 +00:00
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
FGameTexture* Source() const
|
2020-05-24 19:19:33 +00:00
|
|
|
{
|
2020-05-25 21:59:07 +00:00
|
|
|
return sourcetex;
|
2020-05-24 19:19:33 +00:00
|
|
|
}
|
|
|
|
|
2020-06-11 07:15:44 +00:00
|
|
|
void ClearLayers()
|
|
|
|
{
|
|
|
|
mTextureLayers.Resize(1);
|
|
|
|
}
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
void AddTextureLayer(FTexture *tex, bool allowscale)
|
2020-05-24 19:19:33 +00:00
|
|
|
{
|
2020-05-25 21:59:07 +00:00
|
|
|
mTextureLayers.Push({ tex, allowscale });
|
2020-05-24 19:19:33 +00:00
|
|
|
}
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
int NumLayers() const
|
2020-05-24 19:19:33 +00:00
|
|
|
{
|
2020-05-25 21:59:07 +00:00
|
|
|
return mTextureLayers.Size();
|
2020-05-24 19:19:33 +00:00
|
|
|
}
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
IHardwareTexture *GetLayer(int i, int translation, MaterialLayerInfo **pLayer = nullptr) const;
|
2020-05-24 19:19:33 +00:00
|
|
|
|
|
|
|
|
2020-05-25 21:59:07 +00:00
|
|
|
static FMaterial *ValidateTexture(FGameTexture * tex, int scaleflags, bool create = true);
|
|
|
|
const TArray<MaterialLayerInfo> &GetLayerArray() const
|
2020-05-24 19:19:33 +00:00
|
|
|
{
|
|
|
|
return mTextureLayers;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|