2 ===================================================================
\r
3 --- brush.c (revision 158)
\r
4 +++ brush.c (working copy)
\r
9 - for( brushes; brushes != NULL; brushes = brushes->next )
10 + for( ; brushes != NULL; brushes = brushes->next )
18 - if( *((int*) b) == 0xFEFEFEFE )
19 + if( *((unsigned int*) b) == 0xFEFEFEFE )
21 Sys_FPrintf( SYS_VRB, "WARNING: Attempt to free an already freed brush!\n" );
25 /* ydnar: overwrite it */
26 memset( b, 0xFE, (int) &(((brush_t*) 0)->sides[ b->numsides ]) );
27 - *((int*) b) = 0xFEFEFEFE;
28 + *((unsigned int*) b) = 0xFEFEFEFE;
36 - for( brushes; brushes != NULL; brushes = next )
37 + for( ; brushes != NULL; brushes = next )
42 ===================================================================
\r
43 --- bsp.c (revision 158)
\r
44 +++ bsp.c (working copy)
\r
46 char level[ 2 ], shader[ 1024 ];
50 /* sets integer blockSize from worldspawn "_blocksize" key if it exists */
51 value = ValueForKey( &entities[ 0 ], "_blocksize" );
52 if( value[ 0 ] == '\0' )
58 + /* vortex: emit meta stats */
63 Index: bspfile_abstract.c
\r
64 ===================================================================
\r
65 --- bspfile_abstract.c (revision 158)
\r
66 +++ bspfile_abstract.c (working copy)
\r
67 @@ -683,8 +683,26 @@
\r
68 ep->value = copystring( value );
73 +returns true if entity has this key
76 +qboolean KeyExists( const entity_t *ent, const char *key )
80 + /* walk epair list */
81 + for( ep = ent->epairs; ep != NULL; ep = ep->next )
83 + if( !EPAIR_STRCMP( ep->key, key ) )
93 gets the value for an entity key
99 /* get cast shadows */
100 if( castShadows != NULL )
102 @@ -831,5 +848,19 @@
\r
103 if( value[ 0 ] != '\0' )
104 *recvShadows = atoi( value );
107 + /* vortex: game-specific default eneity keys */
108 + value = ValueForKey( ent, "classname" );
109 + if (!Q_stricmp( game->magic, "dq" ) || !Q_stricmp( game->magic, "prophecy" ) )
111 + /* vortex: deluxe quake default shadow flags */
112 + if (!Q_stricmp( value, "func_wall" ) )
114 + if( recvShadows != NULL )
116 + if( castShadows != NULL )
123 ===================================================================
\r
124 --- facebsp.c (revision 158)
\r
125 +++ facebsp.c (working copy)
\r
126 @@ -180,7 +180,7 @@
\r
130 - for( list; list != NULL; list = list->next )
131 + for( ; list != NULL; list = list->next )
136 ===================================================================
\r
137 --- game_ef.h (revision 158)
\r
138 +++ game_ef.h (working copy)
\r
139 @@ -113,7 +113,16 @@
\r
140 qfalse, /* wolf lighting model? */
141 128, /* lightmap width/height */
142 1.0f, /* lightmap gamma */
143 + 1.0f, /* lightmap exposure */
144 1.0f, /* lightmap compensate */
145 + 1.0f, /* lightgrid scale */
146 + 1.0f, /* lightgrid ambient scale */
147 + qfalse, /* disable shader lightstyles hack */
148 + qfalse, /* keep light entities on bsp */
149 + 8, /* default patchMeta subdivisions tolerance */
150 + qfalse, /* patch casting enabled */
151 + qfalse, /* compile deluxemaps */
152 + 0, /* deluxemaps default mode */
153 "IBSP", /* bsp file prefix */
154 46, /* bsp file version */
155 qfalse, /* cod-style lump len/ofs order */
157 ===================================================================
\r
158 --- game_etut.h (revision 158)
\r
159 +++ game_etut.h (working copy)
\r
160 @@ -148,7 +148,16 @@
\r
161 qfalse, /* wolf lighting model? */
162 128, /* lightmap width/height */
163 2.2f, /* lightmap gamma */
164 + 1.0f, /* lightmap exposure */
165 1.0f, /* lightmap compensate */
166 + 1.0f, /* lightgrid scale */
167 + 1.0f, /* lightgrid ambient scale */
168 + qfalse, /* disable shader lightstyles hack */
169 + qfalse, /* keep light entities on bsp */
170 + 8, /* default patchMeta subdivisions tolerance */
171 + qfalse, /* patch casting enabled */
172 + qfalse, /* compile deluxemaps */
173 + 0, /* deluxemaps default mode */
174 "IBSP", /* bsp file prefix */
175 47, /* bsp file version */
176 qfalse, /* cod-style lump len/ofs order */
178 ===================================================================
\r
179 --- game_ja.h (revision 158)
\r
180 +++ game_ja.h (working copy)
\r
182 qfalse, /* wolf lighting model? */
183 128, /* lightmap width/height */
184 1.0f, /* lightmap gamma */
185 + 1.0f, /* lightmap exposure */
186 1.0f, /* lightmap compensate */
187 + 1.0f, /* lightgrid scale */
188 + 1.0f, /* lightgrid ambient scale */
189 + qfalse, /* disable shader lightstyles hack */
190 + qfalse, /* keep light entities on bsp */
191 + 8, /* default patchMeta subdivisions tolerance */
192 + qfalse, /* patch casting enabled */
193 + qfalse, /* compile deluxemaps */
194 + 0, /* deluxemaps default mode */
195 "RBSP", /* bsp file prefix */
196 1, /* bsp file version */
197 qfalse, /* cod-style lump len/ofs order */
199 ===================================================================
\r
200 --- game_jk2.h (revision 158)
\r
201 +++ game_jk2.h (working copy)
\r
203 qfalse, /* wolf lighting model? */
204 128, /* lightmap width/height */
205 1.0f, /* lightmap gamma */
206 + 1.0f, /* lightmap exposure */
207 1.0f, /* lightmap compensate */
208 + 1.0f, /* lightgrid scale */
209 + 1.0f, /* lightgrid ambient scale */
210 + qfalse, /* disable shader lightstyles hack */
211 + qfalse, /* keep light entities on bsp */
212 + 8, /* default patchMeta subdivisions tolerance */
213 + qfalse, /* patch casting enabled */
214 + qfalse, /* compile deluxemaps */
215 + 0, /* deluxemaps default mode */
216 "RBSP", /* bsp file prefix */
217 1, /* bsp file version */
218 qfalse, /* cod-style lump len/ofs order */
219 Index: game_qfusion.h
\r
220 ===================================================================
\r
221 --- game_qfusion.h (revision 158)
\r
222 +++ game_qfusion.h (working copy)
\r
223 @@ -1,195 +1,204 @@
\r
224 -/* -------------------------------------------------------------------------------
226 -This code is based on source provided under the terms of the Id Software
227 -LIMITED USE SOFTWARE LICENSE AGREEMENT, a copy of which is included with the
228 -GtkRadiant sources (see LICENSE_ID). If you did not receive a copy of
229 -LICENSE_ID, please contact Id Software immediately at info@idsoftware.com.
231 -All changes and additions to the original source which have been developed by
232 -other contributors (see CONTRIBUTORS) are provided under the terms of the
233 -license the contributors choose (see LICENSE), to the extent permitted by the
234 -LICENSE_ID. If you did not receive a copy of the contributor license,
235 -please contact the GtkRadiant maintainers at info@gtkradiant.com immediately.
237 -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
238 -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
239 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
240 -DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
241 -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
242 -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
243 -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
244 -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
245 -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
246 -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
248 -----------------------------------------------------------------------------------
250 -This code has been altered significantly from its original form, to support
251 -several games based on the Quake III Arena engine, in the form of "Q3Map2."
253 -------------------------------------------------------------------------------- */
258 -#ifndef GAME_QFUSION_H
259 -#define GAME_QFUSION_H
263 -/* -------------------------------------------------------------------------------
265 -content and surface flags
267 -------------------------------------------------------------------------------- */
270 -#define F_CONT_SOLID 1 /* an eye is never valid in a solid */
271 -#define F_CONT_LAVA 8
272 -#define F_CONT_SLIME 16
273 -#define F_CONT_WATER 32
274 -#define F_CONT_FOG 64
276 -#define F_CONT_AREAPORTAL 0x8000
278 -#define F_CONT_PLAYERCLIP 0x10000
279 -#define F_CONT_MONSTERCLIP 0x20000
280 -#define F_CONT_TELEPORTER 0x40000
281 -#define F_CONT_JUMPPAD 0x80000
282 -#define F_CONT_CLUSTERPORTAL 0x100000
283 -#define F_CONT_DONOTENTER 0x200000
284 -#define F_CONT_BOTCLIP 0x400000
286 -#define F_CONT_ORIGIN 0x1000000 /* removed before bsping an entity */
288 -#define F_CONT_BODY 0x2000000 /* should never be on a brush, only in game */
289 -#define F_CONT_CORPSE 0x4000000
290 -#define F_CONT_DETAIL 0x8000000 /* brushes not used for the bsp */
291 -#define F_CONT_STRUCTURAL 0x10000000 /* brushes used for the bsp */
292 -#define F_CONT_TRANSLUCENT 0x20000000 /* don't consume surface fragments inside */
293 -#define F_CONT_TRIGGER 0x40000000
294 -#define F_CONT_NODROP 0x80000000 /* don't leave bodies or items (death fog, lava) */
296 -#define F_SURF_NODAMAGE 0x1 /* never give falling damage */
297 -#define F_SURF_SLICK 0x2 /* effects game physics */
298 -#define F_SURF_SKY 0x4 /* lighting from environment map */
299 -#define F_SURF_LADDER 0x8
300 -#define F_SURF_NOIMPACT 0x10 /* don't make missile explosions */
301 -#define F_SURF_NOMARKS 0x20 /* don't leave missile marks */
302 -#define F_SURF_FLESH 0x40 /* make flesh sounds and effects */
303 -#define F_SURF_NODRAW 0x80 /* don't generate a drawsurface at all */
304 -#define F_SURF_HINT 0x100 /* make a primary bsp splitter */
305 -#define F_SURF_SKIP 0x200 /* completely ignore, allowing non-closed brushes */
306 -#define F_SURF_NOLIGHTMAP 0x400 /* surface doesn't need a lightmap */
307 -#define F_SURF_POINTLIGHT 0x800 /* generate lighting info at vertexes */
308 -#define F_SURF_METALSTEPS 0x1000 /* clanking footsteps */
309 -#define F_SURF_NOSTEPS 0x2000 /* no footstep sounds */
310 -#define F_SURF_NONSOLID 0x4000 /* don't collide against curves with this set */
311 -#define F_SURF_LIGHTFILTER 0x8000 /* act as a light filter during q3map -light */
312 -#define F_SURF_ALPHASHADOW 0x10000 /* do per-pixel light shadow casting in q3map */
313 -#define F_SURF_NODLIGHT 0x20000 /* don't dlight even if solid (solid lava, skies) */
314 -#define F_SURF_DUST 0x40000 /* leave a dust trail when walking on this surface */
317 -#define F_SURF_VERTEXLIT (F_SURF_POINTLIGHT | F_SURF_NOLIGHTMAP)
321 -/* -------------------------------------------------------------------------------
325 -------------------------------------------------------------------------------- */
328 - "qfusion", /* -game x */
329 - "baseq3", /* default base game data dir */
330 - ".q3a", /* unix home sub-dir */
331 - "quake", /* magic path word */
332 - "scripts", /* shader directory */
333 - 2048, /* max lightmapped surface verts */
334 - 2048, /* max surface verts */
335 - 12288, /* max surface indexes */
336 - qtrue, /* flares */
337 - "flareshader", /* default flare shader */
338 - qfalse, /* wolf lighting model? */
339 - 512, /* lightmap width/height */
340 - 1.0f, /* lightmap gamma */
341 - 1.0f, /* lightmap compensate */
342 - "FBSP", /* bsp file prefix */
343 - 1, /* bsp file version */
344 - qfalse, /* cod-style lump len/ofs order */
345 - LoadRBSPFile, /* bsp load function */
346 - WriteRBSPFile, /* bsp write function */
349 - /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
352 - { "default", F_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
356 - { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
357 - { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
358 - { "skip", 0, 0, 0, 0, C_SKIP, 0 },
362 - { "origin", F_CONT_ORIGIN, F_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
363 - { "areaportal", F_CONT_AREAPORTAL, F_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
364 - { "trans", F_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
365 - { "detail", F_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
366 - { "structural", F_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
367 - { "hint", 0, 0, F_SURF_HINT, 0, C_HINT, 0 },
368 - { "nodraw", 0, 0, F_SURF_NODRAW, 0, C_NODRAW, 0 },
370 - { "alphashadow", 0, 0, F_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
371 - { "lightfilter", 0, 0, F_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
372 - { "nolightmap", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
373 - { "pointlight", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
377 - { "nonsolid", 0, F_CONT_SOLID, F_SURF_NONSOLID, 0, 0, C_SOLID },
379 - { "trigger", F_CONT_TRIGGER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
381 - { "water", F_CONT_WATER, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
382 - { "slime", F_CONT_SLIME, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
383 - { "lava", F_CONT_LAVA, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
385 - { "playerclip", F_CONT_PLAYERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
386 - { "monsterclip", F_CONT_MONSTERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
387 - { "nodrop", F_CONT_NODROP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
389 - { "clusterportal", F_CONT_CLUSTERPORTAL, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
390 - { "donotenter", F_CONT_DONOTENTER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
391 - { "botclip", F_CONT_BOTCLIP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
393 - { "fog", F_CONT_FOG, F_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
394 - { "sky", 0, 0, F_SURF_SKY, 0, C_SKY, 0 },
396 - { "slick", 0, 0, F_SURF_SLICK, 0, 0, 0 },
398 - { "noimpact", 0, 0, F_SURF_NOIMPACT, 0, 0, 0 },
399 - { "nomarks", 0, 0, F_SURF_NOMARKS, 0, C_NOMARKS, 0 },
400 - { "ladder", 0, 0, F_SURF_LADDER, 0, 0, 0 },
401 - { "nodamage", 0, 0, F_SURF_NODAMAGE, 0, 0, 0 },
402 - { "metalsteps", 0, 0, F_SURF_METALSTEPS, 0, 0, 0 },
403 - { "flesh", 0, 0, F_SURF_FLESH, 0, 0, 0 },
404 - { "nosteps", 0, 0, F_SURF_NOSTEPS, 0, 0, 0 },
405 - { "nodlight", 0, 0, F_SURF_NODLIGHT, 0, 0, 0 },
406 - { "dust", 0, 0, F_SURF_DUST, 0, 0, 0 },
410 - { NULL, 0, 0, 0, 0, 0, 0 }
419 +/* -------------------------------------------------------------------------------
\r
421 +This code is based on source provided under the terms of the Id Software
\r
422 +LIMITED USE SOFTWARE LICENSE AGREEMENT, a copy of which is included with the
\r
423 +GtkRadiant sources (see LICENSE_ID). If you did not receive a copy of
\r
424 +LICENSE_ID, please contact Id Software immediately at info@idsoftware.com.
\r
426 +All changes and additions to the original source which have been developed by
\r
427 +other contributors (see CONTRIBUTORS) are provided under the terms of the
\r
428 +license the contributors choose (see LICENSE), to the extent permitted by the
\r
429 +LICENSE_ID. If you did not receive a copy of the contributor license,
\r
430 +please contact the GtkRadiant maintainers at info@gtkradiant.com immediately.
\r
432 +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
\r
433 +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
\r
434 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
\r
435 +DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
\r
436 +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
\r
437 +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
\r
438 +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
\r
439 +ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
\r
440 +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
\r
441 +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\r
443 +----------------------------------------------------------------------------------
\r
445 +This code has been altered significantly from its original form, to support
\r
446 +several games based on the Quake III Arena engine, in the form of "Q3Map2."
\r
448 +------------------------------------------------------------------------------- */
\r
453 +#ifndef GAME_QFUSION_H
\r
454 +#define GAME_QFUSION_H
\r
458 +/* -------------------------------------------------------------------------------
\r
460 +content and surface flags
\r
462 +------------------------------------------------------------------------------- */
\r
465 +#define F_CONT_SOLID 1 /* an eye is never valid in a solid */
\r
466 +#define F_CONT_LAVA 8
\r
467 +#define F_CONT_SLIME 16
\r
468 +#define F_CONT_WATER 32
\r
469 +#define F_CONT_FOG 64
\r
471 +#define F_CONT_AREAPORTAL 0x8000
\r
473 +#define F_CONT_PLAYERCLIP 0x10000
\r
474 +#define F_CONT_MONSTERCLIP 0x20000
\r
475 +#define F_CONT_TELEPORTER 0x40000
\r
476 +#define F_CONT_JUMPPAD 0x80000
\r
477 +#define F_CONT_CLUSTERPORTAL 0x100000
\r
478 +#define F_CONT_DONOTENTER 0x200000
\r
479 +#define F_CONT_BOTCLIP 0x400000
\r
481 +#define F_CONT_ORIGIN 0x1000000 /* removed before bsping an entity */
\r
483 +#define F_CONT_BODY 0x2000000 /* should never be on a brush, only in game */
\r
484 +#define F_CONT_CORPSE 0x4000000
\r
485 +#define F_CONT_DETAIL 0x8000000 /* brushes not used for the bsp */
\r
486 +#define F_CONT_STRUCTURAL 0x10000000 /* brushes used for the bsp */
\r
487 +#define F_CONT_TRANSLUCENT 0x20000000 /* don't consume surface fragments inside */
\r
488 +#define F_CONT_TRIGGER 0x40000000
\r
489 +#define F_CONT_NODROP 0x80000000 /* don't leave bodies or items (death fog, lava) */
\r
491 +#define F_SURF_NODAMAGE 0x1 /* never give falling damage */
\r
492 +#define F_SURF_SLICK 0x2 /* effects game physics */
\r
493 +#define F_SURF_SKY 0x4 /* lighting from environment map */
\r
494 +#define F_SURF_LADDER 0x8
\r
495 +#define F_SURF_NOIMPACT 0x10 /* don't make missile explosions */
\r
496 +#define F_SURF_NOMARKS 0x20 /* don't leave missile marks */
\r
497 +#define F_SURF_FLESH 0x40 /* make flesh sounds and effects */
\r
498 +#define F_SURF_NODRAW 0x80 /* don't generate a drawsurface at all */
\r
499 +#define F_SURF_HINT 0x100 /* make a primary bsp splitter */
\r
500 +#define F_SURF_SKIP 0x200 /* completely ignore, allowing non-closed brushes */
\r
501 +#define F_SURF_NOLIGHTMAP 0x400 /* surface doesn't need a lightmap */
\r
502 +#define F_SURF_POINTLIGHT 0x800 /* generate lighting info at vertexes */
\r
503 +#define F_SURF_METALSTEPS 0x1000 /* clanking footsteps */
\r
504 +#define F_SURF_NOSTEPS 0x2000 /* no footstep sounds */
\r
505 +#define F_SURF_NONSOLID 0x4000 /* don't collide against curves with this set */
\r
506 +#define F_SURF_LIGHTFILTER 0x8000 /* act as a light filter during q3map -light */
\r
507 +#define F_SURF_ALPHASHADOW 0x10000 /* do per-pixel light shadow casting in q3map */
\r
508 +#define F_SURF_NODLIGHT 0x20000 /* don't dlight even if solid (solid lava, skies) */
\r
509 +#define F_SURF_DUST 0x40000 /* leave a dust trail when walking on this surface */
\r
512 +#define F_SURF_VERTEXLIT (F_SURF_POINTLIGHT | F_SURF_NOLIGHTMAP)
\r
516 +/* -------------------------------------------------------------------------------
\r
520 +------------------------------------------------------------------------------- */
\r
523 + "qfusion", /* -game x */
\r
524 + "baseq3", /* default base game data dir */
\r
525 + ".q3a", /* unix home sub-dir */
\r
526 + "quake", /* magic path word */
\r
527 + "scripts", /* shader directory */
\r
528 + 2048, /* max lightmapped surface verts */
\r
529 + 2048, /* max surface verts */
\r
530 + 12288, /* max surface indexes */
\r
531 + qtrue, /* flares */
\r
532 + "flareshader", /* default flare shader */
\r
533 + qfalse, /* wolf lighting model? */
\r
534 + 512, /* lightmap width/height */
\r
535 + 1.0f, /* lightmap gamma */
\r
536 + 1.0f, /* lightmap exposure */
\r
537 + 1.0f, /* lightmap compensate */
\r
538 + 1.0f, /* lightgrid scale */
\r
539 + 1.0f, /* lightgrid ambient scale */
\r
540 + qfalse, /* disable shader lightstyles hack */
\r
541 + qfalse, /* keep light entities on bsp */
\r
542 + 8, /* default patchMeta subdivisions tolerance */
\r
543 + qfalse, /* patch casting enabled */
\r
544 + qfalse, /* compile deluxemaps */
\r
545 + 0, /* deluxemaps default mode */
\r
546 + "FBSP", /* bsp file prefix */
\r
547 + 1, /* bsp file version */
\r
548 + qfalse, /* cod-style lump len/ofs order */
\r
549 + LoadRBSPFile, /* bsp load function */
\r
550 + WriteRBSPFile, /* bsp write function */
\r
553 + /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
\r
556 + { "default", F_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
\r
560 + { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
\r
561 + { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
\r
562 + { "skip", 0, 0, 0, 0, C_SKIP, 0 },
\r
566 + { "origin", F_CONT_ORIGIN, F_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
\r
567 + { "areaportal", F_CONT_AREAPORTAL, F_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
\r
568 + { "trans", F_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
\r
569 + { "detail", F_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
\r
570 + { "structural", F_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
\r
571 + { "hint", 0, 0, F_SURF_HINT, 0, C_HINT, 0 },
\r
572 + { "nodraw", 0, 0, F_SURF_NODRAW, 0, C_NODRAW, 0 },
\r
574 + { "alphashadow", 0, 0, F_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
\r
575 + { "lightfilter", 0, 0, F_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
\r
576 + { "nolightmap", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
577 + { "pointlight", 0, 0, F_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
581 + { "nonsolid", 0, F_CONT_SOLID, F_SURF_NONSOLID, 0, 0, C_SOLID },
\r
583 + { "trigger", F_CONT_TRIGGER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
585 + { "water", F_CONT_WATER, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
586 + { "slime", F_CONT_SLIME, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
587 + { "lava", F_CONT_LAVA, F_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
589 + { "playerclip", F_CONT_PLAYERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
590 + { "monsterclip", F_CONT_MONSTERCLIP, F_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
591 + { "nodrop", F_CONT_NODROP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
593 + { "clusterportal", F_CONT_CLUSTERPORTAL, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
594 + { "donotenter", F_CONT_DONOTENTER, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
595 + { "botclip", F_CONT_BOTCLIP, F_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
597 + { "fog", F_CONT_FOG, F_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
\r
598 + { "sky", 0, 0, F_SURF_SKY, 0, C_SKY, 0 },
\r
600 + { "slick", 0, 0, F_SURF_SLICK, 0, 0, 0 },
\r
602 + { "noimpact", 0, 0, F_SURF_NOIMPACT, 0, 0, 0 },
\r
603 + { "nomarks", 0, 0, F_SURF_NOMARKS, 0, C_NOMARKS, 0 },
\r
604 + { "ladder", 0, 0, F_SURF_LADDER, 0, 0, 0 },
\r
605 + { "nodamage", 0, 0, F_SURF_NODAMAGE, 0, 0, 0 },
\r
606 + { "metalsteps", 0, 0, F_SURF_METALSTEPS, 0, 0, 0 },
\r
607 + { "flesh", 0, 0, F_SURF_FLESH, 0, 0, 0 },
\r
608 + { "nosteps", 0, 0, F_SURF_NOSTEPS, 0, 0, 0 },
\r
609 + { "nodlight", 0, 0, F_SURF_NODLIGHT, 0, 0, 0 },
\r
610 + { "dust", 0, 0, F_SURF_DUST, 0, 0, 0 },
\r
614 + { NULL, 0, 0, 0, 0, 0, 0 }
\r
623 Index: game_quake3.h
\r
624 ===================================================================
\r
625 --- game_quake3.h (revision 158)
\r
626 +++ game_quake3.h (working copy)
\r
627 @@ -112,7 +112,16 @@
\r
628 qfalse, /* wolf lighting model? */
629 128, /* lightmap width/height */
630 1.0f, /* lightmap gamma */
631 + 1.0f, /* lightmap exposure */
632 1.0f, /* lightmap compensate */
633 + 1.0f, /* lightgrid scale */
634 + 1.0f, /* lightgrid ambient scale */
635 + qfalse, /* disable shader lightstyles hack */
636 + qfalse, /* keep light entities on bsp */
637 + 8, /* default patchMeta subdivisions tolerance */
638 + qfalse, /* patch casting enabled */
639 + qfalse, /* compile deluxemaps */
640 + 0, /* deluxemaps default mode */
641 "IBSP", /* bsp file prefix */
642 46, /* bsp file version */
643 qfalse, /* cod-style lump len/ofs order */
645 ===================================================================
\r
646 --- game_sof2.h (revision 158)
\r
647 +++ game_sof2.h (working copy)
\r
648 @@ -139,7 +139,16 @@
\r
649 qfalse, /* wolf lighting model? */
650 128, /* lightmap width/height */
651 1.0f, /* lightmap gamma */
652 + 1.0f, /* lightmap exposure */
653 1.0f, /* lightmap compensate */
654 + 1.0f, /* lightgrid scale */
655 + 1.0f, /* lightgrid ambient scale */
656 + qfalse, /* disable shader lightstyles hack */
657 + qfalse, /* keep light entities on bsp */
658 + 8, /* default patchMeta subdivisions tolerance */
659 + qfalse, /* patch casting enabled */
660 + qfalse, /* compile deluxemaps */
661 + 0, /* deluxemaps default mode */
662 "RBSP", /* bsp file prefix */
663 1, /* bsp file version */
664 qfalse, /* cod-style lump len/ofs order */
665 Index: game_tenebrae.h
\r
666 ===================================================================
\r
667 --- game_tenebrae.h (revision 158)
\r
668 +++ game_tenebrae.h (working copy)
\r
669 @@ -112,7 +112,16 @@
\r
670 qfalse, /* wolf lighting model? */
671 512, /* lightmap width/height */
672 2.0f, /* lightmap gamma */
673 + 1.0f, /* lightmap exposure */
674 1.0f, /* lightmap compensate */
675 + 1.0f, /* lightgrid scale */
676 + 1.0f, /* lightgrid ambient scale */
677 + qtrue, /* disable shader lightstyles hack */
678 + qfalse, /* keep light entities on bsp */
679 + 8, /* default patchMeta subdivisions tolerance */
680 + qfalse, /* patch casting enabled */
681 + qtrue, /* compile deluxemaps */
682 + 0, /* deluxemaps default mode */
683 "IBSP", /* bsp file prefix */
684 46, /* bsp file version */
685 qfalse, /* cod-style lump len/ofs order */
686 Index: game_tremulous.h
\r
687 ===================================================================
\r
688 --- game_tremulous.h (revision 158)
\r
689 +++ game_tremulous.h (working copy)
\r
690 @@ -1,160 +1,169 @@
\r
691 -/* -------------------------------------------------------------------------------
693 -Copyright (C) 1999-2006 Id Software, Inc. and contributors.
694 -For a list of contributors, see the accompanying CONTRIBUTORS file.
696 -This file is part of GtkRadiant.
698 -GtkRadiant is free software; you can redistribute it and/or modify
699 -it under the terms of the GNU General Public License as published by
700 -the Free Software Foundation; either version 2 of the License, or
701 -(at your option) any later version.
703 -GtkRadiant is distributed in the hope that it will be useful,
704 -but WITHOUT ANY WARRANTY; without even the implied warranty of
705 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
706 -GNU General Public License for more details.
708 -You should have received a copy of the GNU General Public License
709 -along with GtkRadiant; if not, write to the Free Software
710 -Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
712 -----------------------------------------------------------------------------------
714 -This code has been altered significantly from its original form, to support
715 -several games based on the Quake III Arena engine, in the form of "Q3Map2."
717 -------------------------------------------------------------------------------- */
719 -/* Tremulous support, by LinuxManMikeC */
723 -#ifndef GAME_TREMULOUS_H
724 -#define GAME_TREMULOUS_H
728 -/* -------------------------------------------------------------------------------
730 -content and surface flags - also uses defines from game_quake3.h
732 -------------------------------------------------------------------------------- */
733 -#define TREM_CONT_NOALIENBUILD 0x1000
734 -#define TREM_CONT_NOHUMANBUILD 0x2000
735 -#define TREM_CONT_NOBUILD 0x4000
737 -#define TREM_SURF_NOALIENBUILDSURFACE 0x80000
738 -#define TREM_SURF_NOHUMANBUILDSURFACE 0x100000
739 -#define TREM_SURF_NOBUILDSURFACE 0x200000
743 -/* -------------------------------------------------------------------------------
747 -------------------------------------------------------------------------------- */
750 - "tremulous", /* -game x */
751 - "base", /* default base game data dir */
752 - ".tremulous", /* unix home sub-dir */
753 - "tremulous", /* magic path word - think this is right for trem*/
754 - "scripts", /* shader directory */
755 - 64, /* max lightmapped surface verts */
756 - 999, /* max surface verts */
757 - 6000, /* max surface indexes */
758 - qfalse, /* flares */
759 - "flareshader", /* default flare shader */
760 - qfalse, /* wolf lighting model? */
761 - 128, /* lightmap width/height */
762 - 1.0f, /* lightmap gamma */
763 - 1.0f, /* lightmap compensate */
764 - "IBSP", /* bsp file prefix */
765 - 46, /* bsp file version */
766 - qfalse, /* cod-style lump len/ofs order */
767 - LoadIBSPFile, /* bsp load function */
768 - WriteIBSPFile, /* bsp write function */
771 - /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
774 - { "default", Q_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
778 - { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
779 - { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
780 - { "skip", 0, 0, 0, 0, C_SKIP, 0 },
784 - { "origin", Q_CONT_ORIGIN, Q_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
785 - { "areaportal", Q_CONT_AREAPORTAL, Q_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
786 - { "trans", Q_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
787 - { "detail", Q_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
788 - { "structural", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
789 - { "hint", 0, 0, Q_SURF_HINT, 0, C_HINT, 0 },
790 - { "nodraw", 0, 0, Q_SURF_NODRAW, 0, C_NODRAW, 0 },
792 - { "alphashadow", 0, 0, Q_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
793 - { "lightfilter", 0, 0, Q_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
794 - { "nolightmap", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
795 - { "pointlight", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
799 - { "nonsolid", 0, Q_CONT_SOLID, Q_SURF_NONSOLID, 0, 0, C_SOLID },
801 - { "trigger", Q_CONT_TRIGGER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
803 - { "water", Q_CONT_WATER, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
804 - { "slime", Q_CONT_SLIME, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
805 - { "lava", Q_CONT_LAVA, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
807 - { "playerclip", Q_CONT_PLAYERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
808 - { "monsterclip", Q_CONT_MONSTERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
809 - { "nodrop", Q_CONT_NODROP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
811 - { "clusterportal", Q_CONT_CLUSTERPORTAL, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
812 - { "donotenter", Q_CONT_DONOTENTER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
813 - { "botclip", Q_CONT_BOTCLIP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
815 - { "fog", Q_CONT_FOG, Q_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
816 - { "sky", 0, 0, Q_SURF_SKY, 0, C_SKY, 0 },
818 - { "slick", 0, 0, Q_SURF_SLICK, 0, 0, 0 },
820 - { "noimpact", 0, 0, Q_SURF_NOIMPACT, 0, 0, 0 },
821 - { "nomarks", 0, 0, Q_SURF_NOMARKS, 0, C_NOMARKS, 0 },
822 - { "ladder", 0, 0, Q_SURF_LADDER, 0, 0, 0 },
823 - { "nodamage", 0, 0, Q_SURF_NODAMAGE, 0, 0, 0 },
824 - { "metalsteps", 0, 0, Q_SURF_METALSTEPS, 0, 0, 0 },
825 - { "flesh", 0, 0, Q_SURF_FLESH, 0, 0, 0 },
826 - { "nosteps", 0, 0, Q_SURF_NOSTEPS, 0, 0, 0 },
827 - { "nodlight", 0, 0, Q_SURF_NODLIGHT, 0, 0, 0 },
828 - { "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
832 - {"noalienbuild", TREM_CONT_NOALIENBUILD,0,0,0,0,0},
833 - {"nohumanbuild", TREM_CONT_NOHUMANBUILD,0,0,0,0,0},
834 - {"nobuild", TREM_CONT_NOBUILD,0,0,0,0,0},
836 - {"noalienbuildsurface", 0,0,TREM_SURF_NOALIENBUILDSURFACE,0,0,0},
837 - {"nohumanbuildsurface", 0,0,TREM_SURF_NOHUMANBUILDSURFACE,0,0,0},
838 - {"nobuildsurface", 0,0,TREM_SURF_NOBUILDSURFACE,0,0,0},
842 - { NULL, 0, 0, 0, 0, 0, 0 }
851 +/* -------------------------------------------------------------------------------
\r
853 +Copyright (C) 1999-2006 Id Software, Inc. and contributors.
\r
854 +For a list of contributors, see the accompanying CONTRIBUTORS file.
\r
856 +This file is part of GtkRadiant.
\r
858 +GtkRadiant is free software; you can redistribute it and/or modify
\r
859 +it under the terms of the GNU General Public License as published by
\r
860 +the Free Software Foundation; either version 2 of the License, or
\r
861 +(at your option) any later version.
\r
863 +GtkRadiant is distributed in the hope that it will be useful,
\r
864 +but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
865 +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
866 +GNU General Public License for more details.
\r
868 +You should have received a copy of the GNU General Public License
\r
869 +along with GtkRadiant; if not, write to the Free Software
\r
870 +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\r
872 +----------------------------------------------------------------------------------
\r
874 +This code has been altered significantly from its original form, to support
\r
875 +several games based on the Quake III Arena engine, in the form of "Q3Map2."
\r
877 +------------------------------------------------------------------------------- */
\r
879 +/* Tremulous support, by LinuxManMikeC */
\r
883 +#ifndef GAME_TREMULOUS_H
\r
884 +#define GAME_TREMULOUS_H
\r
888 +/* -------------------------------------------------------------------------------
\r
890 +content and surface flags - also uses defines from game_quake3.h
\r
892 +------------------------------------------------------------------------------- */
\r
893 +#define TREM_CONT_NOALIENBUILD 0x1000
\r
894 +#define TREM_CONT_NOHUMANBUILD 0x2000
\r
895 +#define TREM_CONT_NOBUILD 0x4000
\r
897 +#define TREM_SURF_NOALIENBUILDSURFACE 0x80000
\r
898 +#define TREM_SURF_NOHUMANBUILDSURFACE 0x100000
\r
899 +#define TREM_SURF_NOBUILDSURFACE 0x200000
\r
903 +/* -------------------------------------------------------------------------------
\r
907 +------------------------------------------------------------------------------- */
\r
910 + "tremulous", /* -game x */
\r
911 + "base", /* default base game data dir */
\r
912 + ".tremulous", /* unix home sub-dir */
\r
913 + "tremulous", /* magic path word - think this is right for trem*/
\r
914 + "scripts", /* shader directory */
\r
915 + 64, /* max lightmapped surface verts */
\r
916 + 999, /* max surface verts */
\r
917 + 6000, /* max surface indexes */
\r
918 + qfalse, /* flares */
\r
919 + "flareshader", /* default flare shader */
\r
920 + qfalse, /* wolf lighting model? */
\r
921 + 128, /* lightmap width/height */
\r
922 + 1.0f, /* lightmap gamma */
\r
923 + 1.0f, /* lightmap exposure */
\r
924 + 1.0f, /* lightmap compensate */
\r
925 + 1.0f, /* lightgrid scale */
\r
926 + 1.0f, /* lightgrid ambient scale */
\r
927 + qfalse, /* disable shader lightstyles hack */
\r
928 + qfalse, /* keep light entities on bsp */
\r
929 + 8, /* default patchMeta subdivisions tolerance */
\r
930 + qfalse, /* patch casting enabled */
\r
931 + qfalse, /* compile deluxemaps */
\r
932 + 0, /* deluxemaps default mode */
\r
933 + "IBSP", /* bsp file prefix */
\r
934 + 46, /* bsp file version */
\r
935 + qfalse, /* cod-style lump len/ofs order */
\r
936 + LoadIBSPFile, /* bsp load function */
\r
937 + WriteIBSPFile, /* bsp write function */
\r
940 + /* name contentFlags contentFlagsClear surfaceFlags surfaceFlagsClear compileFlags compileFlagsClear */
\r
943 + { "default", Q_CONT_SOLID, -1, 0, -1, C_SOLID, -1 },
\r
947 + { "lightgrid", 0, 0, 0, 0, C_LIGHTGRID, 0 },
\r
948 + { "antiportal", 0, 0, 0, 0, C_ANTIPORTAL, 0 },
\r
949 + { "skip", 0, 0, 0, 0, C_SKIP, 0 },
\r
953 + { "origin", Q_CONT_ORIGIN, Q_CONT_SOLID, 0, 0, C_ORIGIN | C_TRANSLUCENT, C_SOLID },
\r
954 + { "areaportal", Q_CONT_AREAPORTAL, Q_CONT_SOLID, 0, 0, C_AREAPORTAL | C_TRANSLUCENT, C_SOLID },
\r
955 + { "trans", Q_CONT_TRANSLUCENT, 0, 0, 0, C_TRANSLUCENT, 0 },
\r
956 + { "detail", Q_CONT_DETAIL, 0, 0, 0, C_DETAIL, 0 },
\r
957 + { "structural", Q_CONT_STRUCTURAL, 0, 0, 0, C_STRUCTURAL, 0 },
\r
958 + { "hint", 0, 0, Q_SURF_HINT, 0, C_HINT, 0 },
\r
959 + { "nodraw", 0, 0, Q_SURF_NODRAW, 0, C_NODRAW, 0 },
\r
961 + { "alphashadow", 0, 0, Q_SURF_ALPHASHADOW, 0, C_ALPHASHADOW | C_TRANSLUCENT, 0 },
\r
962 + { "lightfilter", 0, 0, Q_SURF_LIGHTFILTER, 0, C_LIGHTFILTER | C_TRANSLUCENT, 0 },
\r
963 + { "nolightmap", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
964 + { "pointlight", 0, 0, Q_SURF_VERTEXLIT, 0, C_VERTEXLIT, 0 },
\r
968 + { "nonsolid", 0, Q_CONT_SOLID, Q_SURF_NONSOLID, 0, 0, C_SOLID },
\r
970 + { "trigger", Q_CONT_TRIGGER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
972 + { "water", Q_CONT_WATER, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
973 + { "slime", Q_CONT_SLIME, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
974 + { "lava", Q_CONT_LAVA, Q_CONT_SOLID, 0, 0, C_LIQUID | C_TRANSLUCENT, C_SOLID },
\r
976 + { "playerclip", Q_CONT_PLAYERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
977 + { "monsterclip", Q_CONT_MONSTERCLIP, Q_CONT_SOLID, 0, 0, C_DETAIL | C_TRANSLUCENT, C_SOLID },
\r
978 + { "nodrop", Q_CONT_NODROP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
980 + { "clusterportal", Q_CONT_CLUSTERPORTAL, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
981 + { "donotenter", Q_CONT_DONOTENTER, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
982 + { "botclip", Q_CONT_BOTCLIP, Q_CONT_SOLID, 0, 0, C_TRANSLUCENT, C_SOLID },
\r
984 + { "fog", Q_CONT_FOG, Q_CONT_SOLID, 0, 0, C_FOG, C_SOLID },
\r
985 + { "sky", 0, 0, Q_SURF_SKY, 0, C_SKY, 0 },
\r
987 + { "slick", 0, 0, Q_SURF_SLICK, 0, 0, 0 },
\r
989 + { "noimpact", 0, 0, Q_SURF_NOIMPACT, 0, 0, 0 },
\r
990 + { "nomarks", 0, 0, Q_SURF_NOMARKS, 0, C_NOMARKS, 0 },
\r
991 + { "ladder", 0, 0, Q_SURF_LADDER, 0, 0, 0 },
\r
992 + { "nodamage", 0, 0, Q_SURF_NODAMAGE, 0, 0, 0 },
\r
993 + { "metalsteps", 0, 0, Q_SURF_METALSTEPS, 0, 0, 0 },
\r
994 + { "flesh", 0, 0, Q_SURF_FLESH, 0, 0, 0 },
\r
995 + { "nosteps", 0, 0, Q_SURF_NOSTEPS, 0, 0, 0 },
\r
996 + { "nodlight", 0, 0, Q_SURF_NODLIGHT, 0, 0, 0 },
\r
997 + { "dust", 0, 0, Q_SURF_DUST, 0, 0, 0 },
\r
1001 + {"noalienbuild", TREM_CONT_NOALIENBUILD,0,0,0,0,0},
\r
1002 + {"nohumanbuild", TREM_CONT_NOHUMANBUILD,0,0,0,0,0},
\r
1003 + {"nobuild", TREM_CONT_NOBUILD,0,0,0,0,0},
\r
1005 + {"noalienbuildsurface", 0,0,TREM_SURF_NOALIENBUILDSURFACE,0,0,0},
\r
1006 + {"nohumanbuildsurface", 0,0,TREM_SURF_NOHUMANBUILDSURFACE,0,0,0},
\r
1007 + {"nobuildsurface", 0,0,TREM_SURF_NOBUILDSURFACE,0,0,0},
\r
1011 + { NULL, 0, 0, 0, 0, 0, 0 }
\r
1020 Index: game_wolf.h
\r
1021 ===================================================================
\r
1022 --- game_wolf.h (revision 158)
\r
1023 +++ game_wolf.h (working copy)
\r
1024 @@ -129,7 +129,16 @@
\r
1025 qtrue, /* wolf lighting model? */
1026 128, /* lightmap width/height */
1027 1.0f, /* lightmap gamma */
1028 + 1.0f, /* lightmap exposure */
1029 1.0f, /* lightmap compensate */
1030 + 1.0f, /* lightgrid scale */
1031 + 1.0f, /* lightgrid ambient scale */
1032 + qfalse, /* disable shader lightstyles hack */
1033 + qfalse, /* keep light entities on bsp */
1034 + 8, /* default patchMeta subdivisions tolerance */
1035 + qfalse, /* patch casting enabled */
1036 + qfalse, /* compile deluxemaps */
1037 + 0, /* deluxemaps default mode */
1038 "IBSP", /* bsp file prefix */
1039 47, /* bsp file version */
1040 qfalse, /* cod-style lump len/ofs order */
1041 Index: game_wolfet.h
\r
1042 ===================================================================
\r
1043 --- game_wolfet.h (revision 158)
\r
1044 +++ game_wolfet.h (working copy)
\r
1045 @@ -66,7 +66,16 @@
\r
1046 qtrue, /* wolf lighting model? */
1047 128, /* lightmap width/height */
1048 1.0f, /* lightmap gamma */
1049 + 1.0f, /* lightmap exposure */
1050 1.0f, /* lightmap compensate */
1051 + 1.0f, /* lightgrid scale */
1052 + 1.0f, /* lightgrid ambient scale */
1053 + qfalse, /* disable shader lightstyles hack */
1054 + qfalse, /* keep light entities on bsp */
1055 + 8, /* default patchMeta subdivisions tolerance */
1056 + qfalse, /* patch casting enabled */
1057 + qfalse, /* compile deluxemaps */
1058 + 0, /* deluxemaps default mode */
1059 "IBSP", /* bsp file prefix */
1060 47, /* bsp file version */
1061 qfalse, /* cod-style lump len/ofs order */
1063 ===================================================================
\r
1064 --- light.c (revision 158)
\r
1065 +++ light.c (working copy)
\r
1066 @@ -313,7 +313,15 @@
\r
1067 flags |= LIGHT_GRID;
1068 flags &= ~LIGHT_SURFACES;
1072 + /* vortex: unnormalized? */
1073 + if (spawnflags & 32)
1074 + flags |= LIGHT_UNNORMALIZED;
1076 + /* vortex: distance atten? */
1077 + if (spawnflags & 64)
1078 + flags |= LIGHT_ATTEN_DISTANCE;
1080 /* store the flags */
1081 light->flags = flags;
1083 @@ -357,12 +365,13 @@
\r
1086 /* ydnar: get deviance and samples */
1087 + /* VorteX: now set start value for _samples when _deviance is found */
1088 deviance = FloatForKey( e, "_deviance" );
1089 if( deviance == 0.0f )
1090 deviance = FloatForKey( e, "_deviation" );
1091 if( deviance == 0.0f )
1092 deviance = FloatForKey( e, "_jitter" );
1093 - numSamples = IntForKey( e, "_samples" );
1094 + numSamples = max(IntForKey( e, "_samples" ), deviance);
1095 if( deviance < 0.0f || numSamples < 1 )
1098 @@ -385,14 +394,16 @@
\r
1099 if( _color && _color[ 0 ] )
1101 sscanf( _color, "%f %f %f", &light->color[ 0 ], &light->color[ 1 ], &light->color[ 2 ] );
1102 - ColorNormalize( light->color, light->color );
1103 + if (!(light->flags & LIGHT_UNNORMALIZED))
1105 + ColorNormalize( light->color, light->color );
1109 light->color[ 0 ] = light->color[ 1 ] = light->color[ 2 ] = 1.0f;
1112 intensity = intensity * pointScale;
1113 light->photons = intensity;
1115 light->type = EMIT_POINT;
1117 /* set falloff threshold */
1118 @@ -741,6 +752,7 @@
\r
1121 VectorClear( trace->color );
1122 + VectorClear( trace->colorNoShadow );
1124 /* ydnar: early out */
1125 if( !(light->flags & LIGHT_SURFACES) || light->envelope <= 0.0f )
1126 @@ -766,7 +778,6 @@
\r
1128 vec3_t pushedOrigin;
1131 /* project sample point into light plane */
1132 d = DotProduct( trace->origin, light->normal ) - light->dist;
1134 @@ -881,8 +892,7 @@
\r
1136 float distByNormal, radiusAtDist, sampleRadius;
1137 vec3_t pointAtDist, distToSample;
1141 /* do cone calculation */
1142 distByNormal = -DotProduct( trace->displacement, light->normal );
1143 if( distByNormal < 0.0f )
1144 @@ -922,6 +932,9 @@
\r
1145 add = light->photons * angle;
1149 + /* VorteX: set noShadow color */
1150 + VectorScale(light->color, add, trace->colorNoShadow);
1153 trace->testAll = qtrue;
1154 @@ -942,6 +955,9 @@
\r
1155 /* return to sender */
1159 + /* VorteX: set noShadow color */
1160 + VectorScale(light->color, add, trace->colorNoShadow);
1162 /* ydnar: changed to a variable number */
1163 if( add <= 0.0f || (add <= light->falloffTolerance && (light->flags & LIGHT_FAST_ACTUAL)) )
1164 @@ -1378,6 +1394,56 @@
\r
1168 + /////// Floodlighting for point //////////////////
1169 + //do our floodlight ambient occlusion loop, and add a single contribution based on the brightest dir
1175 + col[0]=col[1]=col[2]=floodlightIntensity;
1179 + trace.testOcclusion = qtrue;
1180 + trace.forceSunlight = qfalse;
1181 + trace.inhibitRadius = DEFAULT_INHIBIT_RADIUS;
1182 + trace.testAll = qtrue;
1186 + if (q==0) //upper hemisphere
1188 + trace.normal[0]=0;
1189 + trace.normal[1]=0;
1190 + trace.normal[2]=1;
1192 + else //lower hemisphere
1194 + trace.normal[0]=0;
1195 + trace.normal[1]=0;
1196 + trace.normal[2]=-1;
1199 + f = FloodLightForSample(&trace, floodlightDistance, floodlight_lowquality);
1201 + contributions[ numCon ].color[0]=col[0]*f;
1202 + contributions[ numCon ].color[1]=col[1]*f;
1203 + contributions[ numCon ].color[2]=col[2]*f;
1205 + contributions[ numCon ].dir[0]=dir[0];
1206 + contributions[ numCon ].dir[1]=dir[1];
1207 + contributions[ numCon ].dir[2]=dir[2];
1209 + contributions[ numCon ].style = 0;
1211 + /* push average direction around */
1212 + addSize = VectorLength( col );
1213 + VectorMA( gp->dir, addSize, dir, gp->dir );
1216 + /////////////////////
1218 /* normalize to get primary light direction */
1219 VectorNormalize( gp->dir, gp->dir );
1221 @@ -1420,6 +1486,9 @@
\r
1223 /* ambient light will be at 1/4 the value of directed light */
1224 /* (ydnar: nuke this in favor of more dramatic lighting?) */
1225 + /* (PM: how about actually making it work? d=1 when it got here for single lights/sun :P */
1227 + /* (Hobbes: always setting it to .25 is hardly any better) */
1228 d = 0.25f * (1.0f - d);
1229 VectorMA( gp->ambient[ j ], d, contributions[ i ].color, gp->ambient[ j ] );
1231 @@ -1437,8 +1506,10 @@
\r
1232 for( j = 0; j < 3; j++ )
1233 if( color[ j ] < minGridLight[ j ] )
1234 color[ j ] = minGridLight[ j ];
1235 - ColorToBytes( color, bgp->ambient[ i ], 1.0f );
1236 - ColorToBytes( gp->directed[ i ], bgp->directed[ i ], 1.0f );
1238 + /* vortex: apply gridscale and gridambientscale here */
1239 + ColorToBytes( color, bgp->ambient[ i ], gridScale*gridAmbientScale );
1240 + ColorToBytes( gp->directed[ i ], bgp->directed[ i ], gridScale );
1244 @@ -1654,14 +1725,12 @@
\r
1247 Sys_Printf( "--- DirtyRawLightmap ---\n" );
1252 RunThreadsOnIndividual( numRawLightmaps, qtrue, DirtyRawLightmap );
1256 + /* floodlight pass */
1257 + FloodlightRawLightmaps();
1259 /* ydnar: set up light envelopes */
1260 SetupEnvelopes( qfalse, fast );
1262 @@ -1774,12 +1843,64 @@
\r
1265 Sys_Printf( "--- Light ---\n" );
1267 + Sys_Printf( "--- ProcessGameSpecific ---\n" );
1269 /* set standard game flags */
1270 wolfLight = game->wolfLight;
1271 + if (wolfLight == qtrue)
1272 + Sys_Printf( " lightning model: wolf\n" );
1274 + Sys_Printf( " lightning model: quake3\n" );
1276 lmCustomSize = game->lightmapSize;
1277 + Sys_Printf( " lightmap size: %d x %d pixels\n", lmCustomSize, lmCustomSize );
1279 lightmapGamma = game->lightmapGamma;
1280 + Sys_Printf( " lightning gamma: %f\n", lightmapGamma );
1282 lightmapCompensate = game->lightmapCompensate;
1283 + Sys_Printf( " lightning compensation: %f\n", lightmapCompensate );
1285 + lightmapExposure = game->lightmapExposure;
1286 + Sys_Printf( " lightning exposure: %f\n", lightmapExposure );
1288 + gridScale = game->gridScale;
1289 + Sys_Printf( " lightgrid scale: %f\n", gridScale );
1291 + gridAmbientScale = game->gridAmbientScale;
1292 + Sys_Printf( " lightgrid ambient scale: %f\n", gridAmbientScale );
1294 + noStyles = game->noStyles;
1295 + if (noStyles == qtrue)
1296 + Sys_Printf( " shader lightstyles hack: disabled\n" );
1298 + Sys_Printf( " shader lightstyles hack: enabled\n" );
1300 + keepLights = game->keepLights;
1301 + if (keepLights == qtrue)
1302 + Sys_Printf( " keep lights: enabled\n" );
1304 + Sys_Printf( " keep lights: disabled\n" );
1306 + patchShadows = game->patchShadows;
1307 + if (patchShadows == qtrue)
1308 + Sys_Printf( " patch shadows: enabled\n" );
1310 + Sys_Printf( " patch shadows: disabled\n" );
1312 + deluxemap = game->deluxeMap;
1313 + deluxemode = game->deluxeMode;
1314 + if (deluxemap == qtrue)
1317 + Sys_Printf( " deluxemapping: enabled with tangentspace deluxemaps\n" );
1319 + Sys_Printf( " deluxemapping: enabled with modelspace deluxemaps\n" );
1322 + Sys_Printf( " deluxemapping: disabled\n" );
1324 + Sys_Printf( "--- ProcessCommandLine ---\n" );
1326 /* process commandline arguments */
1327 for( i = 1; i < (argc - 1); i++ )
1328 @@ -1827,6 +1948,22 @@
\r
1329 Sys_Printf( "All light scaled by %f\n", f );
1333 + else if( !strcmp( argv[ i ], "-gridscale" ) )
1335 + f = atof( argv[ i + 1 ] );
1336 + Sys_Printf( "Grid lightning scaled by %f\n", f );
1341 + else if( !strcmp( argv[ i ], "-gridambientscale" ) )
1343 + f = atof( argv[ i + 1 ] );
1344 + Sys_Printf( "Grid ambient lightning scaled by %f\n", f );
1345 + gridAmbientScale *= f;
1349 else if( !strcmp( argv[ i ], "-gamma" ) )
1351 @@ -1836,6 +1973,14 @@
\r
1355 + else if( !strcmp( argv[ i ], "-exposure" ) )
1357 + f = atof( argv[ i + 1 ] );
1358 + lightmapExposure = f;
1359 + Sys_Printf( "Lighting exposure set to %f\n", lightmapExposure );
1363 else if( !strcmp( argv[ i ], "-compensate" ) )
1365 f = atof( argv[ i + 1 ] );
1366 @@ -1889,12 +2034,6 @@
\r
1367 Sys_Printf( "Dark lightmap seams enabled\n" );
1376 else if( !strcmp( argv[ i ], "-shadeangle" ) )
1378 shadeAngleDegrees = atof( argv[ i + 1 ] );
1379 @@ -1927,13 +2066,28 @@
\r
1380 Sys_Printf( "Approximating lightmaps within a byte tolerance of %d\n", approximateTolerance );
1384 else if( !strcmp( argv[ i ], "-deluxe" ) || !strcmp( argv[ i ], "-deluxemap" ) )
1387 Sys_Printf( "Generating deluxemaps for average light direction\n" );
1390 + else if( !strcmp( argv[ i ], "-deluxemode" ))
1392 + deluxemode = atoi( argv[ i + 1 ] );
1393 + if (deluxemode == 0 || deluxemode > 1 || deluxemode < 0)
1395 + Sys_Printf( "Generating modelspace deluxemaps\n" );
1399 + Sys_Printf( "Generating tangentspace deluxemaps\n" );
1402 + else if( !strcmp( argv[ i ], "-nodeluxe" ) || !strcmp( argv[ i ], "-nodeluxemap" ) )
1404 + deluxemap = qfalse;
1405 + Sys_Printf( "Disabling generating of deluxemaps for average light direction\n" );
1407 else if( !strcmp( argv[ i ], "-external" ) )
1409 externalLightmaps = qtrue;
1410 @@ -2151,6 +2305,12 @@
\r
1412 Sys_Printf( "Default lightmap sample size set to %dx%d units\n", sampleSize, sampleSize );
1414 + else if( !strcmp( argv[ i ], "-samplescale" ) )
1416 + sampleScale = atoi( argv[ i + 1 ] );
1418 + Sys_Printf( "Lightmaps sample scale set to %d\n", sampleScale);
1420 else if( !strcmp( argv[ i ], "-novertex" ) )
1422 noVertexLighting = qtrue;
1423 @@ -2186,11 +2346,36 @@
\r
1425 Sys_Printf( "Disabling lightstyles\n" );
1427 + else if( !strcmp( argv[ i ], "-style" ) || !strcmp( argv[ i ], "-styles" ) )
1429 + noStyles = qfalse;
1430 + Sys_Printf( "Enabling lightstyles\n" );
1432 + else if( !strcmp( argv[ i ], "-keeplights" ))
1434 + keepLights = qtrue;
1435 + Sys_Printf( "Leaving light entities on map after compile\n" );
1437 else if( !strcmp( argv[ i ], "-cpma" ) )
1440 Sys_Printf( "Enabling Challenge Pro Mode Asstacular Vertex Lighting Mode (tm)\n" );
1442 + else if( !strcmp( argv[ i ], "-floodlight" ) )
1444 + floodlighty = qtrue;
1445 + Sys_Printf( "FloodLighting enabled\n" );
1447 + else if( !strcmp( argv[ i ], "-debugnormals" ) )
1449 + debugnormals = qtrue;
1450 + Sys_Printf( "DebugNormals enabled\n" );
1452 + else if( !strcmp( argv[ i ], "-lowquality" ) )
1454 + floodlight_lowquality = qtrue;
1455 + Sys_Printf( "Low Quality FloodLighting enabled\n" );
1458 /* r7: dirtmapping */
1459 else if( !strcmp( argv[ i ], "-dirty" ) )
1460 @@ -2212,6 +2397,7 @@
\r
1461 Sys_Printf( "Enabling randomized dirtmapping\n" );
1463 Sys_Printf( "Enabling ordered dir mapping\n" );
1466 else if( !strcmp( argv[ i ], "-dirtdepth" ) )
1468 @@ -2219,6 +2405,7 @@
\r
1469 if( dirtDepth <= 0.0f )
1471 Sys_Printf( "Dirtmapping depth set to %.1f\n", dirtDepth );
1474 else if( !strcmp( argv[ i ], "-dirtscale" ) )
1476 @@ -2226,6 +2413,7 @@
\r
1477 if( dirtScale <= 0.0f )
1479 Sys_Printf( "Dirtmapping scale set to %.1f\n", dirtScale );
1482 else if( !strcmp( argv[ i ], "-dirtgain" ) )
1484 @@ -2233,6 +2421,7 @@
\r
1485 if( dirtGain <= 0.0f )
1487 Sys_Printf( "Dirtmapping gain set to %.1f\n", dirtGain );
1491 /* unhandled args */
1492 @@ -2279,6 +2468,7 @@
\r
1493 /* ydnar: set up optimization */
1496 + SetupFloodLight();
1497 SetupSurfaceLightmaps();
1499 /* initialize the surface facet tracing */
1500 Index: light_bounce.c
\r
1501 ===================================================================
\r
1502 --- light_bounce.c (revision 158)
\r
1503 +++ light_bounce.c (working copy)
\r
1504 @@ -510,7 +510,7 @@
\r
1507 case MST_TRIANGLE_SOUP:
1508 - numTriangleDiffuseLights;
1509 + numTriangleDiffuseLights++;
1513 Index: light_trace.c
\r
1514 ===================================================================
\r
1515 --- light_trace.c (revision 158)
\r
1516 +++ light_trace.c (working copy)
\r
1518 #define GROW_TRACE_NODES 16384 //% 16384
1519 #define GROW_NODE_ITEMS 16 //% 256
1521 -#define MAX_TW_VERTS 12
1522 +#define MAX_TW_VERTS 24 // vortex: increased from 12 to 24 for ability co compile some insane maps with large curve count
1524 #define TRACE_ON_EPSILON 0.1f
1526 Index: light_ydnar.c
\r
1527 ===================================================================
\r
1528 --- light_ydnar.c (revision 158)
\r
1529 +++ light_ydnar.c (working copy)
\r
1537 /* ydnar: scaling necessary for simulating r_overbrightBits on external lightmaps */
1538 @@ -72,16 +73,51 @@
\r
1540 sample[ i ] = pow( sample[ i ] / 255.0f, gamma ) * 255.0f;
1543 + if (lightmapExposure == 1)
1545 + /* clamp with color normalization */
1546 + max = sample[ 0 ];
1547 + if( sample[ 1 ] > max )
1548 + max = sample[ 1 ];
1549 + if( sample[ 2 ] > max )
1550 + max = sample[ 2 ];
1551 + if( max > 255.0f )
1552 + VectorScale( sample, (255.0f / max), sample );
1556 + if (lightmapExposure==0)
1558 + lightmapExposure=1.0f;
1560 + inv=1.f/lightmapExposure;
1563 + max = sample[ 0 ];
1564 + if( sample[ 1 ] > max )
1565 + max = sample[ 1 ];
1566 + if( sample[ 2 ] > max )
1567 + max = sample[ 2 ];
1569 + dif = (1- exp(-max * inv) ) * 255;
1587 - /* clamp with color normalization */
1588 - max = sample[ 0 ];
1589 - if( sample[ 1 ] > max )
1590 - max = sample[ 1 ];
1591 - if( sample[ 2 ] > max )
1592 - max = sample[ 2 ];
1593 - if( max > 255.0f )
1594 - VectorScale( sample, (255.0f / max), sample );
1596 /* compensate for ingame overbrighting/bitshifting */
1597 VectorScale( sample, (1.0f / lightmapCompensate), sample );
1599 @@ -384,7 +420,7 @@
\r
1601 #define BOGUS_NUDGE -99999.0f
1603 -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 ] )
1604 +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 ] )
1606 int i, x, y, numClusters, *clusters, pointCluster, *cluster;
1607 float *luxel, *origin, *normal, d, lightmapSampleOffset;
1608 @@ -392,6 +428,12 @@
\r
1612 + vec3_t cverts[ 3 ];
1614 + vec4_t sideplane, hostplane;
1619 static float nudges[][ 2 ] =
1621 @@ -485,6 +527,51 @@
\r
1622 /* non axial lightmap projection (explicit xyz) */
1624 VectorCopy( dv->xyz, origin );
1626 + //////////////////////
1627 + //27's test to make sure samples stay within the triangle boundaries
1628 + //1) Test the sample origin to see if it lays on the wrong side of any edge (x/y)
1629 + //2) if it does, nudge it onto the correct side.
1631 + if (worldverts!=NULL)
1635 + VectorCopy(worldverts[j],cverts[j]);
1637 + PlaneFromPoints(hostplane,cverts[0],cverts[1],cverts[2]);
1643 + //build plane using 2 edges and a normal
1646 + VectorCopy(cverts[next],temp);
1647 + VectorAdd(temp,hostplane,temp);
1648 + PlaneFromPoints(sideplane,cverts[i],cverts[ next ], temp);
1650 + //planetest sample point
1651 + e=DotProduct(origin,sideplane);
1656 + //VectorClear(origin);
1657 + //Move the sample point back inside triangle bounds
1658 + origin[0]-=sideplane[0]*(e+1);
1659 + origin[1]-=sideplane[1]*(e+1);
1660 + origin[2]-=sideplane[2]*(e+1);
1662 + VectorClear(origin);
1669 + ////////////////////////
1671 /* planar surfaces have precalculated lightmap vectors for nudging */
1672 if( lm->plane != NULL )
1673 @@ -516,8 +603,13 @@
\r
1675 origin[ lm->axisNum ] += lightmapSampleOffset;
1677 + VectorCopy(origin,origintwo);
1678 + origintwo[0]+=vecs[2][0];
1679 + origintwo[1]+=vecs[2][1];
1680 + origintwo[2]+=vecs[2][2];
1683 - pointCluster = ClusterForPointExtFilter( origin, LUXEL_EPSILON, numClusters, clusters );
1684 + pointCluster = ClusterForPointExtFilter( origintwo, LUXEL_EPSILON, numClusters, clusters );
1686 /* another retarded hack, storing nudge count in luxel[ 1 ] */
1688 @@ -533,14 +625,14 @@
\r
1689 for( i = 0; i < 3; i++ )
1691 /* set nudged point*/
1692 - nudged[ i ] = origin[ i ] + (nudge[ 0 ] * vecs[ 0 ][ i ]) + (nudge[ 1 ] * vecs[ 1 ][ i ]);
1693 + nudged[ i ] = origintwo[ i ] + (nudge[ 0 ] * vecs[ 0 ][ i ]) + (nudge[ 1 ] * vecs[ 1 ][ i ]);
1697 /* get pvs cluster */
1698 pointCluster = ClusterForPointExtFilter( nudged, LUXEL_EPSILON, numClusters, clusters ); //% + 0.625 );
1699 - if( pointCluster >= 0 )
1700 - VectorCopy( nudged, origin );
1701 + //if( pointCluster >= 0 )
1702 + // VectorCopy( nudged, origin );
1706 @@ -550,8 +642,8 @@
\r
1708 VectorMA( dv->xyz, lightmapSampleOffset, dv->normal, nudged );
1709 pointCluster = ClusterForPointExtFilter( nudged, LUXEL_EPSILON, numClusters, clusters );
1710 - if( pointCluster >= 0 )
1711 - VectorCopy( nudged, origin );
1712 + //if( pointCluster >= 0 )
1713 + // VectorCopy( nudged, origin );
1717 @@ -597,7 +689,7 @@
\r
1718 than the distance between two luxels (thanks jc :)
1721 -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 ] )
1722 +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 ] )
1724 bspDrawVert_t mid, *dv2[ 3 ];
1726 @@ -645,7 +737,7 @@
\r
1728 /* split the longest edge and map it */
1729 LerpDrawVert( dv[ max ], dv[ (max + 1) % 3 ], &mid );
1730 - MapSingleLuxel( lm, info, &mid, plane, 1, stv, ttv );
1731 + MapSingleLuxel( lm, info, &mid, plane, 1, stv, ttv, worldverts );
1733 /* push the point up a little bit to account for fp creep (fixme: revisit this) */
1734 //% VectorMA( mid.xyz, 2.0f, mid.normal, mid.xyz );
1735 @@ -653,12 +745,12 @@
\r
1736 /* recurse to first triangle */
1737 VectorCopy( dv, dv2 );
1739 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1740 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1742 /* recurse to second triangle */
1743 VectorCopy( dv, dv2 );
1744 dv2[ (max + 1) % 3 ] = ∣
1745 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1746 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1750 @@ -674,8 +766,8 @@
\r
1753 vec3_t *stv, *ttv, stvStatic[ 3 ], ttvStatic[ 3 ];
1754 + vec3_t worldverts[ 3 ];
1757 /* get plane if possible */
1758 if( lm->plane != NULL )
1760 @@ -699,16 +791,20 @@
\r
1764 + VectorCopy( dv[ 0 ]->xyz, worldverts[ 0 ] );
1765 + VectorCopy( dv[ 1 ]->xyz, worldverts[ 1 ] );
1766 + VectorCopy( dv[ 2 ]->xyz, worldverts[ 2 ] );
1768 /* map the vertexes */
1769 - MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv );
1770 - MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv );
1771 - MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv );
1772 + MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv, worldverts );
1773 + MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv, worldverts );
1774 + MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv, worldverts );
1776 /* 2002-11-20: prefer axial triangle edges */
1779 /* subdivide the triangle */
1780 - MapTriangle_r( lm, info, dv, plane, stv, ttv );
1781 + MapTriangle_r( lm, info, dv, plane, stv, ttv, worldverts );
1785 @@ -730,7 +826,7 @@
\r
1786 dv2[ 2 ] = dv[ (i + 1) % 3 ];
1788 /* map the degenerate triangle */
1789 - MapTriangle_r( lm, info, dv2, plane, stv, ttv );
1790 + MapTriangle_r( lm, info, dv2, plane, stv, ttv, worldverts );
1794 @@ -792,8 +888,8 @@
\r
1795 LerpDrawVert( dv[ max + 2 ], dv[ (max + 3) % 4 ], &mid[ 1 ] );
1797 /* map the vertexes */
1798 - MapSingleLuxel( lm, info, &mid[ 0 ], plane, 1, stv, ttv );
1799 - MapSingleLuxel( lm, info, &mid[ 1 ], plane, 1, stv, ttv );
1800 + MapSingleLuxel( lm, info, &mid[ 0 ], plane, 1, stv, ttv, NULL );
1801 + MapSingleLuxel( lm, info, &mid[ 1 ], plane, 1, stv, ttv, NULL );
1805 @@ -848,7 +944,6 @@
\r
1807 vec3_t *stv, *ttv, stvStatic[ 4 ], ttvStatic[ 4 ];
1810 /* get plane if possible */
1811 if( lm->plane != NULL )
1813 @@ -878,18 +973,16 @@
\r
1816 /* map the vertexes */
1817 - MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv );
1818 - MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv );
1819 - MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv );
1820 - MapSingleLuxel( lm, info, dv[ 3 ], plane, 1, stv, ttv );
1821 + MapSingleLuxel( lm, info, dv[ 0 ], plane, 1, stv, ttv, NULL );
1822 + MapSingleLuxel( lm, info, dv[ 1 ], plane, 1, stv, ttv, NULL );
1823 + MapSingleLuxel( lm, info, dv[ 2 ], plane, 1, stv, ttv, NULL );
1824 + MapSingleLuxel( lm, info, dv[ 3 ], plane, 1, stv, ttv, NULL );
1826 /* subdivide the quad */
1827 MapQuad_r( lm, info, dv, plane, stv, ttv );
1835 maps the locations, normals, and pvs clusters for a raw lightmap
1836 @@ -941,7 +1034,7 @@
\r
1837 num = lightSurfaces[ lm->firstLightSurface + n ];
1838 ds = &bspDrawSurfaces[ num ];
1839 info = &surfaceInfos[ num ];
1842 /* bail if no lightmap to calculate */
1843 if( info->lm != lm )
1845 @@ -1173,7 +1266,7 @@
\r
1848 /* map the fake vert */
1849 - MapSingleLuxel( lm, NULL, &fake, lm->plane, pass, NULL, NULL );
1850 + MapSingleLuxel( lm, NULL, &fake, lm->plane, pass, NULL, NULL, NULL );
1854 @@ -1596,7 +1689,6 @@
\r
1856 VectorSubtract( origin2, origin, originVecs[ 0 ] );
1857 //% VectorSubtract( normal2, normal, normalVecs[ 0 ] );
1859 /* calulate y vector */
1860 if( (y < (lm->sh - 1) && bx >= 0.0f) || (y == 0 && bx <= 0.0f) )
1862 @@ -1660,7 +1752,6 @@
\r
1863 float biasDirs[ 4 ][ 2 ] = { { -1.0f, -1.0f }, { 1.0f, -1.0f }, { -1.0f, 1.0f }, { 1.0f, 1.0f } };
1864 vec3_t color, total;
1868 if( lightLuxel[ 3 ] >= lightSamples )
1870 @@ -1693,7 +1784,6 @@
\r
1871 VectorCopy( normal[ b ], trace->normal );
1875 LightContributionToSample( trace );
1877 /* add to totals (fixme: make contrast function) */
1878 @@ -1768,7 +1858,6 @@
\r
1880 float stackLightLuxels[ STACK_LL_SIZE ];
1883 /* bail if this number exceeds the number of raw lightmaps */
1884 if( rawLightmapNum >= numRawLightmaps )
1886 @@ -1904,7 +1993,7 @@
\r
1889 VectorCopy( ambientColor, luxel );
1892 VectorScale( normal, 0.00390625f, deluxel );
1895 @@ -1963,28 +2052,39 @@
\r
1896 deluxel = SUPER_DELUXEL( x, y );
1897 origin = SUPER_ORIGIN( x, y );
1898 normal = SUPER_NORMAL( x, y );
1900 - /* set contribution count */
1901 - lightLuxel[ 3 ] = 1.0f;
1904 - trace.cluster = *cluster;
1905 - VectorCopy( origin, trace.origin );
1906 - VectorCopy( normal, trace.normal );
1908 - /* get light for this sample */
1909 - LightContributionToSample( &trace );
1910 - VectorCopy( trace.color, lightLuxel );
1912 - /* add to count */
1913 - if( trace.color[ 0 ] || trace.color[ 1 ] || trace.color[ 2 ] )
1915 + ////////// 27's temp hack for testing edge clipping ////
1916 + if( origin[0]==0 && origin[1]==0 && origin[2]==0 )
1918 + lightLuxel[ 1 ] = 255;
1919 + lightLuxel[ 3 ] = 1.0f;
1924 + /* set contribution count */
1925 + lightLuxel[ 3 ] = 1.0f;
1928 + trace.cluster = *cluster;
1929 + VectorCopy( origin, trace.origin );
1930 + VectorCopy( normal, trace.normal );
1932 + /* get light for this sample */
1933 + LightContributionToSample( &trace );
1934 + VectorCopy( trace.color, lightLuxel );
1936 + /* add to count */
1937 + if( trace.color[ 0 ] || trace.color[ 1 ] || trace.color[ 2 ] )
1941 /* add to light direction map (fixme: use luxel normal as starting point for deluxel?) */
1944 + /* vortex: use noShadow color */
1945 /* color to grayscale (photoshop rgb weighting) */
1946 - brightness = trace.color[ 0 ] * 0.3f + trace.color[ 1 ] * 0.59f + trace.color[ 2 ] * 0.11f;
1947 + brightness = trace.colorNoShadow[ 0 ] * 0.3f + trace.colorNoShadow[ 1 ] * 0.59f + trace.colorNoShadow[ 2 ] * 0.11f;
1948 brightness *= (1.0 / 255.0);
1949 VectorScale( trace.direction, brightness, trace.direction );
1950 VectorAdd( deluxel, trace.direction, deluxel );
1951 @@ -2222,6 +2322,38 @@
\r
1952 /* free light list */
1953 FreeTraceLights( &trace );
1955 + /* floodlight pass */
1956 + FloodlightIlluminateLightmap(lm);
1960 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
1963 + if( lm->superLuxels[ lightmapNum ] == NULL )
1966 + for( y = 0; y < lm->sh; y++ )
1968 + for( x = 0; x < lm->sw; x++ )
1971 + cluster = SUPER_CLUSTER( x, y );
1972 + //% if( *cluster < 0 )
1975 + /* get particulars */
1976 + luxel = SUPER_LUXEL( lightmapNum, x, y );
1977 + normal = SUPER_NORMAL ( x, y );
1979 + luxel[0]=(normal[0]*127)+127;
1980 + luxel[1]=(normal[1]*127)+127;
1981 + luxel[2]=(normal[2]*127)+127;
1987 /* -----------------------------------------------------------------
1989 ----------------------------------------------------------------- */
1990 @@ -2263,7 +2395,7 @@
\r
1991 /* -----------------------------------------------------------------
1993 ----------------------------------------------------------------- */
1996 /* walk lightmaps */
1997 for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
1999 @@ -3112,7 +3244,7 @@
\r
2000 int i, x, y, z, x1, y1, z1;
2001 light_t *light, *light2, **owner;
2003 - vec3_t origin, dir, mins, maxs, nullVector = { 0, 0, 0 };
2004 + vec3_t origin, dir, mins, maxs;
2005 float radius, intensity;
2006 light_t *buckets[ 256 ];
2008 @@ -3587,7 +3719,430 @@
\r
2009 CreateTraceLightsForBounds( mins, maxs, normal, info->numSurfaceClusters, &surfaceClusters[ info->firstSurfaceCluster ], LIGHT_SURFACES, trace );
2012 +/////////////////////////////////////////////////////////////
2014 +#define FLOODLIGHT_CONE_ANGLE 88 /* degrees */
2015 +#define FLOODLIGHT_NUM_ANGLE_STEPS 16
2016 +#define FLOODLIGHT_NUM_ELEVATION_STEPS 4
2017 +#define FLOODLIGHT_NUM_VECTORS (FLOODLIGHT_NUM_ANGLE_STEPS * FLOODLIGHT_NUM_ELEVATION_STEPS)
2019 +static vec3_t floodVectors[ FLOODLIGHT_NUM_VECTORS ];
2020 +static int numFloodVectors = 0;
2022 +void SetupFloodLight( void )
2025 + float angle, elevation, angleStep, elevationStep;
2026 + const char *value;
2027 + double v1,v2,v3,v4,v5;
2030 + Sys_FPrintf( SYS_VRB, "--- SetupFloodLight ---\n" );
2032 + /* calculate angular steps */
2033 + angleStep = DEG2RAD( 360.0f / FLOODLIGHT_NUM_ANGLE_STEPS );
2034 + elevationStep = DEG2RAD( FLOODLIGHT_CONE_ANGLE / FLOODLIGHT_NUM_ELEVATION_STEPS );
2036 + /* iterate angle */
2038 + for( i = 0, angle = 0.0f; i < FLOODLIGHT_NUM_ANGLE_STEPS; i++, angle += angleStep )
2040 + /* iterate elevation */
2041 + for( j = 0, elevation = elevationStep * 0.5f; j < FLOODLIGHT_NUM_ELEVATION_STEPS; j++, elevation += elevationStep )
2043 + floodVectors[ numFloodVectors ][ 0 ] = sin( elevation ) * cos( angle );
2044 + floodVectors[ numFloodVectors ][ 1 ] = sin( elevation ) * sin( angle );
2045 + floodVectors[ numFloodVectors ][ 2 ] = cos( elevation );
2046 + numFloodVectors++;
2050 + /* emit some statistics */
2051 + Sys_FPrintf( SYS_VRB, "%9d numFloodVectors\n", numFloodVectors );
2054 + value = ValueForKey( &entities[ 0 ], "_floodlight" );
2056 + if( value[ 0 ] != '\0' )
2059 + v4=floodlightDistance;
2060 + v5=floodlightIntensity;
2062 + sscanf( value, "%lf %lf %lf %lf %lf", &v1, &v2, &v3, &v4, &v5);
2064 + floodlightRGB[0]=v1;
2065 + floodlightRGB[1]=v2;
2066 + floodlightRGB[2]=v3;
2068 + if (VectorLength(floodlightRGB)==0)
2070 + VectorSet(floodlightRGB,240,240,255);
2073 + if (v4<1) v4=1024;
2076 + floodlightDistance = v4;
2077 + floodlightIntensity = v5;
2079 + floodlighty = qtrue;
2080 + Sys_Printf( "FloodLighting enabled via worldspawn _floodlight key.\n" );
2084 + VectorSet(floodlightRGB,240,240,255);
2085 + //floodlighty = qtrue;
2086 + //Sys_Printf( "FloodLighting enabled via worldspawn _floodlight key.\n" );
2088 + VectorNormalize(floodlightRGB,floodlightRGB);
2092 +FloodLightForSample()
2093 +calculates floodlight value for a given sample
2094 +once again, kudos to the dirtmapping coder
2097 +float FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality)
2101 + float contribution;
2103 + float gatherLight, outLight;
2104 + vec3_t normal, worldUp, myUp, myRt, direction, displacement;
2112 + if( trace == NULL || trace->cluster < 0 )
2117 + dd = floodLightDistance;
2118 + VectorCopy( trace->normal, normal );
2120 + /* check if the normal is aligned to the world-up */
2121 + if( normal[ 0 ] == 0.0f && normal[ 1 ] == 0.0f )
2123 + if( normal[ 2 ] == 1.0f )
2125 + VectorSet( myRt, 1.0f, 0.0f, 0.0f );
2126 + VectorSet( myUp, 0.0f, 1.0f, 0.0f );
2128 + else if( normal[ 2 ] == -1.0f )
2130 + VectorSet( myRt, -1.0f, 0.0f, 0.0f );
2131 + VectorSet( myUp, 0.0f, 1.0f, 0.0f );
2136 + VectorSet( worldUp, 0.0f, 0.0f, 1.0f );
2137 + CrossProduct( normal, worldUp, myRt );
2138 + VectorNormalize( myRt, myRt );
2139 + CrossProduct( myRt, normal, myUp );
2140 + VectorNormalize( myUp, myUp );
2143 + /* vortex: optimise floodLightLowQuality a bit */
2144 + if ( floodLightLowQuality == qtrue )
2146 + /* iterate through ordered vectors */
2147 + for( i = 0; i < numFloodVectors; i++ )
2148 + if (rand()%10 != 0 ) continue;
2152 + /* iterate through ordered vectors */
2153 + for( i = 0; i < numFloodVectors; i++ )
2157 + /* transform vector into tangent space */
2158 + direction[ 0 ] = myRt[ 0 ] * floodVectors[ i ][ 0 ] + myUp[ 0 ] * floodVectors[ i ][ 1 ] + normal[ 0 ] * floodVectors[ i ][ 2 ];
2159 + direction[ 1 ] = myRt[ 1 ] * floodVectors[ i ][ 0 ] + myUp[ 1 ] * floodVectors[ i ][ 1 ] + normal[ 1 ] * floodVectors[ i ][ 2 ];
2160 + direction[ 2 ] = myRt[ 2 ] * floodVectors[ i ][ 0 ] + myUp[ 2 ] * floodVectors[ i ][ 1 ] + normal[ 2 ] * floodVectors[ i ][ 2 ];
2162 + /* set endpoint */
2163 + VectorMA( trace->origin, dd, direction, trace->end );
2165 + //VectorMA( trace->origin, 1, direction, trace->origin );
2167 + SetupTrace( trace );
2169 + TraceLine( trace );
2172 + if (trace->compileFlags & C_SKY )
2174 + contribution=1.0f;
2176 + else if ( trace->opaque )
2178 + VectorSubtract( trace->hit, trace->origin, displacement );
2179 + d=VectorLength( displacement );
2181 + // d=trace->distance;
2182 + //if (d>256) gatherDirt+=1;
2183 + contribution=d/dd;
2184 + if (contribution>1) contribution=1.0f;
2186 + //gatherDirt += 1.0f - ooDepth * VectorLength( displacement );
2189 + gatherLight+=contribution;
2194 + if( gatherLight <= 0.0f )
2200 + gatherLight/=(sub);
2202 + outLight=gatherLight;
2203 + if( outLight > 1.0f )
2206 + /* return to sender */
2211 +FloodLightRawLightmap
2212 +lighttracer style ambient occlusion light hack.
2213 +Kudos to the dirtmapping author for most of this source.
2214 +VorteX: modified to floodlight up custom surfaces (q3map_floodLight)
2215 +VorteX: fixed problems with deluxemapping
2218 +// floodlight pass on a lightmap
2219 +void FloodLightRawLightmapPass( rawLightmap_t *lm , vec3_t lmFloodLightRGB, float lmFloodLightIntensity, float lmFloodLightDistance, qboolean lmFloodLightLowQuality, float floodlightDirectionScale)
2221 + int i, x, y, *cluster;
2222 + float *origin, *normal, *floodlight, floodLightAmount;
2223 + surfaceInfo_t *info;
2226 + // float samples, average, *floodlight2;
2228 + memset(&trace,0,sizeof(trace_t));
2231 + trace.testOcclusion = qtrue;
2232 + trace.forceSunlight = qfalse;
2233 + trace.twoSided = qtrue;
2234 + trace.recvShadows = lm->recvShadows;
2235 + trace.numSurfaces = lm->numLightSurfaces;
2236 + trace.surfaces = &lightSurfaces[ lm->firstLightSurface ];
2237 + trace.inhibitRadius = DEFAULT_INHIBIT_RADIUS;
2238 + trace.testAll = qfalse;
2239 + trace.distance = 1024;
2241 + /* twosided lighting (may or may not be a good idea for lightmapped stuff) */
2242 + //trace.twoSided = qfalse;
2243 + for( i = 0; i < trace.numSurfaces; i++ )
2246 + info = &surfaceInfos[ trace.surfaces[ i ] ];
2248 + /* check twosidedness */
2249 + if( info->si->twoSided )
2251 + trace.twoSided = qtrue;
2256 + /* gather floodlight */
2257 + for( y = 0; y < lm->sh; y++ )
2259 + for( x = 0; x < lm->sw; x++ )
2262 + cluster = SUPER_CLUSTER( x, y );
2263 + origin = SUPER_ORIGIN( x, y );
2264 + normal = SUPER_NORMAL( x, y );
2265 + floodlight = SUPER_FLOODLIGHT( x, y );
2267 + /* set default dirt */
2268 + *floodlight = 0.0f;
2270 + /* only look at mapped luxels */
2271 + if( *cluster < 0 )
2274 + /* copy to trace */
2275 + trace.cluster = *cluster;
2276 + VectorCopy( origin, trace.origin );
2277 + VectorCopy( normal, trace.normal );
2279 + /* get floodlight */
2280 + floodLightAmount = FloodLightForSample( &trace , lmFloodLightDistance, lmFloodLightLowQuality)*lmFloodLightIntensity;
2282 + /* add floodlight */
2283 + floodlight[0] += lmFloodLightRGB[0]*floodLightAmount;
2284 + floodlight[1] += lmFloodLightRGB[1]*floodLightAmount;
2285 + floodlight[2] += lmFloodLightRGB[2]*floodLightAmount;
2286 + floodlight[3] += floodlightDirectionScale;
2290 + /* testing no filtering */
2295 + /* filter "dirt" */
2296 + for( y = 0; y < lm->sh; y++ )
2298 + for( x = 0; x < lm->sw; x++ )
2301 + cluster = SUPER_CLUSTER( x, y );
2302 + floodlight = SUPER_FLOODLIGHT(x, y );
2304 + /* filter dirt by adjacency to unmapped luxels */
2305 + average = *floodlight;
2307 + for( sy = (y - 1); sy <= (y + 1); sy++ )
2309 + if( sy < 0 || sy >= lm->sh )
2312 + for( sx = (x - 1); sx <= (x + 1); sx++ )
2314 + if( sx < 0 || sx >= lm->sw || (sx == x && sy == y) )
2317 + /* get neighboring luxel */
2318 + cluster = SUPER_CLUSTER( sx, sy );
2319 + floodlight2 = SUPER_FLOODLIGHT( sx, sy );
2320 + if( *cluster < 0 || *floodlight2 <= 0.0f )
2324 + average += *floodlight2;
2329 + if( samples <= 0.0f )
2334 + if( samples <= 0.0f )
2338 + *floodlight = average / samples;
2344 +void FloodLightRawLightmap( int rawLightmapNum )
2346 + rawLightmap_t *lm;
2348 + /* bail if this number exceeds the number of raw lightmaps */
2349 + if( rawLightmapNum >= numRawLightmaps )
2351 + /* get lightmap */
2352 + lm = &rawLightmaps[ rawLightmapNum ];
2355 + if (floodlighty && floodlightIntensity)
2356 + FloodLightRawLightmapPass(lm, floodlightRGB, floodlightIntensity, floodlightDistance, floodlight_lowquality, 0);
2359 + if (lm->floodlightIntensity)
2361 + FloodLightRawLightmapPass(lm, lm->floodlightRGB, lm->floodlightIntensity, lm->floodlightDistance, qfalse, lm->floodlightDirectionScale);
2362 + numSurfacesFloodlighten += 1;
2366 +void FloodlightRawLightmaps()
2368 + Sys_Printf( "--- FloodlightRawLightmap ---\n" );
2369 + numSurfacesFloodlighten = 0;
2370 + RunThreadsOnIndividual( numRawLightmaps, qtrue, FloodLightRawLightmap );
2371 + Sys_Printf( "%9d custom lightmaps floodlighted\n", numSurfacesFloodlighten );
2375 +FloodLightIlluminate()
2376 +illuminate floodlight into lightmap luxels
2379 +void FloodlightIlluminateLightmap( rawLightmap_t *lm )
2381 + float *luxel, *floodlight, *deluxel, *normal;
2384 + vec3_t lightvector;
2385 + int x, y, lightmapNum;
2387 + /* walk lightmaps */
2388 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
2391 + if( lm->superLuxels[ lightmapNum ] == NULL )
2394 + /* apply floodlight to each luxel */
2395 + for( y = 0; y < lm->sh; y++ )
2397 + for( x = 0; x < lm->sw; x++ )
2399 + /* get floodlight */
2400 + floodlight = SUPER_FLOODLIGHT( x, y );
2401 + if (!floodlight[0] && !floodlight[1] && !floodlight[2])
2405 + cluster = SUPER_CLUSTER( x, y );
2407 + /* only process mapped luxels */
2408 + if( *cluster < 0 )
2411 + /* get particulars */
2412 + luxel = SUPER_LUXEL( lightmapNum, x, y );
2413 + deluxel = SUPER_DELUXEL( x, y );
2415 + /* add to lightmap */
2416 + luxel[0]+=floodlight[0];
2417 + luxel[1]+=floodlight[1];
2418 + luxel[2]+=floodlight[2];
2420 + if (luxel[3]==0) luxel[3]=1;
2422 + /* add to deluxemap */
2423 + if (deluxemap && floodlight[3] > 0)
2425 + normal = SUPER_NORMAL( x, y );
2426 + brightness = floodlight[ 0 ] * 0.3f + floodlight[ 1 ] * 0.59f + floodlight[ 2 ] * 0.11f;
2427 + brightness *= ( 1.0f / 255.0f ) * floodlight[3];
2428 + VectorScale( normal, brightness, lightvector );
2429 + VectorAdd( deluxel, lightvector, deluxel );
2439 Index: lightmaps_ydnar.c
\r
2440 ===================================================================
\r
2441 --- lightmaps_ydnar.c (revision 158)
\r
2442 +++ lightmaps_ydnar.c (working copy)
\r
2443 @@ -414,6 +414,12 @@
\r
2444 lm->superNormals = safe_malloc( size );
2445 memset( lm->superNormals, 0, size );
2447 + /* allocate floodlight map storage */
2448 + size = lm->sw * lm->sh * SUPER_FLOODLIGHT_SIZE * sizeof( float );
2449 + if( lm->superFloodLight == NULL )
2450 + lm->superFloodLight = safe_malloc( size );
2451 + memset( lm->superFloodLight, 0, size );
2453 /* allocate cluster map storage */
2454 size = lm->sw * lm->sh * sizeof( int );
2455 if( lm->superClusters == NULL )
2456 @@ -1087,17 +1093,25 @@
\r
2457 /* allocate a new raw lightmap */
2458 lm = &rawLightmaps[ numRawLightmaps ];
2463 lm->splotchFix = info->si->splotchFix;
2464 lm->firstLightSurface = numLightSurfaces;
2465 lm->numLightSurfaces = 0;
2466 - lm->sampleSize = info->sampleSize;
2467 - lm->actualSampleSize = info->sampleSize;
2468 + /* vortex: multiply lightmap sample size by -samplescale */
2469 + if (sampleScale > 0)
2470 + lm->sampleSize = info->sampleSize*sampleScale;
2472 + lm->sampleSize = info->sampleSize;
2473 + lm->actualSampleSize = lm->sampleSize;
2474 lm->entityNum = info->entityNum;
2475 lm->recvShadows = info->recvShadows;
2476 lm->brightness = info->si->lmBrightness;
2477 lm->filterRadius = info->si->lmFilterRadius;
2478 + VectorCopy(info->si->floodlightRGB, lm->floodlightRGB);
2479 + lm->floodlightDistance = info->si->floodlightDistance;
2480 + lm->floodlightIntensity = info->si->floodlightIntensity;
2481 + lm->floodlightDirectionScale = info->si->floodlightDirectionScale;
2482 VectorCopy( info->axis, lm->axis );
2483 lm->plane = info->plane;
2484 VectorCopy( info->mins, lm->mins );
2485 @@ -2254,7 +2268,6 @@
\r
2486 char *rgbGenValues[ 256 ];
2487 char *alphaGenValues[ 256 ];
2491 Sys_Printf( "--- StoreSurfaceLightmaps ---\n");
2493 @@ -2269,7 +2282,7 @@
\r
2494 ----------------------------------------------------------------- */
2497 - Sys_FPrintf( SYS_VRB, "Subsampling..." );
2498 + Sys_Printf( "Subsampling..." );
2500 /* walk the list of raw lightmaps */
2502 @@ -2437,11 +2450,11 @@
\r
2504 luxel = SUPER_LUXEL( lightmapNum, x, y );
2505 deluxel = SUPER_DELUXEL( x, y );
2508 /* copy light direction */
2509 if( deluxemap && lightmapNum == 0 )
2510 VectorCopy( deluxel, dirSample );
2513 /* is this a valid sample? */
2514 if( luxel[ 3 ] > 0.0f )
2516 @@ -2521,7 +2534,7 @@
\r
2517 /* store the sample in the bsp luxels */
2518 bspLuxel = BSP_LUXEL( lightmapNum, x, y );
2519 bspDeluxel = BSP_DELUXEL( x, y );
2522 VectorAdd( bspLuxel, sample, bspLuxel );
2523 if( deluxemap && lightmapNum == 0 )
2524 VectorAdd( bspDeluxel, dirSample, bspDeluxel );
2525 @@ -2562,7 +2575,7 @@
\r
2531 /* wrap bsp luxels if necessary */
2534 @@ -2604,15 +2617,144 @@
\r
2540 /* -----------------------------------------------------------------
2541 + convert modelspace deluxemaps to tangentspace
2542 + ----------------------------------------------------------------- */
2546 + if( deluxemap && deluxemode == 1)
2548 + vec3_t worldUp, myNormal, myTangent, myBinormal;
2551 + Sys_Printf( "converting..." );
2553 + for( i = 0; i < numRawLightmaps; i++ )
2555 + /* get lightmap */
2556 + lm = &rawLightmaps[ i ];
2558 + /* walk lightmap samples */
2559 + for( y = 0; y < lm->sh; y++ )
2561 + for( x = 0; x < lm->sw; x++ )
2563 + /* get normal and deluxel */
2564 + normal = SUPER_NORMAL(x, y);
2565 + cluster = SUPER_CLUSTER(x, y);
2566 + bspDeluxel = BSP_DELUXEL( x, y );
2567 + deluxel = SUPER_DELUXEL( x, y );
2570 + VectorSet( myNormal, normal[0], normal[1], normal[2] );
2572 + /* get tangent vectors */
2573 + if( myNormal[ 0 ] == 0.0f && myNormal[ 1 ] == 0.0f )
2575 + if( myNormal[ 2 ] == 1.0f )
2577 + VectorSet( myTangent, 1.0f, 0.0f, 0.0f );
2578 + VectorSet( myBinormal, 0.0f, 1.0f, 0.0f );
2580 + else if( myNormal[ 2 ] == -1.0f )
2582 + VectorSet( myTangent, -1.0f, 0.0f, 0.0f );
2583 + VectorSet( myBinormal, 0.0f, 1.0f, 0.0f );
2588 + VectorSet( worldUp, 0.0f, 0.0f, 1.0f );
2589 + CrossProduct( myNormal, worldUp, myTangent );
2590 + VectorNormalize( myTangent, myTangent );
2591 + CrossProduct( myTangent, myNormal, myBinormal );
2592 + VectorNormalize( myBinormal, myBinormal );
2595 + /* project onto plane */
2596 + dist = -DotProduct(myTangent, myNormal);
2597 + VectorMA(myTangent, dist, myNormal, myTangent);
2598 + dist = -DotProduct(myBinormal, myNormal);
2599 + VectorMA(myBinormal, dist, myNormal, myBinormal);
2602 + VectorNormalize( myTangent, myTangent );
2603 + VectorNormalize( myBinormal, myBinormal );
2605 + /* convert modelspace deluxel to tangentspace */
2606 + dirSample[0] = bspDeluxel[0];
2607 + dirSample[1] = bspDeluxel[1];
2608 + dirSample[2] = bspDeluxel[2];
2609 + VectorNormalize(dirSample, dirSample);
2611 + /* fix tangents to world matrix */
2612 + if (myNormal[0] > 0 || myNormal[1] < 0 || myNormal[2] < 0)
2613 + VectorNegate(myTangent, myTangent);
2615 + /* build tangentspace vectors */
2616 + bspDeluxel[0] = DotProduct(dirSample, myTangent);
2617 + bspDeluxel[1] = DotProduct(dirSample, myBinormal);
2618 + bspDeluxel[2] = DotProduct(dirSample, myNormal);
2625 + /* -----------------------------------------------------------------
2627 + ----------------------------------------------------------------- */
2629 +#ifdef sdfsdfwq312323
2631 + Sys_Printf( "blending..." );
2633 + for( i = 0; i < numRawLightmaps; i++ )
2636 + float myBrightness;
2638 + /* get lightmap */
2639 + lm = &rawLightmaps[ i ];
2641 + /* walk individual lightmaps */
2642 + for( lightmapNum = 0; lightmapNum < MAX_LIGHTMAPS; lightmapNum++ )
2645 + if( lm->superLuxels[ lightmapNum ] == NULL )
2648 + /* walk lightmap samples */
2649 + for( y = 0; y < lm->sh; y++ )
2651 + for( x = 0; x < lm->sw; x++ )
2654 + bspLuxel = BSP_LUXEL( lightmapNum, x, y );
2657 + VectorNormalize(bspLuxel, myColor);
2658 + myBrightness = VectorLength(bspLuxel);
2659 + myBrightness *= (1 / 127.0f);
2660 + myBrightness = myBrightness*myBrightness;
2661 + myBrightness *= 127.0f;
2662 + VectorScale(myColor, myBrightness, bspLuxel);
2669 + /* -----------------------------------------------------------------
2670 collapse non-unique lightmaps
2671 ----------------------------------------------------------------- */
2673 if( noCollapse == qfalse && deluxemap == qfalse )
2676 - Sys_FPrintf( SYS_VRB, "collapsing..." );
2677 + Sys_Printf( "collapsing..." );
2679 /* set all twin refs to null */
2680 for( i = 0; i < numRawLightmaps; i++ )
2681 @@ -2674,13 +2816,13 @@
\r
2687 /* -----------------------------------------------------------------
2688 sort raw lightmaps by shader
2689 ----------------------------------------------------------------- */
2692 - Sys_FPrintf( SYS_VRB, "sorting..." );
2693 + Sys_Printf( "sorting..." );
2695 /* allocate a new sorted list */
2696 if( sortLightmaps == NULL )
2697 @@ -2696,7 +2838,7 @@
\r
2698 ----------------------------------------------------------------- */
2701 - Sys_FPrintf( SYS_VRB, "allocating..." );
2702 + Sys_Printf( "allocating..." );
2704 /* kill all existing output lightmaps */
2705 if( outLightmaps != NULL )
2706 @@ -2749,7 +2891,7 @@
\r
2707 ----------------------------------------------------------------- */
2710 - Sys_FPrintf( SYS_VRB, "storing..." );
2711 + Sys_Printf( "storing..." );
2713 /* count the bsp lightmaps and allocate space */
2714 if( bspLightBytes != NULL )
2715 @@ -2817,7 +2959,7 @@
\r
2718 if( numExtLightmaps > 0 )
2719 - Sys_FPrintf( SYS_VRB, "\n" );
2720 + Sys_Printf( SYS_VRB, "\n" );
2722 /* delete unused external lightmaps */
2723 for( i = numExtLightmaps; i; i++ )
2724 @@ -2836,7 +2978,7 @@
\r
2725 ----------------------------------------------------------------- */
2728 - Sys_FPrintf( SYS_VRB, "projecting..." );
2729 + Sys_Printf( "projecting..." );
2731 /* walk the list of surfaces */
2732 for( i = 0; i < numBSPDrawSurfaces; i++ )
2733 @@ -3108,7 +3250,7 @@
\r
2737 - Sys_FPrintf( SYS_VRB, "done.\n" );
2738 + Sys_Printf( "done.\n" );
2740 /* calc num stored */
2741 numStored = numBSPLightBytes / 3;
2743 ===================================================================
\r
2744 --- main.c (revision 158)
\r
2745 +++ main.c (working copy)
\r
2746 @@ -604,7 +604,7 @@
\r
2749 atexit( ExitQ3Map );
2752 /* read general options first */
2753 for( i = 1; i < argc; i++ )
2755 @@ -680,6 +680,10 @@
\r
2757 /* ydnar: new path initialization */
2758 InitPaths( &argc, argv );
2760 + /* set game options */
2761 + if (!patchSubdivisions)
2762 + patchSubdivisions = game->patchSubdivisions;
2764 /* check if we have enough options left to attempt something */
2767 ===================================================================
\r
2768 --- map.c (revision 158)
\r
2769 +++ map.c (working copy)
\r
2770 @@ -1515,14 +1515,18 @@
\r
2771 /* get explicit shadow flags */
2772 GetEntityShadowFlags( mapEnt, NULL, &castShadows, &recvShadows );
2774 + /* vortex: added _ls key (short name of lightmapscale) */
2775 /* ydnar: get lightmap scaling value for this entity */
2776 if( strcmp( "", ValueForKey( mapEnt, "lightmapscale" ) ) ||
2777 - strcmp( "", ValueForKey( mapEnt, "_lightmapscale" ) ) )
2778 + strcmp( "", ValueForKey( mapEnt, "_lightmapscale" ) ) ||
2779 + strcmp( "", ValueForKey( mapEnt, "_ls" ) ) )
2781 /* get lightmap scale from entity */
2782 lightmapScale = FloatForKey( mapEnt, "lightmapscale" );
2783 if( lightmapScale <= 0.0f )
2784 lightmapScale = FloatForKey( mapEnt, "_lightmapscale" );
2785 + if( lightmapScale <= 0.0f )
2786 + lightmapScale = FloatForKey( mapEnt, "_ls" );
2787 if( lightmapScale > 0.0f )
2788 Sys_Printf( "Entity %d (%s) has lightmap scale of %.4f\n", mapEnt->mapEntityNum, classname, lightmapScale );
2791 ===================================================================
\r
2792 --- mesh.c (revision 158)
\r
2793 +++ mesh.c (working copy)
\r
2794 @@ -563,7 +563,7 @@
\r
2798 - for( iterations; iterations > 0; iterations-- )
2799 + for( ; iterations > 0; iterations-- )
2801 /* horizontal subdivisions */
2802 for( j = 0; j + 2 < out.width; j += 4 )
2804 ===================================================================
\r
2805 --- model.c (revision 158)
\r
2806 +++ model.c (working copy)
\r
2807 @@ -266,7 +266,7 @@
\r
2810 /* fix the surface's normals */
2811 - PicoFixSurfaceNormals( surface );
2812 + //PicoFixSurfaceNormals( surface );
2814 /* allocate a surface (ydnar: gs mods) */
2815 ds = AllocDrawSurface( SURFACE_TRIANGLES );
2816 @@ -521,7 +521,15 @@
\r
2822 + Sys_Printf( "WARNING: Model %s unable to generate brush - Case 1.\n", name );
2827 + Sys_Printf( "WARNING: Model %s unable to generate brush - Case 2.\n", name );
2832 @@ -566,8 +574,11 @@
\r
2835 /* get lightmap scale */
2836 + /* vortex: added _ls key (short name of lightmapscale) */
2837 baseLightmapScale = FloatForKey( e, "_lightmapscale" );
2838 if( baseLightmapScale <= 0.0f )
2839 + baseLightmapScale = FloatForKey( e, "_ls" );
2840 + if( baseLightmapScale <= 0.0f )
2841 baseLightmapScale = 0.0f;
2843 /* walk the entity list */
2844 @@ -688,8 +699,11 @@
\r
2847 /* get lightmap scale */
2848 + /* vortex: added _ls key (short name of lightmapscale) */
2849 lightmapScale = FloatForKey( e2, "_lightmapscale" );
2850 if( lightmapScale <= 0.0f )
2851 + lightmapScale = FloatForKey( e2, "_ls" );
2852 + if( lightmapScale <= 0.0f )
2853 lightmapScale = baseLightmapScale;
2855 /* insert the model */
2857 ===================================================================
\r
2858 --- patch.c (revision 158)
\r
2859 +++ patch.c (working copy)
\r
2860 @@ -227,7 +227,6 @@
\r
2868 Index: path_init.c
\r
2869 ===================================================================
\r
2870 --- path_init.c (revision 158)
\r
2871 +++ path_init.c (working copy)
\r
2872 @@ -383,7 +383,7 @@
\r
2873 /* remove processed arguments */
2874 for( i = 0, j = 0, k = 0; i < *argc && j < *argc; i++, j++ )
2876 - for( j; j < *argc && argv[ j ] == NULL; j++ );
2877 + for( ; j < *argc && argv[ j ] == NULL; j++ );
2878 argv[ i ] = argv[ j ];
2879 if( argv[ i ] != NULL )
2882 ===================================================================
\r
2883 --- q3map2.h (revision 158)
\r
2884 +++ q3map2.h (working copy)
\r
2889 -#define Q3MAP_VERSION "2.5.17"
2890 -#define Q3MAP_MOTD "Last one turns the lights off"
2891 +#define Q3MAP_VERSION "2.5.17 base : FS_20g base : R5"
2892 +#define Q3MAP_MOTD "Sorry, it doesn't match my furniture."
2896 @@ -235,6 +235,7 @@
\r
2897 #define LIGHT_FAST_TEMP 512
2898 #define LIGHT_FAST_ACTUAL (LIGHT_FAST | LIGHT_FAST_TEMP)
2899 #define LIGHT_NEGATIVE 1024
2900 +#define LIGHT_UNNORMALIZED 2048 /* vortex: do not normalize _color */
2902 #define LIGHT_SUN_DEFAULT (LIGHT_ATTEN_ANGLE | LIGHT_GRID | LIGHT_SURFACES)
2903 #define LIGHT_AREA_DEFAULT (LIGHT_ATTEN_ANGLE | LIGHT_ATTEN_DISTANCE | LIGHT_GRID | LIGHT_SURFACES) /* q3a and wolf are the same */
2904 @@ -267,6 +268,7 @@
\r
2905 #define SUPER_NORMAL_SIZE 4
2906 #define SUPER_DELUXEL_SIZE 3
2907 #define BSP_DELUXEL_SIZE 3
2908 +#define SUPER_FLOODLIGHT_SIZE 4
2910 #define VERTEX_LUXEL( s, v ) (vertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
2911 #define RAD_VERTEX_LUXEL( s, v )(radVertexLuxels[ s ] + ((v) * VERTEX_LUXEL_SIZE))
2912 @@ -279,9 +281,8 @@
\r
2913 #define SUPER_ORIGIN( x, y ) (lm->superOrigins + ((((y) * lm->sw) + (x)) * SUPER_ORIGIN_SIZE))
2914 #define SUPER_NORMAL( x, y ) (lm->superNormals + ((((y) * lm->sw) + (x)) * SUPER_NORMAL_SIZE))
2915 #define SUPER_DIRT( x, y ) (lm->superNormals + ((((y) * lm->sw) + (x)) * SUPER_NORMAL_SIZE) + 3) /* stash dirtyness in normal[ 3 ] */
2916 +#define SUPER_FLOODLIGHT(x, y ) (lm->superFloodLight + ((((y) * lm->sw) + (x)) * SUPER_FLOODLIGHT_SIZE))
2920 /* -------------------------------------------------------------------------------
2923 @@ -543,7 +544,16 @@
\r
2924 qboolean wolfLight; /* when true, lights work like wolf q3map */
2925 int lightmapSize; /* bsp lightmap width/height */
2926 float lightmapGamma; /* default lightmap gamma */
2927 + float lightmapExposure; /* default lightmap exposure */
2928 float lightmapCompensate; /* default lightmap compensate value */
2929 + float gridScale; /* vortex: default lightgrid scale (affects both directional and ambient spectres) */
2930 + float gridAmbientScale; /* vortex: default lightgrid ambient spectre scale */
2931 + qboolean noStyles; /* use lightstyles hack or not */
2932 + qboolean keepLights; /* keep light entities on bsp */
2933 + int patchSubdivisions; /* default patch subdivisions tolerance */
2934 + qboolean patchShadows; /* patch casting enabled */
2935 + qboolean deluxeMap; /* compile deluxemaps */
2936 + int deluxeMode; /* deluxemap mode (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
2937 char *bspIdent; /* 4-letter bsp file prefix */
2938 int bspVersion; /* bsp version to use */
2939 qboolean lumpSwap; /* cod-style len/ofs order */
2940 @@ -662,6 +672,7 @@
\r
2941 char *backShader; /* for surfaces that generate different front and back passes */
2942 char *cloneShader; /* ydnar: for cloning of a surface */
2943 char *remapShader; /* ydnar: remap a shader in final stage */
2944 + char *deprecateShader; /* vortex: shader is deprecated and replaced by this on use */
2946 surfaceModel_t *surfaceModel; /* ydnar: for distribution of models */
2947 foliage_t *foliage; /* ydnar/splash damage: wolf et foliage */
2948 @@ -737,7 +748,13 @@
\r
2950 vec3_t color; /* normalized color */
2951 vec3_t averageColor;
2955 + /* vortex: per-surface floodlight */
2956 + float floodlightDirectionScale;
2957 + vec3_t floodlightRGB;
2958 + float floodlightIntensity;
2959 + float floodlightDistance;
2961 qb_t lmMergable; /* ydnar */
2962 int lmCustomWidth, lmCustomHeight; /* ydnar */
2963 @@ -1013,7 +1030,7 @@
\r
2965 int patchWidth, patchHeight;
2969 /* ydnar/sd: for foliage */
2970 int numFoliageInstances;
2972 @@ -1061,6 +1078,7 @@
\r
2973 int mapEntityNum, firstDrawSurf;
2974 int firstBrush, numBrushes; /* only valid during BSP compile */
2976 + qboolean forceNormalSmoothing; /* vortex: true if entity has _smoothnormals/_sn/_smooth key */
2980 @@ -1296,7 +1314,8 @@
\r
2982 /* input and output */
2983 vec3_t color; /* starts out at full color, may be reduced if transparent surfaces are crossed */
2985 + vec3_t colorNoShadow; /* result color with no shadow casting */
2989 int compileFlags; /* for determining surface compile flags traced through */
2990 @@ -1367,6 +1386,13 @@
\r
2991 int numLightClusters, *lightClusters;
2993 int sampleSize, actualSampleSize, axisNum;
2995 + /* vortex: per-surface floodlight */
2996 + float floodlightDirectionScale;
2997 + vec3_t floodlightRGB;
2998 + float floodlightIntensity;
2999 + float floodlightDistance;
3003 vec3_t mins, maxs, axis, origin, *vecs;
3004 @@ -1389,9 +1415,9 @@
\r
3005 float *superOrigins;
3006 float *superNormals;
3009 float *superDeluxels; /* average light direction */
3011 + float *superFloodLight; /* floodlight color */
3015 @@ -1421,8 +1447,6 @@
\r
3021 /* -------------------------------------------------------------------------------
3024 @@ -1556,6 +1580,7 @@
\r
3025 void ParsePatch( qboolean onlyLights );
3026 mesh_t *SubdivideMesh( mesh_t in, float maxError, float minLength );
3027 void PatchMapDrawSurfs( entity_t *e );
3028 +void TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds );
3032 @@ -1610,6 +1635,8 @@
\r
3033 void AddEntitySurfaceModels( entity_t *e );
3034 int AddSurfaceModels( mapDrawSurface_t *ds );
3035 void FilterDrawsurfsIntoTree( entity_t *e, tree_t *tree );
3036 +void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds );
3037 +static void EmitTriangleSurface( mapDrawSurface_t *ds );
3041 @@ -1627,6 +1654,7 @@
\r
3042 void FixMetaTJunctions( void );
3043 void SmoothMetaTriangles( void );
3044 void MergeMetaTriangles( void );
3045 +void EmitMetaStats(); // vortex: print meta statistics even in no-verbose mode
3048 /* surface_extra.c */
3049 @@ -1704,6 +1732,12 @@
\r
3050 float DirtForSample( trace_t *trace );
3051 void DirtyRawLightmap( int num );
3053 +void SetupFloodLight();
3054 +void FloodlightRawLightmaps();
3055 +void FloodlightIlluminateLightmap( rawLightmap_t *lm );
3056 +float FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean floodLightLowQuality);
3057 +void FloodLightRawLightmap( int num );
3059 void IlluminateRawLightmap( int num );
3060 void IlluminateVertexes( int num );
3062 @@ -1731,7 +1765,6 @@
\r
3063 void StitchSurfaceLightmaps( void );
3064 void StoreSurfaceLightmaps( void );
3068 void ImageFree( image_t *image );
3069 image_t *ImageFind( const char *filename );
3070 @@ -1783,6 +1816,7 @@
\r
3071 void UnparseEntities( void );
3072 void PrintEntity( const entity_t *ent );
3073 void SetKeyValue( entity_t *ent, const char *key, const char *value );
3074 +qboolean KeyExists( const entity_t *ent, const char *key ); /* VorteX: check if key exists */
3075 const char *ValueForKey( const entity_t *ent, const char *key );
3076 int IntForKey( const entity_t *ent, const char *key );
3077 vec_t FloatForKey( const entity_t *ent, const char *key );
3078 @@ -1845,6 +1879,12 @@
\r
3080 #include "game_qfusion.h" /* qfusion game */
3082 + #include "game_darkplaces.h" /* vortex: darkplaces q1 engine */
3084 + #include "game_dq.h" /* vortex: deluxe quake game ( darkplaces q1 engine) */
3086 + #include "game_prophecy.h" /* vortex: prophecy game ( darkplaces q1 engine) */
3088 { NULL } /* null game */
3091 @@ -1929,6 +1969,7 @@
\r
3092 Q_EXTERN char outbase[ 32 ];
3094 Q_EXTERN int sampleSize; /* lightmap sample size in units */
3095 +Q_EXTERN int sampleScale; /* vortex: lightmap sample scale (ie quality)*/
3097 Q_EXTERN int mapEntityNum Q_ASSIGN( 0 );
3099 @@ -2053,6 +2094,7 @@
\r
3100 Q_EXTERN qboolean wolfLight Q_ASSIGN( qfalse );
3101 Q_EXTERN qboolean loMem Q_ASSIGN( qfalse );
3102 Q_EXTERN qboolean noStyles Q_ASSIGN( qfalse );
3103 +Q_EXTERN qboolean keepLights Q_ASSIGN( qfalse );
3105 Q_EXTERN int sampleSize Q_ASSIGN( DEFAULT_LIGHTMAP_SAMPLE_SIZE );
3106 Q_EXTERN qboolean noVertexLighting Q_ASSIGN( qfalse );
3107 @@ -2065,6 +2107,7 @@
\r
3109 Q_EXTERN qboolean deluxemap Q_ASSIGN( qfalse );
3110 Q_EXTERN qboolean debugDeluxemap Q_ASSIGN( qfalse );
3111 +Q_EXTERN int deluxemode Q_ASSIGN( 0 ); /* deluxemap format (0 - modelspace, 1 - tangentspace with renormalization, 2 - tangentspace without renormalization) */
3113 Q_EXTERN qboolean fast Q_ASSIGN( qfalse );
3114 Q_EXTERN qboolean faster Q_ASSIGN( qfalse );
3115 @@ -2098,6 +2141,14 @@
\r
3116 Q_EXTERN float dirtScale Q_ASSIGN( 1.0f );
3117 Q_EXTERN float dirtGain Q_ASSIGN( 1.0f );
3119 +/* 27: floodlighting */
3120 +Q_EXTERN qboolean debugnormals Q_ASSIGN( qfalse );
3121 +Q_EXTERN qboolean floodlighty Q_ASSIGN( qfalse );
3122 +Q_EXTERN qboolean floodlight_lowquality Q_ASSIGN( qfalse );
3123 +Q_EXTERN vec3_t floodlightRGB;
3124 +Q_EXTERN float floodlightIntensity Q_ASSIGN( 512.0f );
3125 +Q_EXTERN float floodlightDistance Q_ASSIGN( 1024.0f );
3127 Q_EXTERN qboolean dump Q_ASSIGN( qfalse );
3128 Q_EXTERN qboolean debug Q_ASSIGN( qfalse );
3129 Q_EXTERN qboolean debugUnused Q_ASSIGN( qfalse );
3130 @@ -2115,9 +2166,14 @@
\r
3131 Q_EXTERN float skyScale Q_ASSIGN( 1.0f );
3132 Q_EXTERN float bounceScale Q_ASSIGN( 0.25f );
3134 +/* vortex: gridscale and gridambientscale */
3135 +Q_EXTERN float gridScale Q_ASSIGN( 1.0f );
3136 +Q_EXTERN float gridAmbientScale Q_ASSIGN( 1.0f );
3138 /* ydnar: lightmap gamma/compensation */
3139 Q_EXTERN float lightmapGamma Q_ASSIGN( 1.0f );
3140 Q_EXTERN float lightmapCompensate Q_ASSIGN( 1.0f );
3141 +Q_EXTERN float lightmapExposure Q_ASSIGN( 1.0f );
3143 /* ydnar: for runtime tweaking of falloff tolerance */
3144 Q_EXTERN float falloffTolerance Q_ASSIGN( 1.0f );
3145 @@ -2221,6 +2277,9 @@
\r
3146 Q_EXTERN int numExtLightmaps Q_ASSIGN( 0 );
3147 Q_EXTERN outLightmap_t *outLightmaps Q_ASSIGN( NULL );
3149 +/* vortex: per surface floodlight statictics */
3150 +Q_EXTERN int numSurfacesFloodlighten Q_ASSIGN( 0 );
3153 Q_EXTERN int numRawGridPoints Q_ASSIGN( 0 );
3154 Q_EXTERN rawGridPoint_t *rawGridPoints Q_ASSIGN( NULL );
3156 ===================================================================
\r
3157 --- shaders.c (revision 158)
\r
3158 +++ shaders.c (working copy)
\r
3159 @@ -793,8 +793,14 @@
\r
3162 if( VectorLength( si->color ) <= 0.0f )
3164 ColorNormalize( color, si->color );
3165 - VectorScale( color, (1.0f / count), si->averageColor );
3166 + VectorScale( color, (1.0f / count), si->averageColor );
3170 + VectorCopy( si->color, si->averageColor );
3175 @@ -804,13 +810,15 @@
\r
3176 finds a shaderinfo for a named shader
3179 +#define MAX_SHADER_DEPRECATION_DEPTH 16
3181 shaderInfo_t *ShaderInfoForShader( const char *shaderName )
3184 + int deprecationDepth;
3186 char shader[ MAX_QPATH ];
3191 if( shaderName == NULL || shaderName[ 0 ] == '\0' )
3193 @@ -823,11 +831,27 @@
\r
3194 StripExtension( shader );
3197 + deprecationDepth = 0;
3198 for( i = 0; i < numShaderInfo; i++ )
3200 si = &shaderInfo[ i ];
3201 if( !Q_stricmp( shader, si->shader ) )
3203 + /* check if shader is deprecated */
3204 + if (deprecationDepth < MAX_SHADER_DEPRECATION_DEPTH && si->deprecateShader && si->deprecateShader[ 0 ] )
3206 + /* override name */
3207 + strcpy( shader, si->deprecateShader );
3208 + StripExtension( shader );
3209 + /* increase deprecation depth */
3210 + deprecationDepth++;
3211 + if (deprecationDepth == MAX_SHADER_DEPRECATION_DEPTH)
3212 + Sys_Printf("WARNING: Max deprecation depth of %i is reached on shader '%s'\n", MAX_SHADER_DEPRECATION_DEPTH, shader);
3213 + /* search again from beginning */
3218 /* load image if necessary */
3219 if( si->finished == qfalse )
3221 @@ -1340,7 +1364,6 @@
\r
3223 surfaceModel_t *model;
3226 /* allocate new model and attach it */
3227 model = safe_malloc( sizeof( *model ) );
3228 memset( model, 0, sizeof( *model ) );
3229 @@ -1465,6 +1488,24 @@
\r
3230 GetTokenAppend( shaderText, qfalse );
3231 si->backsplashDistance = atof( token );
3234 + /* q3map_floodLight <r> <g> <b> <diste> <intensity> <light_direction_power> */
3235 + else if( !Q_stricmp( token, "q3map_floodLight" ) )
3238 + GetTokenAppend( shaderText, qfalse );
3239 + si->floodlightRGB[ 0 ] = atof( token );
3240 + GetTokenAppend( shaderText, qfalse );
3241 + si->floodlightRGB[ 1 ] = atof( token );
3242 + GetTokenAppend( shaderText, qfalse );
3243 + si->floodlightRGB[ 2 ] = atof( token );
3244 + GetTokenAppend( shaderText, qfalse );
3245 + si->floodlightDistance = atof( token );
3246 + GetTokenAppend( shaderText, qfalse );
3247 + si->floodlightIntensity = atof( token );
3248 + GetTokenAppend( shaderText, qfalse );
3249 + si->floodlightDirectionScale = atof( token );
3252 /* q3map_lightmapSampleSize <value> */
3253 else if( !Q_stricmp( token, "q3map_lightmapSampleSize" ) )
3254 @@ -1590,6 +1631,18 @@
\r
3255 strcpy( si->remapShader, token );
3259 + /* q3map_deprecateShader <shader> */
3260 + else if( !Q_stricmp( token, "q3map_deprecateShader" ) )
3262 + GetTokenAppend( shaderText, qfalse );
3263 + if( token[ 0 ] != '\0' )
3266 + si->deprecateShader = safe_malloc( strlen( token ) + 1 );
3267 + strcpy( si->deprecateShader, token );
3271 /* ydnar: q3map_offset <value> */
3272 else if( !Q_stricmp( token, "q3map_offset" ) )
3273 @@ -1896,12 +1949,14 @@
\r
3274 si->styleMarker = 2;
3276 /* ydnar: default to searching for q3map_<surfaceparm> */
3281 - //% Sys_FPrintf( SYS_VRB, "Attempting to match %s with a known surfaceparm\n", token );
3282 + Sys_FPrintf( SYS_VRB, "Attempting to match %s with a known surfaceparm\n", token );
3283 if( ApplySurfaceParm( &token[ 6 ], &si->contentFlags, &si->surfaceFlags, &si->compileFlags ) == qfalse )
3284 - ;//% Sys_Printf( "WARNING: Unknown q3map_* directive \"%s\"\n", token );
3285 + Sys_Printf( "WARNING: Unknown q3map_* directive \"%s\"\n", token );
3292 ===================================================================
\r
3293 --- surface.c (revision 158)
\r
3294 +++ surface.c (working copy)
\r
3295 @@ -304,7 +304,7 @@
\r
3296 out = &mapDrawSurfs[ i ];
3298 /* walk the surface list again until a proper surface is found */
3299 - for( j; j < numMapDrawSurfs; j++ )
3300 + for( ; j < numMapDrawSurfs; j++ )
3302 /* get in surface */
3303 in = &mapDrawSurfs[ j ];
3304 @@ -484,7 +484,7 @@
\r
3307 /* walk the list of surfaces */
3308 - for( numSurfs; numSurfs > 0; numSurfs--, ds++ )
3309 + for( ; numSurfs > 0; numSurfs--, ds++ )
3311 /* ignore bogus (or flare) surfaces */
3312 if( ds->type == SURFACE_BAD || ds->numVerts <= 0 )
3313 @@ -2445,25 +2445,27 @@
\r
3314 numSurfacesByType[ ds->type ]++;
3321 emits a bsp patch drawsurface
3324 -void EmitPatchSurface( mapDrawSurface_t *ds )
3325 +void EmitPatchSurface( entity_t *e, mapDrawSurface_t *ds )
3328 bspDrawSurface_t *out;
3329 int surfaceFlags, contentFlags;
3330 + int forcePatchMeta;
3332 + /* vortex: _patchMeta support */
3333 + forcePatchMeta = IntForKey(e, "_patchMeta" );
3334 + if (!forcePatchMeta)
3335 + forcePatchMeta = IntForKey(e, "patchMeta" );
3338 /* invert the surface if necessary */
3339 if( ds->backSide || ds->shaderInfo->invert )
3341 bspDrawVert_t *dv1, *dv2, temp;
3344 /* walk the verts, flip the normal */
3345 for( i = 0; i < ds->numVerts; i++ )
3346 @@ -2485,7 +2487,7 @@
\r
3348 VectorScale( ds->lightmapVecs[ 2 ], -1.0f, ds->lightmapVecs[ 2 ] );
3352 /* allocate a new surface */
3353 if( numBSPDrawSurfaces == MAX_MAP_DRAW_SURFS )
3354 Error( "MAX_MAP_DRAW_SURFS" );
3355 @@ -2493,12 +2495,12 @@
\r
3356 ds->outputNum = numBSPDrawSurfaces;
3357 numBSPDrawSurfaces++;
3358 memset( out, 0, sizeof( *out ) );
3362 out->surfaceType = MST_PATCH;
3364 out->shaderNum = EmitShader( "debugsurfaces", NULL, NULL );
3365 - else if( patchMeta )
3366 + else if( patchMeta || forcePatchMeta )
3368 /* patch meta requires that we have nodraw patches for collision */
3369 surfaceFlags = ds->shaderInfo->surfaceFlags;
3370 @@ -2548,8 +2550,6 @@
\r
3371 numSurfacesByType[ ds->type ]++;
3377 OptimizeTriangleSurface() - ydnar
3378 optimizes the vertex/index data in a triangle surface
3379 @@ -2677,8 +2677,7 @@
\r
3382 bspDrawSurface_t *out;
3386 /* invert the surface if necessary */
3387 if( ds->backSide || ds->shaderInfo->invert )
3389 @@ -2689,15 +2688,15 @@
\r
3390 ds->indexes[ i ] = ds->indexes[ i + 1 ];
3391 ds->indexes[ i + 1 ] = temp;
3395 /* walk the verts, flip the normal */
3396 for( i = 0; i < ds->numVerts; i++ )
3397 VectorScale( ds->verts[ i ].normal, -1.0f, ds->verts[ i ].normal );
3401 VectorScale( ds->lightmapVecs[ 2 ], -1.0f, ds->lightmapVecs[ 2 ] );
3405 /* allocate a new surface */
3406 if( numBSPDrawSurfaces == MAX_MAP_DRAW_SURFS )
3407 Error( "MAX_MAP_DRAW_SURFS" );
3408 @@ -2804,15 +2803,14 @@
\r
3409 emits a bsp planar winding (brush face) drawsurface
3412 -static void EmitFaceSurface( mapDrawSurface_t *ds )
3413 +static void EmitFaceSurface(mapDrawSurface_t *ds )
3415 /* strip/fan finding was moved elsewhere */
3416 StripFaceSurface( ds );
3417 - EmitTriangleSurface( ds );
3418 + EmitTriangleSurface(ds);
3424 MakeDebugPortalSurfs_r() - ydnar
3425 generates drawsurfaces for passable portals in the bsp
3426 @@ -3502,7 +3500,7 @@
\r
3428 refs = FilterPatchIntoTree( ds, tree );
3430 - EmitPatchSurface( ds );
3431 + EmitPatchSurface( e, ds );
3434 /* handle triangle surfaces */
3435 Index: surface_meta.c
\r
3436 ===================================================================
\r
3437 --- surface_meta.c (revision 158)
\r
3438 +++ surface_meta.c (working copy)
\r
3439 @@ -312,23 +312,41 @@
\r
3440 creates triangles from a patch
3443 -void TriangulatePatchSurface( mapDrawSurface_t *ds )
3444 +void TriangulatePatchSurface( entity_t *e , mapDrawSurface_t *ds )
3446 int iterations, x, y, pw[ 5 ], r;
3447 mapDrawSurface_t *dsNew;
3448 mesh_t src, *subdivided, *mesh;
3451 + int forcePatchMeta;
3453 + int patchSubdivision;
3455 + /* vortex: _patchMeta, _patchQuality, _patchSubdivide support */
3456 + forcePatchMeta = IntForKey(e, "_patchMeta" );
3457 + if (!forcePatchMeta)
3458 + forcePatchMeta = IntForKey(e, "patchMeta" );
3459 + patchQuality = IntForKey(e, "_patchQuality" );
3460 + if (!patchQuality)
3461 + patchQuality = IntForKey(e, "patchQuality" );
3462 + if (!patchQuality)
3463 + patchQuality = 1.0;
3464 + patchSubdivision = IntForKey(e, "_patchSubdivide" );
3465 + if (!patchSubdivision)
3466 + patchSubdivision = IntForKey(e, "patchSubdivide" );
3468 /* try to early out */
3469 - if( ds->numVerts == 0 || ds->type != SURFACE_PATCH || patchMeta == qfalse )
3470 + if(ds->numVerts == 0 || ds->type != SURFACE_PATCH || ( patchMeta == qfalse && !forcePatchMeta) )
3473 /* make a mesh from the drawsurf */
3474 src.width = ds->patchWidth;
3475 src.height = ds->patchHeight;
3476 src.verts = ds->verts;
3477 //% subdivided = SubdivideMesh( src, 8, 999 );
3478 - iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions );
3479 + if (patchSubdivision)
3480 + iterations = IterationsForCurve( ds->longestCurve, patchSubdivision );
3482 + iterations = IterationsForCurve( ds->longestCurve, patchSubdivisions / patchQuality );
3484 subdivided = SubdivideMesh2( src, iterations ); //% ds->maxIterations
3486 /* fit it to the curve and remove colinear verts on rows/columns */
3487 @@ -599,7 +617,22 @@
\r
3493 +vortex: prints meta statistics in general output
3496 +void EmitMetaStats()
3498 + Sys_Printf( "--- EmitMetaStats ---\n" );
3499 + Sys_Printf( "%9d total meta surfaces\n", numMetaSurfaces );
3500 + Sys_Printf( "%9d stripped surfaces\n", numStripSurfaces );
3501 + Sys_Printf( "%9d fanned surfaces\n", numFanSurfaces );
3502 + Sys_Printf( "%9d patch meta surfaces\n", numPatchMetaSurfaces );
3503 + Sys_Printf( "%9d meta verts\n", numMetaVerts );
3504 + Sys_Printf( "%9d meta triangles\n", numMetaTriangles );
3508 MakeEntityMetaTriangles()
3509 builds meta triangles from brush faces (tristrips and fans)
3510 @@ -652,12 +685,12 @@
\r
3514 - TriangulatePatchSurface( ds );
3515 + TriangulatePatchSurface(e, ds );
3518 case SURFACE_TRIANGLES:
3522 case SURFACE_FORCED_META:
3524 SurfaceToMetaTriangles( ds );
3525 @@ -972,8 +1005,8 @@
\r
3526 vec3_t average, diff;
3527 int indexes[ MAX_SAMPLES ];
3528 vec3_t votes[ MAX_SAMPLES ];
3529 + const char *classname;
3533 Sys_FPrintf( SYS_VRB, "--- SmoothMetaTriangles ---\n" );
3535 @@ -994,11 +1027,31 @@
\r
3536 and set per-vertex smoothing angle */
3537 for( i = 0, tri = &metaTriangles[ i ]; i < numMetaTriangles; i++, tri++ )
3539 + /* vortex: try get smoothing from entity key */
3540 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_smoothnormals");
3541 + if (shadeAngle <= 0.0f)
3542 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_sn");
3543 + if (shadeAngle <= 0.0f)
3544 + shadeAngle = FloatForKey(&entities[tri->entityNum], "_smooth");
3545 + if (shadeAngle > 0.0f)
3547 + if (entities[tri->entityNum].forceNormalSmoothing == qfalse)
3549 + entities[tri->entityNum].forceNormalSmoothing = qtrue;
3550 + classname = ValueForKey( &entities[tri->entityNum], "classname" );
3551 + Sys_Printf( "Entity %d (%s) has vertex normal smoothing with breaking angle of %3.0f\n", tri->entityNum, classname, shadeAngle );
3553 + shadeAngle = DEG2RAD( shadeAngle );
3556 /* get shader for shade angle */
3557 - if( tri->si->shadeAngleDegrees > 0.0f )
3558 - shadeAngle = DEG2RAD( tri->si->shadeAngleDegrees );
3560 - shadeAngle = defaultShadeAngle;
3561 + if (shadeAngle <= 0.0f)
3563 + if( tri->si->shadeAngleDegrees > 0.0f )
3564 + shadeAngle = DEG2RAD( tri->si->shadeAngleDegrees );
3566 + shadeAngle = defaultShadeAngle;
3568 if( shadeAngle > maxShadeAngle )
3569 maxShadeAngle = shadeAngle;
3572 ===================================================================
\r
3573 --- writebsp.c (revision 158)
\r
3574 +++ writebsp.c (working copy)
\r
3575 @@ -136,7 +136,6 @@
\r
3583 @@ -278,18 +277,19 @@
\r
3584 void SetLightStyles( void )
3586 int i, j, style, numStyles;
3587 - qboolean keepLights;
3592 char lightTargets[ MAX_SWITCHED_LIGHTS ][ 64 ];
3593 int lightStyles[ MAX_SWITCHED_LIGHTS ];
3597 /* ydnar: determine if we keep lights in the bsp */
3598 - t = ValueForKey( &entities[ 0 ], "_keepLights" );
3599 - keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
3600 + if (KeyExists(&entities[ 0 ], "_keepLights") == qtrue)
3602 + t = ValueForKey( &entities[ 0 ], "_keepLights" );
3603 + keepLights = (t[ 0 ] == '1') ? qtrue : qfalse;
3606 /* any light that is controlled (has a targetname) must have a unique style number generated for it */