Made RENDERPATH_GL20 require fbo support and always use it.
Implemented R_RenderTarget system for managing fbo and texture requests dynamically, reusing the same ones across frames - this means that the textures are now allocated much smaller and there is better handling of multiple CSQC viewports.
In the short-term this means that vid_samples antialiasing doesn't do anything, it will need to be reimplemented using fbo.
Fix some viewport issues with r_viewfbo and r_bloom by passing view size information when calling the various rendering subsystems - there are still a bunch of bugs but this is a temporary measure before rendertargets are put in.
CSQC polygonbegin functionality now uses the CL_MeshEntities system, this finally makes it possible to use shaders on those polygons.
UI elements (DrawQ_ system) now use the CL_MeshEntities system, but still renders the mesh the old way, shader support is planned.
DrawQ_Line no longer uses GL_LINES, it now produces a polygon in the CL_MeshEntities system, so shownetgraph and r_speeds_graph features now work on D3D9/DPSOFTRAST/GLES2 render paths.
Added MATERIALFLAG_VERTEXCOLOR as a special case for rgbgen vertex shaders that are being used by CL_MeshEntities meshes, currently this is an unlit type of material but lighting support for it is planned.
Added Draw_GetPicWidth, Draw_GetPicHeight, Draw_IsPicLoaded functions and moved cachepic_t to live in gl_draw.c (no longer visible to other modules).
Changed Draw_CachePic to use the R_SkinFrame_LoadExternal system, and reworked font loading to use Draw_CachePic rather than keeping track of textures itself. R_SkinFrame_LoadExternal can now load gfx.wad lumps and gfx/*.lmp files, and the embedded images have been moved to image.c as they are now returned as raw images, suitable for R_SkinFrame_LoadExternal to use.
Reworked cl_video code to not need the cl_dyntexture system (which has been removed); it still uses dynamic texture callbacks (which is a feature of rtexture_t).
Changed the parameters to Mod_LoadCustomMaterial and a few other model_shared.c functions to not assume loadmodel is the owner of memory and textures; this was necessary for Draw_CachePic to be able to use R_SkinFrame_LoadExternal.
Refactored R_UpdateEntityLighting to CL_UpdateEntityShading, which sets fields like ent->render_modellight_ambient.
Added texture->render_modellight_ambient and similar fields which concretely define how the material is to be rendered, so all of the various tweaks and modifiers are no longer buried in R_SetupShader_Surface which has now been refactored heavily.
Removed R_LightPoint as it's really not necessary - this change will make lit particles a little bit slower as R_CompleteLightPoint is a slightly more expensive function.
Refactored R_CompleteLightPoint to have more consistent code, changed the final color math so that it passes q1bsp/q2bsp lighting through unmodified.
Changed shading of tag_entity attachments - they now use the root entity's origin for shading, this fixes r_shadows where the shadows could go in different directions on CSQC entities (r_shadows code already contained a hack to work around this problem for network entities).
Renamed r_refdef.lightmapintensity and ambient to r_refdef.scene.lightmapintensity and ambientintensity.
Change default value of r_shadows_shadowmapscale from 1 to 0.25, so that
shadows cover a larger part of the level around the eye.
Change the way r_shadows 2 size is calculated so that it uses 1/4th of
the texture atlas size (at default this would be 2048 of 8192) rather
than 2*r_shadow_shadowmapping_maxsize (at default that was 2*512 = 1024
of 8192).
Make the semantics of CL_VM_UpdateView more clear - if CSQC is loaded, it is required to provide the CSQC_UpdateView function, and won't render a view if it does not call that, so we don't need to check its return value.
New alternative to fullbright: r_fullbright_directed.
Set this to 1, and anything EF_FULLBRIGHT or fullbright due to
r_fullbright or unlit map (but specifically not sprites and surfaces
with surfaceparm nolightmap) will have a directional effect applied to
them.
This mode is intended for testing maps in early development, and should
not be used for normal gameplay (although it should be rather harmless
there).
Manage resetting the key event state on video reinitialization centrally.
Fixes:
- No key state clear when SDL gets restarted.
- Key state clear was the wrong action - it allows all keys to get pressed
again, but does not actually release anything in cl_input.c, so e.g. +jump
binds stay pressed on vid_restart.
Only vid_wgl.c retains some vid-specific handling (reset of key state when
alt-tabbing out and back in) - there's a chance that we may need similar logic
in the other vid drivers; if so, it may be possible to do this in a shared
place too by watching for changes to vid_activewindow.
havoc [Sun, 25 Mar 2018 20:04:14 +0000 (20:04 +0000)]
Rewrote most of r_lightning.c, it now uses CL_MeshEntities in MESH_PARTICLES rather than its own rendering code.
Changed the texture generation so it is in the same orientation as the external texture to reduce some code duplication, and changed the look of it to more closely mimic the model-based lightning.
havoc [Sun, 25 Mar 2018 19:58:39 +0000 (19:58 +0000)]
Add CL_MeshEntities_*, every frame in the client all MESH_ entities are added to the frame if they have any surfaces - surfaces can be created with Mod_Mesh_AddSurface and friends. These entities have full material rendering support, which should allow reducing the number of special case renderable objects in the scene in future.
Add Mod_Mesh functions - these allow creation of dynamic mesh models.
Add Mod_LoadCustomMaterial which initializes a texture_t using a skinframe and some parameters, useful with Mod_Mesh and CL_MeshEntities.
havoc [Sat, 24 Mar 2018 21:35:50 +0000 (21:35 +0000)]
Change r_showbboxes to have outlined edges of the box, and the box is now rendered as doublesided which feels more consistent when moving in/out of large trigger boxes and similar.
Added r_showbboxes_client which shows bboxes of clientside qc entities.
havoc [Sat, 24 Mar 2018 21:34:21 +0000 (21:34 +0000)]
Add entity number to showtex overlay.
Add clientside qc entity support to showtex - trace is performed on client and server and the shorter one will be shown.
havoc [Sat, 24 Mar 2018 17:47:32 +0000 (17:47 +0000)]
Add skipmaterialflagsmask feature to TraceLine and friends - this allows more sensible skipping of non-occluders by material (MATERIALFLAGMASK_TRANSLUCENT is now useful).
Recreated TracePoint code from TraceLine code to make it set depth variables properly.
havoc [Sat, 17 Mar 2018 07:35:38 +0000 (07:35 +0000)]
Fix a bug with PRVM_64 where CSQC float stats were sent by aliasing to int64 and returning as int32, now correctly converts to float and then uses a union to get the int32 representation.
havoc [Sun, 11 Mar 2018 19:24:42 +0000 (19:24 +0000)]
Rework R_CanSeeBox a bit to support an eyejitter feature, and make it available throughout the renderer.
Make TraceLineOfSight check if the trace endpos is within a box, not just if fraction is 1 - this makes it much more likely to say an object is visible when the object overlaps walls and other obstacles as the rays only need to reach the box, it doesn't matter much where it goes inside the box.
havoc [Sun, 11 Mar 2018 19:08:41 +0000 (19:08 +0000)]
Change shadowless rtlights so that they are not occluded by anything - no pvs checks or portal culling.
This makes r_shadow_deferred 0 look the same as r_shadow_deferred 1 - lights fill their whole area if there are no shadows to block them.
This also fixes a popping issue with r_shadow_deferred 1 where the eye was not in a leaf the light considered to be visible, and thus the light was not drawn (which made quite a difference when you move back and forth between leafs that were and were not lit), since when it was drawn it lit everything in the area.
havoc [Sun, 11 Mar 2018 19:04:22 +0000 (19:04 +0000)]
Don't set MATERIALFLAG_NOSHADOW on SKY materials. They need to cast shadows to prevent issues in e1m7 and other cases where sky occludes light bleed into other areas.
But when loading Q1BSP, set MATERIALFLAG_NOSHADOW on SKY if it has non-SOLID contents behind it, this supports the e1m5 logo shadow trick.
havoc [Wed, 30 Aug 2017 04:29:14 +0000 (04:29 +0000)]
Fix GLSL shader to only specify invariant gl_Position on the vertex shader, not the fragment shader - woops, this is what I get for not testing that change.
havoc [Sun, 6 Aug 2017 15:33:55 +0000 (15:33 +0000)]
Use the invariant keyword on gl_Position on GLSL 1.20 or higher and GLSL ES
1.00 or higher, this should resolve zfighting between light polygons and
base surfaces.
A long long time ago this was using ftransform() which ensured invariance but use of the invariant keyword was not added when we switched away from that.
Thanks for the bug report:
https://www.reddit.com/r/quake/comments/6rwwm5/need_some_help_getting_quake_running_with/
SDL2: combine SDL_KEYDOWN events directly with following SDL_TEXTINPUT events when possible.
This solves ` keypresses that open/close the console also typing in a character
"once and for all". The ability to type the ` character into the console is not
impaired by this as con_closeontoggleconsole's logic to by default ignore the
toggleconsole key when in the console but not at the beginning of the line
still applies.
rcon server: add an explicit check against empty password, instead of assuming the calling code is correct.
This logic had a bug in the past that had been introduced by r8886 and
accidentally fixed when introducing multi-account support in r9420. The bug was
that rcon_password being empty led to the empty password being accepted in some
cases, as there was never any explicit logic to handle that in rcon - it was
more "accidentally" rejected by a packet formatting check which does not apply
to srcon as the empty password wouldn't be empty over the wire.
In other words: DP builds from [r8886, r9419] had a serious vulnerability and
the only workaround is to always have rcon_password set.
The check added here will complain and reject in case the calling code for some
reason no longer prevents empty passwords from being accepted.
Also adding comments to the new logic explaining how it prevents the empty
password from being accepted.
Fix a bug in collisions between brushes and brushes when the plane is rotating - this case is never used currently but it's definitely a bug worth fixing.
Fix bugs in ModList_RebuildList such that it no longer lists files in the quake directory as gamedirs.
These bugs were previously hidden by a different behavior in FS_CheckNastyPath until 20140716 where directories with a period in their name were skipped, but that was not a complete solution.
havoc [Sat, 14 Jan 2017 19:33:33 +0000 (19:33 +0000)]
added separate cl_nopred cvar to use when playing on qw servers since
players expect prediction in quakeworld, now cl_movement is only used on
dp6/dp7 servers.
divverent [Wed, 11 Jan 2017 21:50:45 +0000 (21:50 +0000)]
Travis changes for Xonotic:
- Do not require root any more.
- Change the i386 build to build on Ubuntu directly, not in a chroot created using debootstrap.
- Remove the -isysroot option for OS X as the path broke after some Travis change.
havoc [Tue, 3 Jan 2017 03:25:39 +0000 (03:25 +0000)]
Fix some crashes affecting dedicated quake servers where texture->materialshaderpass is NULL. A few other tweaks to ca_dedicated checks that were redundant.
havoc [Mon, 2 Jan 2017 01:12:46 +0000 (01:12 +0000)]
Fix rogue mission pack (Dissolution of Eternity) plasma launcher which
uses velocity so small initially that SV_CheckVelocity was zeroing it in
the denormal check - the threshold has been lowered by 3 digits since
this was really only meant to detect denormals, not mess with real
numbers
havoc [Mon, 2 Jan 2017 00:26:06 +0000 (00:26 +0000)]
change shadowmapping atlas from 4096x4096 to 8192x8192 because it looks
bad when it has to degrade shadowmap resolution to fit into 4096x4096
some of the time in start.bsp
this texture size is 256MB and should fit on most video cards...
havoc [Sat, 10 Dec 2016 19:50:51 +0000 (19:50 +0000)]
Fix bug in loading additional skins after the ones that exist in the model in mdl loader, which resulted in the missing texture being shown because the skin referenced a texture beyond num_textures.
vic [Fri, 2 Dec 2016 20:19:47 +0000 (20:19 +0000)]
Use tighter bounds for bouncegrid texture
Calculate bounds enclosing all lights instead of using the world bounds.
Maps with unlit monster containers such as e1m7 benefit from reduced RAM usage.
The input destination is toggled on the first event, and the console then would
receive the charcode events. Binds work differently though - their action is
queued into the console buffer, and executed at the end of the frame!
havoc [Tue, 29 Nov 2016 03:24:12 +0000 (03:24 +0000)]
Rewrote bouncegrid path splatting, it now has a cone shape which grows with distance, which reduces the splotchy look (cvars r_shadow_bouncegrid_lightpathsize_initial and r_shadow_bouncegrid_lightpathsize_conespread control this).
Replaced r_shadow_bouncegrid_(static|dynamic)_energyperphoton with r_shadow_bouncegrid_(static|dynamic)_quality cvar which works opposite the old one and is automatically multiplied by spacing^2 so you no longer have to hand-tune it when changing spacing.
Turned off r_shadow_bouncegrid_blur by default - it's still useful but no longer completely necessary.
Replaced r_shadow_bouncegrid_dynamic_stablerandom with r_shadow_bouncegrid_rng_type (which defaults to Lehmer 128bit RNG) and added r_shadow_bouncegrid_rng_seed (which can be set to -1 for the time-based random that stablerandom <= 0 used to trigger).
havoc [Mon, 28 Nov 2016 03:56:16 +0000 (03:56 +0000)]
Fix severe bugs in mul128 implementation which was breaking the Lehmer RNG.
Added gcc specific implementation of mul128 using __int128 intrinsic type.
Added unit tests for mul128 implementation.
Added r_shadow_bouncegrid_normalizevectors cvar, default on, this slightly brightens typical scenes, some more affected than others.
Changed the behavior of r_shadow_bouncegrid_dynamic_stablerandom to also affect static mode, changed it to use the light position as the RNG seed, and changed the meaning of stablerandom 1 to be lhcheeserandom again as it is fast and of sufficient quality, the Lehmer RNG is available as stablerandom 2 but it has a framerate hit in dynamic mode that I can't ignore.
havoc [Sun, 27 Nov 2016 21:52:57 +0000 (21:52 +0000)]
Changed bouncegrid to use its own buffers (Mem_Alloc) instead of R_FrameData_Alloc because bouncegrid can be > 500MB per allocation which is unreasonable pressure on R_FrameData_Alloc.
Reduce memory when using r_shadow_bouncegrid_blur by ping-ponging between two buffers rather than three.
Reduce memory when using small values of r_shadow_bouncegrid_(static|dynamic)_spacing by disabling blur and instead effectively increasing r_shadow_bouncegrid_lightpathsize by 2 (the result is identical, just slower).
havoc [Sun, 27 Nov 2016 21:36:38 +0000 (21:36 +0000)]
Don't allocate resize buffer for texture upload if the texture does not need to be resized (this helps with memory pressure on the bouncegrid texture which was causing a huge memory alloc every frame in dynamic mode).
havoc [Sun, 27 Nov 2016 21:29:12 +0000 (21:29 +0000)]
Add skipsupercontentsmask parameter to all the collision implementations, this allows you to ignore brushes/surfaces matching the specified contents flags, the primary use is ignoring q1bsp sky surfaces which are SUPERCONTENTS_SKY and SUPERCONTENTS_SOLID, since SUPERCONTENTS_SOLID is in the hitsupercontentsmask it will normally block on sky surfaces, but this way it will not if they also have SUPERCONTENTS_SKY set.
Use the new skipsupercontentsmask feature for bouncegrid traces and certain other light traces.