
Enhanced RVis/Light/BspInfo utilities
=====================================

Main features are :

* Progress feedback that works in any console and does not cause performance loss.
* Large map capacity; most limits are beyond the Quake engine capacity.
* RVis: AutoSave feature for securing long vis runs.
* Light: High quality 4x4 oversampling is available.
* Light: Fast processing using new options.
* Light: Soft anti-aliased shadows using new option.
* Light: Support for Hipnotic/Ritual entity rotation.
* Light: Support for min/maxlight, enhanced sunlight and wait/delay/mangle/antilight keys.
* Light: Emulation of TyrLite/IKLite/ArghLite/LightDLX lighting using new options.
* Light: Enhanced control of light distribution via new options and keys.
* Light: Support for QuArK/Hammer ETP (Enhanced Texture Positioning) using new option.
* BspInfo: Portal (prt) file generation available.
* BspInfo: Statistical light data printout available.
* Enhanced warning/error messages.
* Log file.

==================================================================================================

The changes from the original Vis, RVis, Light and BspInfo source code are as follows :

RVis 2.31, Light 1.43 and BspInfo 1.27 (May 1 2006)

1. Light: Fixed a crash bug that could occur when the warning "Texture axis perpendicular ..." was
   printed. This also means that the printed coordinates have been invalid.
2. Added many more checks for corrupt bsp data. The checks are always enabled for RVis and Light,
   while BspInfo needs the new option "-chk" to do the same.
3. BspInfo: Improved so errors during bsp load will not abort program when using wildcards.
4. RVis: Changed so verbose printout will update better and now always contains the extra progress
   bar for each portal.


Light 1.42 (Dec 28 2005)

1. Fixed a bug that could cause invalid lighting when using "-soft" and "-tyrlite"/"-tyrlite95"
   options together with overriding worldspawn minlight with a lower value from command line.
2. Changed so all non-light entities that has a "light" key will also be considered unsourced
   lights.


Light 1.41 (May 23 2005)

1. Added multi target check for any entity except lights. This means that any "target*",
   "targetname*" or "killtarget*" will match each other, e.g. "target" "name" will match
   "targetname3" "name" or "killtarget10" "name". Max 16 targets are allowed for each of the three
   variants in each entity.
2. Added warnings for potentially missing triggers also for trigger_teleports.
3. Added warning for missing targetname for func_spawn*.


RVis 2.30 (Mar 25 2005)

1. Added new options "-noambient", "-noambientlava", "-noambientsky", "-noambientslime", and
   "-noambientwater" to better control ambient sounds.


Light 1.40 (Feb 14 2005)

1. Improved handling when the warning "Too many light styles ..." appears. If "-soft" option is
   enabled, normal light (style 0) and minlight will always be kept since they are most likely
   dominant. Also added warning when minlight overrides. 
2. Added warnings for potentially missing triggers in each skill. Only specific targets are
   checked (all func_* and most trigger_*). The warnings can be disabled with the "-noskill"
   option.
3. Added new option "-nowrite" which does the same as "-onlyents" but with bsp write disabled.
   Useful when only checking entities.
4. Disabled "Elapsed time" printout when using options "-onlyents" or "-nowrite".


Light 1.39 (Oct 29 2004)

1. Added new option "-shadowsense #" which sets the angle (shadow) sensitivity for 2nd sunlight,
   see details below.
2. Added new option "-sunlight3 #" and "_sunlight3" key which just enables 2nd sunlight and at the
   same time sets the shadow sensitivity to 0.4, see details below.
3. Added warning for having targeted (switchable) sourced lights.


Light 1.38 and BspInfo 1.26 (Oct 5 2004)

1. Light: Added new option "-gate #" which enables Fade Gate (default 0.0). This can dramatically
   speedup processing with only minor light distortion, recommended gate value is 1.
2. Light: Speedup of maps with many spotlights.
3. Light: Added new option "-tyrlite95" which enables closer TyrLite 0.95 emulation, see details
   below.
4. Light: Added new option "-noanti" which disables antilights.
5. Light: Added warning for having targeted (switchable) lights with style < 32 set (style
   overrides).
6. Light: Fixed bug when having targeted lights with style < 32 set.
7. Light: Fixed bug when using "-noflash" option and having targeted lights with style < 32 set.
8. BspInfo: Changed warning for # faces exceeding normal engine capacity from 64k to 32k.


Light 1.37 (Sep 21 2004)

1. Fixed a serious bug that invalidated light data when using "-onlyents" option. Bug was
   introduced in 1.36.


RVis 2.29, Light 1.36 and BspInfo 1.25 (Sep 13 2004)

1. Light: Changed error "Bad surface extents" into a warning with more information. Ignoring this
   might cause bad lighting in the specified area. One cause is excessive # vertexes in bsp.
2. Light: Added printout of # light casts that will be made. This is the product of the total
   amount of light emitting objects and the total amount of surface points. It is not affected by
   the "-fast" option.
3. RVis: Speedup of ambient sound calculations.
4. Light: Added detection of entity compression when using the "-detect" or "-unsup" options.
5. Light: Added texture name to several messages.
6. Light: Increased stack in raytracing from 64 to 128 for more complex maps.
7. Light: Added check for too many nodes in bsp.
8. BspInfo: Added warnings for various objects exceeding normal engine capacity.
9. Fixed a crash bug when a bsp lump object was partly beyond filesize.


