Files
sbox-public/engine/Sandbox.Engine/Systems/SceneSystem/SceneSpotLight.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

56 lines
1.1 KiB
C#

using NativeEngine;
namespace Sandbox;
/// <summary>
/// A simple spot light scene object for use in a <see cref="SceneWorld"/>.
/// </summary>
[Expose]
public sealed class SceneSpotLight : SceneLight
{
/// <summary>
/// The inner cone of the spotlight, in half angle degrees.
/// </summary>
public float ConeInner
{
get { return lightNative.GetTheta(); }
set { lightNative.SetTheta( value ); }
}
/// <summary>
/// The outer cone of the spotlight, in half angle degrees
/// </summary>
public float ConeOuter
{
get { return lightNative.GetPhi(); }
set { lightNative.SetPhi( value ); }
}
public float FallOff
{
get { return lightNative.GetFallOff(); }
set { lightNative.SetFallOff( value ); }
}
public SceneSpotLight( SceneWorld world, Vector3 position, Color color ) : base()
{
Assert.IsValid( world );
using ( var h = IHandle.MakeNextHandle( this ) )
{
CSceneSystem.CreateSpotLight( world );
}
LightColor = color;
Position = position;
QuadraticAttenuation = 1.0f;
Radius = 100;
}
public SceneSpotLight( SceneWorld world ) : this( world, Vector3.Zero, Color.White * 10.0f )
{
}
}