havoc [Tue, 21 Jan 2020 08:36:34 +0000 (08:36 +0000)]
Split the global cmd interpreter into 4 separate ones for specific uses (client console, server console, client commands received from server, server commands received from clients), this is intended to make clients more robust against malicious servers by restricting which commands make sense.
This also hides some network protocol implementation details from the console command interpreter, and makes the command list a lot shorter in dedicated servers.
Changed Cbuf_LockThreadMutex/Cbuf_UnlockThreadMutex to Cbuf_Lock/Cbuf_Unlock and they now use a spinlock internally.
havoc [Fri, 17 Jan 2020 06:24:40 +0000 (06:24 +0000)]
R_CanSeeBox no longer uses collision_cache for the random traces, only the fixed positions (corners, etc), random rays were simply wasting resources in the collision_cache.
havoc [Fri, 17 Jan 2020 06:22:09 +0000 (06:22 +0000)]
Overhauled r_shadow_bouncegrid, it performs much faster, makes use of as many threads as you wish, and has a nicer calculation for light path accumulation.
r_shadow_bouncegrid now does refractive index calculations on water surfaces, it's not very obvious yet because the traceline doesn't return texture information (if it did, there would be cool caustics effects in dynamic mode).
Implemented TaskQueue system for simple threaded tasks (fibers but less featureful), this is used by r_shadow_bouncegrid but will be used by other parts of the engine in future, also added Thread_Atomic* functions.
havoc [Wed, 15 Jan 2020 12:53:04 +0000 (12:53 +0000)]
Overhauled bouncegrid light splatting for performance reasons - instead of a series of radial dots being accumulated in the texture, it is spherical distance from line segment calculations performed at each pixel, optimized to process pixels in order (filtering down the list of splat paths in each loop). This is a big framerate increase (as raytracing was not the bottleneck at all), and could be threaded in theory.
This required rebalancing the way that spacing interacts with quality, and the conespread parameter has been eliminated (as measuring distance to a non-uniform capsule seems especially challenging, but maybe that could be added back someday), so all parameters have changed a bit.
havoc [Wed, 15 Jan 2020 09:01:10 +0000 (09:01 +0000)]
Fix UI rendering to not use the bouncegrid texture; it looked interesting on the console text but was definitely a bug - now tracks a ui parameter on several surface drawing functions, and triggers the notrippy path in the material rendering as one wouldn't want r_trippy affecting UI either.
Fix a bug that caused bouncegrid to render black if any light was culled by traces (return that was supposed to be a continue).
Changed default values for these cvars to make bouncegrid emphasize the bounced light more, but also reduce the intensity:
r_shadow_bouncegrid_dynamic_directionalshading : 0 -> 1
r_shadow_bouncegrid_dynamic_lightradiusscale : 2 -> 5
r_shadow_bouncegrid_dynamic_maxbounce : 2 -> 5
r_shadow_bouncegrid_static_lightradiusscale 2 -> 5
r_shadow_bouncegrid_intensity 4 -> 1
havoc [Tue, 7 Jan 2020 10:25:49 +0000 (10:25 +0000)]
Fix PRVM_ValueString and PRVM_UglyValueString to check for out of bounds
dereference on a value provided by VM code, and also a NULL pointer
check for another field type.
After migrating to SDL2 interfaces there is noise during startup fix
this by initializng buffer as specification requires.
Per SDL_AudioCallback spec:
The callback must completely initialize the buffer; as of SDL 2.0, this buffer is not initialized before the callback is called. If there is nothing to play, the callback should fill the buffer with silence.
havoc [Sun, 26 May 2019 03:04:36 +0000 (03:04 +0000)]
Implement SDL2 AUDIO_F32 format and use it as the default, since it has become the preferred format of more platforms these days, and SDL2 uses it internally.
Improved the fallback mechanism on SDL2 audio setup - by removing it; SDL2 will tell us what changes it makes for the format, and it will convert the rest automatically.
divverent [Mon, 4 Feb 2019 15:09:01 +0000 (15:09 +0000)]
Remove code for r_equalize_entities*.
r_fullbright_directed and slapping EF_FULLBRIGHT on these entities works a lot
better. I believe other than Xonotic nobody uses this, and Xonotic used it only
to make some fullbright stuff prettier and that's been removed for a few months
now.
After this change, older Xonotic versions will complain about nonexisting flag
at startup, but I bet no player will even notice the difference - all it changes
is that EF_FULLBRIGHT entities will appear less directionally, and
r_fullbright_directed 1 will fix this in a better way (already set in current
Xonotic).
divverent [Fri, 19 Oct 2018 07:38:00 +0000 (07:38 +0000)]
Do not build VBOs on a dedicated server.
Fixes crash at startup of dedicated server in Quake and Xonotic
(probably in everything).
The only reason why this ever worked before was that Mod_BuildVBOs's
main callee R_Mesh_CreateMeshBuffer did a GL2 feature test before
calling into anything VBO related (and on a dedicated server, which does
not initialize GL, the test always returns false); however now that we
require GL32, the feature test is gone and thus the crash happened. An
explicit check for being a dedicated server fixes that.
divverent [Fri, 19 Oct 2018 07:02:35 +0000 (07:02 +0000)]
Make CDAudio_Play_byName static.
It isn't called by any other compilation units, but only internally by
other cd_shared.c functions; more importantly, it does not check for
music_playlist being active like CDAudio_Play does, which would at the
very least be confusing if someone were to add a string version of
qw_svc_cdtrack (WHY WOULD ONE).
divverent [Fri, 19 Oct 2018 06:40:49 +0000 (06:40 +0000)]
Remove the CONFIG_CD macro, and enable faketracks unconditionally.
All support for playing back CD-DA has been removed by leaving only the
SDL2 clients, and it is rather unlikely for CD-DA support to come back.
However while doing so, the CONFIG_CD macro was disabled in the makefile
but not the MSVC project, which broke faketracks (i.e. background music
via track003.ogg files) on Linux.
This change removes all #ifdefs for CONFIG_CD as well as its enablement
in the MSVC project, which is basically equivalent to having the feature
always being enabled.
Fixes background music in Quake with ripped music, Nexuiz, Xonotic, and
probably many other DP-based games. Also fixes Xonotic log spam about
gettime(GETTIME_CDTRACK).
Added vid_conwidthauto cvar which updates vid_conwidth based on vid_conheight and aspect ratio (honoring vid_pixelheight), this defaults on for better usability.
Go back to defining GL enums ourselves rather than relying on SDL_opengl.h on desktop.
Relying on SDL_opengl.h broke the dedicated server build which does not rely on SDL - having better code isolation of the OpenGL code would make this hack unnecessary.
havoc [Sun, 5 Aug 2018 21:39:11 +0000 (21:39 +0000)]
Upload the VBOs for Mod_Mesh models (such as the UI) during Mod_Mesh_Finalize.
Refactored the vbooffset handling in models to allow different vertex buffers for each array (this would only happen in the dynamic case when a buffer is recycled - so some code makes that assumption about dynamic buffers when freeing these).
havoc [Sun, 13 May 2018 05:06:07 +0000 (05:06 +0000)]
Removed per-platform clients (wgl/glx/agl) - now only SDL2 client
exists.
Removed dedicated server from VS2017 projects - it's not really needed.
Removed cd_sdl.c since SDL1.2 support is not maintained, and the SDL2
code path in it is equivalent to cd_null.c as SDL2 does not support
controlling cd audio playback - also removed cd_null.c and the
corresponding code in cd_shared.c, which now only uses faketrack mode.
havoc [Sun, 6 May 2018 04:39:34 +0000 (04:39 +0000)]
Remove r_vertexgeneric_t, r_vertexmesh_t, vid.interleavedarrays and code related to them.
Refactor r_showsurfaces code to modify the rsurface.batchlightmapcolor4f in place instead of using the R_Mesh_PrepareVertices_Generic_Lock/Unlock functions which have been removed.
havoc [Wed, 2 May 2018 07:23:56 +0000 (07:23 +0000)]
Remove Mod_CreateCollisionMesh and reduce the exposed API of Mod_ShadowMesh, it really doesn't need to support most of the things it supports as only compiled shadowmaps use it now.
havoc [Wed, 2 May 2018 07:17:13 +0000 (07:17 +0000)]
Remove model->surfmesh.shadowmesh which was a vertex-welded version of the regular surfmesh, we don't need that as we're not computing triangle neighbors as shadow volume support was removed.
havoc [Tue, 1 May 2018 06:48:05 +0000 (06:48 +0000)]
Fix a crash on Doombringer duel5.bsp where one of the lights has more than 32768 triangles - this was using more than one shadowmesh and the sidetotals code was written incorrectly to assume there is a single shadowmesh per light - so now shadowmeshes are preallocated large enough for the entire model, to ensure there is only one.
havoc [Tue, 1 May 2018 02:48:46 +0000 (02:48 +0000)]
Generate a pvs for refraction renders just like for reflection renders, this fixes a water rendering issue in the Doombringer map duel2.bsp where certain leafs did not include the necessary pvs data (or something was wrong with how the renderer used the existing vis data).
In light of the above, allow r_wateralpha when r_water is used, even if the bsp is not watervised - this works for all non-recursive cases (so the elder hall water pool in start.bsp is still broken).
Fix bugs with unloading of cachepic skinframes in QC menus - the reloading was broken in some weird way that made it white (it wasn't reusing the skinframe).
Simplify Draw_CachePic behaviors with regards to NewPic and textureflags (mismatch now causes texture reload rather than having multiple with the same name in memory).
Improved reloading of unloaded pics by reusing the existing skinframe, so it can not produce duplicates.
Make Draw_NewPic clear the pic->autoload flag, this is a behavior change in VM_CL_ReadPicture.