Commit Graph

35 Commits

Author SHA1 Message Date
Ozkan Sezer 8797c8c384 r_brush.c (AllocBlock): use calloc() to not leave uninitialized memory.
keeps valgrind happy.
2021-08-27 17:03:00 +03:00
Ozkan Sezer 9ca7d499e5 fixed -Wshadow warnings. 2021-06-23 04:37:10 +03:00
Ozkan Sezer da43c6a57b r_brush.c (AllocBlock): add a FIXME note about a valgrind warning.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1645 af15c1b1-3010-417e-b628-4374ebc0bcbd
2019-11-11 09:35:19 +00:00
Ozkan Sezer 196f89a239 GL_BuildLightmaps: minor warning fixes. more accurate developer warning.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1637 af15c1b1-3010-417e-b628-4374ebc0bcbd
2019-09-18 09:17:24 +00:00
Ozkan Sezer 57ad299dfa r_brush.c (AllocBlock): add casts to malloc and realloc
( in case someone wants to build using C++ compilers. )

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1634 af15c1b1-3010-417e-b628-4374ebc0bcbd
2019-09-16 11:00:38 +00:00
Eric Wasylishen e041b958c7 r_brush.c: dynamically allocate lightmaps, from QuakeSpasm-Spike
This raises LMBLOCK_WIDTH/HEIGHT from 128 to 256 which should
be supported everywhere and decrease draw calls

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1628 af15c1b1-3010-417e-b628-4374ebc0bcbd
2019-09-12 06:49:35 +00:00
Eric Wasylishen f2930ef460 r_brush.c: rename BLOCK_WIDTH/HEIGHT to LMBLOCK_WIDTH/HEIGHT to match QSS
(no other changes)

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1627 af15c1b1-3010-417e-b628-4374ebc0bcbd
2019-09-12 06:49:27 +00:00
Eric Wasylishen 4fe5f6956f Adjust "exceeds standard limit of" debug warnings to include the actual QS limit.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1386 af15c1b1-3010-417e-b628-4374ebc0bcbd
2017-03-30 06:26:16 +00:00
Ozkan Sezer f3af6bf791 Fixed -Wmisleading-indentation warnings from new gcc6.
The warning from gl_model.c:Mod_LoadTextures() seemed
like a real bug: Eric please check and confirm.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1301 af15c1b1-3010-417e-b628-4374ebc0bcbd
2016-04-28 21:47:12 +00:00
Eric Wasylishen e007116a5d Alias model VBO renderer: restructure so each model is stored in a separate VBO and load them in Mod_LoadAliasModel, rather than R_NewMap.
Initially I thought that we would never need to draw an alias model that hadn't been precached when R_NewMap runs, but this assumption turned out to be incorrect. This fixes the issue where progs/bolt.mdl wasn't rendering in the Scourge Done Slick demos.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1253 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-09-20 20:10:49 +00:00
Eric Wasylishen 01faf4e5b6 new cvars: r_lavaalpha, r_slimealpha, r_telealpha for fine-tuning specific liquid opacities (from DirectQ, RMQEngine)
new worldspawn keys: _wateralpha, _lavaalpha, _slimealpha, _telealpha, _skyfog (unique to Quakespasm)

The lava/slime/telealpha cvars are non-archived, and default to 0, which means to use the value of r_wateralpha, so they have no effect by default.

The worldspawn keys allow custom maps to set these values in a way that only applies while the map is loaded, and doesn't change the cvar value. (similar to the behaviour of the "fog" worldspawn key.) They are accepted with or without the underscore, like "fog".

see also:
http://forums.insideqc.com/viewtopic.php?f=3&t=5532
http://celephais.net/board/view_thread.php?id=60452&start=937

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1238 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-07-26 21:51:25 +00:00
Eric Wasylishen 1f3c1a711a Make "exceeds standard limit of" messages only display when developer cvar is set, with a new Con_DWarning function.
Have heard these are confusing players and mappers/modders; people assume there is an error or a limit in QS is exceeded, but the messages are only about exceeding the limits in vanilla WinQuake/GLQuake.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1211 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-05-25 01:48:03 +00:00
Eric Wasylishen 112c8b68b8 Alias model rendering fast-path using OpenGL 2.
In GL_MakeAliasModelDisplayLists, after saving the standerd triangle strips and fans onto the hunk, if the system is GL2 capable, we also save a second version of the mdl on the hunk designed to be loaded into a VBO (GL_MakeAliasModelDisplayLists_VBO). In R_NewMap, and on video mode changes, we call GLMesh_LoadVertexBuffers which loops over all precached mdl's and loads the data into a pair of VBO's (vertices and vertex indices).

Finally, in R_DrawAliasModel, assuming no rendering options are disabling the fast-path (r_drawflat 1, r_lightmap 1, or r_fullbright 1 would disable it), we call GL_DrawAliasFrame_GLSL, which sets up all of the bindings and draws the (possibly lerped) mdl in one glDrawElements call.