RVis 2.28 and Light 1.35 (Aug 14 2004)

1. RVis/Light: Added new option "-priority #" to set the thread priority 0-2 (below/normal/above,
   default 1) in order to make the program more flexible in the Windows environment.
2. RVis: Strengthened check for portal file consistency.
3. RVis: Minor improvement in the linearity of the extra progress bar in slow portals.
4. Light: Added printout of # disabled flashing lights when using the "-noflash" option.


RVis 2.27, Light 1.34 and BspInfo 1.24 (Jul 2 2004)

1. Light: Fixed a bug that could cause light distortion if a non-light entity had a delay 4 (local
   minlight) key. Map must also use minlight and not options "-oldlight" or "-iklite". Bug was
   introduced in 1.30.
2. Light: Fixed a bug that caused minor light distortion when using "light" (minlight) key in
   worldspawn. This light would be cast as normal light entity in addition to its minlight
   function.
3. Light: Fixed a bug that could cause minor light distortion when using additive minlight in maps
   with sunlight.
4. Light: Fixed a bug that disabled 2nd sunlight if sun mangle wasn't explicitly set.
5. Light: Fixed a bug that caused sunlight to be slightly different depending on whether sun
   mangle was explicitly set or not. In some emulation modes, the old behaviour is maintained.
6. RVis: Fixed a crash bug when portal (prt) file was inconsistent (too few portalleafs).
7. RVis: Added check for bsp+portal file mismatch.
8. RVis: Added warning for bsp+state file mismatch when loading state file.
9. RVis: Added more info to several error messages.
10.BspInfo: Fixed minor bug when using "-cutvislight" option.
11.BspInfo: Minor light statistics printout change.


RVis 2.26, Light 1.33 and BspInfo 1.23 (Jun 2 2004)

1. Light: Added new option "-solidsky" that enables also solid sky brushes to cast sunlight. This
   method isn't perfect but normally it produces pretty good results.
2. Light: Fixed a bug that prevented the "-oldlight" and "-iklite" options from disabling
   antilights.
3. Light: Fixed a bug that sometimes caused minor light variations when using the "-oldlight" or
   "-iklite" options.
4. Light: Fixed a bug that caused invalid lighting when light entity keys "target" or "targetname"
   were set to empty strings ("").
5. RVis: Fixed a crash bug when all textures were missing in bsp.
6. RVis: Minor speedup and memory reduction.
7. BspInfo: Fixed minor bug in light statistics printout.
8. BspInfo: Minor printout change.


Light 1.32 and BspInfo 1.22 (May 6 2004)

1. Light: Added support for new attenuation formula (delay 5 lights), see details below. Thanks to
   Kinn for this one.
2. Light: Added new option "-kinn" which translates all delay 2 lights into delay 5.
3. Light: Added new option "-addmin" which enables additive minlight (same as ArghLite). This may
   help reducing the sometimes uniform minlight effect.
4. Light: Changed so sunlight isn't affected by the additive minlight in ArghLite emulation.
5. Light: Minor speedup.
6. Light: Minor improvement of TyrLite emulation when using antilights.
7. Light: Added printout of total capped light amount when using the "-lightcap" option.
8. BspInfo: Added warnings for various objects exceeding normal engine capacity.
9. BspInfo: Fixed a crash bug when using option "-prt" on a bsp with too many nodes or leafs.
10.BspInfo: Added printout of # fullbrights (light > 255) when using the "-lightstat" options.


Light 1.31 (Apr 14 2004)

1. Added recognition of a new key "_softangle" in each light entity that sets the angle of an
   inner spotlight cone for a softer transition, see details below.
2. Expanded the "-fast" option so you can now also specify "-fast #" (default 2, same as before).
   Higher values are faster but with less quality, recommended values are 2-8. Light quality
   varies greatly with map but should be sufficient for checking general light levels.
3. Added new option "-onlyents" which only updates switchable light entities and doesn't alter the
   actual light data. This is convenient after doing an "-onlyents" run with qbsp which might
   disable switchable lights.
4. Added new option "-srclight" which disables all unsourced light entities (classname "light").
5. Added new option "-noglobrange" which disables global range. Only useful with "-arghlite" or
   "-tyrlite" options.
6. Fixed a bug which sometimes caused minor light distortions when using "-fast".
7. Fixed a bug which caused minor light variations when using sunlight, odd range values and not
   "-globrange".
8. Fixed a bug which sometimes caused entity "style" keys to be incorrectly omitted.
9. Disabled usage of the "_anglesense" key in local minlights.


RVis 2.25, Light 1.30 and BspInfo 1.21 (Mar 18 2004)

1. Light: Added support for local minlights (delay 4 lights), see details below.
2. Light: Added new option "-anglesense #" which sets the angle sensitivity globally, see details
   below.
3. BspInfo: Added new option "-copyents" which copies all entities in the bsp and writes them to a
   text file with extension ".ent".
