d07c171f |
1 | /* |
2 | Copyright (C) 2003 Rice1964 |
3 | |
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. |
8 | |
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. |
13 | |
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. |
17 | */ |
18 | |
19 | #ifndef _OGL_RENDER_H_ |
20 | #define _OGL_RENDER_H_ |
21 | |
22 | #include "Combiner.h" |
23 | #include "Render.h" |
24 | |
25 | class OGLRender : public CRender |
26 | { |
27 | friend class COGLColorCombiner; |
28 | friend class COGLBlender; |
29 | friend class OGLDeviceBuilder; |
30 | |
31 | protected: |
32 | OGLRender(); |
33 | |
34 | public: |
35 | ~OGLRender(); |
36 | void Initialize(void); |
37 | |
38 | bool InitDeviceObjects(); |
39 | bool ClearDeviceObjects(); |
40 | |
41 | void ApplyTextureFilter(); |
42 | |
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(); |
55 | void RenderReset(); |
56 | void SetCullMode(bool bCullFront, bool bCullBack); |
57 | void SetAlphaTestEnable(BOOL bAlphaTestEnable); |
58 | void UpdateScissor(); |
59 | void ApplyRDPScissor(bool force=false); |
60 | void ApplyScissorWithClipRatio(bool force=false); |
61 | |
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); |
72 | |
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); |
79 | |
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); |
84 | |
85 | void DisableMultiTexture(); |
86 | void EnableMultiTexture() {m_bEnableMultiTexture=true;} |
87 | void EndRendering(void); |
88 | |
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); |
93 | |
94 | protected: |
95 | COLOR PostProcessDiffuseColor(COLOR curDiffuseColor); |
96 | COLOR PostProcessSpecularColor(); |
97 | |
98 | // Basic render drawing functions |
99 | bool RenderFlushTris(); |
100 | bool RenderTexRect(); |
101 | bool RenderFillRect(uint32 dwColor, float depth); |
102 | bool RenderLine3D(); |
103 | |
104 | bool m_bSupportFogCoordExt; |
105 | bool m_bMultiTexture; |
106 | bool m_bSupportClampToEdge; |
107 | |
108 | GLuint m_curBoundTex[8]; |
109 | BOOL m_texUnitEnabled[8]; |
110 | |
111 | bool m_bEnableMultiTexture; |
112 | }; |
113 | |
114 | #endif |
115 | |
116 | |