1 Index: bspfile_abstract.c
\r
2 ===================================================================
\r
3 --- bspfile_abstract.c (revision 158)
\r
4 +++ bspfile_abstract.c (working copy)
\r
6 ep->value = copystring( value );
11 +returns true if entity has this key
14 +qboolean KeyExists( const entity_t *ent, const char *key )
18 + /* walk epair list */
19 + for( ep = ent->epairs; ep != NULL; ep = ep->next )
21 + if( !EPAIR_STRCMP( ep->key, key ) )
31 gets the value for an entity key
37 /* get cast shadows */
38 if( castShadows != NULL )
40 @@ -831,5 +848,19 @@
\r
41 if( value[ 0 ] != '\0' )
42 *recvShadows = atoi( value );
45 + /* vortex: game-specific default eneity keys */
46 + value = ValueForKey( ent, "classname" );
47 + if (!Q_stricmp( game->magic, "dq" ) || !Q_stricmp( game->magic, "prophecy" ) )
49 + /* vortex: deluxe quake default shadow flags */
50 + if (!Q_stricmp( value, "func_wall" ) )
52 + if( recvShadows != NULL )
54 + if( castShadows != NULL )
61 ===================================================================
\r
62 --- game_ef.h (revision 158)
\r
63 +++ game_ef.h (working copy)
\r
64 @@ -113,7 +113,16 @@
\r
65 qfalse, /* wolf lighting model? */
66 128, /* lightmap width/height */
67 1.0f, /* lightmap gamma */
68 + 1.0f, /* lightmap exposure */
69 1.0f, /* lightmap compensate */
70 + 1.0f, /* lightgrid scale */
71 + 1.0f, /* lightgrid ambient scale */
72 + qfalse, /* disable shader lightstyles hack */
73 + qfalse, /* keep light entities on bsp */
74 + 8, /* default patchMeta subdivisions tolerance */
75 + qfalse, /* patch casting enabled */
76 + qfalse, /* compile deluxemaps */
77 + 0, /* deluxemaps default mode */
78 "IBSP", /* bsp file prefix */
79 46, /* bsp file version */
80 qfalse, /* cod-style lump len/ofs order */
82 ===================================================================
\r
83 --- game_etut.h (revision 158)
\r
84 +++ game_etut.h (working copy)
\r
85 @@ -148,7 +148,16 @@
\r
86 qfalse, /* wolf lighting model? */
87 128, /* lightmap width/height */
88 2.2f, /* lightmap gamma */
89 + 1.0f, /* lightmap exposure */
90 1.0f, /* lightmap compensate */
91 + 1.0f, /* lightgrid scale */
92 + 1.0f, /* lightgrid ambient scale */
93 + qfalse, /* disable shader lightstyles hack */
94 + qfalse, /* keep light entities on bsp */
95 + 8, /* default patchMeta subdivisions tolerance */
96 + qfalse, /* patch casting enabled */
97 + qfalse, /* compile deluxemaps */
98 + 0, /* deluxemaps default mode */
99 "IBSP", /* bsp file prefix */
100 47, /* bsp file version */
101 qfalse, /* cod-style lump len/ofs order */
103 ===================================================================
\r
104 --- game_ja.h (revision 158)
\r
105 +++ game_ja.h (working copy)
\r
107 qfalse, /* wolf lighting model? */
108 128, /* lightmap width/height */
109 1.0f, /* lightmap gamma */
110 + 1.0f, /* lightmap exposure */
111 1.0f, /* lightmap compensate */
112 + 1.0f, /* lightgrid scale */
113 + 1.0f, /* lightgrid ambient scale */
114 + qfalse, /* disable shader lightstyles hack */
115 + qfalse, /* keep light entities on bsp */
116 + 8, /* default patchMeta subdivisions tolerance */
117 + qfalse, /* patch casting enabled */
118 + qfalse, /* compile deluxemaps */
119 + 0, /* deluxemaps default mode */
120 "RBSP", /* bsp file prefix */
121 1, /* bsp file version */
122 qfalse, /* cod-style lump len/ofs order */
124 ===================================================================
\r
125 --- game_jk2.h (revision 158)
\r
126 +++ game_jk2.h (working copy)
\r
128 qfalse, /* wolf lighting model? */
129 128, /* lightmap width/height */
130 1.0f, /* lightmap gamma */
131 + 1.0f, /* lightmap exposure */
132 1.0f, /* lightmap compensate */
133 + 1.0f, /* lightgrid scale */
134 + 1.0f, /* lightgrid ambient scale */
135 + qfalse, /* disable shader lightstyles hack */
136 + qfalse, /* keep light entities on bsp */
137 + 8, /* default patchMeta subdivisions tolerance */
138 + qfalse, /* patch casting enabled */
139 + qfalse, /* compile deluxemaps */
140 + 0, /* deluxemaps default mode */
141 "RBSP", /* bsp file prefix */
142 1, /* bsp file version */
143 qfalse, /* cod-style lump len/ofs order */
144 Index: game_qfusion.h
\r
145 ===================================================================
\r
146 --- game_qfusion.h (revision 158)
\r
147 +++ game_qfusion.h (working copy)
\r
148 @@ -1,195 +1,204 @@
\r
149 -/* -------------------------------------------------------------------------------
151 -This code is based on source provided under the terms of the Id Software
152 -LIMITED USE SOFTWARE LICENSE AGREEMENT, a copy of which is included with the
153 -GtkRadiant sources (see LICENSE_ID). If you did not receive a copy of
154 -LICENSE_ID, please contact Id Software immediately at info@idsoftware.com.
156 -All changes and additions to the original source which have been developed by
157 -other contributors (see CONTRIBUTORS) are provided under the terms of the
158 -license the contributors choose (see LICENSE), to the extent permitted by the
159 -LICENSE_ID. If you did not receive a copy of the contributor license,
160 -please contact the GtkRadiant maintainers at info@gtkradiant.com immediately.
162 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
163 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
164 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
165 -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
166 -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
167 -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
168 -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
169 -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
170 -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
171 -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
173 -----------------------------------------------------------------------------------
175 -This code has been altered significantly from its original form, to support
176 -several games based on the Quake III Arena engine, in the form of "Q3Map2."
178 -------------------------------------------------------------------------------- */
183 -#ifndef GAME_QFUSION_H
184 -#define GAME_QFUSION_H
188 -/* -------------------------------------------------------------------------------
190 -content and surface flags
192 -------------------------------------------------------------------------------- */
195 -#define F_CONT_SOLID 1 /* an eye is never valid in a solid */
196 -#define F_CONT_LAVA 8
197 -#define F_CONT_SLIME 16
198 -#define F_CONT_WATER 32
199 -#define F_CONT_FOG 64
201 -#define F_CONT_AREAPORTAL 0x8000
203 -#define F_CONT_PLAYERCLIP 0x10000
204 -#define F_CONT_MONSTERCLIP 0x20000
205 -#define F_CONT_TELEPORTER 0x40000
206 -#define F_CONT_JUMPPAD 0x80000
207 -#define F_CONT_CLUSTERPORTAL 0x100000
208 -#define F_CONT_DONOTENTER 0x200000
209 -#define F_CONT_BOTCLIP 0x400000
211 -#define F_CONT_ORIGIN 0x1000000 /* removed before bsping an entity */
213 -#define F_CONT_BODY 0x2000000 /* should never be on a brush, only in game */
214 -#define F_CONT_CORPSE 0x4000000
215 -#define F_CONT_DETAIL 0x8000000 /* brushes not used for the bsp */
216 -#define F_CONT_STRUCTURAL 0x10000000 /* brushes used for the bsp */
217 -#define F_CONT_TRANSLUCENT 0x20000000 /* don't consume surface fragments inside */
218 -#define F_CONT_TRIGGER 0x40000000
219 -#define F_CONT_NODROP 0x80000000 /* don't leave bodies or items (death fog, lava) */
221 -#define F_SURF_NODAMAGE 0x1 /* never give falling damage */
222 -#define F_SURF_SLICK 0x2 /* effects game physics */
223 -#define F_SURF_SKY 0x4 /* lighting from environment map */
224 -#define F_SURF_LADDER 0x8
225 -#define F_SURF_NOIMPACT 0x10 /* don't make missile explosions */
226 -#define F_SURF_NOMARKS 0x20 /* don't leave missile marks */
227 -#define F_SURF_FLESH 0x40 /* make flesh sounds and effects */
228 -#define F_SURF_NODRAW 0x80 /* don't generate a drawsurface at all */
229 -#define F_SURF_HINT 0x100 /* make a primary bsp splitter */
230 -#define F_SURF_SKIP 0x200 /* completely ignore, allowing non-closed brushes */
231 -#define F_SURF_NOLIGHTMAP 0x400 /* surface doesn't need a lightmap */
232 -#define F_SURF_POINTLIGHT 0x800 /* generate lighting info at vertexes */
233 -#define F_SURF_METALSTEPS 0x1000 /* clanking footsteps */
234 -#define F_SURF_NOSTEPS 0x2000 /* no footstep sounds */
235 -#define F_SURF_NONSOLID 0x4000 /* don't collide against curves with this set */
236 -#define F_SURF_LIGHTFILTER 0x8000 /* act as a light filter during q3map -light */
237 -#define F_SURF_ALPHASHADOW 0x10000 /* do per-pixel light shadow casting in q3map */
238 -#define F_SURF_NODLIGHT 0x20000 /* don't dlight even if solid (solid lava, skies) */
239 -#define F_SURF_DUST 0x40000 /* leave a dust trail when walking on this surface */
242 -#define F_SURF_VERTEXLIT (F_SURF_POINTLIGHT | F_SURF_NOLIGHTMAP)
246 -/* -------------------------------------------------------------------------------
250 -------------------------------------------------------------------------------- */
253 - "qfusion", /* -game x */
254 - "baseq3", /* default base game data dir */
255 - ".q3a", /* unix home sub-dir */
256 - "quake", /* magic path word */
257 - "scripts", /* shader directory */
258 - 2048, /* max lightmapped surface verts */
259 - 2048, /* max surface verts */
260 - 12288, /* max surface indexes */
261 - qtrue, /* flares */
262 - "flareshader", /* default flare shader */
263 - qfalse, /* wolf lighting model? */
264 - 512, /* lightmap width/height */
265 - 1.0f, /* lightmap gamma */
266 - 1.0f, /* lightmap compensate */
267 - "FBSP", /* bsp file prefix */
268 - 1, /* bsp file version */
269 - qfalse, /* cod-style lump len/ofs order */
270 - LoadRBSPFile, /* bsp load function */
271 - WriteRBSPFile, /* bsp write function */
274 - /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
277 - { "default", F_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
281 - { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
282 - { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
283 - { "skip", 0, 0, 0, 0, C_SKIP, 0 },
287 - { "origin", F_CONT_ORIGIN, F_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
288 - { "areaportal", F_CONT_AREAPORTAL, F_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
289 - { "trans", F_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
290 - { "detail", F_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
291 - { "structural", F_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
292 - { "hint", 0, 0, F_SURF_HINT, 0, C_HINT, 0 },
293 - { "nodraw", 0, 0, F_SURF_NODRAW, 0, C_NODRAW, 0 },
295 - { "alphashadow", 0, 0, F_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
296 - { "lightfilter", 0, 0, F_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
297 - { "nolightmap", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
298 - { "pointlight", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
302 - { "nonsolid", 0, F_CONT_SOLID, F_SURF_NONSOLID, 0, 0, C_SOLID },
304 - { "trigger", F_CONT_TRIGGER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
306 - { "water", F_CONT_WATER, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
307 - { "slime", F_CONT_SLIME, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
308 - { "lava", F_CONT_LAVA, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
310 - { "playerclip", F_CONT_PLAYERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
311 - { "monsterclip", F_CONT_MONSTERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
312 - { "nodrop", F_CONT_NODROP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
314 - { "clusterportal", F_CONT_CLUSTERPORTAL, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
315 - { "donotenter", F_CONT_DONOTENTER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
316 - { "botclip", F_CONT_BOTCLIP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
318 - { "fog", F_CONT_FOG, F_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
319 - { "sky", 0, 0, F_SURF_SKY, 0, C_SKY, 0 },
321 - { "slick", 0, 0, F_SURF_SLICK, 0, 0, 0 },
323 - { "noimpact", 0, 0, F_SURF_NOIMPACT, 0, 0, 0 },
324 - { "nomarks", 0, 0, F_SURF_NOMARKS, 0, C_NOMARKS, 0 },
325 - { "ladder", 0, 0, F_SURF_LADDER, 0, 0, 0 },
326 - { "nodamage", 0, 0, F_SURF_NODAMAGE, 0, 0, 0 },
327 - { "metalsteps", 0, 0, F_SURF_METALSTEPS, 0, 0, 0 },
328 - { "flesh", 0, 0, F_SURF_FLESH, 0, 0, 0 },
329 - { "nosteps", 0, 0, F_SURF_NOSTEPS, 0, 0, 0 },
330 - { "nodlight", 0, 0, F_SURF_NODLIGHT, 0, 0, 0 },
331 - { "dust", 0, 0, F_SURF_DUST, 0, 0, 0 },
335 - { NULL, 0, 0, 0, 0, 0, 0 }
344 +/* -------------------------------------------------------------------------------
\r
346 +This code is based on source provided under the terms of the Id Software
\r
347 +LIMITED USE SOFTWARE LICENSE AGREEMENT, a copy of which is included with the
\r
348 +GtkRadiant sources (see LICENSE_ID). If you did not receive a copy of
\r
349 +LICENSE_ID, please contact Id Software immediately at info@idsoftware.com.
\r
351 +All changes and additions to the original source which have been developed by
\r
352 +other contributors (see CONTRIBUTORS) are provided under the terms of the
\r
353 +license the contributors choose (see LICENSE), to the extent permitted by the
\r
354 +LICENSE_ID. If you did not receive a copy of the contributor license,
\r
355 +please contact the GtkRadiant maintainers at info@gtkradiant.com immediately.
\r
357 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
\r
358 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
359 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
360 +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
\r
361 +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
362 +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
363 +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
\r
364 +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
365 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
366 +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
368 +----------------------------------------------------------------------------------
\r
370 +This code has been altered significantly from its original form, to support
\r
371 +several games based on the Quake III Arena engine, in the form of "Q3Map2."
\r
373 +------------------------------------------------------------------------------- */
\r
378 +#ifndef GAME_QFUSION_H
\r
379 +#define GAME_QFUSION_H
\r
383 +/* -------------------------------------------------------------------------------
\r
385 +content and surface flags
\r
387 +------------------------------------------------------------------------------- */
\r
390 +#define F_CONT_SOLID 1 /* an eye is never valid in a solid */
\r
391 +#define F_CONT_LAVA 8
\r
392 +#define F_CONT_SLIME 16
\r
393 +#define F_CONT_WATER 32
\r
394 +#define F_CONT_FOG 64
\r
396 +#define F_CONT_AREAPORTAL 0x8000
\r
398 +#define F_CONT_PLAYERCLIP 0x10000
\r
399 +#define F_CONT_MONSTERCLIP 0x20000
\r
400 +#define F_CONT_TELEPORTER 0x40000
\r
401 +#define F_CONT_JUMPPAD 0x80000
\r
402 +#define F_CONT_CLUSTERPORTAL 0x100000
\r
403 +#define F_CONT_DONOTENTER 0x200000
\r
404 +#define F_CONT_BOTCLIP 0x400000
\r
406 +#define F_CONT_ORIGIN 0x1000000 /* removed before bsping an entity */
\r
408 +#define F_CONT_BODY 0x2000000 /* should never be on a brush, only in game */
\r
409 +#define F_CONT_CORPSE 0x4000000
\r
410 +#define F_CONT_DETAIL 0x8000000 /* brushes not used for the bsp */
\r
411 +#define F_CONT_STRUCTURAL 0x10000000 /* brushes used for the bsp */
\r
412 +#define F_CONT_TRANSLUCENT 0x20000000 /* don't consume surface fragments inside */
\r
413 +#define F_CONT_TRIGGER 0x40000000
\r
414 +#define F_CONT_NODROP 0x80000000 /* don't leave bodies or items (death fog, lava) */
\r
416 +#define F_SURF_NODAMAGE 0x1 /* never give falling damage */
\r
417 +#define F_SURF_SLICK 0x2 /* effects game physics */
\r
418 +#define F_SURF_SKY 0x4 /* lighting from environment map */
\r
419 +#define F_SURF_LADDER 0x8
\r
420 +#define F_SURF_NOIMPACT 0x10 /* don't make missile explosions */
\r
421 +#define F_SURF_NOMARKS 0x20 /* don't leave missile marks */
\r
422 +#define F_SURF_FLESH 0x40 /* make flesh sounds and effects */
\r
423 +#define F_SURF_NODRAW 0x80 /* don't generate a drawsurface at all */
\r
424 +#define F_SURF_HINT 0x100 /* make a primary bsp splitter */
\r
425 +#define F_SURF_SKIP 0x200 /* completely ignore, allowing non-closed brushes */
\r
426 +#define F_SURF_NOLIGHTMAP 0x400 /* surface doesn't need a lightmap */
\r
427 +#define F_SURF_POINTLIGHT 0x800 /* generate lighting info at vertexes */
\r
428 +#define F_SURF_METALSTEPS 0x1000 /* clanking footsteps */
\r
429 +#define F_SURF_NOSTEPS 0x2000 /* no footstep sounds */
\r
430 +#define F_SURF_NONSOLID 0x4000 /* don't collide against curves with this set */
\r
431 +#define F_SURF_LIGHTFILTER 0x8000 /* act as a light filter during q3map -light */
\r
432 +#define F_SURF_ALPHASHADOW 0x10000 /* do per-pixel light shadow casting in q3map */
\r
433 +#define F_SURF_NODLIGHT 0x20000 /* don't dlight even if solid (solid lava, skies) */
\r
434 +#define F_SURF_DUST 0x40000 /* leave a dust trail when walking on this surface */
\r
437 +#define F_SURF_VERTEXLIT (F_SURF_POINTLIGHT | F_SURF_NOLIGHTMAP)
\r
441 +/* -------------------------------------------------------------------------------
\r
445 +------------------------------------------------------------------------------- */
\r
448 + "qfusion", /* -game x */
\r
449 + "baseq3", /* default base game data dir */
\r
450 + ".q3a", /* unix home sub-dir */
\r
451 + "quake", /* magic path word */
\r
452 + "scripts", /* shader directory */
\r
453 + 2048, /* max lightmapped surface verts */
\r
454 + 2048, /* max surface verts */
\r
455 + 12288, /* max surface indexes */
\r
456 + qtrue, /* flares */
\r
457 + "flareshader", /* default flare shader */
\r
458 + qfalse, /* wolf lighting model? */
\r
459 + 512, /* lightmap width/height */
\r
460 + 1.0f, /* lightmap gamma */
\r
461 + 1.0f, /* lightmap exposure */
\r
462 + 1.0f, /* lightmap compensate */
\r
463 + 1.0f, /* lightgrid scale */
\r
464 + 1.0f, /* lightgrid ambient scale */
\r
465 + qfalse, /* disable shader lightstyles hack */
\r
466 + qfalse, /* keep light entities on bsp */
\r
467 + 8, /* default patchMeta subdivisions tolerance */
\r
468 + qfalse, /* patch casting enabled */
\r
469 + qfalse, /* compile deluxemaps */
\r
470 + 0, /* deluxemaps default mode */
\r
471 + "FBSP", /* bsp file prefix */
\r
472 + 1, /* bsp file version */
\r
473 + qfalse, /* cod-style lump len/ofs order */
\r
474 + LoadRBSPFile, /* bsp load function */
\r
475 + WriteRBSPFile, /* bsp write function */
\r
478 + /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
\r
481 + { "default", F_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
\r
485 + { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
\r
486 + { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
\r
487 + { "skip", 0, 0, 0, 0, C_SKIP, 0 },
\r
491 + { "origin", F_CONT_ORIGIN, F_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
\r
492 + { "areaportal", F_CONT_AREAPORTAL, F_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
\r
493 + { "trans", F_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
\r
494 + { "detail", F_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
\r
495 + { "structural", F_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
\r
496 + { "hint", 0, 0, F_SURF_HINT, 0, C_HINT, 0 },
\r
497 + { "nodraw", 0, 0, F_SURF_NODRAW, 0, C_NODRAW, 0 },
\r
499 + { "alphashadow", 0, 0, F_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
\r
500 + { "lightfilter", 0, 0, F_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
\r
501 + { "nolightmap", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
502 + { "pointlight", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
506 + { "nonsolid", 0, F_CONT_SOLID, F_SURF_NONSOLID, 0, 0, C_SOLID },
\r
508 + { "trigger", F_CONT_TRIGGER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
510 + { "water", F_CONT_WATER, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
511 + { "slime", F_CONT_SLIME, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
512 + { "lava", F_CONT_LAVA, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
514 + { "playerclip", F_CONT_PLAYERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
515 + { "monsterclip", F_CONT_MONSTERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
516 + { "nodrop", F_CONT_NODROP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
518 + { "clusterportal", F_CONT_CLUSTERPORTAL, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
519 + { "donotenter", F_CONT_DONOTENTER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
520 + { "botclip", F_CONT_BOTCLIP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
522 + { "fog", F_CONT_FOG, F_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
\r
523 + { "sky", 0, 0, F_SURF_SKY, 0, C_SKY, 0 },
\r
525 + { "slick", 0, 0, F_SURF_SLICK, 0, 0, 0 },
\r
527 + { "noimpact", 0, 0, F_SURF_NOIMPACT, 0, 0, 0 },
\r
528 + { "nomarks", 0, 0, F_SURF_NOMARKS, 0, C_NOMARKS, 0 },
\r
529 + { "ladder", 0, 0, F_SURF_LADDER, 0, 0, 0 },
\r
530 + { "nodamage", 0, 0, F_SURF_NODAMAGE, 0, 0, 0 },
\r
531 + { "metalsteps", 0, 0, F_SURF_METALSTEPS, 0, 0, 0 },
\r
532 + { "flesh", 0, 0, F_SURF_FLESH, 0, 0, 0 },
\r
533 + { "nosteps", 0, 0, F_SURF_NOSTEPS, 0, 0, 0 },
\r
534 + { "nodlight", 0, 0, F_SURF_NODLIGHT, 0, 0, 0 },
\r
535 + { "dust", 0, 0, F_SURF_DUST, 0, 0, 0 },
\r
539 + { NULL, 0, 0, 0, 0, 0, 0 }
\r
548 Index: game_quake3.h
\r
549 ===================================================================
\r
550 --- game_quake3.h (revision 158)
\r
551 +++ game_quake3.h (working copy)
\r
552 @@ -112,7 +112,16 @@
\r
553 qfalse, /* wolf lighting model? */
554 128, /* lightmap width/height */
555 1.0f, /* lightmap gamma */
556 + 1.0f, /* lightmap exposure */
557 1.0f, /* lightmap compensate */
558 + 1.0f, /* lightgrid scale */
559 + 1.0f, /* lightgrid ambient scale */
560 + qfalse, /* disable shader lightstyles hack */
561 + qfalse, /* keep light entities on bsp */
562 + 8, /* default patchMeta subdivisions tolerance */
563 + qfalse, /* patch casting enabled */
564 + qfalse, /* compile deluxemaps */
565 + 0, /* deluxemaps default mode */
566 "IBSP", /* bsp file prefix */
567 46, /* bsp file version */
568 qfalse, /* cod-style lump len/ofs order */
570 ===================================================================
\r
571 --- game_sof2.h (revision 158)
\r
572 +++ game_sof2.h (working copy)
\r
573 @@ -139,7 +139,16 @@
\r
574 qfalse, /* wolf lighting model? */
575 128, /* lightmap width/height */
576 1.0f, /* lightmap gamma */
577 + 1.0f, /* lightmap exposure */
578 1.0f, /* lightmap compensate */
579 + 1.0f, /* lightgrid scale */
580 + 1.0f, /* lightgrid ambient scale */
581 + qfalse, /* disable shader lightstyles hack */
582 + qfalse, /* keep light entities on bsp */
583 + 8, /* default patchMeta subdivisions tolerance */
584 + qfalse, /* patch casting enabled */
585 + qfalse, /* compile deluxemaps */
586 + 0, /* deluxemaps default mode */
587 "RBSP", /* bsp file prefix */
588 1, /* bsp file version */
589 qfalse, /* cod-style lump len/ofs order */
590 Index: game_tenebrae.h
\r
591 ===================================================================
\r
592 --- game_tenebrae.h (revision 158)
\r
593 +++ game_tenebrae.h (working copy)
\r
594 @@ -112,7 +112,16 @@
\r
595 qfalse, /* wolf lighting model? */
596 512, /* lightmap width/height */
597 2.0f, /* lightmap gamma */
598 + 1.0f, /* lightmap exposure */
599 1.0f, /* lightmap compensate */
600 + 1.0f, /* lightgrid scale */
601 + 1.0f, /* lightgrid ambient scale */
602 + qtrue, /* disable shader lightstyles hack */
603 + qfalse, /* keep light entities on bsp */
604 + 8, /* default patchMeta subdivisions tolerance */
605 + qfalse, /* patch casting enabled */
606 + qtrue, /* compile deluxemaps */
607 + 0, /* deluxemaps default mode */
608 "IBSP", /* bsp file prefix */
609 46, /* bsp file version */
610 qfalse, /* cod-style lump len/ofs order */
611 Index: game_tremulous.h
\r
612 ===================================================================
\r
613 --- game_tremulous.h (revision 158)
\r
614 +++ game_tremulous.h (working copy)
\r
615 @@ -1,160 +1,169 @@
\r
616 -/* -------------------------------------------------------------------------------
618 -Copyright (C) 1999-2006 Id Software, Inc. and contributors.
619 -For a list of contributors, see the accompanying CONTRIBUTORS file.
621 -This file is part of GtkRadiant.
623 -GtkRadiant is free software; you can redistribute it and/or modify
624 -it under the terms of the GNU General Public License as published by
625 -the Free Software Foundation; either version 2 of the License, or
626 -(at your option) any later version.
628 -GtkRadiant is distributed in the hope that it will be useful,
629 -but WITHOUT ANY WARRANTY; without even the implied warranty of
630 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
631 -GNU General Public License for more details.
633 -You should have received a copy of the GNU General Public License
634 -along with GtkRadiant; if not, write to the Free Software
635 -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
637 -----------------------------------------------------------------------------------
639 -This code has been altered significantly from its original form, to support
640 -several games based on the Quake III Arena engine, in the form of "Q3Map2."
642 -------------------------------------------------------------------------------- */
644 -/* Tremulous support, by LinuxManMikeC */
648 -#ifndef GAME_TREMULOUS_H
649 -#define GAME_TREMULOUS_H
653 -/* -------------------------------------------------------------------------------
655 -content and surface flags - also uses defines from game_quake3.h
657 -------------------------------------------------------------------------------- */
658 -#define TREM_CONT_NOALIENBUILD 0x1000
659 -#define TREM_CONT_NOHUMANBUILD 0x2000
660 -#define TREM_CONT_NOBUILD 0x4000
662 -#define TREM_SURF_NOALIENBUILDSURFACE 0x80000
663 -#define TREM_SURF_NOHUMANBUILDSURFACE 0x100000
664 -#define TREM_SURF_NOBUILDSURFACE 0x200000
668 -/* -------------------------------------------------------------------------------
672 -------------------------------------------------------------------------------- */
675 - "tremulous", /* -game x */
676 - "base", /* default base game data dir */
677 - ".tremulous", /* unix home sub-dir */
678 - "tremulous", /* magic path word - think this is right for trem*/
679 - "scripts", /* shader directory */
680 - 64, /* max lightmapped surface verts */
681 - 999, /* max surface verts */
682 - 6000, /* max surface indexes */
683 - qfalse, /* flares */
684 - "flareshader", /* default flare shader */
685 - qfalse, /* wolf lighting model? */
686 - 128, /* lightmap width/height */
687 - 1.0f, /* lightmap gamma */
688 - 1.0f, /* lightmap compensate */
689 - "IBSP", /* bsp file prefix */
690 - 46, /* bsp file version */
691 - qfalse, /* cod-style lump len/ofs order */
692 - LoadIBSPFile, /* bsp load function */
693 - WriteIBSPFile, /* bsp write function */
696 - /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
699 - { "default", Q_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
703 - { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
704 - { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
705 - { "skip", 0, 0, 0, 0, C_SKIP, 0 },
709 - { "origin", Q_CONT_ORIGIN, Q_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
710 - { "areaportal", Q_CONT_AREAPORTAL, Q_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
711 - { "trans", Q_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
712 - { "detail", Q_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
713 - { "structural", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
714 - { "hint", 0, 0, Q_SURF_HINT, 0, C_HINT, 0 },
715 - { "nodraw", 0, 0, Q_SURF_NODRAW, 0, C_NODRAW, 0 },
717 - { "alphashadow", 0, 0, Q_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
718 - { "lightfilter", 0, 0, Q_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
719 - { "nolightmap", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
720 - { "pointlight", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
724 - { "nonsolid", 0, Q_CONT_SOLID, Q_SURF_NONSOLID, 0, 0, C_SOLID },
726 - { "trigger", Q_CONT_TRIGGER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
728 - { "water", Q_CONT_WATER, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
729 - { "slime", Q_CONT_SLIME, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
730 - { "lava", Q_CONT_LAVA, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
732 - { "playerclip", Q_CONT_PLAYERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
733 - { "monsterclip", Q_CONT_MONSTERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
734 - { "nodrop", Q_CONT_NODROP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
736 - { "clusterportal", Q_CONT_CLUSTERPORTAL, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
737 - { "donotenter", Q_CONT_DONOTENTER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
738 - { "botclip", Q_CONT_BOTCLIP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
740 - { "fog", Q_CONT_FOG, Q_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
741 - { "sky", 0, 0, Q_SURF_SKY, 0, C_SKY, 0 },
743 - { "slick", 0, 0, Q_SURF_SLICK, 0, 0, 0 },
745 - { "noimpact", 0, 0, Q_SURF_NOIMPACT, 0, 0, 0 },
746 - { "nomarks", 0, 0, Q_SURF_NOMARKS, 0, C_NOMARKS, 0 },
747 - { "ladder", 0, 0, Q_SURF_LADDER, 0, 0, 0 },
748 - { "nodamage", 0, 0, Q_SURF_NODAMAGE, 0, 0, 0 },
749 - { "metalsteps", 0, 0, Q_SURF_METALSTEPS, 0, 0, 0 },
750 - { "flesh", 0, 0, Q_SURF_FLESH, 0, 0, 0 },
751 - { "nosteps", 0, 0, Q_SURF_NOSTEPS, 0, 0, 0 },
752 - { "nodlight", 0, 0, Q_SURF_NODLIGHT, 0, 0, 0 },
753 - { "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
757 - {"noalienbuild", TREM_CONT_NOALIENBUILD,0,0,0,0,0},
758 - {"nohumanbuild", TREM_CONT_NOHUMANBUILD,0,0,0,0,0},
759 - {"nobuild", TREM_CONT_NOBUILD,0,0,0,0,0},
761 - {"noalienbuildsurface", 0,0,TREM_SURF_NOALIENBUILDSURFACE,0,0,0},
762 - {"nohumanbuildsurface", 0,0,TREM_SURF_NOHUMANBUILDSURFACE,0,0,0},
763 - {"nobuildsurface", 0,0,TREM_SURF_NOBUILDSURFACE,0,0,0},
767 - { NULL, 0, 0, 0, 0, 0, 0 }
776 +/* -------------------------------------------------------------------------------
\r
778 +Copyright (C) 1999-2006 Id Software, Inc. and contributors.
\r
779 +For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
781 +This file is part of GtkRadiant.
\r
783 +GtkRadiant is free software; you can redistribute it and/or modify
\r
784 +it under the terms of the GNU General Public License as published by
\r
785 +the Free Software Foundation; either version 2 of the License, or
\r
786 +(at your option) any later version.
\r
788 +GtkRadiant is distributed in the hope that it will be useful,
\r
789 +but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
790 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
791 +GNU General Public License for more details.
\r
793 +You should have received a copy of the GNU General Public License
\r
794 +along with GtkRadiant; if not, write to the Free Software
\r
795 +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
797 +----------------------------------------------------------------------------------
\r
799 +This code has been altered significantly from its original form, to support
\r
800 +several games based on the Quake III Arena engine, in the form of "Q3Map2."
\r
802 +------------------------------------------------------------------------------- */
\r
804 +/* Tremulous support, by LinuxManMikeC */
\r
808 +#ifndef GAME_TREMULOUS_H
\r
809 +#define GAME_TREMULOUS_H
\r
813 +/* -------------------------------------------------------------------------------
\r
815 +content and surface flags - also uses defines from game_quake3.h
\r
817 +------------------------------------------------------------------------------- */
\r
818 +#define TREM_CONT_NOALIENBUILD 0x1000
\r
819 +#define TREM_CONT_NOHUMANBUILD 0x2000
\r
820 +#define TREM_CONT_NOBUILD 0x4000
\r
822 +#define TREM_SURF_NOALIENBUILDSURFACE 0x80000
\r
823 +#define TREM_SURF_NOHUMANBUILDSURFACE 0x100000
\r
824 +#define TREM_SURF_NOBUILDSURFACE 0x200000
\r
828 +/* -------------------------------------------------------------------------------
\r
832 +------------------------------------------------------------------------------- */
\r
835 + "tremulous", /* -game x */
\r
836 + "base", /* default base game data dir */
\r
837 + ".tremulous", /* unix home sub-dir */
\r
838 + "tremulous", /* magic path word - think this is right for trem*/
\r
839 + "scripts", /* shader directory */
\r
840 + 64, /* max lightmapped surface verts */
\r
841 + 999, /* max surface verts */
\r
842 + 6000, /* max surface indexes */
\r
843 + qfalse, /* flares */
\r
844 + "flareshader", /* default flare shader */
\r
845 + qfalse, /* wolf lighting model? */
\r
846 + 128, /* lightmap width/height */
\r
847 + 1.0f, /* lightmap gamma */
\r
848 + 1.0f, /* lightmap exposure */
\r
849 + 1.0f, /* lightmap compensate */
\r
850 + 1.0f, /* lightgrid scale */
\r
851 + 1.0f, /* lightgrid ambient scale */
\r
852 + qfalse, /* disable shader lightstyles hack */
\r
853 + qfalse, /* keep light entities on bsp */
\r
854 + 8, /* default patchMeta subdivisions tolerance */
\r
855 + qfalse, /* patch casting enabled */
\r
856 + qfalse, /* compile deluxemaps */
\r
857 + 0, /* deluxemaps default mode */
\r
858 + "IBSP", /* bsp file prefix */
\r
859 + 46, /* bsp file version */
\r
860 + qfalse, /* cod-style lump len/ofs order */
\r
861 + LoadIBSPFile, /* bsp load function */
\r
862 + WriteIBSPFile, /* bsp write function */
\r
865 + /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
\r
868 + { "default", Q_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
\r
872 + { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
\r
873 + { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
\r
874 + { "skip", 0, 0, 0, 0, C_SKIP, 0 },
\r
878 + { "origin", Q_CONT_ORIGIN, Q_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
\r
879 + { "areaportal", Q_CONT_AREAPORTAL, Q_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
\r
880 + { "trans", Q_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
\r
881 + { "detail", Q_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
\r
882 + { "structural", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
\r
883 + { "hint", 0, 0, Q_SURF_HINT, 0, C_HINT, 0 },
\r
884 + { "nodraw", 0, 0, Q_SURF_NODRAW, 0, C_NODRAW, 0 },
\r
886 + { "alphashadow", 0, 0, Q_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
\r
887 + { "lightfilter", 0, 0, Q_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
\r
888 + { "nolightmap", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
889 + { "pointlight", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
893 + { "nonsolid", 0, Q_CONT_SOLID, Q_SURF_NONSOLID, 0, 0, C_SOLID },
\r
895 + { "trigger", Q_CONT_TRIGGER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
897 + { "water", Q_CONT_WATER, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
898 + { "slime", Q_CONT_SLIME, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
899 + { "lava", Q_CONT_LAVA, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
901 + { "playerclip", Q_CONT_PLAYERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
902 + { "monsterclip", Q_CONT_MONSTERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
903 + { "nodrop", Q_CONT_NODROP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
905 + { "clusterportal", Q_CONT_CLUSTERPORTAL, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
906 + { "donotenter", Q_CONT_DONOTENTER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
907 + { "botclip", Q_CONT_BOTCLIP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
909 + { "fog", Q_CONT_FOG, Q_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
\r
910 + { "sky", 0, 0, Q_SURF_SKY, 0, C_SKY, 0 },
\r
912 + { "slick", 0, 0, Q_SURF_SLICK, 0, 0, 0 },
\r
914 + { "noimpact", 0, 0, Q_SURF_NOIMPACT, 0, 0, 0 },
\r
915 + { "nomarks", 0, 0, Q_SURF_NOMARKS, 0, C_NOMARKS, 0 },
\r
916 + { "ladder", 0, 0, Q_SURF_LADDER, 0, 0, 0 },
\r
917 + { "nodamage", 0, 0, Q_SURF_NODAMAGE, 0, 0, 0 },
\r
918 + { "metalsteps", 0, 0, Q_SURF_METALSTEPS, 0, 0, 0 },
\r
919 + { "flesh", 0, 0, Q_SURF_FLESH, 0, 0, 0 },
\r
920 + { "nosteps", 0, 0, Q_SURF_NOSTEPS, 0, 0, 0 },
\r
921 + { "nodlight", 0, 0, Q_SURF_NODLIGHT, 0, 0, 0 },
\r
922 + { "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
\r
926 + {"noalienbuild", TREM_CONT_NOALIENBUILD,0,0,0,0,0},
\r
927 + {"nohumanbuild", TREM_CONT_NOHUMANBUILD,0,0,0,0,0},
\r
928 + {"nobuild", TREM_CONT_NOBUILD,0,0,0,0,0},
\r
930 + {"noalienbuildsurface", 0,0,TREM_SURF_NOALIENBUILDSURFACE,0,0,0},
\r
931 + {"nohumanbuildsurface", 0,0,TREM_SURF_NOHUMANBUILDSURFACE,0,0,0},
\r
932 + {"nobuildsurface", 0,0,TREM_SURF_NOBUILDSURFACE,0,0,0},
\r
936 + { NULL, 0, 0, 0, 0, 0, 0 }
\r
946 ===================================================================
\r
947 --- game_wolf.h (revision 158)
\r
948 +++ game_wolf.h (working copy)
\r
949 @@ -129,7 +129,16 @@
\r
950 qtrue, /* wolf lighting model? */
951 128, /* lightmap width/height */
952 1.0f, /* lightmap gamma */
953 + 1.0f, /* lightmap exposure */
954 1.0f, /* lightmap compensate */
955 + 1.0f, /* lightgrid scale */
956 + 1.0f, /* lightgrid ambient scale */
957 + qfalse, /* disable shader lightstyles hack */
958 + qfalse, /* keep light entities on bsp */
959 + 8, /* default patchMeta subdivisions tolerance */
960 + qfalse, /* patch casting enabled */
961 + qfalse, /* compile deluxemaps */
962 + 0, /* deluxemaps default mode */
963 "IBSP", /* bsp file prefix */
964 47, /* bsp file version */
965 qfalse, /* cod-style lump len/ofs order */
966 Index: game_wolfet.h
\r
967 ===================================================================
\r
968 --- game_wolfet.h (revision 158)
\r
969 +++ game_wolfet.h (working copy)
\r
971 qtrue, /* wolf lighting model? */
972 128, /* lightmap width/height */
973 1.0f, /* lightmap gamma */
974 + 1.0f, /* lightmap exposure */
975 1.0f, /* lightmap compensate */
976 + 1.0f, /* lightgrid scale */
977 + 1.0f, /* lightgrid ambient scale */
978 + qfalse, /* disable shader lightstyles hack */
979 + qfalse, /* keep light entities on bsp */
980 + 8, /* default patchMeta subdivisions tolerance */
981 + qfalse, /* patch casting enabled */
982 + qfalse, /* compile deluxemaps */
983 + 0, /* deluxemaps default mode */
984 "IBSP", /* bsp file prefix */
985 47, /* bsp file version */
986 qfalse, /* cod-style lump len/ofs order */
988 ===================================================================
\r
989 --- light.c (revision 158)
\r
990 +++ light.c (working copy)
\r
991 @@ -313,7 +313,15 @@
\r
993 flags &= ~LIGHT_SURFACES;
997 + /* vortex: unnormalized? */
998 + if (spawnflags & 32)
999 + flags |= LIGHT_UNNORMALIZED;
1001 + /* vortex: distance atten? */
1002 + if (spawnflags & 64)
1003 + flags |= LIGHT_ATTEN_DISTANCE;
1005 /* store the flags */
1006 light->flags = flags;
1008 @@ -357,12 +365,13 @@
\r
1011 /* ydnar: get deviance and samples */
1012 + /* VorteX: now set start value for _samples when _deviance is found */
1013 deviance = FloatForKey( e, "_deviance" );
1014 if( deviance == 0.0f )
1015 deviance = FloatForKey( e, "_deviation" );
1016 if( deviance == 0.0f )
1017 deviance = FloatForKey( e, "_jitter" );
1018 - numSamples = IntForKey( e, "_samples" );
1019 + numSamples = max(IntForKey( e, "_samples" ), deviance);
1020 if( deviance < 0.0f || numSamples < 1 )
1023 @@ -385,14 +394,16 @@
\r
1024 if( _color && _color[ 0 ] )
1026 sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] );
1027 - ColorNormalize( light->color, light->color );
1028 + if (!(light->flags & LIGHT_UNNORMALIZED))
1030 + ColorNormalize( light->color, light->color );
1034 light->color[ 0 ] = light->color[ 1 ] = light->color[ 2 ] = 1.0f;
1037 intensity = intensity * pointScale;
1038 light->photons = intensity;
1040 light->type = EMIT_POINT;
1042 /* set falloff threshold */
1043 @@ -741,6 +752,7 @@
\r
1046 VectorClear( trace->color );
1047 + VectorClear( trace->colorNoShadow );
1049 /* ydnar: early out */
1050 if( !(light->flags & LIGHT_SURFACES) || light->envelope <= 0.0f )
1051 @@ -766,7 +778,6 @@
\r
1053 vec3_t pushedOrigin;
1056 /* project sample point into light plane */
1057 d = DotProduct( trace->origin, light->normal ) - light->dist;
1059 @@ -881,8 +892,7 @@
\r
1061 float distByNormal, radiusAtDist, sampleRadius;
1062 vec3_t pointAtDist, distToSample;
1066 /* do cone calculation */
1067 distByNormal = -DotProduct( trace->displacement, light->normal );
1068 if( distByNormal < 0.0f )
1069 @@ -922,6 +932,9 @@
\r
1070 add = light->photons * angle;
1074 + /* VorteX: set noShadow color */
1075 + VectorScale(light->color, add, trace->colorNoShadow);
1078 trace->testAll = qtrue;
1079 @@ -942,6 +955,9 @@
\r
1080 /* return to sender */
1084 + /* VorteX: set noShadow color */
1085 + VectorScale(light->color, add, trace->colorNoShadow);
1087 /* ydnar: changed to a variable number */
1088 if( add <= 0.0f || (add <= light->falloffTolerance && (light->flags & LIGHT_FAST_ACTUAL)) )
1089 @@ -1378,6 +1394,56 @@
\r
1093 + /////// Floodlighting for point //////////////////
1094 + //do our floodlight ambient occlusion loop, and add a single contribution based on the brightest dir
1100 + col[0]=col[1]=col[2]=floodlightIntensity;
1104 + trace.testOcclusion = qtrue;
1105 + trace.forceSunlight = qfalse;
1106 + trace.inhibitRadius = DEFAULT_INHIBIT_RADIUS;
1107 + trace.testAll = qtrue;
1111 + if (q==0) //upper hemisphere
1113 + trace.normal[0]=0;
1114 + trace.normal[1]=0;
1115 + trace.normal[2]=1;
1117 + else //lower hemisphere
1119 + trace.normal[0]=0;
1120 + trace.normal[1]=0;
1121 + trace.normal[2]=-1;
1124 + f = FloodLightForSample(&trace, floodlightDistance, floodlight_lowquality);
1126 + contributions[ numCon ].color[0]=col[0]*f;
1127 + contributions[ numCon ].color[1]=col[1]*f;
1128 + contributions[ numCon ].color[2]=col[2]*f;
1130 + contributions[ numCon ].dir[0]=dir[0];
1131 + contributions[ numCon ].dir[1]=dir[1];
1132 + contributions[ numCon ].dir[2]=dir[2];
1134 + contributions[ numCon ].style = 0;
1136 + /* push average direction around */
1137 + addSize = VectorLength( col );
1138 + VectorMA( gp->dir, addSize, dir, gp->dir );
1141 + /////////////////////
1143 /* normalize to get primary light direction */
1144 VectorNormalize( gp->dir, gp->dir );
1146 @@ -1420,6 +1486,9 @@
\r
1148 /* ambient light will be at 1/4 the value of directed light */
1149 /* (ydnar: nuke this in favor of more dramatic lighting?) */
1150 + /* (PM: how about actually making it work? d=1 when it got here for single lights/sun :P */
1152 + /* (Hobbes: always setting it to .25 is hardly any better) */
1153 d = 0.25f * (1.0f - d);
1154 VectorMA( gp->ambient[ j ], d, contributions[ i ].color, gp->ambient[ j ] );
1156 @@ -1437,8 +1506,10 @@
\r
1157 for( j = 0; j < 3; j++ )
1158 if( color[ j ] < minGridLight[ j ] )
1159 color[ j ] = minGridLight[ j ];
1160 - ColorToBytes( color, bgp->ambient[ i ], 1.0f );
1161 - ColorToBytes( gp->directed[ i ], bgp->directed[ i ], 1.0f );
1163 + /* vortex: apply gridscale and gridambientscale here */
1164 + ColorToBytes( color, bgp->ambient[ i ], gridScale*gridAmbientScale );
1165 + ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale );
1169 @@ -1654,14 +1725,12 @@
\r
1172 Sys_Printf( "--- DirtyRawLightmap ---\n" );
1177 RunThreadsOnIndividual( numRawLightmaps, qtrue, DirtyRawLightmap );
1181 + /* floodlight pass */
1182 + FloodlightRawLightmaps();
1184 /* ydnar: set up light envelopes */
1185 SetupEnvelopes( qfalse, fast );
1187 @@ -1774,12 +1843,64 @@
\r
1190 Sys_Printf( "--- Light ---\n" );
1192 + Sys_Printf( "--- ProcessGameSpecific ---\n" );
1194 /* set standard game flags */
1195 wolfLight = game->wolfLight;
1196 + if (wolfLight == qtrue)
1197 + Sys_Printf( " lightning model: wolf\n" );
1199 + Sys_Printf( " lightning model: quake3\n" );
1201 lmCustomSize = game->lightmapSize;
1202 + Sys_Printf( " lightmap size: %d x %d pixels\n", lmCustomSize, lmCustomSize );
1204 lightmapGamma = game->lightmapGamma;
1205 + Sys_Printf( " lightning gamma: %f\n", lightmapGamma );
1207 lightmapCompensate = game->lightmapCompensate;
1208 + Sys_Printf( " lightning compensation: %f\n", lightmapCompensate );
1210 + lightmapExposure = game->lightmapExposure;
1211 + Sys_Printf( " lightning exposure: %f\n", lightmapExposure );
1213 + gridScale = game->gridScale;
1214 + Sys_Printf( " lightgrid scale: %f\n", gridScale );
1216 + gridAmbientScale = game->gridAmbientScale;
1217 + Sys_Printf( " lightgrid ambient scale: %f\n", gridAmbientScale );
1219 + noStyles = game->noStyles;
1220 + if (noStyles == qtrue)
1221 + Sys_Printf( " shader lightstyles hack: disabled\n" );
1223 + Sys_Printf( " shader lightstyles hack: enabled\n" );
1225 + keepLights = game->keepLights;
1226 + if (keepLights == qtrue)
1227 + Sys_Printf( " keep lights: enabled\n" );
1229 + Sys_Printf( " keep lights: disabled\n" );
1231 + patchShadows = game->patchShadows;
1232 + if (patchShadows == qtrue)
1233 + Sys_Printf( " patch shadows: enabled\n" );
1235 + Sys_Printf( " patch shadows: disabled\n" );
1237 + deluxemap = game->deluxeMap;
1238 + deluxemode = game->deluxeMode;
1239 + if (deluxemap == qtrue)
1242 + Sys_Printf( " deluxemapping: enabled with tangentspace deluxemaps\n" );
1244 + Sys_Printf( " deluxemapping: enabled with modelspace deluxemaps\n" );
1247 + Sys_Printf( " deluxemapping: disabled\n" );
1249 + Sys_Printf( "--- ProcessCommandLine ---\n" );
1251 /* process commandline arguments */
1252 for( i = 1; i < (argc - 1); i++ )
1253 @@ -1827,6 +1948,22 @@
\r
1254 Sys_Printf( "All light scaled by %f\n", f );
1258 + else if( !strcmp( argv[ i ], "-gridscale" ) )
1260 + f = atof( argv[ i + 1 ] );
1261 + Sys_Printf( "Grid lightning scaled by %f\n", f );
1266 + else if( !strcmp( argv[ i ], "-gridambientscale" ) )
1268 + f = atof( argv[ i + 1 ] );
1269 + Sys_Printf( "Grid ambient lightning scaled by %f\n", f );
1270 + gridAmbientScale *= f;
1274 else if( !strcmp( argv[ i ], "-gamma" ) )
1276 @@ -1836,6 +1973,14 @@
\r
1280 + else if( !strcmp( argv[ i ], "-exposure" ) )
1282 + f = atof( argv[ i + 1 ] );
1283 + lightmapExposure = f;
1284 + Sys_Printf( "Lighting exposure set to %f\n", lightmapExposure );
1288 else if( !strcmp( argv[ i ], "-compensate" ) )
1290 f = atof( argv[ i + 1 ] );
1291 @@ -1889,12 +2034,6 @@
\r
1292 Sys_Printf( "Dark lightmap seams enabled\n" );
1301 else if( !strcmp( argv[ i ], "-shadeangle" ) )
1303 shadeAngleDegrees = atof( argv[ i + 1 ] );
1304 @@ -1927,13 +2066,28 @@
\r
1305 Sys_Printf( "Approximating lightmaps within a byte tolerance of %d\n", approximateTolerance );
1309 else if( !strcmp( argv[ i ], "-deluxe" ) || !strcmp( argv[ i ], "-deluxemap" ) )
1312 Sys_Printf( "Generating deluxemaps for average light direction\n" );
1315 + else if( !strcmp( argv[ i ], "-deluxemode" ))
1317 + deluxemode = atoi( argv[ i + 1 ] );
1318 + if (deluxemode == 0 || deluxemode > 1 || deluxemode < 0)
1320 + Sys_Printf( "Generating modelspace deluxemaps\n" );
1324 + Sys_Printf( "Generating tangentspace deluxemaps\n" );
1327 + else if( !strcmp( argv[ i ], "-nodeluxe" ) || !strcmp( argv[ i ], "-nodeluxemap" ) )
1329 + deluxemap = qfalse;
1330 + Sys_Printf( "Disabling generating of deluxemaps for average light direction\n" );
1332 else if( !strcmp( argv[ i ], "-external" ) )
1334 externalLightmaps = qtrue;
1335 @@ -2151,6 +2305,12 @@
\r
1337 Sys_Printf( "Default lightmap sample size set to %dx%d units\n", sampleSize, sampleSize );
1339 + else if( !strcmp( argv[ i ], "-samplescale" ) )
1341 + sampleScale = atoi( argv[ i + 1 ] );
1343 + Sys_Printf( "Lightmaps sample scale set to %d\n", sampleScale);
1345 else if( !strcmp( argv[ i ], "-novertex" ) )
1347 noVertexLighting = qtrue;
1348 @@ -2186,11 +2346,36 @@
\r
1350 Sys_Printf( "Disabling lightstyles\n" );
1352 + else if( !strcmp( argv[ i ], "-style" ) || !strcmp( argv[ i ], "-styles" ) )
1354 + noStyles = qfalse;
1355 + Sys_Printf( "Enabling lightstyles\n" );
1357 + else if( !strcmp( argv[ i ], "-keeplights" ))
1359 + keepLights = qtrue;
1360 + Sys_Printf( "Leaving light entities on map after compile\n" );
1362 else if( !strcmp( argv[ i ], "-cpma" ) )
1365 Sys_Printf( "Enabling Challenge Pro Mode Asstacular Vertex Lighting Mode (tm)\n" );
1367 + else if( !strcmp( argv[ i ], "-floodlight" ) )
1369 + floodlighty = qtrue;
1370 + Sys_Printf( "FloodLighting enabled\n" );
1372 + else if( !strcmp( argv[ i ], "-debugnormals" ) )
1374 + debugnormals = qtrue;
1375 + Sys_Printf( "DebugNormals enabled\n" );
1377 + else if( !strcmp( argv[ i ], "-lowquality" ) )
1379 + floodlight_lowquality = qtrue;
1380 + Sys_Printf( "Low Quality FloodLighting enabled\n" );
1383 /* r7: dirtmapping */
1384 else if( !strcmp( argv[ i ], "-dirty" ) )
1385 @@ -2212,6 +2397,7 @@
\r
1386 Sys_Printf( "Enabling randomized dirtmapping\n" );
1388 Sys_Printf( "Enabling ordered dir mapping\n" );
1391 else if( !strcmp( argv[ i ], "-dirtdepth" ) )
1393 @@ -2219,6 +2405,7 @@
\r
1394 if( dirtDepth <= 0.0f )
1396 Sys_Printf( "Dirtmapping depth set to %.1f\n", dirtDepth );
1399 else if( !strcmp( argv[ i ], "-dirtscale" ) )
1401 @@ -2226,6 +2413,7 @@
\r
1402 if( dirtScale <= 0.0f )
1404 Sys_Printf( "Dirtmapping scale set to %.1f\n", dirtScale );
1407 else if( !strcmp( argv[ i ], "-dirtgain" ) )
1409 @@ -2233,6 +2421,7 @@
\r
1410 if( dirtGain <= 0.0f )
1412 Sys_Printf( "Dirtmapping gain set to %.1f\n", dirtGain );
1416 /* unhandled args */
1417 @@ -2279,6 +2468,7 @@
\r
1418 /* ydnar: set up optimization */
1421 + SetupFloodLight();
1422 SetupSurfaceLightmaps();
1424 /* initialize the surface facet tracing */
1425 Index: light_bounce.c
\r
1426 ===================================================================
\r
1427 --- light_bounce.c (revision 158)
\r
1428 +++ light_bounce.c (working copy)
\r
1429 @@ -510,7 +510,7 @@
\r
1432 case MST_TRIANGLE_SOUP:
1433 - numTriangleDiffuseLights;
1434 + numTriangleDiffuseLights++;
1438 Index: light_trace.c
\r
1439 ===================================================================
\r
1440 --- light_trace.c (revision 158)
\r
1441 +++ light_trace.c (working copy)
\r
1443 #define GROW_TRACE_NODES 16384 //% 16384
1444 #define GROW_NODE_ITEMS 16 //% 256
1446 -#define MAX_TW_VERTS 12
1447 +#define MAX_TW_VERTS 24 // vortex: increased from 12 to 24 for ability co compile some insane maps with large curve count
1449 #define TRACE_ON_EPSILON 0.1f
1451 Index: light_ydnar.c
\r
1452 ===================================================================
\r
1453 --- light_ydnar.c (revision 158)
\r
1454 +++ light_ydnar.c (working copy)
\r
1462 /* ydnar: scaling necessary for simulating r_overbrightBits on external lightmaps */
1463 @@ -72,16 +73,51 @@
\r
1465 sample[ i ] = pow( sample[ i ] / 255.0f, gamma ) * 255.0f;
1468 + if (lightmapExposure == 1)
1470 + /* clamp with color normalization */
1471 + max = sample[ 0 ];
1472 + if( sample[ 1 ] > max )
1473 + max = sample[ 1 ];
1474 + if( sample[ 2 ] > max )
1475 + max = sample[ 2 ];
1476 + if( max > 255.0f )
1477 + VectorScale( sample, (255.0f / max), sample );
1481 + if (lightmapExposure==0)
1483 + lightmapExposure=1.0f;
1485 + inv=1.f/lightmapExposure;
1488 + max = sample[ 0 ];
1489 + if( sample[ 1 ] > max )
1490 + max = sample[ 1 ];
1491 + if( sample[ 2 ] > max )
1492 + max = sample[ 2 ];
1494 + dif = (1- exp(-max * inv) ) * 255;
1512 - /* clamp with color normalization */
1513 - max = sample[ 0 ];
1514 - if( sample[ 1 ] > max )
1515 - max = sample[ 1 ];
1516 - if( sample[ 2 ] > max )
1517 - max = sample[ 2 ];
1518 - if( max > 255.0f )
1519 - VectorScale( sample, (255.0f / max), sample );
1521 /* compensate for ingame overbrighting/bitshifting */
1522 VectorScale( sample, (1.0f / lightmapCompensate), sample );
1524 @@ -384,7 +420,7 @@
\r
1526 #define BOGUS_NUDGE -99999.0f
1528 -static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t *dv, vec4_t plane, float pass, vec3_t stv[ 3 ], vec3_t ttv[ 3 ] )
1529 +static int MapSingleLuxel( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t *dv, vec4_t plane, float pass, vec3_t stv[ 3 ], vec3_t ttv[ 3 ], vec3_t worldverts[ 3 ] )
1531 int i, x, y, numClusters, *clusters, pointCluster, *cluster;
1532 float *luxel, *origin, *normal, d, lightmapSampleOffset;
1533 @@ -392,6 +428,12 @@
\r
1537 + vec3_t cverts[ 3 ];
1539 + vec4_t sideplane, hostplane;
1544 static float nudges[][ 2 ] =
1546 @@ -485,6 +527,51 @@
\r
1547 /* non axial lightmap projection (explicit xyz) */
1549 VectorCopy( dv->xyz, origin );
1551 + //////////////////////
1552 + //27's test to make sure samples stay within the triangle boundaries
1553 + //1) Test the sample origin to see if it lays on the wrong side of any edge (x/y)
1554 + //2) if it does, nudge it onto the correct side.
1556 + if (worldverts!=NULL)
1560 + VectorCopy(worldverts[j],cverts[j]);
1562 + PlaneFromPoints(hostplane,cverts[0],cverts[1],cverts[2]);
1568 + //build plane using 2 edges and a normal
1571 + VectorCopy(cverts[next],temp);
1572 + VectorAdd(temp,hostplane,temp);
1573 + PlaneFromPoints(sideplane,cverts[i],cverts[ next ], temp);
1575 + //planetest sample point
1576 + e=DotProduct(origin,sideplane);
1581 + //VectorClear(origin);
1582 + //Move the sample point back inside triangle bounds
1583 + origin[0]-=sideplane[0]*(e+1);
1584 + origin[1]-=sideplane[1]*(e+1);
1585 + origin[2]-=sideplane[2]*(e+1);
1587 + VectorClear(origin);
1594 + ////////////////////////
1596 /* planar surfaces have precalculated lightmap vectors for nudging */
1597 if( lm->plane != NULL )
1598 @@ -516,8 +603,13 @@
\r
1600 origin[ lm->axisNum ] += lightmapSampleOffset;
1602 + VectorCopy(origin,origintwo);
1603 + origintwo[0]+=vecs[2][0];
1604 + origintwo[1]+=vecs[2][1];
1605 + origintwo[2]+=vecs[2][2];
1608 - pointCluster = ClusterForPointExtFilter( origin, LUXEL_EPSILON, numClusters, clusters );
1609 + pointCluster = ClusterForPointExtFilter( origintwo, LUXEL_EPSILON, numClusters, clusters );
1611 /* another retarded hack, storing nudge count in luxel[ 1 ] */
1613 @@ -533,14 +625,14 @@
\r
1614 for( i = 0; i < 3; i++ )
1616 /* set nudged point*/
1617 - nudged[ i ] = origin[ i ] + (nudge[ 0 ] * vecs[ 0 ][ i ]) + (nudge[ 1 ] * vecs[ 1 ][ i ]);
1618 + nudged[ i ] = origintwo[ i ] + (nudge[ 0 ] * vecs[ 0 ][ i ]) + (nudge[ 1 ] * vecs[ 1 ][ i ]);
1622 /* get pvs cluster */
1623 pointCluster = ClusterForPointExtFilter( nudged, LUXEL_EPSILON, numClusters, clusters ); //% + 0.625 );
1624 - if( pointCluster >= 0 )
1625 - VectorCopy( nudged, origin );
1626 + //if( pointCluster >= 0 )
1627 + // VectorCopy( nudged, origin );
1631 @@ -550,8 +642,8 @@
\r
1633 VectorMA( dv->xyz, lightmapSampleOffset, dv->normal, nudged );
1634 pointCluster = ClusterForPointExtFilter( nudged, LUXEL_EPSILON, numClusters, clusters );
1635 - if( pointCluster >= 0 )
1636 - VectorCopy( nudged, origin );
1637 + //if( pointCluster >= 0 )
1638 + // VectorCopy( nudged, origin );
1642 @@ -597,7 +689,7 @@
\r
1643 than the distance between two luxels (thanks jc :)
1646 -static void MapTriangle_r( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t *dv[ 3 ], vec4_t plane, vec3_t stv[ 3 ], vec3_t ttv[ 3 ] )
1647 +static void MapTriangle_r( rawLightmap_t *lm, surfaceInfo_t *info, bspDrawVert_t *dv[ 3 ], vec4_t plane, vec3_t stv[ 3 ], vec3_t ttv[ 3 ], vec3_t worldverts[ 3 ] )
1649 bspDrawVert_t mid, *dv2[ 3 ];
1651 @@ -645,7 +737,7 @@
\r
1653 /* split the longest edge and map it */
1654 LerpDrawVert( dv[ max ], dv[ (max + 1) % 3 ], &mid );
1655 - MapSingleLuxel( lm, info, &mid, plane, 1, stv, ttv );
1656 + MapSingleLuxel( lm, info, &mid, plane, 1, stv, ttv, worldverts );
1658 /* push the point up a little bit to account for fp creep (fixme: revisit this) */
1659 //% VectorMA( mid.xyz, 2.0f, mid.normal, mid.xyz );
1660 @@ -653,12 +745,12 @@
\r
1661 /* recurse to first triangle */
1662 VectorCopy( dv, dv2 );
1664 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1665 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1667 /* recurse to second triangle */
1668 VectorCopy( dv, dv2 );
1669 dv2[ (max + 1) % 3 ] = ∣
1670 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1671 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1675 @@ -674,8 +766,8 @@
\r
1678 vec3_t *stv, *ttv, stvStatic[ 3 ], ttvStatic[ 3 ];
1679 + vec3_t worldverts[ 3 ];
1682 /* get plane if possible */
1683 if( lm->plane != NULL )
1685 @@ -699,16 +791,20 @@
\r
1689 + VectorCopy( dv[ 0 ]->xyz, worldverts[ 0 ] );
1690 + VectorCopy( dv[ 1 ]->xyz, worldverts[ 1 ] );
1691 + VectorCopy( dv[ 2 ]->xyz, worldverts[ 2 ] );
1693 /* map the vertexes */
1694 - MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv );
1695 - MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv );
1696 - MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv );
1697 + MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv, worldverts );
1698 + MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv, worldverts );
1699 + MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv, worldverts );
1701 /* 2002-11-20: prefer axial triangle edges */
1704 /* subdivide the triangle */
1705 - MapTriangle_r( lm, info, dv, plane, stv, ttv );
1706 + MapTriangle_r( lm, info, dv, plane, stv, ttv, worldverts );
1710 @@ -730,7 +826,7 @@
\r
1711 dv2[ 2 ] = dv[ (i + 1) % 3 ];
1713 /* map the degenerate triangle */
1714 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1715 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1719 @@ -792,8 +888,8 @@
\r
1720 LerpDrawVert( dv[ max + 2 ], dv[ (max + 3) % 4 ], &mid[ 1 ] );
1722 /* map the vertexes */
1723 - MapSingleLuxel( lm, info, &mid[ 0 ], plane, 1, stv, ttv );
1724 - MapSingleLuxel( lm, info, &mid[ 1 ], plane, 1, stv, ttv );
1725 + MapSingleLuxel( lm, info, &mid[ 0 ], plane, 1, stv, ttv, NULL );
1726 + MapSingleLuxel( lm, info, &mid[ 1 ], plane, 1, stv, ttv, NULL );
1730 @@ -848,7 +944,6 @@
\r
1732 vec3_t *stv, *ttv, stvStatic[ 4 ], ttvStatic[ 4 ];
1735 /* get plane if possible */
1736 if( lm->plane != NULL )
1738 @@ -878,18 +973,16 @@
\r
1741 /* map the vertexes */
1742 - MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv );
1743 - MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv );
1744 - MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv );
1745 - MapSingleLuxel( lm, info, dv[ 3 ], plane, 1, stv, ttv );
1746 + MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv, NULL );
1747 + MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv, NULL );
1748 + MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv, NULL );
1749 + MapSingleLuxel( lm, info, dv[ 3 ], plane, 1, stv, ttv, NULL );
1751 /* subdivide the quad */
1752 MapQuad_r( lm, info, dv, plane, stv, ttv );
1760 maps the locations, normals, and pvs clusters for a raw lightmap
1761 @@ -941,7 +1034,7 @@
\r
1762 num = lightSurfaces[ lm->firstLightSurface + n ];
1763 ds = &bspDrawSurfaces[ num ];
1764 info = &surfaceInfos[ num ];
1767 /* bail if no lightmap to calculate */
1768 if( info->lm != lm )
1770 @@ -1173,7 +1266,7 @@
\r
1773 /* map the fake vert */
1774 - MapSingleLuxel( lm, NULL, &fake, lm->plane, pass, NULL, NULL );
1775 + MapSingleLuxel( lm, NULL, &fake, lm->plane, pass, NULL, NULL, NULL );
1779 @@ -1596,7 +1689,6 @@
\r
1781 VectorSubtract( origin2, origin, originVecs[ 0 ] );
1782 //% VectorSubtract( normal2, normal, normalVecs[ 0 ] );
1784 /* calulate y vector */
1785 if( (y < (lm->sh - 1) && bx >= 0.0f) || (y == 0 && bx <= 0.0f) )
1787 @@ -1660,7 +1752,6 @@
\r
1788 float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
1789 vec3_t color, total;
1793 if( lightLuxel[ 3 ] >= lightSamples )
1795 @@ -1693,7 +1784,6 @@
\r
1796 VectorCopy( normal[ b ], trace->normal );
1800 LightContributionToSample( trace );
1802 /* add to totals (fixme: make contrast function) */
1803 @@ -1768,7 +1858,6 @@
\r
1805 float stackLightLuxels[ STACK_LL_SIZE ];
1808 /* bail if this number exceeds the number of raw lightmaps */
1809 if( rawLightmapNum >= numRawLightmaps )
1811 @@ -1904,7 +1993,7 @@
\r
1814 VectorCopy( ambientColor, luxel );
1817 VectorScale( normal, 0.00390625f, deluxel );
1820 @@ -1963,28 +2052,39 @@
\r
1821 deluxel = SUPER_DELUXEL( x, y );
1822 origin = SUPER_ORIGIN( x, y );
1823 normal = SUPER_NORMAL( x, y );
1825 - /* set contribution count */
1826 - lightLuxel[ 3 ] = 1.0f;
1829 - trace.cluster = *cluster;
1830 - VectorCopy( origin, trace.origin );
1831 - VectorCopy( normal, trace.normal );
1833 - /* get light for this sample */
1834 - LightContributionToSample( &trace );
1835 - VectorCopy( trace.color, lightLuxel );
1837 - /* add to count */
1838 - if( trace.color[ 0 ] || trace.color[ 1 ] || trace.color[ 2 ] )
1840 + ////////// 27's temp hack for testing edge clipping ////
1841 + if( origin[0]==0 && origin[1]==0 && origin[2]==0 )
1843 + lightLuxel[ 1 ] = 255;
1844 + lightLuxel[ 3 ] = 1.0f;
1849 + /* set contribution count */
1850 + lightLuxel[ 3 ] = 1.0f;
1853 + trace.cluster = *cluster;
1854 + VectorCopy( origin, trace.origin );
1855 + VectorCopy( normal, trace.normal );
1857 + /* get light for this sample */
1858 + LightContributionToSample( &trace );
1859 + VectorCopy( trace.color, lightLuxel );
1861 + /* add to count */
1862 + if( trace.color[ 0 ] || trace.color[ 1 ] || trace.color[ 2 ] )
1866 /* add to light direction map (fixme: use luxel normal as starting point for deluxel?) */
1869 + /* vortex: use noShadow color */
1870 /* color to grayscale (photoshop rgb weighting) */
1871 - brightness = trace.color[ 0 ] * 0.3f + trace.color[ 1 ] * 0.59f + trace.color[ 2 ] * 0.11f;
1872 + brightness = trace.colorNoShadow[ 0 ] * 0.3f + trace.colorNoShadow[ 1 ] * 0.59f + trace.colorNoShadow[ 2 ] * 0.11f;
1873 brightness *= (1.0 / 255.0);
1874 VectorScale( trace.direction, brightness, trace.direction );
1875 VectorAdd( deluxel, trace.direction, deluxel );
1876 @@ -2222,6 +2322,38 @@
\r
1877 /* free light list */
1878 FreeTraceLights( &trace );
1880 + /* floodlight pass */
1881 + FloodlightIlluminateLightmap(lm);
1885 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
1888 + if( lm->superLuxels[ lightmapNum ] == NULL )
1891 + for( y = 0; y < lm->sh; y++ )
1893 + for( x = 0; x < lm->sw; x++ )
1896 + cluster = SUPER_CLUSTER( x, y );
1897 + //% if( *cluster < 0 )
1900 + /* get particulars */
1901 + luxel = SUPER_LUXEL( lightmapNum, x, y );
1902 + normal = SUPER_NORMAL ( x, y );
1904 + luxel[0]=(normal[0]*127)+127;
1905 + luxel[1]=(normal[1]*127)+127;
1906 + luxel[2]=(normal[2]*127)+127;
1912 /* -----------------------------------------------------------------
1914 ----------------------------------------------------------------- */
1915 @@ -2263,7 +2395,7 @@
\r
1916 /* -----------------------------------------------------------------
1918 ----------------------------------------------------------------- */
1921 /* walk lightmaps */
1922 for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
1924 @@ -3112,7 +3244,7 @@
\r
1925 int i, x, y, z, x1, y1, z1;
1926 light_t *light, *light2, **owner;
1928 - vec3_t origin, dir, mins, maxs, nullVector = { 0, 0, 0 };
1929 + vec3_t origin, dir, mins, maxs;
1930 float radius, intensity;
1931 light_t *buckets[ 256 ];
1933 @@ -3587,7 +3719,430 @@
\r
1934 CreateTraceLightsForBounds( mins, maxs, normal, info->numSurfaceClusters, &surfaceClusters[ info->firstSurfaceCluster ], LIGHT_SURFACES, trace );
1937 +/////////////////////////////////////////////////////////////
1939 +#define FLOODLIGHT_CONE_ANGLE 88 /* degrees */
1940 +#define FLOODLIGHT_NUM_ANGLE_STEPS 16
1941 +#define FLOODLIGHT_NUM_ELEVATION_STEPS 4
1942 +#define FLOODLIGHT_NUM_VECTORS (FLOODLIGHT_NUM_ANGLE_STEPS * FLOODLIGHT_NUM_ELEVATION_STEPS)
1944 +static vec3_t floodVectors[ FLOODLIGHT_NUM_VECTORS ];
1945 +static int numFloodVectors = 0;
1947 +void SetupFloodLight( void )
1950 + float angle, elevation, angleStep, elevationStep;
1951 + const char *value;
1952 + double v1,v2,v3,v4,v5;
1955 + Sys_FPrintf( SYS_VRB, "--- SetupFloodLight ---\n" );
1957 + /* calculate angular steps */
1958 + angleStep = DEG2RAD( 360.0f / FLOODLIGHT_NUM_ANGLE_STEPS );
1959 + elevationStep = DEG2RAD( FLOODLIGHT_CONE_ANGLE / FLOODLIGHT_NUM_ELEVATION_STEPS );
1961 + /* iterate angle */
1963 + for( i = 0, angle = 0.0f; i < FLOODLIGHT_NUM_ANGLE_STEPS; i++, angle += angleStep )
1965 + /* iterate elevation */
1966 + for( j = 0, elevation = elevationStep * 0.5f; j < FLOODLIGHT_NUM_ELEVATION_STEPS; j++, elevation += elevationStep )
1968 + floodVectors[ numFloodVectors ][ 0 ] = sin( elevation ) * cos( angle );
1969 + floodVectors[ numFloodVectors ][ 1 ] = sin( elevation ) * sin( angle );
1970 + floodVectors[ numFloodVectors ][ 2 ] = cos( elevation );
1971 + numFloodVectors++;
1975 + /* emit some statistics */
1976 + Sys_FPrintf( SYS_VRB, "%9d numFloodVectors\n", numFloodVectors );
1979 + value = ValueForKey( &entities[ 0 ], "_floodlight" );
1981 + if( value[ 0 ] != '\0' )
1984 + v4=floodlightDistance;
1985 + v5=floodlightIntensity;
1987 + sscanf( value, "%lf %lf %lf %lf %lf", &v1, &v2, &v3, &v4, &v5);
1989 + floodlightRGB[0]=v1;
1990 + floodlightRGB[1]=v2;
1991 + floodlightRGB[2]=v3;
1993 + if (VectorLength(floodlightRGB)==0)
1995 + VectorSet(floodlightRGB,240,240,255);
1998 + if (v4<1) v4=1024;
2001 + floodlightDistance = v4;
2002 + floodlightIntensity = v5;
2004 + floodlighty = qtrue;
2005 + Sys_Printf( "FloodLighting enabled via worldspawn _floodlight key.\n" );
2009 + VectorSet(floodlightRGB,240,240,255);
2010 + //floodlighty = qtrue;
2011 + //Sys_Printf( "FloodLighting enabled via worldspawn _floodlight key.\n" );
2013 + VectorNormalize(floodlightRGB,floodlightRGB);
2017 +FloodLightForSample()
2018 +calculates floodlight value for a given sample
2019 +once again, kudos to the dirtmapping coder
2022 +float FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality)
2026 + float contribution;
2028 + float gatherLight, outLight;
2029 + vec3_t normal, worldUp, myUp, myRt, direction, displacement;
2037 + if( trace == NULL || trace->cluster < 0 )
2042 + dd = floodLightDistance;
2043 + VectorCopy( trace->normal, normal );
2045 + /* check if the normal is aligned to the world-up */
2046 + if( normal[ 0 ] == 0.0f && normal[ 1 ] == 0.0f )
2048 + if( normal[ 2 ] == 1.0f )
2050 + VectorSet( myRt, 1.0f, 0.0f, 0.0f );
2051 + VectorSet( myUp, 0.0f, 1.0f, 0.0f );
2053 + else if( normal[ 2 ] == -1.0f )
2055 + VectorSet( myRt, -1.0f, 0.0f, 0.0f );
2056 + VectorSet( myUp, 0.0f, 1.0f, 0.0f );
2061 + VectorSet( worldUp, 0.0f, 0.0f, 1.0f );
2062 + CrossProduct( normal, worldUp, myRt );
2063 + VectorNormalize( myRt, myRt );
2064 + CrossProduct( myRt, normal, myUp );
2065 + VectorNormalize( myUp, myUp );
2068 + /* vortex: optimise floodLightLowQuality a bit */
2069 + if ( floodLightLowQuality == qtrue )
2071 + /* iterate through ordered vectors */
2072 + for( i = 0; i < numFloodVectors; i++ )
2073 + if (rand()%10 != 0 ) continue;
2077 + /* iterate through ordered vectors */
2078 + for( i = 0; i < numFloodVectors; i++ )
2082 + /* transform vector into tangent space */
2083 + direction[ 0 ] = myRt[ 0 ] * floodVectors[ i ][ 0 ] + myUp[ 0 ] * floodVectors[ i ][ 1 ] + normal[ 0 ] * floodVectors[ i ][ 2 ];
2084 + direction[ 1 ] = myRt[ 1 ] * floodVectors[ i ][ 0 ] + myUp[ 1 ] * floodVectors[ i ][ 1 ] + normal[ 1 ] * floodVectors[ i ][ 2 ];
2085 + direction[ 2 ] = myRt[ 2 ] * floodVectors[ i ][ 0 ] + myUp[ 2 ] * floodVectors[ i ][ 1 ] + normal[ 2 ] * floodVectors[ i ][ 2 ];
2087 + /* set endpoint */
2088 + VectorMA( trace->origin, dd, direction, trace->end );
2090 + //VectorMA( trace->origin, 1, direction, trace->origin );
2092 + SetupTrace( trace );
2094 + TraceLine( trace );
2097 + if (trace->compileFlags & C_SKY )
2099 + contribution=1.0f;
2101 + else if ( trace->opaque )
2103 + VectorSubtract( trace->hit, trace->origin, displacement );
2104 + d=VectorLength( displacement );
2106 + // d=trace->distance;
2107 + //if (d>256) gatherDirt+=1;
2108 + contribution=d/dd;
2109 + if (contribution>1) contribution=1.0f;
2111 + //gatherDirt += 1.0f - ooDepth * VectorLength( displacement );
2114 + gatherLight+=contribution;
2119 + if( gatherLight <= 0.0f )
2125 + gatherLight/=(sub);
2127 + outLight=gatherLight;
2128 + if( outLight > 1.0f )
2131 + /* return to sender */
2136 +FloodLightRawLightmap
2137 +lighttracer style ambient occlusion light hack.
2138 +Kudos to the dirtmapping author for most of this source.
2139 +VorteX: modified to floodlight up custom surfaces (q3map_floodLight)
2140 +VorteX: fixed problems with deluxemapping
2143 +// floodlight pass on a lightmap
2144 +void FloodLightRawLightmapPass( rawLightmap_t *lm , vec3_t lmFloodLightRGB, float lmFloodLightIntensity, float lmFloodLightDistance, qboolean lmFloodLightLowQuality, float floodlightDirectionScale)
2146 + int i, x, y, *cluster;
2147 + float *origin, *normal, *floodlight, floodLightAmount;
2148 + surfaceInfo_t *info;
2151 + // float samples, average, *floodlight2;
2153 + memset(&trace,0,sizeof(trace_t));
2156 + trace.testOcclusion = qtrue;
2157 + trace.forceSunlight = qfalse;
2158 + trace.twoSided = qtrue;
2159 + trace.recvShadows = lm->recvShadows;
2160 + trace.numSurfaces = lm->numLightSurfaces;
2161 + trace.surfaces = &lightSurfaces[ lm->firstLightSurface ];
2162 + trace.inhibitRadius = DEFAULT_INHIBIT_RADIUS;
2163 + trace.testAll = qfalse;
2164 + trace.distance = 1024;
2166 + /* twosided lighting (may or may not be a good idea for lightmapped stuff) */
2167 + //trace.twoSided = qfalse;
2168 + for( i = 0; i < trace.numSurfaces; i++ )
2171 + info = &surfaceInfos[ trace.surfaces[ i ] ];
2173 + /* check twosidedness */
2174 + if( info->si->twoSided )
2176 + trace.twoSided = qtrue;
2181 + /* gather floodlight */
2182 + for( y = 0; y < lm->sh; y++ )
2184 + for( x = 0; x < lm->sw; x++ )
2187 + cluster = SUPER_CLUSTER( x, y );
2188 + origin = SUPER_ORIGIN( x, y );
2189 + normal = SUPER_NORMAL( x, y );
2190 + floodlight = SUPER_FLOODLIGHT( x, y );
2192 + /* set default dirt */
2193 + *floodlight = 0.0f;
2195 + /* only look at mapped luxels */
2196 + if( *cluster < 0 )
2199 + /* copy to trace */
2200 + trace.cluster = *cluster;
2201 + VectorCopy( origin, trace.origin );
2202 + VectorCopy( normal, trace.normal );
2204 + /* get floodlight */
2205 + floodLightAmount = FloodLightForSample( &trace , lmFloodLightDistance, lmFloodLightLowQuality)*lmFloodLightIntensity;
2207 + /* add floodlight */
2208 + floodlight[0] += lmFloodLightRGB[0]*floodLightAmount;
2209 + floodlight[1] += lmFloodLightRGB[1]*floodLightAmount;
2210 + floodlight[2] += lmFloodLightRGB[2]*floodLightAmount;
2211 + floodlight[3] += floodlightDirectionScale;
2215 + /* testing no filtering */
2220 + /* filter "dirt" */
2221 + for( y = 0; y < lm->sh; y++ )
2223 + for( x = 0; x < lm->sw; x++ )
2226 + cluster = SUPER_CLUSTER( x, y );
2227 + floodlight = SUPER_FLOODLIGHT(x, y );
2229 + /* filter dirt by adjacency to unmapped luxels */
2230 + average = *floodlight;
2232 + for( sy = (y - 1); sy <= (y + 1); sy++ )
2234 + if( sy < 0 || sy >= lm->sh )
2237 + for( sx = (x - 1); sx <= (x + 1); sx++ )
2239 + if( sx < 0 || sx >= lm->sw || (sx == x && sy == y) )
2242 + /* get neighboring luxel */
2243 + cluster = SUPER_CLUSTER( sx, sy );
2244 + floodlight2 = SUPER_FLOODLIGHT( sx, sy );
2245 + if( *cluster < 0 || *floodlight2 <= 0.0f )
2249 + average += *floodlight2;
2254 + if( samples <= 0.0f )
2259 + if( samples <= 0.0f )
2263 + *floodlight = average / samples;
2269 +void FloodLightRawLightmap( int rawLightmapNum )
2271 + rawLightmap_t *lm;
2273 + /* bail if this number exceeds the number of raw lightmaps */
2274 + if( rawLightmapNum >= numRawLightmaps )
2276 + /* get lightmap */
2277 + lm = &rawLightmaps[ rawLightmapNum ];
2280 + if (floodlighty && floodlightIntensity)
2281 + FloodLightRawLightmapPass(lm, floodlightRGB, floodlightIntensity, floodlightDistance, floodlight_lowquality, 0);
2284 + if (lm->floodlightIntensity)
2286 + FloodLightRawLightmapPass(lm, lm->floodlightRGB, lm->floodlightIntensity, lm->floodlightDistance, qfalse, lm->floodlightDirectionScale);
2287 + numSurfacesFloodlighten += 1;
2291 +void FloodlightRawLightmaps()
2293 + Sys_Printf( "--- FloodlightRawLightmap ---\n" );
2294 + numSurfacesFloodlighten = 0;
2295 + RunThreadsOnIndividual( numRawLightmaps, qtrue, FloodLightRawLightmap );
2296 + Sys_Printf( "%9d custom lightmaps floodlighted\n", numSurfacesFloodlighten );
2300 +FloodLightIlluminate()
2301 +illuminate floodlight into lightmap luxels
2304 +void FloodlightIlluminateLightmap( rawLightmap_t *lm )
2306 + float *luxel, *floodlight, *deluxel, *normal;
2309 + vec3_t lightvector;
2310 + int x, y, lightmapNum;
2312 + /* walk lightmaps */
2313 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
2316 + if( lm->superLuxels[ lightmapNum ] == NULL )
2319 + /* apply floodlight to each luxel */
2320 + for( y = 0; y < lm->sh; y++ )
2322 + for( x = 0; x < lm->sw; x++ )
2324 + /* get floodlight */
2325 + floodlight = SUPER_FLOODLIGHT( x, y );
2326 + if (!floodlight[0] && !floodlight[1] && !floodlight[2])
2330 + cluster = SUPER_CLUSTER( x, y );
2332 + /* only process mapped luxels */
2333 + if( *cluster < 0 )
2336 + /* get particulars */
2337 + luxel = SUPER_LUXEL( lightmapNum, x, y );
2338 + deluxel = SUPER_DELUXEL( x, y );
2340 + /* add to lightmap */
2341 + luxel[0]+=floodlight[0];
2342 + luxel[1]+=floodlight[1];
2343 + luxel[2]+=floodlight[2];
2345 + if (luxel[3]==0) luxel[3]=1;
2347 + /* add to deluxemap */
2348 + if (deluxemap && floodlight[3] > 0)
2350 + normal = SUPER_NORMAL( x, y );
2351 + brightness = floodlight[ 0 ] * 0.3f + floodlight[ 1 ] * 0.59f + floodlight[ 2 ] * 0.11f;
2352 + brightness *= ( 1.0f / 255.0f ) * floodlight[3];
2353 + VectorScale( normal, brightness, lightvector );
2354 + VectorAdd( deluxel, lightvector, deluxel );
2364 Index: lightmaps_ydnar.c
\r
2365 ===================================================================
\r
2366 --- lightmaps_ydnar.c (revision 158)
\r
2367 +++ lightmaps_ydnar.c (working copy)
\r
2368 @@ -414,6 +414,12 @@
\r
2369 lm->superNormals = safe_malloc( size );
2370 memset( lm->superNormals, 0, size );
2372 + /* allocate floodlight map storage */
2373 + size = lm->sw * lm->sh * SUPER_FLOODLIGHT_SIZE * sizeof( float );
2374 + if( lm->superFloodLight == NULL )
2375 + lm->superFloodLight = safe_malloc( size );
2376 + memset( lm->superFloodLight, 0, size );
2378 /* allocate cluster map storage */
2379 size = lm->sw * lm->sh * sizeof( int );
2380 if( lm->superClusters == NULL )
2381 @@ -1087,17 +1093,25 @@
\r
2382 /* allocate a new raw lightmap */
2383 lm = &rawLightmaps[ numRawLightmaps ];
2388 lm->splotchFix = info->si->splotchFix;
2389 lm->firstLightSurface = numLightSurfaces;
2390 lm->numLightSurfaces = 0;
2391 - lm->sampleSize = info->sampleSize;
2392 - lm->actualSampleSize = info->sampleSize;
2393 + /* vortex: multiply lightmap sample size by -samplescale */
2394 + if (sampleScale > 0)
2395 + lm->sampleSize = info->sampleSize*sampleScale;
2397 + lm->sampleSize = info->sampleSize;
2398 + lm->actualSampleSize = lm->sampleSize;
2399 lm->entityNum = info->entityNum;
2400 lm->recvShadows = info->recvShadows;
2401 lm->brightness = info->si->lmBrightness;
2402 lm->filterRadius = info->si->lmFilterRadius;
2403 + VectorCopy(info->si->floodlightRGB, lm->floodlightRGB);
2404 + lm->floodlightDistance = info->si->floodlightDistance;
2405 + lm->floodlightIntensity = info->si->floodlightIntensity;
2406 + lm->floodlightDirectionScale = info->si->floodlightDirectionScale;
2407 VectorCopy( info->axis, lm->axis );
2408 lm->plane = info->plane;
2409 VectorCopy( info->mins, lm->mins );
2410 @@ -2254,7 +2268,6 @@
\r
2411 char *rgbGenValues[ 256 ];
2412 char *alphaGenValues[ 256 ];
2416 Sys_Printf( "--- StoreSurfaceLightmaps ---\n");
2418 @@ -2269,7 +2282,7 @@
\r
2419 ----------------------------------------------------------------- */
2422 - Sys_FPrintf( SYS_VRB, "Subsampling..." );
2423 + Sys_Printf( "Subsampling..." );
2425 /* walk the list of raw lightmaps */
2427 @@ -2437,11 +2450,11 @@
\r
2429 luxel = SUPER_LUXEL( lightmapNum, x, y );
2430 deluxel = SUPER_DELUXEL( x, y );
2433 /* copy light direction */
2434 if( deluxemap && lightmapNum == 0 )
2435 VectorCopy( deluxel, dirSample );
2438 /* is this a valid sample? */
2439 if( luxel[ 3 ] > 0.0f )
2441 @@ -2521,7 +2534,7 @@
\r
2442 /* store the sample in the bsp luxels */
2443 bspLuxel = BSP_LUXEL( lightmapNum, x, y );
2444 bspDeluxel = BSP_DELUXEL( x, y );
2447 VectorAdd( bspLuxel, sample, bspLuxel );
2448 if( deluxemap && lightmapNum == 0 )
2449 VectorAdd( bspDeluxel, dirSample, bspDeluxel );
2450 @@ -2562,7 +2575,7 @@
\r
2456 /* wrap bsp luxels if necessary */
2459 @@ -2604,15 +2617,144 @@
\r
2465 /* -----------------------------------------------------------------
2466 + convert modelspace deluxemaps to tangentspace
2467 + ----------------------------------------------------------------- */
2471 + if( deluxemap && deluxemode == 1)
2473 + vec3_t worldUp, myNormal, myTangent, myBinormal;
2476 + Sys_Printf( "converting..." );
2478 + for( i = 0; i < numRawLightmaps; i++ )
2480 + /* get lightmap */
2481 + lm = &rawLightmaps[ i ];
2483 + /* walk lightmap samples */
2484 + for( y = 0; y < lm->sh; y++ )
2486 + for( x = 0; x < lm->sw; x++ )
2488 + /* get normal and deluxel */
2489 + normal = SUPER_NORMAL(x, y);
2490 + cluster = SUPER_CLUSTER(x, y);
2491 + bspDeluxel = BSP_DELUXEL( x, y );
2492 + deluxel = SUPER_DELUXEL( x, y );
2495 + VectorSet( myNormal, normal[0], normal[1], normal[2] );
2497 + /* get tangent vectors */
2498 + if( myNormal[ 0 ] == 0.0f && myNormal[ 1 ] == 0.0f )
2500 + if( myNormal[ 2 ] == 1.0f )
2502 + VectorSet( myTangent, 1.0f, 0.0f, 0.0f );
2503 + VectorSet( myBinormal, 0.0f, 1.0f, 0.0f );
2505 + else if( myNormal[ 2 ] == -1.0f )
2507 + VectorSet( myTangent, -1.0f, 0.0f, 0.0f );
2508 + VectorSet( myBinormal, 0.0f, 1.0f, 0.0f );
2513 + VectorSet( worldUp, 0.0f, 0.0f, 1.0f );
2514 + CrossProduct( myNormal, worldUp, myTangent );
2515 + VectorNormalize( myTangent, myTangent );
2516 + CrossProduct( myTangent, myNormal, myBinormal );
2517 + VectorNormalize( myBinormal, myBinormal );
2520 + /* project onto plane */
2521 + dist = -DotProduct(myTangent, myNormal);
2522 + VectorMA(myTangent, dist, myNormal, myTangent);
2523 + dist = -DotProduct(myBinormal, myNormal);
2524 + VectorMA(myBinormal, dist, myNormal, myBinormal);
2527 + VectorNormalize( myTangent, myTangent );
2528 + VectorNormalize( myBinormal, myBinormal );
2530 + /* convert modelspace deluxel to tangentspace */
2531 + dirSample[0] = bspDeluxel[0];
2532 + dirSample[1] = bspDeluxel[1];
2533 + dirSample[2] = bspDeluxel[2];
2534 + VectorNormalize(dirSample, dirSample);
2536 + /* fix tangents to world matrix */
2537 + if (myNormal[0] > 0 || myNormal[1] < 0 || myNormal[2] < 0)
2538 + VectorNegate(myTangent, myTangent);
2540 + /* build tangentspace vectors */
2541 + bspDeluxel[0] = DotProduct(dirSample, myTangent);
2542 + bspDeluxel[1] = DotProduct(dirSample, myBinormal);
2543 + bspDeluxel[2] = DotProduct(dirSample, myNormal);
2550 + /* -----------------------------------------------------------------
2552 + ----------------------------------------------------------------- */
2554 +#ifdef sdfsdfwq312323
2556 + Sys_Printf( "blending..." );
2558 + for( i = 0; i < numRawLightmaps; i++ )
2561 + float myBrightness;
2563 + /* get lightmap */
2564 + lm = &rawLightmaps[ i ];
2566 + /* walk individual lightmaps */
2567 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
2570 + if( lm->superLuxels[ lightmapNum ] == NULL )
2573 + /* walk lightmap samples */
2574 + for( y = 0; y < lm->sh; y++ )
2576 + for( x = 0; x < lm->sw; x++ )
2579 + bspLuxel = BSP_LUXEL( lightmapNum, x, y );
2582 + VectorNormalize(bspLuxel, myColor);
2583 + myBrightness = VectorLength(bspLuxel);
2584 + myBrightness *= (1 / 127.0f);
2585 + myBrightness = myBrightness*myBrightness;
2586 + myBrightness *= 127.0f;
2587 + VectorScale(myColor, myBrightness, bspLuxel);
2594 + /* -----------------------------------------------------------------
2595 collapse non-unique lightmaps
2596 ----------------------------------------------------------------- */
2598 if( noCollapse == qfalse && deluxemap == qfalse )
2601 - Sys_FPrintf( SYS_VRB, "collapsing..." );
2602 + Sys_Printf( "collapsing..." );
2604 /* set all twin refs to null */
2605 for( i = 0; i < numRawLightmaps; i++ )
2606 @@ -2674,13 +2816,13 @@
\r
2612 /* -----------------------------------------------------------------
2613 sort raw lightmaps by shader
2614 ----------------------------------------------------------------- */
2617 - Sys_FPrintf( SYS_VRB, "sorting..." );
2618 + Sys_Printf( "sorting..." );
2620 /* allocate a new sorted list */
2621 if( sortLightmaps == NULL )
2622 @@ -2696,7 +2838,7 @@
\r
2623 ----------------------------------------------------------------- */
2626 - Sys_FPrintf( SYS_VRB, "allocating..." );
2627 + Sys_Printf( "allocating..." );
2629 /* kill all existing output lightmaps */
2630 if( outLightmaps != NULL )
2631 @@ -2749,7 +2891,7 @@
\r
2632 ----------------------------------------------------------------- */
2635 - Sys_FPrintf( SYS_VRB, "storing..." );
2636 + Sys_Printf( "storing..." );
2638 /* count the bsp lightmaps and allocate space */
2639 if( bspLightBytes != NULL )
2640 @@ -2817,7 +2959,7 @@
\r
2643 if( numExtLightmaps > 0 )
2644 - Sys_FPrintf( SYS_VRB, "\n" );
2645 + Sys_Printf( SYS_VRB, "\n" );
2647 /* delete unused external lightmaps */
2648 for( i = numExtLightmaps; i; i++ )
2649 @@ -2836,7 +2978,7 @@
\r
2650 ----------------------------------------------------------------- */
2653 - Sys_FPrintf( SYS_VRB, "projecting..." );
2654 + Sys_Printf( "projecting..." );
2656 /* walk the list of surfaces */
2657 for( i = 0; i < numBSPDrawSurfaces; i++ )
2658 @@ -3108,7 +3250,7 @@
\r
2662 - Sys_FPrintf( SYS_VRB, "done.\n" );
2663 + Sys_Printf( "done.\n" );
2665 /* calc num stored */
2666 numStored = numBSPLightBytes / 3;
2668 ===================================================================
\r
2669 --- main.c (revision 158)
\r
2670 +++ main.c (working copy)
\r
2671 @@ -604,7 +604,7 @@
\r
2674 atexit( ExitQ3Map );
2677 /* read general options first */
2678 for( i = 1; i < argc; i++ )
2680 @@ -680,6 +680,10 @@
\r
2682 /* ydnar: new path initialization */
2683 InitPaths( &argc, argv );
2685 + /* set game options */
2686 + if (!patchSubdivisions)
2687 + patchSubdivisions = game->patchSubdivisions;
2689 /* check if we have enough options left to attempt something */
2692 ===================================================================
\r
2693 --- q3map2.h (revision 158)
\r
2694 +++ q3map2.h (working copy)
\r
2699 -#define Q3MAP_VERSION "2.5.17"
2700 -#define Q3MAP_MOTD "Last one turns the lights off"
2701 +#define Q3MAP_VERSION "2.5.17 base : FS_20g base : R5"
2702 +#define Q3MAP_MOTD "Sorry, it doesn't match my furniture."
2706 @@ -235,6 +235,7 @@
\r
2707 #define LIGHT_FAST_TEMP 512
2708 #define LIGHT_FAST_ACTUAL (LIGHT_FAST | LIGHT_FAST_TEMP)
2709 #define LIGHT_NEGATIVE 1024
2710 +#define LIGHT_UNNORMALIZED 2048 /* vortex: do not normalize _color */
2712 #define LIGHT_SUN_DEFAULT (LIGHT_ATTEN_ANGLE | LIGHT_GRID | LIGHT_SURFACES)
2713 #define LIGHT_AREA_DEFAULT (LIGHT_ATTEN_ANGLE | LIGHT_ATTEN_DISTANCE | LIGHT_GRID | LIGHT_SURFACES) /* q3a and wolf are the same */
2714 @@ -267,6 +268,7 @@
\r
2715 #define SUPER_NORMAL_SIZE 4
2716 #define SUPER_DELUXEL_SIZE 3
2717 #define BSP_DELUXEL_SIZE 3
2718 +#define SUPER_FLOODLIGHT_SIZE 4
2720 #define VERTEX_LUXEL( s, v ) (vertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
2721 #define RAD_VERTEX_LUXEL( s, v )(radVertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
2722 @@ -279,9 +281,8 @@
\r
2723 #define SUPER_ORIGIN( x, y ) (lm->superOrigins + ((((y) * lm->sw) + (x)) * SUPER_ORIGIN_SIZE))
2724 #define SUPER_NORMAL( x, y ) (lm->superNormals + ((((y) * lm->sw) + (x)) * SUPER_NORMAL_SIZE))
2725 #define SUPER_DIRT( x, y ) (lm->superNormals + ((((y) * lm->sw) + (x)) * SUPER_NORMAL_SIZE) + 3) /* stash dirtyness in normal[ 3 ] */
2726 +#define SUPER_FLOODLIGHT(x, y ) (lm->superFloodLight + ((((y) * lm->sw) + (x)) * SUPER_FLOODLIGHT_SIZE))
2730 /* -------------------------------------------------------------------------------
2733 @@ -543,7 +544,16 @@
\r
2734 qboolean wolfLight; /* when true, lights work like wolf q3map */
2735 int lightmapSize; /* bsp lightmap width/height */
2736 float lightmapGamma; /* default lightmap gamma */
2737 + float lightmapExposure; /* default lightmap exposure */
2738 float lightmapCompensate; /* default lightmap compensate value */
2739 + float gridScale; /* vortex: default lightgrid scale (affects both directional and ambient spectres) */
2740 + float gridAmbientScale; /* vortex: default lightgrid ambient spectre scale */
2741 + qboolean noStyles; /* use lightstyles hack or not */
2742 + qboolean keepLights; /* keep light entities on bsp */
2743 + int patchSubdivisions; /* default patch subdivisions tolerance */
2744 + qboolean patchShadows; /* patch casting enabled */
2745 + qboolean deluxeMap; /* compile deluxemaps */
2746 + int deluxeMode; /* deluxemap mode (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
2747 char *bspIdent; /* 4-letter bsp file prefix */
2748 int bspVersion; /* bsp version to use */
2749 qboolean lumpSwap; /* cod-style len/ofs order */
2750 @@ -662,6 +672,7 @@
\r
2751 char *backShader; /* for surfaces that generate different front and back passes */
2752 char *cloneShader; /* ydnar: for cloning of a surface */
2753 char *remapShader; /* ydnar: remap a shader in final stage */
2754 + char *deprecateShader; /* vortex: shader is deprecated and replaced by this on use */
2756 surfaceModel_t *surfaceModel; /* ydnar: for distribution of models */
2757 foliage_t *foliage; /* ydnar/splash damage: wolf et foliage */
2758 @@ -737,7 +748,13 @@
\r
2760 vec3_t color; /* normalized color */
2761 vec3_t averageColor;
2765 + /* vortex: per-surface floodlight */
2766 + float floodlightDirectionScale;
2767 + vec3_t floodlightRGB;
2768 + float floodlightIntensity;
2769 + float floodlightDistance;
2771 qb_t lmMergable; /* ydnar */
2772 int lmCustomWidth, lmCustomHeight; /* ydnar */
2773 @@ -1013,7 +1030,7 @@
\r
2775 int patchWidth, patchHeight;
2779 /* ydnar/sd: for foliage */
2780 int numFoliageInstances;
2782 @@ -1061,6 +1078,7 @@
\r
2783 int mapEntityNum, firstDrawSurf;
2784 int firstBrush, numBrushes; /* only valid during BSP compile */
2786 + qboolean forceNormalSmoothing; /* vortex: true if entity has _smoothnormals/_sn/_smooth key */
2790 @@ -1296,7 +1314,8 @@
\r
2792 /* input and output */
2793 vec3_t color; /* starts out at full color, may be reduced if transparent surfaces are crossed */
2795 + vec3_t colorNoShadow; /* result color with no shadow casting */
2799 int compileFlags; /* for determining surface compile flags traced through */
2800 @@ -1367,6 +1386,13 @@
\r
2801 int numLightClusters, *lightClusters;
2803 int sampleSize, actualSampleSize, axisNum;
2805 + /* vortex: per-surface floodlight */
2806 + float floodlightDirectionScale;
2807 + vec3_t floodlightRGB;
2808 + float floodlightIntensity;
2809 + float floodlightDistance;
2813 vec3_t mins, maxs, axis, origin, *vecs;
2814 @@ -1389,9 +1415,9 @@
\r
2815 float *superOrigins;
2816 float *superNormals;
2819 float *superDeluxels; /* average light direction */
2821 + float *superFloodLight; /* floodlight color */
2825 @@ -1421,8 +1447,6 @@
\r
2831 /* -------------------------------------------------------------------------------
2834 @@ -1556,6 +1580,7 @@
\r
2835 void ParsePatch( qboolean onlyLights );
2836 mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength );
2837 void PatchMapDrawSurfs( entity_t *e );
2838 +void TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds );
2842 @@ -1610,6 +1635,8 @@
\r
2843 void AddEntitySurfaceModels( entity_t *e );
2844 int AddSurfaceModels( mapDrawSurface_t *ds );
2845 void FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree );
2846 +void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds );
2847 +static void EmitTriangleSurface( mapDrawSurface_t *ds );
2851 @@ -1704,6 +1732,12 @@
\r
2852 float DirtForSample( trace_t *trace );
2853 void DirtyRawLightmap( int num );
2855 +void SetupFloodLight();
2856 +void FloodlightRawLightmaps();
2857 +void FloodlightIlluminateLightmap( rawLightmap_t *lm );
2858 +float FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality);
2859 +void FloodLightRawLightmap( int num );
2861 void IlluminateRawLightmap( int num );
2862 void IlluminateVertexes( int num );
2864 @@ -1731,7 +1765,6 @@
\r
2865 void StitchSurfaceLightmaps( void );
2866 void StoreSurfaceLightmaps( void );
2870 void ImageFree( image_t *image );
2871 image_t *ImageFind( const char *filename );
2872 @@ -1783,6 +1816,7 @@
\r
2873 void UnparseEntities( void );
2874 void PrintEntity( const entity_t *ent );
2875 void SetKeyValue( entity_t *ent, const char *key, const char *value );
2876 +qboolean KeyExists( const entity_t *ent, const char *key ); /* VorteX: check if key exists */
2877 const char *ValueForKey( const entity_t *ent, const char *key );
2878 int IntForKey( const entity_t *ent, const char *key );
2879 vec_t FloatForKey( const entity_t *ent, const char *key );
2880 @@ -1845,6 +1879,12 @@
\r
2882 #include "game_qfusion.h" /* qfusion game */
2884 + #include "game_darkplaces.h" /* vortex: darkplaces q1 engine */
2886 + #include "game_dq.h" /* vortex: deluxe quake game ( darkplaces q1 engine) */
2888 + #include "game_prophecy.h" /* vortex: prophecy game ( darkplaces q1 engine) */
2890 { NULL } /* null game */
2893 @@ -1929,6 +1969,7 @@
\r
2894 Q_EXTERN char outbase[ 32 ];
2896 Q_EXTERN int sampleSize; /* lightmap sample size in units */
2897 +Q_EXTERN int sampleScale; /* vortex: lightmap sample scale (ie quality)*/
2899 Q_EXTERN int mapEntityNum Q_ASSIGN( 0 );
2901 @@ -2053,6 +2094,7 @@
\r
2902 Q_EXTERN qboolean wolfLight Q_ASSIGN( qfalse );
2903 Q_EXTERN qboolean loMem Q_ASSIGN( qfalse );
2904 Q_EXTERN qboolean noStyles Q_ASSIGN( qfalse );
2905 +Q_EXTERN qboolean keepLights Q_ASSIGN( qfalse );
2907 Q_EXTERN int sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE );
2908 Q_EXTERN qboolean noVertexLighting Q_ASSIGN( qfalse );
2909 @@ -2065,6 +2107,7 @@
\r
2911 Q_EXTERN qboolean deluxemap Q_ASSIGN( qfalse );
2912 Q_EXTERN qboolean debugDeluxemap Q_ASSIGN( qfalse );
2913 +Q_EXTERN int deluxemode Q_ASSIGN( 0 ); /* deluxemap format (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
2915 Q_EXTERN qboolean fast Q_ASSIGN( qfalse );
2916 Q_EXTERN qboolean faster Q_ASSIGN( qfalse );
2917 @@ -2098,6 +2141,14 @@
\r
2918 Q_EXTERN float dirtScale Q_ASSIGN( 1.0f );
2919 Q_EXTERN float dirtGain Q_ASSIGN( 1.0f );
2921 +/* 27: floodlighting */
2922 +Q_EXTERN qboolean debugnormals Q_ASSIGN( qfalse );
2923 +Q_EXTERN qboolean floodlighty Q_ASSIGN( qfalse );
2924 +Q_EXTERN qboolean floodlight_lowquality Q_ASSIGN( qfalse );
2925 +Q_EXTERN vec3_t floodlightRGB;
2926 +Q_EXTERN float floodlightIntensity Q_ASSIGN( 512.0f );
2927 +Q_EXTERN float floodlightDistance Q_ASSIGN( 1024.0f );
2929 Q_EXTERN qboolean dump Q_ASSIGN( qfalse );
2930 Q_EXTERN qboolean debug Q_ASSIGN( qfalse );
2931 Q_EXTERN qboolean debugUnused Q_ASSIGN( qfalse );
2932 @@ -2115,9 +2166,14 @@
\r
2933 Q_EXTERN float skyScale Q_ASSIGN( 1.0f );
2934 Q_EXTERN float bounceScale Q_ASSIGN( 0.25f );
2936 +/* vortex: gridscale and gridambientscale */
2937 +Q_EXTERN float gridScale Q_ASSIGN( 1.0f );
2938 +Q_EXTERN float gridAmbientScale Q_ASSIGN( 1.0f );
2940 /* ydnar: lightmap gamma/compensation */
2941 Q_EXTERN float lightmapGamma Q_ASSIGN( 1.0f );
2942 Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
2943 +Q_EXTERN float lightmapExposure Q_ASSIGN( 1.0f );
2945 /* ydnar: for runtime tweaking of falloff tolerance */
2946 Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );
2947 @@ -2221,6 +2277,9 @@
\r
2948 Q_EXTERN int numExtLightmaps Q_ASSIGN( 0 );
2949 Q_EXTERN outLightmap_t *outLightmaps Q_ASSIGN( NULL );
2951 +/* vortex: per surface floodlight statictics */
2952 +Q_EXTERN int numSurfacesFloodlighten Q_ASSIGN( 0 );
2955 Q_EXTERN int numRawGridPoints Q_ASSIGN( 0 );
2956 Q_EXTERN rawGridPoint_t *rawGridPoints Q_ASSIGN( NULL );
2958 ===================================================================
\r
2959 --- shaders.c (revision 158)
\r
2960 +++ shaders.c (working copy)
\r
2961 @@ -793,8 +793,14 @@
\r
2964 if( VectorLength( si->color ) <= 0.0f )
2966 ColorNormalize( color, si->color );
2967 - VectorScale( color, (1.0f / count), si->averageColor );
2968 + VectorScale( color, (1.0f / count), si->averageColor );
2972 + VectorCopy( si->color, si->averageColor );
2977 @@ -804,13 +810,15 @@
\r
2978 finds a shaderinfo for a named shader
2981 +#define MAX_SHADER_DEPRECATION_DEPTH 16
2983 shaderInfo_t *ShaderInfoForShader( const char *shaderName )
2986 + int deprecationDepth;
2988 char shader[ MAX_QPATH ];
2993 if( shaderName == NULL || shaderName[ 0 ] == '\0' )
2995 @@ -823,11 +831,27 @@
\r
2996 StripExtension( shader );
2999 + deprecationDepth = 0;
3000 for( i = 0; i < numShaderInfo; i++ )
3002 si = &shaderInfo[ i ];
3003 if( !Q_stricmp( shader, si->shader ) )
3005 + /* check if shader is deprecated */
3006 + if (deprecationDepth < MAX_SHADER_DEPRECATION_DEPTH && si->deprecateShader && si->deprecateShader[ 0 ] )
3008 + /* override name */
3009 + strcpy( shader, si->deprecateShader );
3010 + StripExtension( shader );
3011 + /* increase deprecation depth */
3012 + deprecationDepth++;
3013 + if (deprecationDepth == MAX_SHADER_DEPRECATION_DEPTH)
3014 + Sys_Printf("WARNING: Max deprecation depth of %i is reached on shader '%s'\n", MAX_SHADER_DEPRECATION_DEPTH, shader);
3015 + /* search again from beginning */
3020 /* load image if necessary */
3021 if( si->finished == qfalse )
3023 @@ -1340,7 +1364,6 @@
\r
3025 surfaceModel_t *model;
3028 /* allocate new model and attach it */
3029 model = safe_malloc( sizeof( *model ) );
3030 memset( model, 0, sizeof( *model ) );
3031 @@ -1465,6 +1488,24 @@
\r
3032 GetTokenAppend( shaderText, qfalse );
3033 si->backsplashDistance = atof( token );
3036 + /* q3map_floodLight <r> <g> <b> <diste> <intensity> <light_direction_power> */
3037 + else if( !Q_stricmp( token, "q3map_floodLight" ) )
3040 + GetTokenAppend( shaderText, qfalse );
3041 + si->floodlightRGB[ 0 ] = atof( token );
3042 + GetTokenAppend( shaderText, qfalse );
3043 + si->floodlightRGB[ 1 ] = atof( token );
3044 + GetTokenAppend( shaderText, qfalse );
3045 + si->floodlightRGB[ 2 ] = atof( token );
3046 + GetTokenAppend( shaderText, qfalse );
3047 + si->floodlightDistance = atof( token );
3048 + GetTokenAppend( shaderText, qfalse );
3049 + si->floodlightIntensity = atof( token );
3050 + GetTokenAppend( shaderText, qfalse );
3051 + si->floodlightDirectionScale = atof( token );
3054 /* q3map_lightmapSampleSize <value> */
3055 else if( !Q_stricmp( token, "q3map_lightmapSampleSize" ) )
3056 @@ -1590,6 +1631,18 @@
\r
3057 strcpy( si->remapShader, token );
3061 + /* q3map_deprecateShader <shader> */
3062 + else if( !Q_stricmp( token, "q3map_deprecateShader" ) )
3064 + GetTokenAppend( shaderText, qfalse );
3065 + if( token[ 0 ] != '\0' )
3068 + si->deprecateShader = safe_malloc( strlen( token ) + 1 );
3069 + strcpy( si->deprecateShader, token );
3073 /* ydnar: q3map_offset <value> */
3074 else if( !Q_stricmp( token, "q3map_offset" ) )
3075 @@ -1896,12 +1949,14 @@
\r
3076 si->styleMarker = 2;
3078 /* ydnar: default to searching for q3map_<surfaceparm> */
3083 - //% Sys_FPrintf( SYS_VRB, "Attempting to match %s with a known surfaceparm\n", token );
3084 + Sys_FPrintf( SYS_VRB, "Attempting to match %s with a known surfaceparm\n", token );
3085 if( ApplySurfaceParm( &token[ 6 ], &si->contentFlags, &si->surfaceFlags, &si->compileFlags ) == qfalse )
3086 - ;//% Sys_Printf( "WARNING: Unknown q3map_* directive \"%s\"\n", token );
3087 + Sys_Printf( "WARNING: Unknown q3map_* directive \"%s\"\n", token );
3094 ===================================================================
\r
3095 --- surface.c (revision 158)
\r
3096 +++ surface.c (working copy)
\r
3097 @@ -304,7 +304,7 @@
\r
3098 out = &mapDrawSurfs[ i ];
3100 /* walk the surface list again until a proper surface is found */
3101 - for( j; j < numMapDrawSurfs; j++ )
3102 + for( ; j < numMapDrawSurfs; j++ )
3104 /* get in surface */
3105 in = &mapDrawSurfs[ j ];
3106 @@ -484,7 +484,7 @@
\r
3109 /* walk the list of surfaces */
3110 - for( numSurfs; numSurfs > 0; numSurfs--, ds++ )
3111 + for( ; numSurfs > 0; numSurfs--, ds++ )
3113 /* ignore bogus (or flare) surfaces */
3114 if( ds->type == SURFACE_BAD || ds->numVerts <= 0 )
3115 @@ -2445,25 +2445,27 @@
\r
3116 numSurfacesByType[ ds->type ]++;
3123 emits a bsp patch drawsurface
3126 -void EmitPatchSurface( mapDrawSurface_t *ds )
3127 +void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds )
3130 bspDrawSurface_t *out;
3131 int surfaceFlags, contentFlags;
3132 + int forcePatchMeta;
3134 + /* vortex: _patchMeta support */
3135 + forcePatchMeta = IntForKey(e, "_patchMeta" );
3136 + if (!forcePatchMeta)
3137 + forcePatchMeta = IntForKey(e, "patchMeta" );
3140 /* invert the surface if necessary */
3141 if( ds->backSide || ds->shaderInfo->invert )
3143 bspDrawVert_t *dv1, *dv2, temp;
3146 /* walk the verts, flip the normal */
3147 for( i = 0; i < ds->numVerts; i++ )
3148 @@ -2485,7 +2487,7 @@
\r
3150 VectorScale( ds->lightmapVecs[ 2 ], -1.0f, ds->lightmapVecs[ 2 ] );
3154 /* allocate a new surface */
3155 if( numBSPDrawSurfaces == MAX_MAP_DRAW_SURFS )
3156 Error( "MAX_MAP_DRAW_SURFS" );
3157 @@ -2493,12 +2495,12 @@
\r
3158 ds->outputNum = numBSPDrawSurfaces;
3159 numBSPDrawSurfaces++;
3160 memset( out, 0, sizeof( *out ) );
3164 out->surfaceType = MST_PATCH;
3166 out->shaderNum = EmitShader( "debugsurfaces", NULL, NULL );
3167 - else if( patchMeta )
3168 + else if( patchMeta || forcePatchMeta )
3170 /* patch meta requires that we have nodraw patches for collision */
3171 surfaceFlags = ds->shaderInfo->surfaceFlags;
3172 @@ -2548,8 +2550,6 @@
\r
3173 numSurfacesByType[ ds->type ]++;
3179 OptimizeTriangleSurface() - ydnar
3180 optimizes the vertex/index data in a triangle surface
3181 @@ -2677,8 +2677,7 @@
\r
3184 bspDrawSurface_t *out;
3188 /* invert the surface if necessary */
3189 if( ds->backSide || ds->shaderInfo->invert )
3191 @@ -2689,15 +2688,15 @@
\r
3192 ds->indexes[ i ] = ds->indexes[ i + 1 ];
3193 ds->indexes[ i + 1 ] = temp;
3197 /* walk the verts, flip the normal */
3198 for( i = 0; i < ds->numVerts; i++ )
3199 VectorScale( ds->verts[ i ].normal, -1.0f, ds->verts[ i ].normal );
3203 VectorScale( ds->lightmapVecs[ 2 ], -1.0f, ds->lightmapVecs[ 2 ] );
3207 /* allocate a new surface */
3208 if( numBSPDrawSurfaces == MAX_MAP_DRAW_SURFS )
3209 Error( "MAX_MAP_DRAW_SURFS" );
3210 @@ -2804,15 +2803,14 @@
\r
3211 emits a bsp planar winding (brush face) drawsurface
3214 -static void EmitFaceSurface( mapDrawSurface_t *ds )
3215 +static void EmitFaceSurface(mapDrawSurface_t *ds )
3217 /* strip/fan finding was moved elsewhere */
3218 StripFaceSurface( ds );
3219 - EmitTriangleSurface( ds );
3220 + EmitTriangleSurface(ds);
3226 MakeDebugPortalSurfs_r() - ydnar
3227 generates drawsurfaces for passable portals in the bsp
3228 @@ -3502,7 +3500,7 @@
\r
3230 refs = FilterPatchIntoTree( ds, tree );
3232 - EmitPatchSurface( ds );
3233 + EmitPatchSurface( e, ds );
3236 /* handle triangle surfaces */
3237 Index: surface_meta.c
\r
3238 ===================================================================
\r
3239 --- surface_meta.c (revision 158)
\r
3240 +++ surface_meta.c (working copy)
\r
3241 @@ -312,23 +312,41 @@
\r
3242 creates triangles from a patch
3245 -void TriangulatePatchSurface( mapDrawSurface_t *ds )
3246 +void TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds )
3248 int iterations, x, y, pw[ 5 ], r;
3249 mapDrawSurface_t *dsNew;
3250 mesh_t src, *subdivided, *mesh;
3253 + int forcePatchMeta;
3255 + int patchSubdivision;
3257 + /* vortex: _patchMeta, _patchQuality, _patchSubdivide support */
3258 + forcePatchMeta = IntForKey(e, "_patchMeta" );
3259 + if (!forcePatchMeta)
3260 + forcePatchMeta = IntForKey(e, "patchMeta" );
3261 + patchQuality = IntForKey(e, "_patchQuality" );
3262 + if (!patchQuality)
3263 + patchQuality = IntForKey(e, "patchQuality" );
3264 + if (!patchQuality)
3265 + patchQuality = 1.0;
3266 + patchSubdivision = IntForKey(e, "_patchSubdivide" );
3267 + if (!patchSubdivision)
3268 + patchSubdivision = IntForKey(e, "patchSubdivide" );
3270 /* try to early out */
3271 - if( ds->numVerts == 0 || ds->type != SURFACE_PATCH || patchMeta == qfalse )
3272 + if(ds->numVerts == 0 || ds->type != SURFACE_PATCH || ( patchMeta == qfalse && !forcePatchMeta) )
3275 /* make a mesh from the drawsurf */
3276 src.width = ds->patchWidth;
3277 src.height = ds->patchHeight;
3278 src.verts = ds->verts;
3279 //% subdivided = SubdivideMesh( src, 8, 999 );
3280 - iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions );
3281 + if (patchSubdivision)
3282 + iterations = IterationsForCurve( ds->longestCurve, patchSubdivision );
3284 + iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions / patchQuality );
3286 subdivided = SubdivideMesh2( src, iterations ); //% ds->maxIterations
3288 /* fit it to the curve and remove colinear verts on rows/columns */
3289 @@ -652,12 +685,12 @@
\r
3293 - TriangulatePatchSurface( ds );
3294 + TriangulatePatchSurface(e, ds );
3297 case SURFACE_TRIANGLES:
3301 case SURFACE_FORCED_META:
3303 SurfaceToMetaTriangles( ds );
3304 @@ -972,8 +1005,8 @@
\r
3305 vec3_t average, diff;
3306 int indexes[ MAX_SAMPLES ];
3307 vec3_t votes[ MAX_SAMPLES ];
3308 + const char *classname;
3312 Sys_FPrintf( SYS_VRB, "--- SmoothMetaTriangles ---\n" );
3314 @@ -994,11 +1027,31 @@
\r
3315 and set per-vertex smoothing angle */
3316 for( i = 0, tri = &metaTriangles[ i ]; i < numMetaTriangles; i++, tri++ )
3318 + /* vortex: try get smoothing from entity key */
3319 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_smoothnormals");
3320 + if (shadeAngle <= 0.0f)
3321 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_sn");
3322 + if (shadeAngle <= 0.0f)
3323 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_smooth");
3324 + if (shadeAngle > 0.0f)
3326 + if (entities[tri->entityNum].forceNormalSmoothing == qfalse)
3328 + entities[tri->entityNum].forceNormalSmoothing = qtrue;
3329 + classname = ValueForKey( &entities[tri->entityNum], "classname" );
3330 + Sys_Printf( "Entity %d (%s) has vertex normal smoothing with breaking angle of %3.0f\n", tri->entityNum, classname, shadeAngle );
3332 + shadeAngle = DEG2RAD( shadeAngle );
3335 /* get shader for shade angle */
3336 - if( tri->si->shadeAngleDegrees > 0.0f )
3337 - shadeAngle = DEG2RAD( tri->si->shadeAngleDegrees );
3339 - shadeAngle = defaultShadeAngle;
3340 + if (shadeAngle <= 0.0f)
3342 + if( tri->si->shadeAngleDegrees > 0.0f )
3343 + shadeAngle = DEG2RAD( tri->si->shadeAngleDegrees );
3345 + shadeAngle = defaultShadeAngle;
3347 if( shadeAngle > maxShadeAngle )
3348 maxShadeAngle = shadeAngle;
3351 ===================================================================
\r
3352 --- writebsp.c (revision 158)
\r
3353 +++ writebsp.c (working copy)
\r
3354 @@ -136,7 +136,6 @@
\r
3362 @@ -278,18 +277,19 @@
\r
3363 void SetLightStyles( void )
3365 int i, j, style, numStyles;
3366 - qboolean keepLights;
3371 char lightTargets[ MAX_SWITCHED_LIGHTS ][ 64 ];
3372 int lightStyles[ MAX_SWITCHED_LIGHTS ];
3376 /* ydnar: determine if we keep lights in the bsp */
3377 - t = ValueForKey( &entities[ 0 ], "_keepLights" );
3378 - keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
3379 + if (KeyExists(&entities[ 0 ], "_keepLights") == qtrue)
3381 + t = ValueForKey( &entities[ 0 ], "_keepLights" );
3382 + keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
3385 /* any light that is controlled (has a targetname) must have a unique style number generated for it */