Special thanks to MH for some of the code from RMQEngine and the general concept.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1151 af15c1b1-3010-417e-b628-4374ebc0bcbd
2015-01-20 18:59:15 +00:00
Ozkan Sezer b9032b7815 copyright years, general tidy-up, remove unused d_ifacea.h.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1059 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-22 08:55:46 +00:00
Eric Wasylishen 90b26fc215 r_world: Add a new R_DrawTextureChains_Multitexture_VBO function. Draws lightmapped surfaces with fulbrights in one pass, using the VBO. Requires 3 TMUs, GL_COMBINE_EXT, and GL_ADD.
R_DrawTextureChains_Multitexture: revert to the way it was before VBO support was added.
gl_texmgr: expose GL_SelectTexture. make the implementation less convoluted and support 3 TMUs.
gl_vidsdl: check GL_MAX_TEXTURE_UNITS
r_brush: only create VBOs if 3 TMUs available

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1035 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-20 01:08:13 +00:00
Eric Wasylishen e0680cb6d3 Load world and brush models into a VBO, and draw it in batches in R_DrawTextureChains_Multitexture. Uses the same immediate mode code as before if VBOs are not available, or if "-novbo" used at the command line. I only touched R_DrawTextureChains_Multitexture because it's usually the main bottleneck aside from alias model rendering.
This seems to help fps a fair bit on maps with a lot of world polys like jam2_tronyn. Tried on a few computers with intel and nvidia gpus, windows, mac os, linux, and there's always at least some fps improvement. Best case was 70fps -> 96fps on jam2_tronyn, on OS X + nvidia 650gt.

Interested to hear how this works for amd gpu's, just do a timedemo with and without "-novbo".

Only downside is I had to disable the fast path in Vid_Toggle_f() because at least with SDL1, the vbo no longer works after a toggle. So as a result, fullscreen toggles with alt-enter are slightly slower.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1018 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-09-11 04:55:16 +00:00
Ozkan Sezer b8fc8caa0f dropped support for GL_SGIS_multitexture
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@984 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-30 08:00:34 +00:00
Eric Wasylishen 9c6f93eb8a Remove R_DrawSequentialPoly and use texture chains for drawing brush models.
To make this work with the drawing order we use in gl_rmain (world excluding water, opaque ents, world water, transparent ents), I made each texture_t have two texture chains, one for world and one for bmodels. This way they can be cleared during entity drawing without having to regenerate the world ones.

