rendering: formalize main light shadow params
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <XCEngine/Core/Math/Vector2.h>
|
||||
#include <XCEngine/Core/Math/Vector3.h>
|
||||
#include <XCEngine/Core/Math/Vector4.h>
|
||||
#include <XCEngine/Rendering/FrameData/RenderCameraData.h>
|
||||
@@ -50,11 +51,32 @@ struct RenderAdditionalLightData {
|
||||
float spotAngle = 0.0f;
|
||||
};
|
||||
|
||||
struct RenderDirectionalShadowMapMetrics {
|
||||
Math::Vector2 inverseMapSize = Math::Vector2::Zero();
|
||||
float worldTexelSize = 0.0f;
|
||||
float padding = 0.0f;
|
||||
};
|
||||
|
||||
static_assert(
|
||||
sizeof(RenderDirectionalShadowMapMetrics) == sizeof(float) * 4u,
|
||||
"RenderDirectionalShadowMapMetrics must stay float4-sized for GPU constant layout");
|
||||
|
||||
struct RenderDirectionalShadowSamplingData {
|
||||
float enabled = 0.0f;
|
||||
float receiverDepthBias = 0.0f;
|
||||
float normalBiasScale = 0.0f;
|
||||
float shadowStrength = 0.0f;
|
||||
};
|
||||
|
||||
static_assert(
|
||||
sizeof(RenderDirectionalShadowSamplingData) == sizeof(float) * 4u,
|
||||
"RenderDirectionalShadowSamplingData must stay float4-sized for GPU constant layout");
|
||||
|
||||
struct RenderDirectionalShadowData {
|
||||
bool enabled = false;
|
||||
Math::Matrix4x4 viewProjection = Math::Matrix4x4::Identity();
|
||||
Math::Vector4 shadowParams = Math::Vector4::Zero();
|
||||
Math::Vector4 shadowOptions = Math::Vector4::Zero();
|
||||
RenderDirectionalShadowMapMetrics mapMetrics = {};
|
||||
RenderDirectionalShadowSamplingData sampling = {};
|
||||
RHI::RHIResourceView* shadowMap = nullptr;
|
||||
|
||||
bool IsValid() const {
|
||||
|
||||
@@ -91,8 +91,8 @@ private:
|
||||
|
||||
struct ShadowReceiverConstants {
|
||||
Math::Matrix4x4 worldToShadow = Math::Matrix4x4::Identity();
|
||||
Math::Vector4 shadowBiasAndTexelSize = Math::Vector4::Zero();
|
||||
Math::Vector4 shadowOptions = Math::Vector4::Zero();
|
||||
RenderDirectionalShadowMapMetrics shadowMapMetrics = {};
|
||||
RenderDirectionalShadowSamplingData shadowSampling = {};
|
||||
};
|
||||
|
||||
struct SkyboxConstants {
|
||||
|
||||
@@ -12,6 +12,9 @@ class Scene;
|
||||
|
||||
namespace Rendering {
|
||||
|
||||
// Planning-only knobs for fitting the single main-light shadow camera to the
|
||||
// current view. Receiver-side bias/filtering parameters live in runtime shadow
|
||||
// data and are not configured here.
|
||||
struct DirectionalShadowPlanningSettings {
|
||||
uint32_t mapDimension = 1024u;
|
||||
float minFocusDistance = 5.0f;
|
||||
|
||||
Reference in New Issue
Block a user