Files
sbox-public/engine/Sandbox.Engine/Systems/SceneSystem/SceneDirectionalLight.cs
s&box team 71f266059a Open source release
This commit imports the C# engine code and game files, excluding C++ source code.

[Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
2025-11-24 09:05:18 +00:00

50 lines
1.2 KiB
C#

using System;
using NativeEngine;
namespace Sandbox;
/// <summary>
/// A directional scene light that is used to mimic sun light in a <see cref="SceneWorld"/>. Direction is controlled by this objects' <see cref="Rotation"/>.
/// </summary>
[Expose]
public sealed class SceneDirectionalLight : SceneLight
{
/// <summary>
/// Ambient light color outside of all light probes.
/// </summary>
[Obsolete( "Use AmbientLight Component or World.AmbientLightColor Instead." )] public Color SkyColor { get; set; }
internal SceneDirectionalLight( HandleCreationData d ) : base( d )
{
}
public SceneDirectionalLight( SceneWorld sceneWorld, Rotation rotation, Color color ) : base()
{
Assert.IsValid( sceneWorld );
using ( var h = IHandle.MakeNextHandle( this ) )
{
CSceneSystem.CreateDirectionalLight( sceneWorld, rotation.Backward );
}
LightColor = color;
}
/// <summary>
/// Control number of shadow cascades
/// </summary>
public int ShadowCascadeCount
{
get { return lightNative.GetShadowCascades(); }
set { lightNative.SetShadowCascades( value ); }
}
/// <summary>
/// Set the max distance of the shadow cascade
/// </summary>
public void SetCascadeDistanceScale( float distance )
{
lightNative.SetCascadeDistanceScale( distance );
}
}