31 #include "common/array.h" 32 #include "graphics/pixelformat.h" 33 #include "hpl1/engine/graphics/GraphicsTypes.h" 34 #include "hpl1/engine/graphics/LowLevelPicture.h" 35 #include "hpl1/engine/graphics/bitmap2D.h" 36 #include "hpl1/engine/resources/ResourceBase.h" 42 eTextureType_RenderTarget,
52 eTextureTarget_CubeMap,
54 eTextureTarget_LastEnum
62 eTextureWrap_ClampToEdge,
63 eTextureWrap_ClampToBorder,
70 eTextureFilter_Bilinear,
71 eTextureFilter_Trilinear,
72 eTextureFilter_LastEnum
77 enum eTextureAnimMode {
78 eTextureAnimMode_None,
79 eTextureAnimMode_Loop,
80 eTextureAnimMode_Oscillate,
81 eTextureAnimMode_LastEnum
86 class iLowLevelGraphics;
91 eTextureType aType,
bool abUseMipMaps, eTextureTarget aTarget,
92 bool abCompress =
false)
94 mType(aType), mbUseMipMaps(abUseMipMaps),
95 mpLowLevelGraphics(apLowLevelGraphics), mbCompress(abCompress),
97 mWrapS(eTextureWrap_Repeat), mWrapT(eTextureWrap_Repeat), mWrapR(eTextureWrap_Repeat),
98 mfFrameTime(1), mAnimMode(eTextureAnimMode_Loop), mlSizeLevel(0), mvMinLevelSize(16, 16),
99 mfAnisotropyDegree(1.0f), mFilter(eTextureFilter_Bilinear), _bpp(apPxlFmt->
bpp()) {}
103 void SetSizeLevel(
unsigned int alLevel) { mlSizeLevel = alLevel; }
104 void SetMinLevelSize(
const cVector2l &avSize) { mvMinLevelSize = avSize; }
130 virtual bool Create(
unsigned int alWidth,
unsigned int alHeight,
cColor aCol) = 0;
132 virtual bool CreateAnimFromBitmapVec(
tBitmap2DVec *avBitmaps) = 0;
134 virtual bool CreateFromArray(
unsigned char *apPixelData,
int alChannels,
const cVector3l &avSize) = 0;
136 virtual void Update(
float afTimeStep) = 0;
138 virtual void SetPixels2D(
int alLevel,
const cVector2l &avOffset,
const cVector2l &avSize,
139 eColorDataFormat aDataFormat,
void *apPixelData) = 0;
141 virtual void SetFilter(eTextureFilter aFilter) = 0;
142 virtual void SetAnisotropyDegree(
float afX) = 0;
143 eTextureFilter GetFilter() {
return mFilter; }
144 float GetAnisotropyDegree(
float afX) {
return mfAnisotropyDegree; }
146 virtual float GetGamma() = 0;
147 virtual void SetGamma(
float afGamma) = 0;
148 virtual int GetHandle() = 0;
150 virtual bool hasAlpha()
override {
return false; }
151 uint32 getBpp()
const override {
return _bpp; }
153 virtual void SetWrapS(eTextureWrap aMode) = 0;
154 virtual void SetWrapT(eTextureWrap aMode) = 0;
155 virtual void SetWrapR(eTextureWrap aMode) = 0;
157 eTextureWrap GetWrapS() {
return mWrapS; }
158 eTextureWrap GetWrapT() {
return mWrapT; }
159 eTextureWrap GetWrapR() {
return mWrapR; }
161 void SetFrameTime(
float afX) { mfFrameTime = afX; }
162 float GetFrameTime() {
return mfFrameTime; }
164 eTextureAnimMode GetAnimMode() {
return mAnimMode; }
165 void SetAnimMode(eTextureAnimMode aMode) { mAnimMode = aMode; };
167 eTextureType GetTextureType() {
return mType; }
168 bool UsesMipMaps() {
return mbUseMipMaps; }
169 void SetMipMapUse(
bool abX) { mbUseMipMaps = abX; }
170 eTextureTarget GetTarget() {
return mTarget; }
172 virtual bool HasAnimation() = 0;
173 virtual void NextFrame() = 0;
174 virtual void PrevFrame() = 0;
175 virtual float GetT() = 0;
176 virtual float GetTimeCount() = 0;
177 virtual void SetTimeCount(
float afX) = 0;
178 virtual int GetCurrentLowlevelHandle() = 0;
182 eTextureTarget mTarget;
186 eTextureFilter mFilter;
187 float mfAnisotropyDegree;
193 eTextureAnimMode mAnimMode;
194 unsigned int mlSizeLevel;
204 #endif // HPL_TEXTURE_H
virtual bool Create(unsigned int alWidth, unsigned int alHeight, cColor aCol)=0
Definition: ResourceBase.h:36
Definition: LowLevelPicture.h:37
Definition: bitmap2D.h:42
iTexture * * iterator
Definition: array.h:54
bool reload() override
Definition: Texture.h:106
void destroy() override
Definition: Texture.h:108
void unload() override
Definition: Texture.h:107
virtual bool CreateFromBitmap(Bitmap2D *pBmp)=0
virtual bool CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps)=0
Definition: LowLevelGraphics.h:200