Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions res/gamedata/shaders/r5/shared/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ cbuffer static_globals : register(b2)
float4 dev_param_2;
float4 dev_param_3;
float4 dev_param_4;

float4 gamma_params; // x=invGamma, y=brightness, z=contrast
};

/*
Expand Down
Binary file modified res/gamedata/shaders/r5/tonemap.ps
Binary file not shown.
2 changes: 1 addition & 1 deletion src/Layers/xrRender/FGRenderBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ class FGRenderBase : public IRender, public pureFrame

protected:
bool b_loaded{ false };
CGammaControl m_Gamma;

private:
void ConvertLegacyAssetsToPBRImpl();

CGammaControl m_Gamma;
std::thread m_pbrConversionThread;
};
}
2 changes: 1 addition & 1 deletion src/Layers/xrRender/FSkinnedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ inline void q_tc(s16& dst, float val)
}

#ifdef _DEBUG
float errN(Fvector3 v, u8* qv)
inline float errN(Fvector3 v, u8* qv)
{
Fvector3 uv;
uv.set(float(qv[0]), float(qv[1]), float(qv[2])).div(255.f).mul(2.f).sub(1.f);
Expand Down
3 changes: 2 additions & 1 deletion src/Layers/xrRender/FrameGraphPasses/ShaderConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,9 @@ struct alignas(16) StaticGlobals {
Fvector4 dev_param_2;
Fvector4 dev_param_3;
Fvector4 dev_param_4;
Fvector4 gamma_params; // x=invGamma, y=brightness, z=contrast
};
static_assert(sizeof(StaticGlobals) == 848, "StaticGlobals must be 848 bytes");
static_assert(sizeof(StaticGlobals) == 864, "StaticGlobals must be 864 bytes");

// Legacy alias for compatibility
using GlobalConstants = StaticGlobals;
Expand Down
12 changes: 12 additions & 0 deletions src/Layers/xrRender/FrameGraphPasses/TonemapPassSetup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "Layers/xrRender/FrameGraph/RenderPassBuilder.h"
#include "Layers/xrRender/FrameGraph/ShaderCache.h"
#include "Layers/xrRender/RenderContext/RenderContext.h"
#include "Layers/xrRender/FrameGraphPasses/ShaderConstants.h"
#include "Layers/xrRender/FrameGraph/ShaderLoader.h"
#include "Layers/xrRender/RenderContext/RenderDevice.h"

Expand Down Expand Up @@ -154,8 +155,19 @@ framegraph::VirtualResourceHandle setupTonemapPass(
if (!vsRefl || !psRefl)
return;

auto staticGlobalsCB = cache.GetOrCreateVolatileCB("Frame", "StaticGlobals",
sizeof(passes::StaticGlobals), ctx->GetDevice());

auto* exposureTexture = fg.GetPhysicalTexture(data.exposureInput);
if (!exposureTexture)
exposureTexture = ps->fallbackExposureTexture;

framegraph::BindingSetBuilder bsb(*vsRefl, *psRefl, device, "Tonemap");
bsb.Texture("t_hdr", hdrTexture);
if (exposureTexture)
bsb.Texture("t_exposure", exposureTexture);
if (staticGlobalsCB)
bsb.ConstantBuffer("static_globals", staticGlobalsCB);
auto bindingSet = cache.GetOrCreateBindingSet(bsb.Build(), ps->bindingLayout, device);
if (!bindingSet)
return;
Expand Down
6 changes: 6 additions & 0 deletions src/Layers/xrRender/r_FrameGraphRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,12 @@ void FrameGraphRenderer::Render() {
auto staticGlobalsCB = cache.GetOrCreateVolatileCB("Frame", "StaticGlobals", sizeof(passes::StaticGlobals), m_device);
auto staticGlobalsData = passes::BuildStaticGlobals();

{
float G, B, C; Fcolor Balance;
m_Gamma.GetIP(G, B, C, Balance);
staticGlobalsData.gamma_params.set(1.0f / (G + 0.001f), B, C, 0.0f);
}

auto& clm = fg::ClusteredLightManager::Instance();
if (clm.IsReady() && clm.GetLightCount() > 0) {
float zNear = VIEWPORT_NEAR;
Expand Down
2 changes: 1 addition & 1 deletion src/Layers/xrRender/xr_effgamma.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CGammaControl
void Gamma(float G) { fGamma = G; }
void Brightness(float B) { fBrightness = B; }
void Contrast(float C) { fContrast = C; }
void GetIP(float& G, float& B, float& C, Fcolor& Balance)
void GetIP(float& G, float& B, float& C, Fcolor& Balance) const
{
G = fGamma;
B = fBrightness;
Expand Down
6 changes: 2 additions & 4 deletions src/xrGame/CharacterPhysicsSupport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,9 +573,8 @@ void CCharacterPhysicsSupport::in_UpdateCL()
#endif
update_animation_collision();
m_character_shell_control.CalculateTimeDelta();
if (m_pPhysicsShell)
if (m_pPhysicsShell && m_pPhysicsShell->isFullActive())
Comment thread
L1SP marked this conversation as resolved.
Outdated
{
VERIFY(m_pPhysicsShell->isFullActive());
m_pPhysicsShell->SetRagDoll(); //Теперь шела относиться к классу объектов cbClassRagDoll

if (!is_imotion(m_interactive_motion)) //! m_flags.test(fl_use_death_motion)
Expand Down Expand Up @@ -679,9 +678,8 @@ bool CCharacterPhysicsSupport::CollisionCorrectObjPos(const Fvector& start_from,
box.set(movement()->Box());
else
{
if (m_pPhysicsShell)
if (m_pPhysicsShell && m_pPhysicsShell->isFullActive())
{
VERIFY(m_pPhysicsShell->isFullActive());
Fvector sz, c;
get_box(m_pPhysicsShell, mXFORM, sz, c);
box.setb(Fvector().sub(c, m_EntityAlife.Position()), Fvector(sz).mul(0.5f));
Expand Down