mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-22 05:09:37 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
50 lines
1.2 KiB
C#
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 );
|
|
}
|
|
}
|