4. Fixed a bug which aborted bsp load if there was a texture index table but all textures were
   missing.


RVis 2.24, Light 1.29 and BspInfo 1.20 (Feb 16 2004)

1. Light: Added basic support for antilights, see details below. Thanks to Tyrann for this one.
2. RVis: Removed the vis limitation (MAX_MAP_VISIBILITY) of 4 MB.
3. Changed some printouts for higher capacity and clarity.


BspInfo 1.19 (Jan 29 2004)

1. Added new option "-prt" which generates a portal (prt) file from the bsp, similar to the
   bsp2prt utility. BspInfo has larger capacity and produces a better portal file with fewer
   leafs/portals, which helps vis. On older operating systems, it's also several times faster and
   requires less memory.
2. Added new option "-nowatervis" which disables portal information for transparent water when
   using the "-prt" option.
3. Added new option "-quiet" which disables the bsp summary printout.


RVis 2.23 and Light 1.28 (Jan 2 2004)

1. Light: Added new option "-softdist #" which controls directional tolerance, see details below.
2. Light: Added recognition of the key "_anglesense" also in worldspawn, thereby affecting the
   sunlight. This can have quite a large effect on the sunlight appearance, see details below.
3. RVis: Added persistence of the high resolution percent mode in the state file.
4. RVis: Added calculation and printout of the total time spent in state file handling. This is
   the extra time that the AutoSave feature costs. It will only be printed for fullvis runs and
   only if it's at least one second.


RVis 2.22 and Light 1.27 (Dec 14 2003)

1. Light: Improved the accuracy of all emulation modes, see details below.
2. Light: Added new option "-tyrlite" which enables closer TyrLite emulation, see details below.
3. Light: Added new option "-etp" which enables support for QuArK/Hammer ETP, see details below.
   Thanks to Tyrann for this one.
4. Light: Added new option "-lightcap #" which sets a maximum light entity intensity. Any light entity
   that is brighter than this level gets capped.
5. Light: Added new option "-detect" which enables printout of detected keys summary. Enabling "-unsup"
   will also activate this printout.
6. Light: Added a warning for multiple light values in each entity. The last "light" value will be used.
7. Light: Added a warning for misplaced sunlight key (should be in worldspawn).
8. Light: Added a check to prevent multiple emulation mode activation.
9. Light: Added a printout when "-oldlight" mode is enabled.
10.RVis: Minor speedup of Base processing, typically about 10%.
11.RVis: Fixed a minor potential bug in ambient sound calculations.


Light 1.26 (Nov 13 2003)

1. Added new option "-iklite" which enables IKLite emulation, see details below. Thanks to Iikka
   Keränen for this one.
2. Added new option "-ikangle" which enables an angle sensitivity partly similar to IKLite.
   Sensitivity for delay 3 lights is set to 1 and for delay 2 lights it is set to 0.
3. Added recognition of a new key "_anglesense" in each light entity that controls the angle
   sensitivity, see details below.
4. Added new option "-arghlite" which enables ArghLite emulation, see details below.
5. Added new option "-dlx" which enables partial LightDLX emulation, see details below.
6. Removed option "-nodelay" which is replaced by "-arghlite".
7. Fixed a bug which could cause light bleeding and prolonged processing time when using the
   "-soft" option on a map with delay 1-3 lights.
8. Added new option "-norev" which prevents the usual entity key order reversal. This helps when
   doing binary comparisons between bsp files.
9. Fixed a bug which caused the printout of # switchable light styles to behave unexpectedly.


RVis 2.21, Light 1.25 and BspInfo 1.18 (Oct 29 2003)

1. Light: Added new option "-nodelay" which disables the entity delay feature.
2. Light: Added new option "-noflash" which converts flashing light entities into normal ones.
3. Light: Changed error "Texture axis perpendicular ..." into a warning. Ignoring this might cause
   bad lighting in the specified area.
4. Light: Changed error "LoadEntities: not 2/3 values for mangle ..." into a warning.
5. Light: Fixed minor bugs in the unsupported key handling and improved information for several
   errors and warnings.
6. Light: Fixed a bug which disabled maxlight when using the "-globrange" option.
7. Light: Fixed a bug that in rare cases could abort processing of entity section.
8. Light: Fixed a crash bug when an entity had no classname.
9. Light: Fixed a crash bug when loading bsp files with corrupt node data.
10.Fixed a crash bug when loading bsp files with corrupt lump info.
11.Fixed a crash bug when loading bsp files with corrupt texture index data.
12.BspInfo: Fixed a crash bug when there were no textures in bsp.
13.BspInfo: Fixed a memory leak when using the "-cutvislight" option.


Light 1.24 and BspInfo 1.17 (Oct 15 2003)

1. Light: Added new directional tolerance feature to the "-soft" option, see details below.
2. Light: Fixed a bug which in some cases prevented usage of the "-soft" option.
3. Light: Fixed a bug which sometimes caused min/sunlight to be slightly lower than specified.
4. Light: Fixed a bug which sometimes caused minor light variations.
5. Light: Fixed a bug which sometimes caused unnecessary warning "Too many light styles ...".
   Thanks to Tyrann for this one.
