diff --git a/Hydrogent/interface/HnRenderer.hpp b/Hydrogent/interface/HnRenderer.hpp index e75e02ea..46075f38 100644 --- a/Hydrogent/interface/HnRenderer.hpp +++ b/Hydrogent/interface/HnRenderer.hpp @@ -49,6 +49,8 @@ struct HnRendererCreateInfo /// Depth-buffer format. TEXTURE_FORMAT DSVFormat = TEX_FORMAT_UNKNOWN; + bool FrontCCW = false; + bool ConvertOutputToSRGB = false; /// Camera attributes constant buffer. @@ -60,7 +62,7 @@ struct HnRendererCreateInfo struct HnDrawAttribs { - float4x4 CameraViewProj = float4x4::Identity(); + float4x4 Transform = float4x4::Identity(); int DebugView = 0; float OcclusionStrength = 1; diff --git a/Hydrogent/src/HnRendererImpl.cpp b/Hydrogent/src/HnRendererImpl.cpp index fc6cc260..db1813c5 100644 --- a/Hydrogent/src/HnRendererImpl.cpp +++ b/Hydrogent/src/HnRendererImpl.cpp @@ -79,6 +79,7 @@ HnRendererImpl::HnRendererImpl(IReferenceCounters* pRefCounters, PBRRendererCI.RTVFmt = CI.RTVFormat; PBRRendererCI.DSVFmt = CI.DSVFormat; + PBRRendererCI.FrontCCW = CI.FrontCCW; PBRRendererCI.AllowDebugView = true; PBRRendererCI.UseIBL = true; PBRRendererCI.UseAO = true; @@ -253,15 +254,15 @@ void HnRendererImpl::Draw(IDeviceContext* pCtx, const HnDrawAttribs& Attribs) pCtx->SetIndexBuffer(pIB, 0, RESOURCE_STATE_TRANSITION_MODE_TRANSITION); { - MapHelper pAttribs{pCtx, m_PBRRenderer->GetPBRAttribsCB(), MAP_WRITE, MAP_FLAG_DISCARD}; + MapHelper pDstShaderAttribs{pCtx, m_PBRRenderer->GetPBRAttribsCB(), MAP_WRITE, MAP_FLAG_DISCARD}; - pAttribs->Transforms.NodeMatrix = Mesh.GetTransform(); - pAttribs->Transforms.JointCount = 0; + pDstShaderAttribs->Transforms.NodeMatrix = Mesh.GetTransform() * Attribs.Transform; + pDstShaderAttribs->Transforms.JointCount = 0; - static_assert(sizeof(pAttribs->Material) == sizeof(ShaderAttribs), "The sizeof(PBRMaterialShaderInfo) is inconsistent with sizeof(ShaderAttribs)"); - memcpy(&pAttribs->Material, &ShaderAttribs, sizeof(ShaderAttribs)); + static_assert(sizeof(pDstShaderAttribs->Material) == sizeof(ShaderAttribs), "The sizeof(PBRMaterialShaderInfo) is inconsistent with sizeof(ShaderAttribs)"); + memcpy(&pDstShaderAttribs->Material, &ShaderAttribs, sizeof(ShaderAttribs)); - auto& RendererParams = pAttribs->Renderer; + auto& RendererParams = pDstShaderAttribs->Renderer; RendererParams.DebugViewType = Attribs.DebugView; RendererParams.OcclusionStrength = Attribs.OcclusionStrength; diff --git a/PBR/src/PBR_Renderer.cpp b/PBR/src/PBR_Renderer.cpp index 772c134d..587b8fc5 100644 --- a/PBR/src/PBR_Renderer.cpp +++ b/PBR/src/PBR_Renderer.cpp @@ -660,8 +660,8 @@ void PBR_Renderer::CreatePSO(IRenderDevice* pDevice, IRenderStateCache* pStateCa RT0.SrcBlend = BLEND_FACTOR_SRC_ALPHA; RT0.DestBlend = BLEND_FACTOR_INV_SRC_ALPHA; RT0.BlendOp = BLEND_OPERATION_ADD; - RT0.SrcBlendAlpha = BLEND_FACTOR_INV_SRC_ALPHA; - RT0.DestBlendAlpha = BLEND_FACTOR_ZERO; + RT0.SrcBlendAlpha = BLEND_FACTOR_ONE; + RT0.DestBlendAlpha = BLEND_FACTOR_INV_SRC_ALPHA; RT0.BlendOpAlpha = BLEND_OPERATION_ADD; {