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 _OGLEXT_COMBINER_H_
20 #define _OGLEXT_COMBINER_H_
24 #include "osal_opengl.h"
26 #include "OGLCombiner.h"
27 #include "GeneralCombiner.h"
58 OGLExt1CombType rgbComb;
59 OGLExt1CombType alphaComb;
61 OGLExt1CombType Combs[2];
97 GLint glAlphaFlags[3];
102 //float scale; //Will not be used
103 } OGLExtCombinerType;
108 OGLExtCombinerType units[8];
110 uint32 constantColor;
112 // For 1.4 v2 combiner
116 } OGLExtCombinerSaveType;
119 //========================================================================
120 // OpenGL 1.4 combiner which support Texture Crossbar feature
121 class COGLColorCombiner4 : public COGLColorCombiner
124 bool Initialize(void);
126 friend class OGLDeviceBuilder;
127 void InitCombinerCycle12(void);
128 void InitCombinerCycleFill(void);
129 virtual void GenerateCombinerSetting(int index);
130 virtual void GenerateCombinerSettingConstants(int index);
131 virtual int ParseDecodedMux();
133 COGLColorCombiner4(CRender *pRender);
134 ~COGLColorCombiner4() {};
136 bool m_bOGLExtCombinerSupported; // Is this OGL extension combiner supported by the video card driver?
137 bool m_bSupportModAdd_ATI;
138 bool m_bSupportModSub_ATI;
145 void DisplaySimpleMuxString(void);
149 virtual int SaveParsedResult(OGLExtCombinerSaveType &result);
150 static GLint MapRGBArgFlags(uint8 arg);
151 static GLint MapAlphaArgFlags(uint8 arg);
152 std::vector<OGLExtCombinerSaveType> m_vCompiledSettings;
153 static GLint RGBArgsMap4[];
154 static const char* GetOpStr(GLenum op);
157 virtual int ParseDecodedMux2Units();
158 virtual int FindCompiledMux();
160 virtual GLint MapRGBArgs(uint8 arg);
161 virtual GLint MapAlphaArgs(uint8 arg);
165 class COGLColorCombiner4v2 : public COGLColorCombiner4
167 /************************************************************************
168 * Version 2 of OGL 1.4 combiner
169 * Will support up to 4 texture units
170 * Texture unit 0 and 1 are for N64 texture T0 and T1
171 * Texture unit 2 and 3 will be used to map constant colors
172 * Constant color mapping:
173 * OGL constant factor: MUX_PRIM
174 * ARB_TEXTURE2: MUX_ENV
175 * ARB_TEXTURE3: MUX_LODFRAC
176 ************************************************************************/
178 friend class OGLDeviceBuilder;
179 virtual void GenerateCombinerSettingConstants(int index);
180 virtual int SaveParsedResult(OGLExtCombinerSaveType &result);
182 COGLColorCombiner4v2(CRender *pRender);
183 ~COGLColorCombiner4v2() {};
185 static GLint RGBArgsMap4v2[];
188 virtual GLint MapRGBArgs(uint8 arg);
189 virtual GLint MapAlphaArgs(uint8 arg);
192 //////////////////////////////////////////////////////////////////////////
193 // OpenGL 1.2, 1.3 combiner which does not support Texture Crossbar feature
194 class COGLColorCombiner2 : public COGLColorCombiner4, CGeneralCombiner
197 bool Initialize(void);
200 void DisplaySimpleMuxString(void);
204 friend class OGLDeviceBuilder;
206 COGLColorCombiner2(CRender *pRender);
207 ~COGLColorCombiner2() {};
210 virtual int ParseDecodedMux();
211 virtual void GenerateCombinerSetting(int index);
212 virtual void GenerateCombinerSettingConstants(int index);
214 virtual GLint MapRGBArgs(uint8 arg);
215 virtual GLint MapAlphaArgs(uint8 arg);
216 static GLint RGBArgsMap2[];