6. Light: Added entity # to several error messages.
7. Light: Added printout of # faces in map.
8. Light: Added warning for multiple worldspawn entities.
9. BspInfo: Added new options "-lightstat", "-lightstat2" and "-lightstat3" that enable printout
   of statistical light data. The first just prints a brief summary and the other two add an ASCII
   graphics representation with auto/fixed scale of the light distribution in the bsp. The summary
   contains the three highest peak light levels and mean & standard deviation values. Note that
   complete dark spots (level 0) are not included due to random noise problems.
   This can help in determining what light options that have been used to build a bsp and also to
   better understand how a map is lit and e.g. if there are many areas with fullbright lighting.
10.BspInfo: Added a more descriptive option printout.


Light 1.23 (Sep 25 2003)

1. Added new option "-soft" to reduce jagged shadows, see details below.
2. Added new option "-globrange" which makes the "-range #" option affect global light levels
   (sun/min/maxlight) as well (for compatibility with TyrLite).


Light 1.22 (Sep 15 2003)

1. Added new option "-extra4" which enables 4x4 oversampling instead of the normal 2x2 for even
   higher quality. This also adds more suns for the 2nd sunlight. Naturally, this is a lot slower
   but for some maps it makes a difference, typically for bright maps with high-contrast shadows.
2. Fixed a bug which caused bad "ripple" shadows when using "-fast" option. Now also sunlight is
   affected by "-fast".
3. Fixed a bug where entity "style" keys could be incorrectly inserted or changed.
4. Reduced processing time with up to 20% in some cases.


Light 1.21 and BspInfo 1.16 (Sep 4 2003)

1. Light: Added support for wait/delay/mangle keys in light entities, see details below. Thanks to
   Tyrann for this one.
2. Light: Added new option "-fast" which cuts the processing time in half. When used without
   "-extra", there are visible shadow artifacts in some spots, but it should still be useful for
   quickly checking out the lighting. When used together with "-extra", these artifacts are hardly
   visible, making it useful even for release builds.
3. Light: Added support for old TyrLite _sun_mangle format "x y z".
4. Light: Fixed a bug that could cause an abort with error message "FindFaceOffsets: numfaces ...
   exceeded".
5. Light: Changed error "Bad sun mangle pitch ..." into a warning. This means that it's now
   possible to have sunlight that shines upwards (normally completely pointless).
6. Light: Changed error "FindFaceOffsets: Couldn't find entity for model ..." into a warning.
7. Light: Added new option "-unsup" which enables detailed printout of unsupported keys.
8. BspInfo: Added new option "-texname" which repairs missing texture names with "noname1",
   "noname2" etc. Experimental.
9. BspInfo: Added printout of missing textures.


RVis 2.20, Light 1.20 and BspInfo 1.15 (Aug 4 2003)

1. Removed most of the bsp data limits except for vis/light/entities (4/4/1 MB). This also means
   that normally, less memory is required for processing.
2. RVis: Fixed a bug that allowed for changing fullvis level unnoticed when reloading a saved
   state file. Now the fullvis level is also saved and will override any command line option.
3. Light: Fixed a bug where random garbage bytes could be written to the light data lump.
4. RVis: Minor reduction of state file size. The 2.20 version can still read 2.19 state files.
5. RVis/Light: Added high resolution percent printout to the AutoRate feature. When enabled,
   percent is printed in the form 12.34% instead of 12.3%. It is activated when the same
   percentage value has been printed repeatedly.
6. RVis/Light: Removed printout of estimation when it's not done yet.
7. RVis/Light: Minor adjustments to estimation handling.
8. RVis: Minor adjustments to extra progress bar handling.


RVis 2.19, Light 1.19 (Jul 24 2003)

1. RVis: Added an AutoSave feature for securing long vis runs, see details below.
2. RVis: Added new option "-visdist #" that makes it possible to set a maximum distance that vis
   will consider visible. This can be useful when tracking down spots with high r_speeds. With
   careful map design, this feature might make it possible to lower r_speeds in areas where normal
   vis-blocking doesn't help. This is done by using simple brushes (e.g. closed doors) to hide the
   HOMs that is a result of the range limited vis. Thanks to KrimZon (slightly.quakesrc.org) for
   this one.
3. RVis: Removed the max numportals limitation of 65536.
4. RVis/Light: Added an AutoRate feature for the progress feedback which tries to adjust the
   percentage rate down to avoid long periods with no updates. Using the "-rate" option will
   disable AutoRate.
5. RVis: Added an extra progress bar when processing one portal is very slow, see details below.
6. RVis/Light: Added possibility to set the percentage rate as a float (e.g. 0.2) in the "-rate"
   option.
7. RVis/Light: Changed time format when hours > 0 to "HHh MMm" (e.g. 12h 13m). There is a new
   option "-oldhformat" if you prefer the old format "HH:MM:SS" (e.g. 12:13:14).
8. RVis/Light: Fixed small bugs in timing calculations.
9. RVis: Added printout of "Session time" when an AutoSave state file is loaded at startup. This
   is the totally accumulated time spent in Base/Full and is useful in disrupted sessions.
10.RVis: Changed default Full vis level from 2 to 4, i.e. if you don't specify "-fast", a level 4
   vis will be made.
