]> icculus.org git repositories - divverent/nexuiz.git/blob - misc/gtkradiant/singlepatches/q3map2-UTlmexposure.diff
add the ACBC Assault Circuit Board Creator
[divverent/nexuiz.git] / misc / gtkradiant / singlepatches / q3map2-UTlmexposure.diff
1 Index: tools/quake3/q3map2/game_ja.h
2 ===================================================================
3 --- tools/quake3/q3map2/game_ja.h.orig  2008-09-06 15:32:04.000000000 +0200
4 +++ tools/quake3/q3map2/game_ja.h       2008-09-06 15:32:16.000000000 +0200
5 @@ -67,6 +67,7 @@
6         qfalse,                         /* wolf lighting model? */
7         128,                            /* lightmap width/height */
8         1.0f,                           /* lightmap gamma */
9 +       1.0f,                           /* lightmap exposure */
10         1.0f,                           /* lightmap compensate */
11         "RBSP",                         /* bsp file prefix */
12         1,                                      /* bsp file version */
13 Index: tools/quake3/q3map2/game_tremulous.h
14 ===================================================================
15 --- tools/quake3/q3map2/game_tremulous.h.orig   2008-09-06 15:32:04.000000000 +0200
16 +++ tools/quake3/q3map2/game_tremulous.h        2008-09-06 15:32:16.000000000 +0200
17 @@ -70,6 +70,7 @@
18         qfalse,                         /* wolf lighting model? */
19         128,                            /* lightmap width/height */
20         1.0f,                           /* lightmap gamma */
21 +       1.0f,                           /* lightmap exposure */
22         1.0f,                           /* lightmap compensate */
23         "IBSP",                         /* bsp file prefix */
24         46,                                     /* bsp file version */
25 Index: tools/quake3/q3map2/game_wolfet.h
26 ===================================================================
27 --- tools/quake3/q3map2/game_wolfet.h.orig      2008-09-06 15:32:04.000000000 +0200
28 +++ tools/quake3/q3map2/game_wolfet.h   2008-09-06 15:32:16.000000000 +0200
29 @@ -66,6 +66,7 @@
30         qtrue,                          /* wolf lighting model? */
31         128,                            /* lightmap width/height */
32         1.0f,                           /* lightmap gamma */
33 +       1.0f,                           /* lightmap exposure */
34         1.0f,                           /* lightmap compensate */
35         "IBSP",                         /* bsp file prefix */
36         47,                                     /* bsp file version */
37 Index: tools/quake3/q3map2/game_wolf.h
38 ===================================================================
39 --- tools/quake3/q3map2/game_wolf.h.orig        2008-09-06 15:32:04.000000000 +0200
40 +++ tools/quake3/q3map2/game_wolf.h     2008-09-06 15:32:16.000000000 +0200
41 @@ -129,6 +129,7 @@
42         qtrue,                          /* wolf lighting model? */
43         128,                            /* lightmap width/height */
44         1.0f,                           /* lightmap gamma */
45 +       1.0f,                           /* lightmap exposure */
46         1.0f,                           /* lightmap compensate */
47         "IBSP",                         /* bsp file prefix */
48         47,                                     /* bsp file version */
49 Index: tools/quake3/q3map2/game_sof2.h
50 ===================================================================
51 --- tools/quake3/q3map2/game_sof2.h.orig        2008-09-06 15:32:04.000000000 +0200
52 +++ tools/quake3/q3map2/game_sof2.h     2008-09-06 15:32:16.000000000 +0200
53 @@ -139,6 +139,7 @@
54         qfalse,                                 /* wolf lighting model? */
55         128,                                    /* lightmap width/height */
56         1.0f,                                   /* lightmap gamma */
57 +       1.0f,                                   /* lightmap exposure */
58         1.0f,                                   /* lightmap compensate */
59         "RBSP",                                 /* bsp file prefix */
60         1,                                              /* bsp file version */
61 Index: tools/quake3/q3map2/game_etut.h
62 ===================================================================
63 --- tools/quake3/q3map2/game_etut.h.orig        2008-09-06 15:32:04.000000000 +0200
64 +++ tools/quake3/q3map2/game_etut.h     2008-09-06 15:32:16.000000000 +0200
65 @@ -148,6 +148,7 @@
66         qfalse,                         /* wolf lighting model? */
67         128,                            /* lightmap width/height */
68         2.2f,                           /* lightmap gamma */
69 +       1.0f,                           /* lightmap exposure */
70         1.0f,                           /* lightmap compensate */
71         "IBSP",                         /* bsp file prefix */
72         47,                                     /* bsp file version */
73 Index: tools/quake3/q3map2/game_jk2.h
74 ===================================================================
75 --- tools/quake3/q3map2/game_jk2.h.orig 2008-09-06 15:32:04.000000000 +0200
76 +++ tools/quake3/q3map2/game_jk2.h      2008-09-06 15:32:16.000000000 +0200
77 @@ -64,6 +64,7 @@
78         qfalse,                         /* wolf lighting model? */
79         128,                            /* lightmap width/height */
80         1.0f,                           /* lightmap gamma */
81 +       1.0f,                           /* lightmap exposure */
82         1.0f,                           /* lightmap compensate */
83         "RBSP",                         /* bsp file prefix */
84         1,                                      /* bsp file version */
85 Index: tools/quake3/q3map2/game_qfusion.h
86 ===================================================================
87 --- tools/quake3/q3map2/game_qfusion.h.orig     2008-09-06 15:32:04.000000000 +0200
88 +++ tools/quake3/q3map2/game_qfusion.h  2008-09-06 15:32:16.000000000 +0200
89 @@ -115,6 +115,7 @@
90         qfalse,                         /* wolf lighting model? */
91         512,                            /* lightmap width/height */
92         1.0f,                           /* lightmap gamma */
93 +       1.0f,                           /* lightmap exposure */
94         1.0f,                           /* lightmap compensate */
95         "FBSP",                         /* bsp file prefix */
96         1,                                      /* bsp file version */
97 Index: tools/quake3/q3map2/game_tenebrae.h
98 ===================================================================
99 --- tools/quake3/q3map2/game_tenebrae.h.orig    2008-09-06 15:32:04.000000000 +0200
100 +++ tools/quake3/q3map2/game_tenebrae.h 2008-09-06 15:32:16.000000000 +0200
101 @@ -112,6 +112,7 @@
102         qfalse,                         /* wolf lighting model? */
103         512,                            /* lightmap width/height */
104         2.0f,                           /* lightmap gamma */
105 +       1.0f,                           /* lightmap exposure */
106         1.0f,                           /* lightmap compensate */
107         "IBSP",                         /* bsp file prefix */
108         46,                                     /* bsp file version */
109 Index: tools/quake3/q3map2/game_quake3.h
110 ===================================================================
111 --- tools/quake3/q3map2/game_quake3.h.orig      2008-09-06 15:32:04.000000000 +0200
112 +++ tools/quake3/q3map2/game_quake3.h   2008-09-06 15:32:16.000000000 +0200
113 @@ -112,6 +112,7 @@
114         qfalse,                         /* wolf lighting model? */
115         128,                            /* lightmap width/height */
116         1.0f,                           /* lightmap gamma */
117 +       1.0f,                           /* lightmap exposure */
118         1.0f,                           /* lightmap compensate */
119         "IBSP",                         /* bsp file prefix */
120         47,                                     /* bsp file version */
121 Index: tools/quake3/q3map2/game_ef.h
122 ===================================================================
123 --- tools/quake3/q3map2/game_ef.h.orig  2008-09-06 15:32:04.000000000 +0200
124 +++ tools/quake3/q3map2/game_ef.h       2008-09-06 15:32:16.000000000 +0200
125 @@ -113,6 +113,7 @@
126         qfalse,                         /* wolf lighting model? */
127         128,                            /* lightmap width/height */
128         1.0f,                           /* lightmap gamma */
129 +       1.0f,                           /* lightmap exposure */
130         1.0f,                           /* lightmap compensate */
131         "IBSP",                         /* bsp file prefix */
132         46,                                     /* bsp file version */
133 Index: tools/quake3/q3map2/light_ydnar.c
134 ===================================================================
135 --- tools/quake3/q3map2/light_ydnar.c.orig      2008-09-06 15:32:14.000000000 +0200
136 +++ tools/quake3/q3map2/light_ydnar.c   2008-09-06 15:32:16.000000000 +0200
137 @@ -49,6 +49,7 @@
138         int             i;
139         float   max, gamma;
140         vec3_t  sample;
141 +       float   inv, dif;
142         
143         
144         /* ydnar: scaling necessary for simulating r_overbrightBits on external lightmaps */
145 @@ -72,15 +73,50 @@
146                 /* gamma */
147                 sample[ i ] = pow( sample[ i ] / 255.0f, gamma ) * 255.0f;
148         }
149 -       
150 -       /* clamp with color normalization */
151 -       max = sample[ 0 ];
152 -       if( sample[ 1 ] > max )
153 -               max = sample[ 1 ];
154 -       if( sample[ 2 ] > max )
155 -               max = sample[ 2 ];
156 -       if( max > 255.0f )
157 -               VectorScale( sample, (255.0f / max), sample );
158 +
159 +       if (lightmapExposure == 1)
160 +       {
161 +               /* clamp with color normalization */
162 +               max = sample[ 0 ];
163 +               if( sample[ 1 ] > max )
164 +                       max = sample[ 1 ];
165 +               if( sample[ 2 ] > max )
166 +                       max = sample[ 2 ];
167 +               if( max > 255.0f )
168 +                       VectorScale( sample, (255.0f / max), sample );
169 +       }
170 +       else
171 +       {
172 +               if (lightmapExposure==0)
173 +               {
174 +                       lightmapExposure=1.0f;
175 +               }
176 +               inv=1.f/lightmapExposure;
177 +               //Exposure
178 +
179 +               max = sample[ 0 ];
180 +               if( sample[ 1 ] > max )
181 +                       max = sample[ 1 ];
182 +               if( sample[ 2 ] > max )
183 +                       max = sample[ 2 ];
184 +
185 +               dif = (1-  exp(-max * inv) )  *  255;
186 +
187 +               if (max >0)
188 +               {
189 +                       dif = dif / max;
190 +               }
191 +               else
192 +               {
193 +                       dif = 0;
194 +               }
195 +
196 +               for (i=0;i<3;i++)
197 +               {
198 +                       sample[i]*=dif;
199 +               }
200 +       }
201 +
202         
203         /* compensate for ingame overbrighting/bitshifting */
204         VectorScale( sample, (1.0f / lightmapCompensate), sample );
205 Index: tools/quake3/q3map2/q3map2.h
206 ===================================================================
207 --- tools/quake3/q3map2/q3map2.h.orig   2008-09-06 15:32:14.000000000 +0200
208 +++ tools/quake3/q3map2/q3map2.h        2008-09-06 15:32:16.000000000 +0200
209 @@ -553,6 +553,7 @@
210         qboolean                        wolfLight;                                              /* when true, lights work like wolf q3map  */
211         int                                     lightmapSize;                                   /* bsp lightmap width/height */
212         float                           lightmapGamma;                                  /* default lightmap gamma */
213 +       float                           lightmapExposure;                               /* default lightmap exposure */
214         float                           lightmapCompensate;                             /* default lightmap compensate value */
215         char                            *bspIdent;                                              /* 4-letter bsp file prefix */
216         int                                     bspVersion;                                             /* bsp version to use */
217 @@ -2139,6 +2140,7 @@
218  
219  /* ydnar: lightmap gamma/compensation */
220  Q_EXTERN float                         lightmapGamma Q_ASSIGN( 1.0f );
221 +Q_EXTERN float                         lightmapExposure Q_ASSIGN( 1.0f );
222  Q_EXTERN float                         lightmapCompensate Q_ASSIGN( 1.0f );
223  
224  /* ydnar: for runtime tweaking of falloff tolerance */
225 Index: tools/quake3/q3map2/light.c
226 ===================================================================
227 --- tools/quake3/q3map2/light.c.orig    2008-09-06 15:32:14.000000000 +0200
228 +++ tools/quake3/q3map2/light.c 2008-09-06 15:32:16.000000000 +0200
229 @@ -1893,6 +1893,14 @@
230                         i++;
231                 }
232                 
233 +               else if( !strcmp( argv[ i ], "-exposure" ) )
234 +               {
235 +                       f = atof( argv[ i + 1 ] );
236 +                       lightmapExposure = f;
237 +                       Sys_Printf( "Lighting exposure set to %f\n", lightmapExposure );
238 +                       i++;
239 +               }
240 +
241                 else if( !strcmp( argv[ i ], "-compensate" ) )
242                 {
243                         f = atof( argv[ i + 1 ] );