Other than this the changes are mostly minor adjustments to the R_DrawTextureChains_* functions so they can work for things other than the world.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@979 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-29 08:27:22 +00:00
Eric Wasylishen 890fe165e8 Revert r968, optimization in R_DrawSequentialPoly. Going to try a deeper change that uses the world drawing code for bmodels.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@978 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-29 08:27:16 +00:00
Eric Wasylishen d10512a72b Fence texture support on brush models, e.g. for rmqdemo2 e1m6rq.bsp. Based on Baker's implementation in Fitz Mark V. Consistent with Fitz Mark V, RMQEngine, FTEQW rendering.
Not implemented for world polys (afaik it's useless for world polys) but could be added if needed.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@970 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-19 02:20:12 +00:00
Eric Wasylishen 0824c53967 r_brush.c: small optimization in R_DrawSequentialPoly; move the drawing of fullbrights to a separate function, and draw them in a separate pass through the polys of the brush mode. This reduces the amount of texture binding. The extreme case would be, e.g. 1000 polys with one texture (with fullbrights), before would require 2000 binds, after would require 2 binds. This gets part way to the performance of https://sourceforge.net/p/quakespasm/patches/14/ with much less code change
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@968 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-17 21:12:54 +00:00
Eric Wasylishen d9f78442fe AllocBlock: cache index of last used lightmap, start search there
Can speed up map loading by multiple seconds on levels with a lot of lightmaps, at a cost of using slightly more lightmaps (about 5% more).

https://sourceforge.net/p/quakespasm/patches/20/


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@956 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-08-05 18:22:58 +00:00
Ozkan Sezer ef1c613c9f dynamic light speedup, patch from Eric Wasylishen, based on an earlier work by MH.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@933 af15c1b1-3010-417e-b628-4374ebc0bcbd
2014-07-12 07:01:58 +00:00
Ozkan Sezer 6c23dcd91f comment cleanup
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@814 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-20 06:22:42 +00:00
Ozkan Sezer 204c6290b2 convert our GL_RGB lightmaps to GL_RGBA which gives considerable
performance boost on some systems. add GL_BGRA as an option, thanks
to Kristian Duske. the format is hardcoded as GL_RGBA for now,
need a way to make it configurable later.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@813 af15c1b1-3010-417e-b628-4374ebc0bcbd
2013-02-20 06:01:10 +00:00
Ozkan Sezer 5f6a2d7820 Fixed increased (more than 32) dynamic lights.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@694 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-07-10 11:21:17 +00:00
Ozkan Sezer dbdd675552 renamed model_t to qmodel_t in order to avoid conflicts on solaris.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@676 af15c1b1-3010-417e-b628-4374ebc0bcbd
2012-05-30 08:56:06 +00:00
Steven 9b721b0a01 z-fighting (flickering gl texture clash most notable in e1m1) bug fix, from Sander.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@480 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-08-24 07:47:29 +00:00
Ozkan Sezer 4f95ba8ef8 fixed several gcc-4.6 -Wunused-but-set-variable warnings.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@442 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-12 12:36:04 +00:00
Ozkan Sezer 2bcdb4b39f just properly use (u)intptr_t where necessary and don't do the cheap hack
of using size_t instead of it.  include stdint.h in q_stdinc.h for it.
for Visual Studio earlier than version 2010, use the header provided by
the msinttypes project.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@439 af15c1b1-3010-417e-b628-4374ebc0bcbd
2011-04-01 14:55:45 +00:00
Ozkan Sezer c24d592580 host_cmd.c, console.c, gl_draw.c, image.c, gl_model.c, r_sprite.c, cl_parse.c,
gl_warp.c, host.c, gl_mesh.c, gl_sky.c, gl_texmgr.c, cvar.c, sv_main.c, cvar.h,
gl_screen.c, r_brush.c, gl_vidsdl.c, zone.c, cl_main.c, cmd.c, snd_dma.c,
snd_mem.c, common.c, sv_phys.c: Added explicit casts to eliminate -Wc++-compat
warnings.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@170 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-05-31 07:42:36 +00:00
Ozkan Sezer 317e2d4bd5 make the code to compile with -fno-common flag:
glquake.h (dev_stats): Add extern.
(dev_peakstats): Likewise.
(dev_overflows): Likewise.
(lightmap_textures): Likewise.
(gl_warpimagesize): Likewise.
(r_drawflat_cheatsafe): Likewise.
(r_fullbright_cheatsafe): Likewise.
(r_lightmap_cheatsafe): Likewise.
(r_drawworld_cheatsafe): Likewise.
gl_texmgr.h (notexture): Likewise.
(nulltexture): Likewise.
(d_8to24table): Likewise.
(d_8to24table_fbright): Likewise.
(d_8to24table_nobright): Likewise.
(d_8to24table_conchars): Likewise.
(d_8to24table_shirt): Likewise.
(d_8to24table_pants): Likewise.
gl_screen.c (sb_lines): Remove and make it live only in sbar.c.
(vid): Remove and make it live only in gl_vid*.c
gl_vidsdl.c (m_state): Remove and make it live only in menu.c.
gl_vidnt.c (m_state): Likewise.
net_dgrm.c (m_state): Remove extern declaration.
menu.c (m_state): Tagged the m_state enum as m_state_e and moved it to menu.h.
Declared m_state as enum m_state_e.
menu.h (enum m_state_e): Moved from menu.c to here.
(m_state): Added extern declaration.
gl_rmain.c (r_drawflat_cheatsafe): Made the global to live here.
(r_fullbright_cheatsafe): Likewise.
(r_lightmap_cheatsafe): Likewise.
(r_drawworld_cheatsafe): Likewise.
gl_warp.c (gl_warpimagesize): Likewise.
host.c (dev_stats): Likewise.
(dev_peakstats): Likewise.
(dev_overflows): Likewise.
gl_texmgr.c (notexture): Likewise.
(nulltexture): Likewise.
(d_8to24table): Likewise.
(d_8to24table_fbright): Likewise.
(d_8to24table_nobright): Likewise.
(d_8to24table_conchars): Likewise.
(d_8to24table_shirt): Likewise.
(d_8to24table_pants[): Likewise.
r_brush.c (lightmap_textures): Likewise.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@117 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-04-22 19:02:29 +00:00
Ozkan Sezer f9928b24ac 64 bit compatibility effort, 2/nn: type correctness work in common.h,
gl_draw.c, gl_model.c, gl_sky.c, gl_texmgr.c, gl_texmgr.h, r_alias.c,
r_brush.c, r_part.c, r_world.c, snd_mem.c.  next step will be server
side (progs) work which is actually the heart of the problems.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@34 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 21:26:11 +00:00
Ozkan Sezer 68fc38c3a6 chase.c, cl_input.c, cl_parse.c, client.h, common.c, common.h, console.h,
cvar.h, draw.h, gl_draw.c, gl_fog.c, gl_mesh.c, gl_model.c, gl_model.h,
gl_rmain.c, gl_rmisc.c, gl_screen.c, gl_sky.c, gl_texmgr.c, glquake.h,
host.c, keys.c, keys.h, main.c, menu.c, menu.h, pr_cmds.c, quakedef.h,
r_alias.c, r_brush.c, r_part.c, r_sprite.c, r_world.c, sbar.c, sbar.h,
screen.h, snd_dma.c, snd_mem.c, snd_mix.c, sv_main.c, sys_sdl.c, vid.h,
view.h, world.c, world.h:  Loads of warning fixes about missing function
prototypes, missing parens around &, missing braces leading to ambiguous
else statements and unused and uninitialized variables. There are still a
couple of unitialised variables here and there, but not much. The warnings
about strict aliasing violations need taking care of.


git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@21 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-16 12:01:07 +00:00
Ozkan Sezer db613ab35d initial import of SDL port of Fitzquake-0.85 / 20090510 sources.
git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@2 af15c1b1-3010-417e-b628-4374ebc0bcbd
2010-02-15 23:26:55 +00:00