1 Index: tools/quake3/q3map2/game_ja.h
2 ===================================================================
3 --- tools/quake3/q3map2/game_ja.h (revision 191)
4 +++ tools/quake3/q3map2/game_ja.h (working copy)
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 (revision 191)
16 +++ tools/quake3/q3map2/game_tremulous.h (working copy)
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 (revision 191)
28 +++ tools/quake3/q3map2/game_wolfet.h (working copy)
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 (revision 191)
40 +++ tools/quake3/q3map2/game_wolf.h (working copy)
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 (revision 191)
52 +++ tools/quake3/q3map2/game_sof2.h (working copy)
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 (revision 191)
64 +++ tools/quake3/q3map2/game_etut.h (working copy)
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 (revision 191)
76 +++ tools/quake3/q3map2/game_jk2.h (working copy)
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 (revision 191)
88 +++ tools/quake3/q3map2/game_qfusion.h (working copy)
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 (revision 191)
100 +++ tools/quake3/q3map2/game_tenebrae.h (working copy)
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 (revision 191)
112 +++ tools/quake3/q3map2/game_quake3.h (working copy)
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 46, /* bsp file version */
121 Index: tools/quake3/q3map2/game_ef.h
122 ===================================================================
123 --- tools/quake3/q3map2/game_ef.h (revision 191)
124 +++ tools/quake3/q3map2/game_ef.h (working copy)
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 (revision 191)
136 +++ tools/quake3/q3map2/light_ydnar.c (working copy)
144 /* ydnar: scaling necessary for simulating r_overbrightBits on external lightmaps */
147 sample[ i ] = pow( sample[ i ] / 255.0f, gamma ) * 255.0f;
150 + if (lightmapExposure == 1)
152 + /* clamp with color normalization */
154 + if( sample[ 1 ] > max )
156 + if( sample[ 2 ] > max )
159 + VectorScale( sample, (255.0f / max), sample );
163 + if (lightmapExposure==0)
165 + lightmapExposure=1.0f;
167 + inv=1.f/lightmapExposure;
171 + if( sample[ 1 ] > max )
173 + if( sample[ 2 ] > max )
176 + dif = (1- exp(-max * inv) ) * 255;
194 - /* clamp with color normalization */
196 - if( sample[ 1 ] > max )
198 - if( sample[ 2 ] > max )
201 - VectorScale( sample, (255.0f / max), sample );
203 /* compensate for ingame overbrighting/bitshifting */
204 VectorScale( sample, (1.0f / lightmapCompensate), sample );
206 Index: tools/quake3/q3map2/light.c
207 ===================================================================
208 --- tools/quake3/q3map2/light.c (revision 191)
209 +++ tools/quake3/q3map2/light.c (working copy)
210 @@ -1836,6 +1893,14 @@
214 + else if( !strcmp( argv[ i ], "-exposure" ) )
216 + f = atof( argv[ i + 1 ] );
217 + lightmapExposure = f;
218 + Sys_Printf( "Lighting exposure set to %f\n", lightmapExposure );
222 else if( !strcmp( argv[ i ], "-compensate" ) )
224 f = atof( argv[ i + 1 ] );
225 Index: tools/quake3/q3map2/q3map2.h
226 ===================================================================
227 --- tools/quake3/q3map2/q3map2.h (revision 191)
228 +++ tools/quake3/q3map2/q3map2.h (working copy)
230 qboolean wolfLight; /* when true, lights work like wolf q3map */
231 int lightmapSize; /* bsp lightmap width/height */
232 float lightmapGamma; /* default lightmap gamma */
233 + float lightmapExposure; /* default lightmap exposure */
234 float lightmapCompensate; /* default lightmap compensate value */
235 char *bspIdent; /* 4-letter bsp file prefix */
236 int bspVersion; /* bsp version to use */
237 @@ -2117,6 +2132,7 @@
239 /* ydnar: lightmap gamma/compensation */
240 Q_EXTERN float lightmapGamma Q_ASSIGN( 1.0f );
241 +Q_EXTERN float lightmapExposure Q_ASSIGN( 1.0f );
242 Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
244 /* ydnar: for runtime tweaking of falloff tolerance */