Implement gl_outline, fixing some of the issues with my previous attempt.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@5502 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2019-08-03 02:07:40 +00:00
parent 26e527a8a6
commit 707fba95cd
5 changed files with 30 additions and 17 deletions

View File

@ -569,7 +569,10 @@ void M_Menu_Audio_f (void)
extern cvar_t nosound, snd_leftisright, snd_device, snd_khz, snd_speakers, ambient_level, bgmvolume, snd_playersoundvolume, ambient_fade, cl_staticsounds, snd_inactive, _snd_mixahead, snd_doppler;
// extern cvar_t snd_noextraupdate, snd_eax, precache;
#ifdef VOICECHAT
extern cvar_t snd_voip_capturedevice, snd_voip_play, snd_voip_send, snd_voip_test, snd_voip_micamp, snd_voip_vad_threshhold, snd_voip_ducking, snd_voip_noisefilter, snd_voip_codec;
extern cvar_t snd_voip_capturedevice, snd_voip_play, snd_voip_send, snd_voip_test, snd_voip_micamp, snd_voip_vad_threshhold, snd_voip_ducking, snd_voip_codec;
#ifdef HAVE_SPEEX
extern cvar_t snd_voip_noisefilter;
#endif
#endif
static const char *soundqualityoptions[] = {
@ -691,7 +694,9 @@ void M_Menu_Audio_f (void)
MB_COMBOCVAR("Activation Mode", snd_voip_send, voipsendoptions, voipsendvalue, NULL),
MB_SLIDER("Act. Threshhold", snd_voip_vad_threshhold, 0, 30, 1, NULL),
MB_CHECKBOXCVAR("Audio Ducking", snd_voip_ducking, 0),
#ifdef HAVE_SPEEX
MB_CHECKBOXCVAR("Noise Cancelation", snd_voip_noisefilter, 0),
#endif
MB_COMBOCVAR("Codec", snd_voip_codec, voipcodecoptions, voipcodecvalue, NULL),
#endif

View File

@ -127,7 +127,7 @@ cvar_t r_lightmap = CVARF ("r_lightmap", "0",
cvar_t r_wireframe = CVARAFD ("r_wireframe", "0",
"r_showtris", CVAR_CHEAT, "Developer feature where everything is drawn with wireframe over the top. Only active where cheats are permitted.");
cvar_t r_outline = CVARD ("gl_outline", "0", "Draw some stylised outlines.");
cvar_t r_outline_width = CVARD ("gl_outline_width", "0", "The width of those outlines.");
cvar_t r_outline_width = CVARD ("gl_outline_width", "2", "The width of those outlines.");
cvar_t r_wireframe_smooth = CVAR ("r_wireframe_smooth", "0");
cvar_t r_refract_fbo = CVARD ("r_refract_fbo", "1", "Use an fbo for refraction. If 0, just renders as a portal and uses a copy of the current framebuffer.");
cvar_t r_refractreflect_scale = CVARD ("r_refractreflect_scale", "0.5", "Use a different scale for refraction and reflection texturemaps. Because $reasons.");
@ -889,8 +889,8 @@ void Renderer_Init(void)
Cvar_Register (&r_telestyle, GRAPHICALNICETIES);
Cvar_Register (&r_wireframe, GRAPHICALNICETIES);
Cvar_Register (&r_wireframe_smooth, GRAPHICALNICETIES);
// Cvar_Register (&r_outline, GRAPHICALNICETIES);
// Cvar_Register (&r_outline_width, GRAPHICALNICETIES);
Cvar_Register (&r_outline, GRAPHICALNICETIES);
Cvar_Register (&r_outline_width, GRAPHICALNICETIES);
Cvar_Register (&r_refract_fbo, GRAPHICALNICETIES);
Cvar_Register (&r_refractreflect_scale, GRAPHICALNICETIES);
Cvar_Register (&r_postprocshader, GRAPHICALNICETIES);

View File

@ -110,13 +110,13 @@ typedef enum uploadfmt
PTI_R8_SNORM,
PTI_RG8_SNORM, //might be useful for normalmaps
//big formats
PTI_R16,
PTI_RGBA16,
PTI_R16, //useful for heightmaps
PTI_RGBA16, //if people use 16bit pngs, people get 16 bits per channel textures. muppets.
//floating point formats
PTI_R16F,
PTI_R32F,
PTI_RGBA16F,
PTI_RGBA32F,
PTI_RGBA16F, //consider using e5bgr9
PTI_RGBA32F, //usually overkill
//packed/misaligned formats: these are specified in native endian order (high bits listed first because that's how things are represented in hex), so may need byte swapping...
PTI_A2BGR10, //mostly for rendertargets, might also be useful for overbight lightmaps.
PTI_E5BGR9, //mostly for fancy lightmaps
@ -134,7 +134,7 @@ typedef enum uploadfmt
PTI_BC2_RGBA_SRGB,
PTI_BC3_RGBA, //maybe add a bc3 normalmapswizzle type for d3d9?
PTI_BC3_RGBA_SRGB,
PTI_BC4_R8,
PTI_BC4_R8, //greyscale, kinda
PTI_BC4_R8_SNORM,
PTI_BC5_RG8, //useful for normalmaps
PTI_BC5_RG8_SNORM, //useful for normalmaps

View File

@ -157,7 +157,7 @@
// Other Audio Options
#define VOICECHAT
//#define HAVE_SPEEX //Support the speex codec.
#define HAVE_SPEEX //Support the speex codec.
#define HAVE_OPUS //Support the opus codec.
#define HAVE_MEDIA_DECODER //can play cin/roq, more with plugins
#define HAVE_MEDIA_ENCODER //capture/capturedemo work.

View File

@ -166,6 +166,7 @@ struct {
float identitylighting; //set to how bright world lighting should be (reduced by realtime_world_lightmaps)
float identitylightmap; //set to how bright lightmaps should be (reduced by overbrights+realtime_world_lightmaps)
polyoffset_t polyoffset; //mode-specific polygon offsets...
texid_t temptexture; //$current
texid_t fogtexture;
@ -228,12 +229,8 @@ static void BE_PolyOffset(void)
po.unit += r_polygonoffset_submodel_offset.value;
}
#endif
if (shaderstate.mode == BEM_DEPTHONLY)
{
extern cvar_t r_polygonoffset_shadowmap_offset, r_polygonoffset_shadowmap_factor;
po.factor += r_polygonoffset_shadowmap_factor.value;
po.unit += r_polygonoffset_shadowmap_offset.value;
}
po.factor += shaderstate.polyoffset.factor;
po.unit += shaderstate.polyoffset.unit;
#ifndef FORCESTATE
if (shaderstate.curpolyoffset.factor != po.factor || shaderstate.curpolyoffset.unit != po.unit)
@ -3998,6 +3995,7 @@ qboolean GLBE_LightCullModel(vec3_t org, model_t *model)
//Note: Be cautious about using BEM_LIGHT here, as it won't select the light.
void GLBE_SelectMode(backendmode_t mode)
{
extern cvar_t r_polygonoffset_shadowmap_offset, r_polygonoffset_shadowmap_factor;
extern int gldepthfunc;
// shaderstate.lastuniform = 0;
@ -4007,6 +4005,8 @@ void GLBE_SelectMode(backendmode_t mode)
{
shaderstate.mode = mode;
shaderstate.flags = 0;
shaderstate.polyoffset.factor = 0;
shaderstate.polyoffset.unit = 0;
switch (mode)
{
default:
@ -4023,6 +4023,8 @@ void GLBE_SelectMode(backendmode_t mode)
);
break;
case BEM_DEPTHONLY:
shaderstate.polyoffset.factor = r_polygonoffset_shadowmap_factor.value;
shaderstate.polyoffset.unit = r_polygonoffset_shadowmap_offset.value;
#ifndef GLSLONLY
if (!gl_config_nofixedfunc)
{
@ -6343,11 +6345,17 @@ void GLBE_DrawWorld (batch_t **worldbatches)
{
shaderstate.identitylighting = 0;
shaderstate.identitylightmap = 0;
r_refdef.flipcull = SHADER_CULL_FLIP;
BE_SelectMode(BEM_DEPTHDARK);
qglLineWidth (bound(0.1, r_outline_width.value, 2000.0));
shaderstate.polyoffset.unit = -25;
shaderstate.polyoffset.factor = -0.05;
qglEnable(GL_POLYGON_OFFSET_LINE);
qglLineWidth (bound(0.1, r_outline_width.value, 3.0));
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
GLBE_SubmitMeshes(NULL, SHADER_SORT_PORTAL, SHADER_SORT_SEETHROUGH+1);
BE_SelectMode(BEM_STANDARD);
qglDisable(GL_POLYGON_OFFSET_LINE);
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
qglLineWidth (1);
}