ScummVM API documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
SDLTexture.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 /*
23  * Copyright (C) 2006-2010 - Frictional Games
24  *
25  * This file is part of HPL1 Engine.
26  */
27 
28 #ifndef HPL_SDL_TEXTURE_H
29 #define HPL_SDL_TEXTURE_H
30 
31 #include "common/scummsys.h"
32 #include "hpl1/engine/graphics/Texture.h"
33 #include "hpl1/engine/graphics/bitmap2D.h"
34 #include "hpl1/engine/impl/LowLevelGraphicsSDL.h"
35 
36 #ifdef USE_OPENGL
37 
38 namespace hpl {
39 
40 class cSDLTexture : public iTexture {
41 public:
42  cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
43  eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
44  bool abCompress = false);
45  ~cSDLTexture();
46 
47  bool CreateFromBitmap(Bitmap2D *pBmp);
48 
49  bool CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps);
50 
51  bool CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps);
52  bool Create(unsigned int alWidth, unsigned int alHeight, cColor aCol);
53 
54  bool CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize);
55 
56  void SetPixels2D(int alLevel, const cVector2l &avOffset, const cVector2l &avSize,
57  eColorDataFormat aDataFormat, void *apPixelData);
58 
59  float GetGamma() { return 0; }
60  void SetGamma(float afGamma) {}
61  int GetHandle() { return (int)mvTextureHandles[0]; }
62 
63  void SetFilter(eTextureFilter aFilter);
64  void SetAnisotropyDegree(float afX);
65 
66  void SetWrapS(eTextureWrap aMode);
67  void SetWrapT(eTextureWrap aMode);
68  void SetWrapR(eTextureWrap aMode);
69 
70  void Update(float afTimeStep);
71 
72  bool HasAnimation();
73  void NextFrame();
74  void PrevFrame();
75  float GetT();
76  float GetTimeCount();
77  void SetTimeCount(float afX);
78  int GetCurrentLowlevelHandle();
79 
81 
82  unsigned int GetTextureHandle();
83  // cPBuffer *GetPBuffer() { return mpPBuffer; }
84 
85 private:
86  bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
87 
88  GLenum InitCreation(int alHandleIdx);
89  void PostCreation(GLenum aGLTarget);
90 
91  GLenum GetGLWrap(eTextureWrap aMode);
92 
93  tUIntVec mvTextureHandles;
94  bool mbContainsData;
95  cLowLevelGraphicsSDL *mpGfxSDL;
96 
97  float mfTimeCount;
98  int mlTextureIndex;
99  float mfTimeDir;
100 };
101 
102 } // namespace hpl
103 
104 #endif // USE_OPENGL
105 #endif // HPL_SDL_TEXTURE_H
Definition: AI.h:36
Definition: pixelformat.h:138