2 Copyright (C) 2003 Rice1964
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef _OGL_RENDER_H_
20 #define _OGL_RENDER_H_
25 class OGLRender : public CRender
27 friend class COGLColorCombiner;
28 friend class COGLBlender;
29 friend class OGLDeviceBuilder;
36 void Initialize(void);
38 bool InitDeviceObjects();
39 bool ClearDeviceObjects();
41 void ApplyTextureFilter();
43 void SetShadeMode(RenderShadeMode mode);
44 void ZBufferEnable(BOOL bZBuffer);
45 void ClearBuffer(bool cbuffer, bool zbuffer);
46 void ClearZBuffer(float depth);
47 void SetZCompare(BOOL bZCompare);
48 void SetZUpdate(BOOL bZUpdate);
49 void SetZBias(int bias);
50 void ApplyZBias(int bias);
51 void SetAlphaRef(uint32 dwAlpha);
52 void ForceAlphaRef(uint32 dwAlpha);
53 void SetFillMode(FillMode mode);
54 void SetViewportRender();
56 void SetCullMode(bool bCullFront, bool bCullBack);
57 void SetAlphaTestEnable(BOOL bAlphaTestEnable);
59 void ApplyRDPScissor(bool force=false);
60 void ApplyScissorWithClipRatio(bool force=false);
62 bool SetCurrentTexture(int tile, CTexture *handler,uint32 dwTileWidth, uint32 dwTileHeight, TxtrCacheEntry *pTextureEntry);
63 bool SetCurrentTexture(int tile, TxtrCacheEntry *pTextureEntry);
64 void SetAddressUAllStages(uint32 dwTile, TextureUVFlag dwFlag);
65 void SetAddressVAllStages(uint32 dwTile, TextureUVFlag dwFlag);
66 void SetTextureUFlag(TextureUVFlag dwFlag, uint32 tile);
67 void SetTextureVFlag(TextureUVFlag dwFlag, uint32 tile);
68 virtual void BindTexture(GLuint texture, int unitno);
69 virtual void DisBindTexture(GLuint texture, int unitno);
70 virtual void TexCoord2f(float u, float v);
71 virtual void TexCoord(TLITVERTEX &vtxInfo);
73 void DrawSimple2DTexture(float x0, float y0, float x1, float y1, float u0, float v0, float u1, float v1, COLOR dif, COLOR spe, float z, float rhw);
74 void DrawSimpleRect(int nX0, int nY0, int nX1, int nY1, uint32 dwColor, float depth, float rhw);
75 void InitCombinerBlenderForSimpleRectDraw(uint32 tile=0);
76 void DrawSpriteR_Render();
77 void DrawObjBGCopy(uObjBg &info);
78 void DrawText(const char* str, RECT *rect);
80 void SetFogMinMax(float fMin, float fMax);
81 void SetFogEnable(bool bEnable);
82 void TurnFogOnOff(bool flag);
83 void SetFogColor(uint32 r, uint32 g, uint32 b, uint32 a);
85 void DisableMultiTexture();
86 void EnableMultiTexture() {m_bEnableMultiTexture=true;}
87 void EndRendering(void);
89 void glViewportWrapper(GLint x, GLint y, GLsizei width, GLsizei height, bool flag=true);
90 virtual void EnableTexUnit(int unitno, BOOL flag);
91 virtual void SetTexWrapS(int unitno,GLuint flag);
92 virtual void SetTexWrapT(int unitno,GLuint flag);
95 COLOR PostProcessDiffuseColor(COLOR curDiffuseColor);
96 COLOR PostProcessSpecularColor();
98 // Basic render drawing functions
99 bool RenderFlushTris();
100 bool RenderTexRect();
101 bool RenderFillRect(uint32 dwColor, float depth);
104 bool m_bSupportFogCoordExt;
105 bool m_bMultiTexture;
106 bool m_bSupportClampToEdge;
108 GLuint m_curBoundTex[8];
109 BOOL m_texUnitEnabled[8];
111 bool m_bEnableMultiTexture;