11.RVis/Light: Added a more descriptive option printout.


RVis 2.18, Light 1.18 and BspInfo 1.14 (Jun 25 2003)

1. Light: Added support for sunlight, see details below. Thanks to Tyrann for this one.
2. Light: Added support for a 2nd sunlight, see details below.
3. Light: Added recognition of "_maxlight" key in worldspawn for maxlight values ("maxlight" is
   still supported but causes a warning at engine startup).
4. Light: Added support for "_dist" and "_range" keys in worldspawn. The command line overrides
   worldspawn settings.
5. RVis/Light: Added simplified progress feedback, see details below.
6. Light: Added new option "-nowarnings" which disables printout of the more repetitive warnings
   to screen.
7. BspInfo: Added new option "-extents" which extracts non-brush entities from the bsp and writes
   them to a text file with extension ".ent". All other entities remain in the bsp. Experimental.
8. BspInfo: Added new option "-cutvislight" which just deletes the light/vis data lumps.
   Experimental.
9. RVis/Light: Improved timing precision.
10.RVis: Added recognition of "-verbose" option ("-v" still works).
11.RVis: Removed printout of c_chains when "-fast" option is used.
12.BspInfo: Changed name of "-fixup" option to "-limit" for clarity.


Light 1.17 (May 20 2003)

1. Added support for Hipnotic/Ritual entity rotation.
2. Added coordinates to the error message "Texture axis perpendicular to face".


RVis 2.17, Light 1.16 and BspInfo 1.13 (Apr 30 2003)

1. BspInfo: Added new option "-fixup" for repairing bsps that appear to have exceeded the Q1 map
   limits. This is experimental and should only be used when required. Backup original file before
   usage.
2. Fixed a bug where loading and saving a bsp would cause random garbage bytes to be written at
   the end of each data lump. These bytes aren't harmful but may be confusing in a file
   comparison.


RVis 2.16, Light 1.15 and BspInfo 1.12 (Mar 25 2003)

1. Fixed a bug in printout of bsp version when mismatch.


Light 1.14 (Aug 15 2002)

1. Added min/maxlight support using options "-light #"/"-maxlight #" or "light"/"maxlight" keys in
   worldspawn. Note that these light levels are normally not affected by the "-range" option. This
   makes the combination of global options more useful.
2. Added support for disabling all light entities using option "-nolight". Using this option
   together with e.g. "-light 50" is very efficient for quickly setting a low light level in the
   map. This in turn is very useful when looking for thin brush seams or tjunction effects.
3. Added more relevant info to the warning message "Entity at ... has unmatched target".
4. Added a warning message when there are unsupported light keys detected and a recommendation for
   proper light tool (TyrLite/IKLite).
5. Reduced memory requirements, typically about 50%.
6. Added several safety checks when reading entities to prevent data corruption.
7. Clarified error message when light data size is exceeded.


RVis 2.15, Light 1.13 and BspInfo 1.11 (Jul 30 2002)

1. RVis: Fixed a serious bug that caused data corruption when vising a map with more than 16384
   numportals. The limit is now set to 65536 and a safety check is added to prevent corruption.
2. RVis: Removed the limitation that causes the error message "Leaf with too many portals".
3. Increased two bsp data limits : MAX_MAP_VISIBILITY and MAX_MAP_LIGHTING from 1 to 4 MB. This
   allows for more complex maps that QBSP compilers now are capable of.
4. RVis/Light: Fixed bugs in the option handling.
5. RVis/Light: Improved printout when warning messages appear.


BspInfo 1.10 (May 29 2002)

1. Increased several bsp data limits : MAX_MAP_ENTITIES from 1024 to 4096, MAX_MAP_ENTSTRING from
   64KB to 1MB, MAX_MAP_PLANES from 8192 to 32768 and MAX_MAP_TEXINFO from 4096 to 8192. This
   allows for more complex maps that QBSP compilers now are capable of.
2. Added safety check to ensure data integrity when the bsp data limits are exceeded.
3. Fixed a bug in printout of surfedges.
4. Added printout of models.
5. Added handling of file name wildcards.
6. Minor adjustments to handle larger values in printouts of big maps.
7. Added version number. The original BspInfo is assumed to have version 1.00.


RVis 2.14 and Light 1.12 (May 28 2002)

1. Made option parsing case insensitive.


RVis 2.13 and Light 1.11 (May 17 2002)

1. Increased several bsp data limits : MAX_MAP_ENTITIES from 1024 to 4096, MAX_MAP_ENTSTRING from
   64KB to 1MB, MAX_MAP_PLANES from 8192 to 32768 and MAX_MAP_TEXINFO from 4096 to 8192. This
   allows for more complex maps that QBSP compilers now are capable of.
2. Added safety check to ensure data integrity when the bsp data limits are exceeded.
3. Added printout of percent estimated time completed.
4. Light: Fixed a bug when writing entity strings longer than 128 byte to the bsp file.
5. Light: Added log file (LIGHT.LOG) handling.
6. Light: Added coordinates to the warning message "Too many light styles on a face".
7. Light: Removed option "-threads" as it didn't work anyway.


RVis 2.12 (Apr 16 2002)

