ScummVM API documentation
texture_tgl.h
1/* ScummVM - Graphic Adventure Engine
2 *
3 * ScummVM is the legal property of its developers, whose names
4 * are too numerous to list here. Please refer to the COPYRIGHT
5 * file distributed with this source distribution.
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 */
21
22#ifndef HPL_TEXTURE_TGL_H
23#define HPL_TEXTURE_TGL_H
24
25#include "hpl1/engine/graphics/Texture.h"
26#include "hpl1/engine/graphics/bitmap2D.h"
27#include "hpl1/engine/impl/low_level_graphics_tgl.h"
28
29#ifdef USE_TINYGL
30
31namespace hpl {
32
33class TGLTexture : public iTexture {
34public:
35 TGLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
36 eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
37 bool abCompress = false);
38 ~TGLTexture();
39
40 bool CreateFromBitmap(Bitmap2D *pBmp);
41
42 bool CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps);
43
44 bool CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps);
45 bool Create(unsigned int alWidth, unsigned int alHeight, cColor aCol);
46
47 bool CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize);
48
49 float GetGamma() { return 0; }
50 void SetGamma(float afGamma) {}
51 int GetHandle() { return (int)mvTextureHandles[0]; }
52
53 void SetFilter(eTextureFilter aFilter);
54 void SetAnisotropyDegree(float afX);
55
56 void SetWrapS(eTextureWrap aMode);
57 void SetWrapT(eTextureWrap aMode);
58 void SetWrapR(eTextureWrap aMode);
59
60 void Update(float afTimeStep);
61
62 bool HasAnimation();
63 void NextFrame();
64 void PrevFrame();
65 float GetT();
66 float GetTimeCount();
67 void SetTimeCount(float afX);
68 int GetCurrentLowlevelHandle();
69
71
72 unsigned int GetTextureHandle();
73 // cPBuffer *GetPBuffer() { return mpPBuffer; }
74
75private:
76 bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
77
78 TGLenum InitCreation(int alHandleIdx);
79 void PostCreation(TGLenum aGLTarget);
80
81 TGLenum GetGLWrap(eTextureWrap aMode);
82
83 tUIntVec mvTextureHandles;
84 bool mbContainsData;
85 LowLevelGraphicsTGL *mpGfxSDL;
86
87 float mfTimeCount;
88 int mlTextureIndex;
89 float mfTimeDir;
90};
91
92} // namespace hpl
93
94#endif // USE_TINYGL
95
96#endif // HPL_TEXTURE_TGL_H
Definition: pixelformat.h:138