mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-03-21 10:11:01 +00:00
Add settings for soft particles in menu, documentation, cleanups
r_skipDepthCapture is now called r_enableDepthCapture, and instead of being a bool it's now an int with -1 meaning "enable if soft particles are used"
This commit is contained in:
parent
3c887d5af5
commit
724ab1727c
8 changed files with 62 additions and 19 deletions
|
@ -28,6 +28,14 @@ Note: Numbers starting with a "#" like #330 refer to the bugreport with that num
|
|||
downscaling by OpenAL's output limiter
|
||||
* If `r_windowResizable` is set, the dhewm3 window (when in windowed mode..) can be freely resized.
|
||||
Needs SDL2; with 2.0.5 and newer it's applied immediately, otherwise when creating the window.
|
||||
* "Soft" Particles (that don't "cut" into geometry but fade smoothly), based on code from The Dark Mod
|
||||
2.04. Can be enabled/disabled with `r_useSoftParticles`, is applied automatically for all appropriate
|
||||
particles (view-aligned and using additive or alpha blending).
|
||||
For custom particles you can configure this per particle stage, with the `"softeningRadius"` attribute.
|
||||
Generally it's the radius in Doom-Units used for fading, special values are `-2` (auto-mode, same
|
||||
as particles where this isn't specified at all) and `-1` (disable softening, render like in orig Doom3).
|
||||
* `r_enableDepthCapture`: Enable capturing depth buffer to texture, needed for the soft particles.
|
||||
Can be used in custom materials by using the `"_currentDepth"` texture.
|
||||
|
||||
|
||||
1.5.3 (2024-03-29)
|
||||
|
|
|
@ -210,6 +210,11 @@ This can be configured with the following CVars:
|
|||
at the end of each frame. Needed at least when using Wayland.
|
||||
`1`: do this, `0`: don't do it, `-1`: let dhewm3 decide (default)
|
||||
|
||||
- `r_useSoftParticles` Soften particle transitions when player walks through them or they cross solid geometry.
|
||||
Needs r_enableDepthCapture. Can slow down rendering! `1`: enable (default), `0`: disable
|
||||
- `r_enableDepthCapture` Enable capturing depth buffer to texture. `0`: disable, `1`: enable,
|
||||
`-1`: enable automatically (if soft particles are enabled; the default).
|
||||
This can be used in custom materials with the "_currentDepth" texture.
|
||||
- `r_useCarmacksReverse` Use Z-Fail ("Carmack's Reverse") when rendering shadows (default `1`)
|
||||
- `r_useStencilOpSeparate` Use glStencilOpSeparate() (if available) when rendering shadow (default `1`)
|
||||
- `r_scaleMenusTo43` Render full-screen menus in 4:3 by adding black bars on the left/right if necessary (default `1`)
|
||||
|
|
|
@ -1142,6 +1142,14 @@ static void InitBindingEntries()
|
|||
bindingEntries.Append( BindingEntry( bet ) );
|
||||
}
|
||||
|
||||
// player.def defines, in player_base, used by player_doommarine and player_doommarine_mp (and player_doommarine_ctf),
|
||||
// "def_weapon0" "weapon_fists", "def_weapon1" "weapon_pistol" etc
|
||||
// => get all those definitions (up to MAX_WEAPONS=16) from Player, and then
|
||||
// get the entities for the corresponding keys ("weapon_fists" etc),
|
||||
// which should have an entry like "inv_name" "Pistol" (could also be #str_00100207 though!)
|
||||
|
||||
// hardcorps uses: idCVar pm_character("pm_character", "0", CVAR_GAME | CVAR_BOOL, "Change Player character. 1 = Scarlet. 0 = Doom Marine");
|
||||
// but I guess (hope) they use the same weapons..
|
||||
const idDict* playerDict = GetEntityDefDict( "player_doommarine" );
|
||||
const idDict* playerDictMP = GetEntityDefDict( "player_doommarine_mp" );
|
||||
bool impulse27used = false;
|
||||
|
@ -1209,15 +1217,6 @@ static void InitBindingEntries()
|
|||
idStr impName = idStr::Format( "_impulse%d", i );
|
||||
bindingEntries.Append( BindingEntry( impName, impName ) );
|
||||
}
|
||||
|
||||
// player.def defines, in player_base, used by player_doommarine and player_doommarine_mp (and player_doommarine_ctf),
|
||||
// "def_weapon0" "weapon_fists", "def_weapon1" "weapon_pistol" etc
|
||||
// => get all those definitions (up to MAX_WEAPONS=16) from Player, and then
|
||||
// get the entities for the corresponding keys ("weapon_fists" etc),
|
||||
// which should have an entry like "inv_name" "Pistol" (could also be #str_00100207 though!)
|
||||
|
||||
// hardcorps uses: idCVar pm_character("pm_character", "0", CVAR_GAME | CVAR_BOOL, "Change Player character. 1 = Scarlet. 0 = Doom Marine");
|
||||
// but I guess (hope) they use the same weapons..
|
||||
}
|
||||
|
||||
// this initialization should be done every time the bindings tab is opened,
|
||||
|
@ -1666,8 +1665,31 @@ static CVarOption videoOptionsImmediately[] = {
|
|||
} ),
|
||||
CVarOption( "r_screenshotPngCompression", "Compression level for PNG screenshots", OT_INT, 0, 9 ),
|
||||
CVarOption( "r_screenshotJpgQuality", "Quality level for JPG screenshots", OT_INT, 1, 100 ),
|
||||
CVarOption( "r_useSoftParticles", []( idCVar& cvar ) {
|
||||
bool enable = cvar.GetBool();
|
||||
if ( ImGui::Checkbox( "Use Soft Particles", &enable ) ) {
|
||||
cvar.SetBool( enable );
|
||||
if ( enable && r_enableDepthCapture.GetInteger() == 0 ) {
|
||||
r_enableDepthCapture.SetInteger(-1);
|
||||
D3::ImGuiHooks::ShowWarningOverlay( "Capturing the Depth Buffer was disabled.\nEnabled it because soft particles need it!" );
|
||||
}
|
||||
}
|
||||
AddCVarOptionTooltips( cvar );
|
||||
} ),
|
||||
|
||||
CVarOption( "Advanced Options" ),
|
||||
CVarOption( "r_enableDepthCapture", []( idCVar& cvar ) {
|
||||
int sel = idMath::ClampInt( -1, 1, cvar.GetInteger() ) + 1; // +1 for -1..1 to 0..2
|
||||
if ( ImGui::Combo( "Capture Depth Buffer to Texture", &sel, "Auto (enable if needed for Soft Particles)\0Disabled\0Always Enabled\0" ) ) {
|
||||
--sel; // back to -1..1 from 0..2
|
||||
cvar.SetInteger( sel );
|
||||
if ( sel == 0 && r_useSoftParticles.GetBool() ) {
|
||||
r_useSoftParticles.SetBool( false );
|
||||
D3::ImGuiHooks::ShowWarningOverlay( "You disabled capturing the Depth Buffer.\nDisabling Soft Particles because they need the depth buffer texture." );
|
||||
}
|
||||
}
|
||||
AddCVarOptionTooltips( cvar );
|
||||
}),
|
||||
CVarOption( "r_skipNewAmbient", "Disable High Quality Special Effects", OT_BOOL ),
|
||||
CVarOption( "r_shadows", "Enable Shadows", OT_BOOL ),
|
||||
CVarOption( "r_skipSpecular", "Disable Specular", OT_BOOL ),
|
||||
|
@ -2262,7 +2284,7 @@ void DrawGameOptionsMenu()
|
|||
playerNameIso[40] = '\0'; // limit to 40 chars, like the original menu
|
||||
ui_nameVar->SetString( playerNameIso );
|
||||
// update the playerNameBuf to reflect the name as it is now: limited to 40 chars
|
||||
// and possibly containing '?' from non-translatable unicode chars
|
||||
// and possibly containing '!' from non-translatable unicode chars
|
||||
D3_ISO8859_1toUTF8( ui_nameVar->GetString(), playerNameBuf, sizeof(playerNameBuf) );
|
||||
} else {
|
||||
D3::ImGuiHooks::ShowWarningOverlay( "Player Name way too long (max 40 chars) or contains invalid UTF-8 encoding!" );
|
||||
|
|
|
@ -240,8 +240,9 @@ idCVar r_windowResizable("r_windowResizable", "1", CVAR_RENDERER | CVAR_ARCHIVE
|
|||
idCVar r_vidRestartAlwaysFull( "r_vidRestartAlwaysFull", 0, CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Always do a full vid_restart (ignore 'partial' argument), e.g. when changing window size" );
|
||||
|
||||
// DG: for soft particles (ported from TDM)
|
||||
idCVar r_skipDepthCapture( "r_skipDepthCapture", "0", CVAR_RENDERER | CVAR_BOOL, "skip depth capture" ); // #3877
|
||||
idCVar r_useSoftParticles( "r_useSoftParticles", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "soften particle transitions when player walks through them or they cross solid geometry" );
|
||||
idCVar r_enableDepthCapture( "r_enableDepthCapture", "-1", CVAR_RENDERER | CVAR_INTEGER,
|
||||
"enable capturing depth buffer to texture. -1: enable automatically (if soft particles are enabled), 0: disable, 1: enable", -1, 1 ); // #3877
|
||||
idCVar r_useSoftParticles( "r_useSoftParticles", "1", CVAR_RENDERER | CVAR_ARCHIVE | CVAR_BOOL, "Soften particle transitions when player walks through them or they cross solid geometry. Needs r_enableDepthCapture. Can slow down rendering!" ); // #3878
|
||||
|
||||
idCVar r_glDebugContext( "r_glDebugContext", "0", CVAR_RENDERER | CVAR_BOOL, "Enable OpenGL Debug context - requires vid_restart, needs SDL2" );
|
||||
|
||||
|
|
|
@ -558,15 +558,17 @@ void RB_STD_FillDepthBuffer( drawSurf_t **drawSurfs, int numDrawSurfs ) {
|
|||
RB_RenderDrawSurfListWithFunction( drawSurfs, numDrawSurfs, RB_T_FillDepthBuffer );
|
||||
|
||||
// Make the early depth pass available to shaders. #3877
|
||||
if ( backEnd.viewDef->renderView.viewID >= 0 // Suppress for lightgem rendering passes
|
||||
&& !r_skipDepthCapture.GetBool() )
|
||||
bool getDepthCapture = r_enableDepthCapture.GetInteger() == 1
|
||||
|| (r_enableDepthCapture.GetInteger() == -1 && r_useSoftParticles.GetBool());
|
||||
|
||||
if ( getDepthCapture && backEnd.viewDef->renderView.viewID >= 0 ) // Suppress for lightgem rendering passes
|
||||
{
|
||||
globalImages->currentDepthImage->CopyDepthbuffer( backEnd.viewDef->viewport.x1,
|
||||
backEnd.viewDef->viewport.y1,
|
||||
backEnd.viewDef->viewport.x2 - backEnd.viewDef->viewport.x1 + 1,
|
||||
backEnd.viewDef->viewport.y2 - backEnd.viewDef->viewport.y1 + 1,
|
||||
true );
|
||||
bool isPostProcess = false; // TODO
|
||||
bool isPostProcess = false;
|
||||
RB_SetProgramEnvironment( isPostProcess );
|
||||
}
|
||||
|
||||
|
|
|
@ -1441,8 +1441,8 @@ static void R_AddAmbientDrawsurfs( viewEntity_t *vEntity ) {
|
|||
|
||||
// Soft Particles -- SteveL #3878
|
||||
float particle_radius = -1.0f; // Default = disallow softening, but allow modelDepthHack if specified in the decl.
|
||||
if ( r_useSoftParticles.GetBool()
|
||||
&& !shader->ReceivesLighting() // don't soften surfaces that are meant to be solid
|
||||
if ( r_useSoftParticles.GetBool() && r_enableDepthCapture.GetInteger() != 0
|
||||
&& !shader->ReceivesLighting() // don't soften surfaces that are meant to be solid
|
||||
&& tr.viewDef->renderView.viewID >= 0 ) // Skip during "invisible" rendering passes (e.g. lightgem)
|
||||
{
|
||||
const idRenderModelPrt* prt = dynamic_cast<const idRenderModelPrt*>( def->parms.hModel ); // yuck.
|
||||
|
|
|
@ -984,7 +984,7 @@ extern idCVar r_materialOverride; // override all materials
|
|||
extern idCVar r_debugRenderToTexture;
|
||||
|
||||
extern idCVar r_glDebugContext; // DG: use debug context to call logging callbacks on GL errors
|
||||
extern idCVar r_skipDepthCapture; // DG: disable capturing depth buffer, used for soft particles
|
||||
extern idCVar r_enableDepthCapture; // DG: disable capturing depth buffer, used for soft particles
|
||||
extern idCVar r_useSoftParticles;
|
||||
|
||||
/*
|
||||
|
|
|
@ -453,7 +453,12 @@ void RB_ShowDepthBuffer( void ) {
|
|||
GL_State( GLS_DEPTHFUNC_ALWAYS );
|
||||
qglColor3f( 1, 1, 1 );
|
||||
|
||||
if ( !r_skipDepthCapture.GetBool() ) {
|
||||
bool haveDepthCapture = r_enableDepthCapture.GetInteger() == 1
|
||||
|| (r_enableDepthCapture.GetInteger() == -1 && r_useSoftParticles.GetBool());
|
||||
|
||||
if ( haveDepthCapture ) {
|
||||
//GL_SelectTexture( 0 );
|
||||
//qglEnable(GL_TEXTURE_2D);
|
||||
globalImages->currentDepthImage->Bind();
|
||||
|
||||
const float x=0, y=0, w=1, h=1;
|
||||
|
|
Loading…
Reference in a new issue