mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-04-21 06:48:11 -04:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
namespace Sandbox;
|
|
|
|
// I doubt this should ever be promoted, so it's a bit messy
|
|
internal sealed class SceneSkybox3D : IValid
|
|
{
|
|
public SceneWorld ParentWorld { get; set; }
|
|
public SceneWorld SkyboxWorld { get; set; }
|
|
|
|
public Vector3 Origin { get; set; }
|
|
public Vector3 CameraOrigin { get; set; }
|
|
public Angles Angles { get; set; }
|
|
public float Scale { get; set; } = 16.0f;
|
|
|
|
public SceneSkybox3D( SceneWorld parentWorld, SceneWorld skyboxWorld )
|
|
{
|
|
ParentWorld = parentWorld ?? throw new ArgumentNullException( nameof( parentWorld ) );
|
|
SkyboxWorld = skyboxWorld ?? throw new ArgumentNullException( nameof( skyboxWorld ) );
|
|
|
|
ParentWorld.native.Add3DSkyboxWorld( SkyboxWorld );
|
|
ParentWorld.InternalSkyboxWorlds.Add( this );
|
|
}
|
|
|
|
public void Update()
|
|
{
|
|
if ( !IsValid ) return;
|
|
ParentWorld.native.Set3DSkyboxParameters( Origin, Angles, Scale );
|
|
}
|
|
|
|
public bool IsValid => SkyboxWorld.IsValid();
|
|
|
|
/// <summary>
|
|
/// Delete this fog volume. You shouldn't access it anymore.
|
|
/// </summary>
|
|
public void Delete()
|
|
{
|
|
if ( !IsValid ) return;
|
|
|
|
ParentWorld.native.Remove3DSkyboxWorld( SkyboxWorld );
|
|
ParentWorld.InternalSkyboxWorlds.Remove( this );
|
|
}
|
|
}
|