1. Added log file (VIS.LOG) handling.
2. Added printout of # leafs (if more than one) where the "max leafs visible" can be seen.
3. Added coordinates to the complete leaf list when "-v" (verbose) is used.
4. Minor adjustments to improve printouts.


RVis 2.11 (Apr 9 2002)

1. Changed the error message "Leaf portals saw into leaf" into a warning and added coordinates.
2. Added coordinates to the error message "CheckStack: leaf recursion".
3. Added printout of max leafs visible with coordinates. This indicates the position in the map
   where the framerate will be low. Note that only worldbrushes count here, no entities.
4. Minor adjustments to handle larger leaf values in printouts of big maps.
5. Removed option "-threads" as it didn't work anyway.


RVis 2.10 and Light 1.10 (Jan 16 2002)

1. Fixed a bug in estimation when using option "-rate" with percent parameter 0 and process is
   lengthy.
2. Added version numbers. The original Vis is assumed to have version 1.00, RVis 2.00 and Light
   1.00.


RVis/Light, no version number (Nov 5 2001)

1. Improved overall estimation accuracy.


RVis/Light, no version number (Nov 2 2001)

1. Improved estimation accuracy at the beginning of a process.


RVis/Light, no version number (Oct 31 2001)

1. Added useful progress feedback and an option to control it, see details below.
2. Added a check for read-only file before processing.

==================================================================================================

Details regarding progress feedback
-----------------------------------

One of the major enhancements is the ability to display progress while running.
This is especially important in the RVis process, since it may require a long time to finish.
There are other variants available (e.g. RVis+, HVis) that can also display progress, but they :

1. Increase total process time significantly.
2. Output a large amount of text and this is bad when running in the console of e.g. QuArK or WC.
3. Do not make any serious attempt to estimate how long time left until the process is finished.
   It is definitely not enough in the Vis process to display the # objects (or percentage thereof)
   that is finished, since the process is non-linear. It is quite normal to have 60% objects done
   but 80% processing time left.

--------------------------------------------------------------------------------------------------

Progress is normally displayed in the form (example from RVis) :

Base:  68.3%, Elapsed:   13:09, Left:    6:43, Total:   19:52,  68%

The "Left" time is a filtered, dynamically calculated linear estimate. It is NOT a 100% reliable
figure, but it _will_ indicate the overall progress. The first percent number displays processed
objects and the last displays estimated time completed.

A new linear coefficient estimation is calculated normally when the integer part of the object
percent value changes, e.g. when 12.9% becomes 13.0%. In some cases, estimations will be done more
often. Intermittent updates will use the previously estimated coefficient.

The progress feedback is always printed between the processing of two portals. In large maps, one
portal can be very slow to process and to avoid complete absence of feedback for a long time, an
extra progress bar has been added. It has the form "----+----+" and is activated when more than 12
times the SecRate (see "-rate" option below) has passed inside processing one portal. The default
time is then 12 * 10 = 120 seconds.

Usually, the bar is not updated in a very linear fashion but it may offer some indication of
progress. Using the "-rate" option with a PercRate value of >= 0.1 will disable the extra progress
bar. When using option "-verbose", the extra progress bar is always displayed for each portal.

With the verbose mode it's also possible to track down the origin of slow portals. Just read the
portal number it's currently working on, divide by 2, add 3 and the resulting value is now a line
number in the portal file (prt). Open this file in an editor, go to the line number and read the
first coordinate on that line. This is one of the vertices of the portal.

The portal translation formula is because there are two memory portals (front and back) for each
file portal and there are three header lines in the prt file before the long list of portals.
Example: if portal number is 12345, then the prt file line number is (12345/2 + 3) = 6175.

--------------------------------------------------------------------------------------------------

There is an option that controls the normal progress feedback, "-rate sec,perc,line,tot".

Explanation :

sec	SecRate, minimum # seconds between screen updates, default 10
perc	PercRate, minimum # percent between screen updates, default 1.0
line	NewLine, new linefeed for each screen update, default 1 (TRUE)
tot	Total, display total estimated time, default 1 (TRUE)

The default setting has been tweaked to suit most situations.

--------------------------------------------------------------------------------------------------

Simplified progress is displayed in one of the following forms (example from RVis) :

Base
----+--

Base
73%

The first is enabled by the "-barpercent" option and the second by "-numpercent". For Light and
RVis Base, the percentage values are here just the object percentage value. For RVis Full, the
values are derived from the object percentage value, but weighted. The weighting is an attempt to
make the progress info more linear and a simple third degree equation curve is used to balance the
percentage values.

The following translation table can be used to obtain the actual object percentage value.

Displayed    Objects	   
   0%	        0%
  25%	       63%
  50%	       79%
  75%	       91%
 100%	      100%

The net result is that the progress is slowed down in the beginning and then sped up to counteract
the typical RVis behaviour.

==================================================================================================

Details regarding sunlight features in Light
--------------------------------------------

