ScummVM API documentation
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#include "hpl1/opengl.h"
36
37#ifdef HPL1_USE_OPENGL
38
39namespace hpl {
40
41class cSDLTexture : public iTexture {
42public:
43 cSDLTexture(const tString &asName, Graphics::PixelFormat *apPxlFmt, iLowLevelGraphics *apLowLevelGraphics,
44 eTextureType aType, bool abUseMipMaps, eTextureTarget aTarget,
45 bool abCompress = false);
46 ~cSDLTexture();
47
48 bool CreateFromBitmap(Bitmap2D *pBmp);
49
50 bool CreateAnimFromBitmapVec(tBitmap2DVec *avBitmaps);
51
52 bool CreateCubeFromBitmapVec(tBitmap2DVec *avBitmaps);
53 bool Create(unsigned int alWidth, unsigned int alHeight, cColor aCol);
54
55 bool CreateFromArray(unsigned char *apPixelData, int alChannels, const cVector3l &avSize);
56
57 float GetGamma() { return 0; }
58 void SetGamma(float afGamma) {}
59 int GetHandle() { return (int)mvTextureHandles[0]; }
60
61 void SetFilter(eTextureFilter aFilter);
62 void SetAnisotropyDegree(float afX);
63
64 void SetWrapS(eTextureWrap aMode);
65 void SetWrapT(eTextureWrap aMode);
66 void SetWrapR(eTextureWrap aMode);
67
68 void Update(float afTimeStep);
69
70 bool HasAnimation();
71 void NextFrame();
72 void PrevFrame();
73 float GetT();
74 float GetTimeCount();
75 void SetTimeCount(float afX);
76 int GetCurrentLowlevelHandle();
77
79
80 unsigned int GetTextureHandle();
81 // cPBuffer *GetPBuffer() { return mpPBuffer; }
82
83private:
84 bool CreateFromBitmapToHandle(Bitmap2D *pBmp, int alHandleIdx);
85
86 GLenum InitCreation(int alHandleIdx);
87 void PostCreation(GLenum aGLTarget);
88
89 GLenum GetGLWrap(eTextureWrap aMode);
90
91 tUIntVec mvTextureHandles;
92 bool mbContainsData;
93 cLowLevelGraphicsSDL *mpGfxSDL;
94
95 float mfTimeCount;
96 int mlTextureIndex;
97 float mfTimeDir;
98};
99
100} // namespace hpl
101
102#endif // HPL1_USE_OPENGL
103#endif // HPL_SDL_TEXTURE_H
Definition: pixelformat.h:138