point entities recognition is malformed in general
leak is about point entities, detection by origin key presence is weak, because there may exist entity w/o this key at 0 0 0
group entities may have origin too
detection by primitives presence haven't been working for _decal, as its primitive gets freed at this point
New code produces same result without loop at all, so
it cannot fall in infinite loop, and it is faster in
use cases requiring more than one loop in previous code.
The Unvanquished vega map is known to trigger the bug:
https://github.com/UnvanquishedAssets/map-vega_src.dpkdir
I reproduced it multiple time on various hardware (8 core FX-9590,
12 core/24 thread Ryzen 9 3900X) with commit af40508 and using
final compilation profile edited to use -fastbounce instead
of -fast option.
The symptom is simple, q3map2 stucks there:
--- Radiosity (bounce 1 of 8) ---
--- RadCreateDiffuseLights ---
0...1...2...3..
Or somewhere else in that progression bar given your hardware
and the amount of core your CPU has.
When stuck, all the CPU cores are running 100% but the thread
never returns (a strace can reveals it, a gdb backtrace too).
Thanks to @slipher for the precious advices and improving my first
attempt to fix it.
For more information on the issue, I asked:
> which negative value never can become positive
> when incremented infinitely?
slipher said:
> for a double, any value less than -2^53 would have this property
> don't know for float off the top of my head
But then, it means that's theorically verified this loop was able
to run forever in some case.
I don't know what this code is doing anyway, but at least we can
keep the behaviour without requiring to understand it.
Correct math requires the ambient component of the lightgrid to be zero
in that case. However, q3 ignores lightgrid cells with all zero ambient
value, EVEN if the directed value is nonzero.
This change sets the ambient value to #010101 if it'd be pitch black. This
should be a minimal change without affecting light hue that fixes
lightgrid rendering. In engines like DarkPlaces, almost no map should
look different from this.
Fixes https://gitlab.com/xonotic/netradiant/-/issues/137
q3map2: fix inconsistency, introduced in d92c32d453
(_remap result could depend on _remap keys order, e.g. remapping src: moo/rock, moo/sand-rock by: rock, sand-rock suffix matches; rock could be used for moo/sand-rock)
fix -bsp crash with .bsp sent as map path
* fix: qer_editorimage, q3map_lightImage etc work with file names, containing period
(i.e. 'file.name.ext' names; don't StripExtension() twice in ImageLoad() for that)
The arrays were always meant to be variably sized, and objects are only ever allocated dynamically. Object size computations are simplified with this change.
Flexible arrays were introduced in C99, so this change means that we will require a C99-conforming compiler henceforth.
Move -keeplights help from -light stage to -bsp. Add other ~40 arguments
that were missing from help. My main focus was on the -convert stage
but I tried to document the rest as well. Some descriptions are copied
from message when enabling the option.
Running `q3map2 -fs_forbiddenpath -v mapname.map` would crash because
-v gets replaced with NULL in main().
Running `q3map2 -threads` would crash because missing next argument
for number of threads.
similar to -lightmapsize N: Size of lightmaps to generate (must be a power of two)
but instead of native external lightmaps enables hack to reference them in autogenerated shader (for vanilla Q3 etc)
The arrays were always meant to be variably sized, and objects are only ever allocated dynamically. Object size computations are simplified with this change.
Flexible arrays were introduced in C99, so this change means that we will require a C99-conforming compiler henceforth.
AAS_LoadAASLump will return 0/NULL in an error case. However it will also
return the input buffer pointer if length is 0, and the input buffer pointer
may be 0/NULL in the case where AAS_LoadAASLump is meant to allocate memory.
This means that it can return 0/NULL in a perfectly legal case where the lump
length is 0. Since AAS_LoadAASFile inteprets this as a fatal error, that's
bad.
I'm not sure how to best disambiguate this, but a low-touch fix is for the
caller of AAS_LoadAASLump to be OK with a returned NULL pointer if the lump
length is 0.
Also: added a missing break statement to avoid a spurious "don't know what to
do" message when using the aasinfo switch.
The settings in cfgq3.c had diverged from the actual fields and defaults in
these ways:
- extra field phys_maxacceleration
- missing fields phys_walkaccelerate, phys_swimaccelerate, rs_maxfallheight
- different defaults for phys_airaccelerate, phys_maxstep, phys_maxwaterjump
Also the code in aas_cfg.[ch] for reading the settings was missing
rs_maxfallheight.
It's brittle to require multiple different files to agree on these fields, but
rather than fix that issue this is just a band-aid to bring things back into
alignment so that custom configs based on the example file can be used again.
* brushexport plugin fix: invert Y during YZ swap; invert V of UV coords (correct texturing)
* brushexport plugin: default to 'Don't collapse' option
q3map2: * obj export: save in popular 'Y = Up, -Z = Forward' format
* picomodel::obj: load as popular 'Y = Up, -Z = Forward' format
* picomodel::obj: fix support of back references in faces
misc...
* fix scaling for doom3 brush format
* Pointfile function: try to also load .pts leak line file (q1), if .lin isn't found
* snap transform origin for flip commands
* change light intensity save format from %f to %g to prevent .99999 on transforms
* support 'stupid quake bug' (invert pitch in angles)(generic and miscmodel ents)(cfg: entities="quake" in .game)
* clipper: place 1st and 2nd points far, 3rd near to ease 3 points clipping
* fix: parsing of /* */ comments, having * or / inside
Radiant:
misc...
encapsulate RETURN_FALSE_IF_FAIL macros with do while 0: minus warnings
* button to call color selector from ents inspector color entry
* explanatory text on initial engine path configuration
* don't show Global preferences by default, except first start
* activate {xyview, camera, texbro glwidget} on mouse button press and scroll, so {texbro treeview and console} hotkeys do not override global ones
* activate windows, containing xyview, camera, texbro on mouse scroll
* fix: autoapplying trigger texture on entity creation is undoable
* fix: texbro m1/2 x2 work, when some tag is loaded
* bold key and spawnflags names in entity inspector entity description
* fix: +CameraFreeMove* command, +shift, -CameraFreeMove*, -shift = still moving (reason: caps letter)
* -backsplash (float)scale (float)distance: scale area lights backsplash fraction + set distance globally
(distance < -900 to omit distance setting); def = 1 23; real area lights have no backsplash (scale = 0)
q3map_backsplash shader keyword overrides this setting
Radiant:
binds...
* alt + m1 click/drag in component modes: select objects
misc...
* fix: selected entity and brush numbers display in 'Find brush' dialog
* prefer to display texture width and height in status bar over name (PANGO_ELLIPSIZE_START)
* allow search shortcut (ctr+f in win) in entity inspector -> entity class list
* fix: don't save empty group entities (but worldspawn)
binds...
* ctrl + shift + m1 (in texbro): open shader in external editor
misc...
* fix: do not unmaximize external shader editor on win
* fix: blank cursor in radiant after calling external shader editor on win
* fix shader editors stuff for non uindowses
* 'Shader Editor Command' preference is available on win (is used, if set; otherwise try default os action for file)
* fix: 'Shader Editor Command' preference allows selecting executable via dialog
* GDK_HAND2 cursor in clipper tool mode
* fix: clipper points have numeric labels
* '2d zoom in to mouse pointer' option works for alt + m2 zoom
* '3d zoom in to mouse pointer' option (def = yes)
* new slightly less careful, but much faster lightmaps packing algorithm (allocating... process)
* -slowallocate switch to enable old lightmaps packing algorithm
* Subsampling...collapsing...sorting...allocating...storing...projecting... timers
* new area lights backsplash algorithm ( by Jelvan ), hijacking temp area lights ( to simulate volumetric behavior of source ones )
* fix: create backsplash for area lights, while q3map_lightsubdivide'ing too
* no backsplash for area lights, if surf == sky
* report patches count in -info
* -exportents to exports entities to a .ent file
* unvanquished game support
* -fs_basepath: can be used more than once to look in multiple paths (Sets the given path as main directory of the game)
* -fs_game: can be used more than once (Sets a different game directory name (default for Q3A: baseq3))
* -fs_pakpath <dir>: Specify additional custom path to assets (can be used more than once to look in multiple paths)
* fix undocumented unexpected LokiInitPaths
* -help option (-h, --help)
* _setmaxstdio(2048) for windows
* game_qfusion update
Radiant:
misc...
* wrap long command lines in build menu -> customize
* map info dialog: + Total patches, Ingame entities, Group entities, Ingame group entities counts
* fix: map info dialog -> sort by count works
* fix of: minimize main wnd, close, start = cam, cons, texbro null size
* code fixes
* packer: !FAIL! msg for missing ingame resources, ~fail for the rest
* bumped stack size to 4Mb to fix crash for huge skies, using old shaders with fairly useless q3map_surfacelight + q3map_lightsubdivide < 999 combo
Radiant:
binds...
* F5: run first in the list or recently invoked build option
* F11: fullscreen
misc...
* opening *.map, sent via cmd line: enabled for non win32 too
* fix: textures find/replace wnd better default pos, size
* fix: crash in CSG::Subtract
* fix crash: main wnd maximized + 'start on primary monitor' off + monitors > 1
* correct save/restore of main wnd pos/size and maximized/fullscreened states
* scale widgets consistently along with main wnd, while using regular layout
* do not delete q3map2_*.shader on minimap generation
Radiant:
misc...
* fix: crash in CSG::BrushDeleteSelected
* fix: crash in Brush::windingForClipPlane
* disabled snapping of transform/pivot origin
* fix crash with nonpthreads xmllib + multithreading + output to system console
* number of code fixes
Radiant:
misc...
* fix: clone group ent / map import / saving map as : group ents name labels at 0,0,0;
* number of code fixes
* decompiling: fix: broken brushes, empty brush definitions; shut down too usual warnings; with -force tries to decompile model autoclip too
* decompiling: -fast mode for BSPToMap conversion
Radiant:
misc...
* _setmaxstdio(2048): tested max pk3s count: 1021
* curve: deform (randomize Z points coord at given amount)
* fix: number of problems, found by Visual Studio's static code analyser
(76ea7385dd)
Radiant:
misc...
* fix of: convert group entity to diff one = entity w/o objects
* asking for game path at 1st start, even if one, specified in .game exists (auto picking could make confused)
* disabled game autodetecting: (~2min awaiting on w7 in non admin mode was confusing)
* -brightness 0..alot, def 1: mimics q3map_lightmapBrightness, but globally + affects vertexlight
* -contrast -255..255, def 0: lighting contrast
* packer improvements
Radiant:
binds...
* entity inspector: Tab enters Key field, toggles between key/value fields; Del deletes keys; Esc quits
misc...
* improved mwheel 2d zoom by Neumond
* +makeRoom: like hollow, but extrudes faces outwards; for making rooms
* deactivating tex dirs tree after loading dir, so SPACE and ENTER aren't broken for 2D after that
* Regular, RegularLeft layouts: smaller console, bigger tex browser
* Rotate, Scale dialogs: values aren't erased on Enter, OK, Apply (are on cancel, esc)
* Rotate dialog: fix: new value in focused field wasn't taking in account on Enter
* +updating texture directories list on 'flush and reload shaders' (reloading shaderlist aswell)
* NumLock perspective window fix
* ctrl+k(ConnectEntities): friendlier to complex connections, takes in account existing keys
(priority: target > targetname > none)
* +'all Supported formats' default option in open dialogs
* defaulted show light radii
* camera fov: 90->110
* cubic clip: off by default; bigger def dist; fixed button's shortcut tip
* prefs: Min & Max texture thumbnail size + dependant on scale;
def = *scale .5, min 48, max 160 (makes range 96-320 visually differentiated)
* packer: +warnings on implicitMaps, mapNoComps
* packer: known problem: minizip crash, when trying to get file with 2039 year date from disk
* -repack: repacks multiple maps, strips out only required shaders; main argument is single bsp path or txt with full pathes to bsps
switches: -dbg: talkative mode; -png: include pngs, at highest priority; -complevel: -1..10, def 0, compression level
uses additional exclusions file repack.exclude with different logic
* packer: rewrote logic to make sure not to include excluded stuff
* packer: preserves file date, if grabbing file from .pk3 too
* packer: in case of missing *ingame* resources pk3 gets _FAILEDpack suffix
* -pk3: autopackager mode(complete Q3 support); bsp path as input; switches: -dbg - talkative mode, -png - include pngs, at highest priority
is using file 'gamename.exclude' to exclude vanilla game resources
tip: ioq3, netradiant, compiler (and packager) treat *.pk3dir directories as separate pk3 files
* shot down spammy warning about samplesize for lmsize<=128; -debugsamplesize to show
* numBspModels ('brusmodels') stat emitting
Radiant:
misc...
* filters toolbar (disableable)
* fix: shift + m1 click in tex browser to open shader in internal/external editor;
defaulted internal; focuses on wanted shader; correct opening/saving
* fix: angles "0 x 0" autoconvert to angle "x" on transform (was getting deleted w/o a trace)
* content of brush is determined now not by 1st side in brush definition (inconsistency!)
but on priority: liquid > fog > playerclip > nonsolid > solid
ex.: nodraw solid shader works now for hiding liquid or fog volume splits / unwanted faces
solid or nonsolid shader + face(s) of playerclip = playerclip
solid shader + face(s) of nonsolid = nonsolid (b4 could happen: 5nonsolid sides + 1solid = solid brush )
Radiant:
binds...
* make structural - alt+s
* shift+n - cycle patch tex projection
* ctrl+f - fit texture
* bind a, d in no mlook mode - CameraStrafeLeft/Right
menus...
* smartified content basically
* hidden killconnect for games, which are not nexuiz
* view-orthographic+: center 2d on selected (ctrl+shift+tab)
* removed parent from menu, regroup does work + isn't bugged
* edit+: SelectAllOfType (shift+a)
* view->show+: ToggleCrosshair, show size info, show grid
* view menu: +patch inspector
* curve->texture+: flip patch tex ( {ctrl}shift+i ), naturalize, cycle projection
* cleaned, updated help menu links,+: Mouse Shortcuts, recent offline&fixed Shader Manual,
netRadiant specific docs, lists of q3map2 switches/entity keys/shader directives
misc...
* removed note to save before going to preferences, project settings
* fog is automatically transparent
* Doom3LightRadius: failed to parse default light radius - spammy msg removed
* 1.5x bigger light ents (8->12u)
* longer list of recently opened (4->9)
* crosshair display: is saving in prefs
* defaulted Maya theme
* removed question to override current compile monitoring
* -clipdepth F, def 2, _clipdepth
* fixed model autoclip (64u thick brushes/no collision at all in some cases)
* pyramidal etc zillion (20!) of autoclip modes
* removed stuctural caulk in models, was broken anyway
Radiant:
misc...
* hollow: produces not intersecting brushes
* -bounceColorRatio 0..1 (ratio of colorizing sample by texture)
* -debugclip: autoclip debug, uses shaders debugclip, debugclip2
* >2GB makefile option, allows up to 3GB ram on 32bit, 4GB on 64bit
* speedup patch to use fast sqrt at some points of light phase, where precision is not needed
Radiant:
binds...
* paste to camera - shift+v (alt+v was leading to texBro-View menu)
fix * q3map_remapshader remaps anything fine, on all stages (effect is: postrenaming shader when things are have been done)
* typo at -dirtmode
Radiant:
misc...
* translucent textures are visible, while selected, too; +matching trans polys are visible simultaneously
* native surfaceparm noob support (no -custinfoparms needed)
* -noob in bsp phase: assign surfaceparm noob to all map surfaces
* surfaceparm ob: skip assigning surfaceparm noob with -noob on that
* farplane modes: radius+radius, origin2origin, exact (add r/o/e to the number to enable), < 0 works too
* samples+filter - enabled again, makes sense
* -vertexscale
* fixed -novertex, (0..1) sets
* quick q3map_novertexlight (?)
* fixed _clone _ins _instance (_clonename)
* -nolm - no lightmaps
* ent keys aliases:_sa - shadeangle;_ss - samplesize
* -shift N -shift X Y Z: shift whole map to some coords
* more fogs (256) (ingame appearence lots of ones might be bugged due to engine arrangement, needs testing)
* q3map_remapshader remaps anything fine, on all stages (effect is: postrenaming shader when things are have been done)
* fixed 'unknown argument 1' at -lightanglehl
* -nocmdline writting to worldspawn
Radiant:
binds...
* wasd camera binds, c - deSelect, z - delete
* ExpandSelectionToEntities - shift+e
* make detail - alt+d
* arbitrary rotation - shifr+r
* arbitrary scale - ctrl+shift+s
misc...
* fit width, fit height butts in surf inspector (for trims) (saves scales ratio)
add old TODO with ideas
Fixes a "buffer overflow detected" abort when compiled with _FORTIFY_SOURCE=1.
The realpath(3) function in glibc checks if the destination buffer is large
enough to hold up to PATH_MAX characters and aborts if that is not the case.
PATH_MAX doesn't have to be defined so assume that it's equal to 4096.
We should really be using pathconf(_PC_PATH_MAX) instead of a hard-coded value
but that means we can no longer use static buffers to hold paths.
Move one variable to the section it is used in, and remove one unnecessary
NULL check.
If si were NULL at that point, we would have segfaulted ages ago.
Signed-off-by: Lauri Kasanen <curaga@operamail.com>