ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
31 namespace hpl {
32 
33 class TGLTexture : public iTexture {
34 public:
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  void SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
50  eColorDataFormat aDataFormat, void *apPixelData);
51 
52  float GetGamma() { return 0; }
53  void SetGamma(float afGamma) {}
54  int GetHandle() { return (int)mvTextureHandles[0]; }
55 
56  void SetFilter(eTextureFilter aFilter);
57  void SetAnisotropyDegree(float afX);
58 
59  void SetWrapS(eTextureWrap aMode);
60  void SetWrapT(eTextureWrap aMode);
61  void SetWrapR(eTextureWrap aMode);
62 
63  void Update(float afTimeStep);
64 
65  bool HasAnimation();
66  void NextFrame();
67  void PrevFrame();
68  float GetT();
69  float GetTimeCount();
70  void SetTimeCount(float afX);
71  int GetCurrentLowlevelHandle();
72 
74 
75  unsigned int GetTextureHandle();
76  // cPBuffer *GetPBuffer() { return mpPBuffer; }
77 
78 private:
79  bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
80 
81  TGLenum InitCreation(int alHandleIdx);
82  void PostCreation(TGLenum aGLTarget);
83 
84  TGLenum GetGLWrap(eTextureWrap aMode);
85 
86  tUIntVec mvTextureHandles;
87  bool mbContainsData;
88  LowLevelGraphicsTGL *mpGfxSDL;
89 
90  float mfTimeCount;
91  int mlTextureIndex;
92  float mfTimeDir;
93 };
94 
95 } // namespace hpl
96 
97 #endif // USE_TINYGL
98 
99 #endif // HPL_TEXTURE_TGL_H
Definition: AI.h:36
Definition: pixelformat.h:138