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.
Reworked v_isometric code significantly, it now defaults to a proper isometric view and some maps are actually playable like this.
Added R_Viewport_InitOrtho3D which more correctly implements the VF_PERSPECTIVE=0 case for CSQC, with correct camera orientation and all that. This may break existing mods that tried to use that feature but I doubt there are any as it was pretty broken before.
Reworked how R_CanSeeBox (and other vis code) determine if the view is able to use vieworigin based culling or not, this is now a separate property (r_refdef.view.usevieworiginculling) and can be turned on or off for reflection views and such. This is also exposed as v_isometric_usevieworiginculling for the v_isometric case.
Changed how polygonbegin guesses if the geometry is 2D or 3D, it now uses a separate variable rather than relying on r_refdef.draw2dstage.
Reworked DrawQ_* and R_RenderView code to make clear distinctions between 2D and 3D code, this removes a lot of unnecessary calls to DrawQ_FlushUI (including ones that happened in R_RenderView).
Added R_DebugLine which takes a line in world coordinates and adds it as a 2D line in CL_Mesh_UI.
Added r_showparticleedges and r_showspriteedges debugging cvars which make use of R_DebugLine.
Added v_isometric cvars, this mode is mostly a curiosity but it's useful for testing engine compatibility with non-perspective rendering.
Fixed a few bugs where distance culling was misbehaving with non-perspective rendering.
Make r_refdef.view.ismain more useful - it's now cleared after R_RenderView rather than before, so R_RenderView can make use of it (for r_motionblur ghost texture updates and anything else that wants to happen just on the main view).
Added r_cullentities_trace_expand and pad cvars, these configure additional ways to expand entity boxes when culling by traceline.
Added r_vis_trace feature which allows you to turn on traceline-based culling of portals, and r_vis_trace_surfaces lets you cull surfaces by traceline (slow and probably pointless, but a curious feature).
Added r_shadow_culllights_trace_expand and pad cvars.
Added sv_cullentities_trace_expand to make SV_CanSeeBox be at feature parity with R_CanSeeBox.
Enable PRVM_64 - the QuakeC VM will run as 64bit (using int64/double rather than int/float).
This means that levels can run for > 10 hours without time precision issues, and float flags values can have flags ranging up to 54 bits rather than 24 bits.
There may be bugs, and physics is still using 32bit floats in a bunch of places so this does not enable huge worlds currently.
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.