Sunlight is enabled via command line options "-sunlight #" and "-sunmangle #,#" or via
"_sunlight"/"_sun_mangle" keys in worldspawn. _sun_mangle uses the format "# #" (or "# # 0"),
where the first value is the yaw angle (0 to 360 degrees around the Z-axis, negative values are
also OK) and the second value is the pitch angle (90 degrees up to -90 down). Default values are
"0 -90" and the command line overrides worldspawn settings. Note that sunlight is normally not
affected by the "-range" option.

A good start combination is "_sunlight" "250" and "_sun_mangle" "45 -75" and then experiment
for best results. Note that the important thing is normally not to create light, but interesting
shadows.

You can also control how the sunlight is attenuated by its incoming angle for each face by using
the "_anglesense" key in worldspawn. Higher values means more attenuation (darker). Valid float
values are 0-1 with 0.5 as default.

The 2nd sunlight is enabled via command line option "-sunlight2 #" or via "_sunlight2" key in
worldspawn. This 2nd sun is actually many suns automatically positioned in an arrangement with
different yaw/pitch to eliminate bad shadows. When option "-extra" or "-extra4" is enabled, more
suns are used.

This 2nd sunlight value can be used to soften the shadows in outdoor areas from the normal
sunlight without using minlight, which in turn then may be reserved for indoor areas. A value of
60 is a good starting point for the 2nd sunlight if the normal sunlight is 250.

You can also add the "-shadowsense #" option which sets the angle (shadow) sensitivity for 2nd
sunlight (default 0.0). This can reduce the sometimes uniform look of sunlight. Recommended value
is 0.4 together with an increased 2nd sunlight level of about 10. For convenience, you can also
use option "-sunlight3 #" or "_sunlight3" key which just enables 2nd sunlight and at the same time
sets shadow sensitivity to 0.4.

==================================================================================================

Details regarding wait/delay/mangle/antilight/angle/_softangle/_anglesense features in Light
--------------------------------------------------------------------------------------------

Several keys can be added to a light entity to better control its behaviour. The "wait" key
controls the fade distance and the default value is 1.0. Using a higher value will make the light
fade faster thus making it darker, e.g. "wait" "1.5".

The "delay" key sets the attenuation formulae, possible values are:

0 (default)  - Linear falloff, identical to id's original light program.
1            - Use the 1/x attenuation formula, has wider range than default.
2            - Use the 1/(x*x) attenuation formula, faster falloff than delay 1.
3            - No attenuation (light stays same brightness at any distance).
4            - Local minlight (no attenuation, non-additive and minlight override).
5            - Similar to 2 but with more attenuation and never brighter than "light" value.

Local minlight can be used to have different minlight levels in different areas. Just add these
lights until all corners of an area are lit. Local minlight will never add more light to a face if
it's already sufficiently lit. Just remember that its range is only limited by solid architecture
or using spotlight cone.

Local minlight also override each other (brighter wins) and normal minlight with any level. This
means that they can be used both to brighten or darken (similar to antilights below) areas that
are otherwise controlled by minlight. However, local minlight cannot darken areas that are lit by
normal lights or sunlight. Local minlights open for many possibilities, some experimentation is
recommended here.

The "mangle" key controls the direction of a light, i.e. a spotlight. It has the form "# #" (or
"# # 0"), where the first value is the yaw angle (0 to 360 degrees around the Z-axis, negative
values are also OK) and the second value is the pitch angle (90 degrees up to -90 down), e.g.
"mangle" "45 -75". Also, similar to targeted lights, you can change the width of the spotlight
cone with the "angle" key (default 40 degrees).

For spotlights, you can also specify an inner cone using the "_softangle" key. This creates a
softer transition between full spotlight effect within the inner cone and then gradually lower
effect until reaching the outer cone. This key must be smaller than the angle key and its default
value is 0, which means disabled.

The "_anglesense" key controls how a light is attenuated by its incoming angle for each face.
Higher values means more attenuation (darker). Valid float values are 0-1 with 0.5 as default.
Local minlight can't use this feature and is always 0. Angle sensitivity can also be globally set
from command line but will not override the entity values. See also "-shadowsense #" option above.

Using antilight (lights with negative value) will "cast darkness" with the same rules (wait, delay
etc) as for positive lights. Note that light styles are important here; antilights will only
darken lights with matching light style. Also note that with antilights, you can go below the
ambient (min/sunlight etc) limit. You can't use antilight as ambient lights.

Using the "-oldlight" or "-iklite" options will disable the wait/delay/mangle/antilight features,
using the "-dlx" option will disable the wait/delay/mangle features and using the "-noanti" option
will disable antilights.

==================================================================================================

Details regarding the softening feature in Light
------------------------------------------------

Adding the "-soft" option can reduce the jagged edges of shadows by slightly softening (blurring)
the lighting. This is especially useful in bright maps with high-contrast shadows.

The option can be used with ("-soft #") or without a value ("-soft"). If used without a value, an
automatic mode is set where the softening value follows the level of oversampling (the "-extra*"
options). If no oversampling is enabled, a value of 1 is used. Together with "-extra" or
"-extra4", a value of 2 or 3 respectively will be used.

Setting the value manually will override the auto mode and is normally not recommended. A higher
value means a softer lighting for the same level of oversampling. Keeping the value in the range
1-5 is recommended, since otherwise visible distortions might appear near face edges. This is due
to the softening being performed separately for each texture face. If distortions appear, either
lower the softening value or manipulate the lighting slightly (yaw/pitch etc) in that particular
area.

