Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
[mupen64plus-pandora.git] / source / gles2glide64 / src / Glide64 / Combine.h
1 /*
2 * Glide64 - Glide video plugin for Nintendo 64 emulators.
3 * Copyright (c) 2002  Dave2001
4 * Copyright (c) 2003-2009  Sergey 'Gonetz' Lipski
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20
21 //****************************************************************
22 //
23 // Glide64 - Glide Plugin for Nintendo 64 emulators
24 // Project started on December 29th, 2001
25 //
26 // Authors:
27 // Dave2001, original author, founded the project in 2001, left it in 2002
28 // Gugaman, joined the project in 2002, left it in 2002
29 // Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
30 // Hiroshi 'KoolSmoky' Morii, joined the project in 2007
31 //
32 //****************************************************************
33 //
34 // To modify Glide64:
35 // * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
36 // * Do NOT send me the whole project or file that you modified.  Take out your modified code sections, and tell me where to put them.  If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
37 //
38 //****************************************************************
39 #ifndef COMBINE_H
40 #define COMBINE_H
41
42 // texture MOD types
43 #define TMOD_TEX_INTER_COLOR_USING_FACTOR                       1
44 #define TMOD_TEX_INTER_COL_USING_COL1                           2
45 #define TMOD_FULL_COLOR_SUB_TEX                                         3
46 #define TMOD_COL_INTER_COL1_USING_TEX                           4
47 #define TMOD_COL_INTER_COL1_USING_TEXA                          5
48 #define TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX         6
49 #define TMOD_COL_INTER_TEX_USING_TEXA                           7
50 #define TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA   8
51 #define TMOD_TEX_SCALE_FAC_ADD_FAC                                      9
52 #define TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX                        10
53 #define TMOD_TEX_SCALE_COL_ADD_COL                                      11
54 #define TMOD_TEX_ADD_COL                                                        12
55 #define TMOD_TEX_SUB_COL                                                        13
56 #define TMOD_TEX_SUB_COL_MUL_FAC                                        14
57 #define TMOD_COL_INTER_TEX_USING_COL1                           15
58 #define TMOD_COL_MUL_TEXA_ADD_TEX                                       16
59 #define TMOD_COL_INTER_TEX_USING_TEX                            17
60 #define TMOD_TEX_INTER_NOISE_USING_COL                          18
61 #define TMOD_TEX_INTER_COL_USING_TEXA                           19
62 #define TMOD_TEX_MUL_COL                                            20
63 #define TMOD_TEX_SCALE_FAC_ADD_COL                                      21
64
65 #define COMBINE_EXT_COLOR     1
66 #define COMBINE_EXT_ALPHA     2
67 #define TEX_COMBINE_EXT_COLOR 1
68 #define TEX_COMBINE_EXT_ALPHA 2
69
70 typedef struct
71 {
72   wxUint32 ccolor;  // constant color to set at the end, color and alpha
73   wxUint32 c_fnc, c_fac, c_loc, c_oth;  // grColorCombine flags
74   wxUint32 a_fnc, a_fac, a_loc, a_oth;  // grAlphaCombine flags
75   wxUint32 tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
76   wxUint32 tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
77   int   dc0_lodbias, dc1_lodbias;
78   wxUint8  dc0_detailscale, dc1_detailscale;
79   float dc0_detailmax, dc1_detailmax;
80   float lodbias0, lodbias1;
81   wxUint32 abf1, abf2;
82   wxUint32 mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
83   wxUint32 mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
84   //combine extensions
85   wxUint32 c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
86   int  c_ext_c_invert, c_ext_d_invert;
87   wxUint32 a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
88   int  a_ext_c_invert, a_ext_d_invert;
89   wxUint32 t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
90   int  t0c_ext_c_invert, t0c_ext_d_invert;
91   wxUint32 t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
92   int  t0a_ext_c_invert, t0a_ext_d_invert;
93   wxUint32 t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
94   int  t1c_ext_c_invert, t1c_ext_d_invert;
95   wxUint32 t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
96   int  t1a_ext_c_invert, t1a_ext_d_invert;
97   GRCOLORCOMBINEEXT    grColorCombineExt;
98   GRCOLORCOMBINEEXT    grAlphaCombineExt;
99   GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
100   GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
101   GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
102   wxUint32 tex_ccolor;  
103   int combine_ext;
104   wxUint8 cmb_ext_use;
105   wxUint8 tex_cmb_ext_use;
106   wxUint32 shade_mod_hash;  
107 } COMBINE;
108
109 extern COMBINE cmb;
110
111 void Combine ();
112 void CombineBlender ();
113 void CountCombine ();
114 void InitCombine ();
115 void ColorCombinerToExtension ();
116 void AlphaCombinerToExtension ();
117 void TexColorCombinerToExtension (GrChipID_t tmu);
118 void TexAlphaCombinerToExtension (GrChipID_t tmu);
119
120 #endif //COMBINE _H