Files
XCEngine/managed/XCEngine.ScriptCore/DirectionalShadowData.cs

84 lines
2.3 KiB
C#

namespace XCEngine
{
public sealed class DirectionalShadowData
{
internal static readonly DirectionalShadowData Default =
new DirectionalShadowData(
false,
Matrix4x4.Identity,
0.0f,
0.1f,
0.0f,
0,
0,
0.0f,
0.0f,
0.0f,
0.0f,
0.0f,
0);
internal DirectionalShadowData(
bool enabled,
Matrix4x4 viewProjection,
float orthographicHalfExtent,
float nearClipPlane,
float farClipPlane,
int mapWidth,
int mapHeight,
float worldTexelSize,
float receiverDepthBias,
float normalBiasScale,
float shadowStrength,
float depthBiasFactor,
int depthBiasUnits)
{
this.enabled = enabled;
this.viewProjection = viewProjection;
this.orthographicHalfExtent =
orthographicHalfExtent;
this.nearClipPlane = nearClipPlane;
this.farClipPlane = farClipPlane;
this.mapWidth = mapWidth;
this.mapHeight = mapHeight;
this.worldTexelSize = worldTexelSize;
this.receiverDepthBias = receiverDepthBias;
this.normalBiasScale = normalBiasScale;
this.shadowStrength = shadowStrength;
this.depthBiasFactor = depthBiasFactor;
this.depthBiasUnits = depthBiasUnits;
}
public bool enabled { get; }
public Matrix4x4 viewProjection { get; }
public float orthographicHalfExtent { get; }
public float nearClipPlane { get; }
public float farClipPlane { get; }
public int mapWidth { get; }
public int mapHeight { get; }
public float worldTexelSize { get; }
public float receiverDepthBias { get; }
public float normalBiasScale { get; }
public float shadowStrength { get; }
public float depthBiasFactor { get; }
public int depthBiasUnits { get; }
public bool hasShadowMap =>
enabled &&
mapWidth > 0 &&
mapHeight > 0;
}
}