Some experimentation might be required here for best results.

The "-soft" option also enables higher tolerance for the directional relationship between each
face and the light sources that cast light on it. Traditionally, a light source is disregarded if
it's on the same plane or behind a face. This may cause some faces to be strangely dark even if a
visible light source is nearby. Enabling the "-soft" option will consider a light source visible
even if it's slightly behind the face.

The distance behind the face is default 3, but can be set using the "-softdist #" option.

Tip : For a very fast but somewhat sketchy lighting, use "-fast -soft". For a very high quality
      but still not too slow lighting, use "-fast -soft -extra4".

==================================================================================================

Details regarding Light emulation capabilities
----------------------------------------------

Original Light features are supported by default. Use the "-oldlight" option for closer emulation
and to prevent detection of newer features. Setting "-light 0" from the command line can also help
avoiding undesired effects.

Most TyrLite 0.94 features are also supported by default, main exceptions are coloured lighting
and some antilight features. Use the "-tyrlite" or "-tyrlite95" options for closer emulation.
These options enable global range and disable lights in non-light entities (i.e. with a classname
that doesn't begin with "light"). Automatic detection and conversion of the older TyrLite
_sun_mangle format (x y z) is always enabled. Should it fail, override with the "-sunmangle"
option. Light distribution may differ compared to older TyrLite versions.

Use the "-etp" option for maps that are created in QuArK/Hammer using the ETP or Valve 220 format
and built with an ETP capable compiler (e.g. Tx/TreeQBSP). It's probably valid for any editor that
can generate these formats. TyrLite 0.94 and later use this mode for any map.

IKLite emulation is enabled by the "-iklite" option. All features are supported. Emulation is done
by translating the angle keys into corresponding delay keys, adjusting distance attenuation and
setting angle sensitivity for delay 3 lights to 1 and the default range to 1. The range can be
overridden by command line or worldspawn if necessary. As above, setting "-light 0" from the
command line is sometimes required.

ArghLite emulation is enabled by the "-arghlite" option. All features are supported. Emulation is
done by disabling the entity delay feature and enabling additive minlight and global range.

Partial LightDLX emulation is enabled by the "-dlx" option. Only antilights and the "message"
"max #" feature are supported.

Using any of the emulation modes and not having "-extra4" enabled will enforce maximum
compatibility. Enabling "-extra4" will favour quality over compatibility.

Detection of unsupported keys varies with the currently enabled options and should only be
considered a hint. Since several of the entity keys are the same for different light tools, it's
very difficult to always correctly identify the proper emulation. Use the "-unsup" option to
display unsupported key details. Use the "-detect" option to display a summary of detected keys.

==================================================================================================

Details regarding AutoSave feature in RVis
------------------------------------------

The AutoSave feature makes vis save its state at certain intervals while it's running. If it gets
interrupted for various reasons, you can just restart and it will proceed from the last valid
state. This is very convenient in long vis runs and you e.g. need to shut down the computer or in
case of a power failure.

The default save time is 60 seconds but this can be changed using option "-savetime #". Note that
using a too short interval may prolong the total vis time significantly and may also cause intense
disk activity. Also, the state can only be saved between the processing of two portals. This means
that if vis gets interrupted while processing one slow portal, the time spent in that portal will
be lost.

AutoSave uses a new file "map.vis" (if the map name is "map.bsp") for saving the state. In case of
disrupted state save, there might also be a "map.vi0" file that will automatically be removed when
restarting. For successful restart from a saved state, vis requires the state file (vis/vi0),
the portal file (prt) and the bsp file itself.

Note that if the portal file gets updated (new file date/time stamp), the state file will be
considered out of date and hence not loaded. It will be overwritten at the next state save time.

The same state file is used for both Base ("-fast") and Full ("-level #") sessions, which means
that after a partial or completed Base session, you can start a Full and vis will take advantage
of what's been done already. Conversely, after a partial or completed Full session, you can start
a Base and it will complete immediately. However, you cannot change fullvis level afterwards and
starting with version 2.20, this will be enforced.

There is a "-nosave" option to disable the AutoSave feature altogether.

==================================================================================================

Tip : When you leave your computer for processing a lengthy operation (e.g. RVis), make sure
      you're using a very simple screen saver (e.g. the one that just makes the screen black).
      Modern CPU intensive screen savers can _easily_ add 50-100% processing time.

==================================================================================================

Original Vis/Light/BspInfo source code by John Carmack,       http://www.idsoftware.com
RVis modification by Antony Suter, TeamFortress Software,     antony -at- teamfortress -dot- com
Several modifications inspired by Tyrann's RVis+ and TyrLite, http://disenchant.net
IKLite features inspired by Iikka Keränen's IKLite,           http://www.planetquake.com/ikq
LightDLX features inspired by Neal White III's LightDLX,      nwhite -at- softblox -dot- com
ArghLite features inspired by Tim Wright's ArghLite,          argh -at- ntplx -dot- net
Delay 5 attenuation formula by Kinn,                          http://kinn.spawnpoint.org

