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

121 lines
2.5 KiB
C#

using NativeEngine;
namespace Sandbox;
/// <summary>
/// A decal. Use the Component.
/// </summary>
internal sealed class DecalSceneObject : SceneObject
{
NativeEngine.CDecalSceneObject decalNative;
internal DecalSceneObject() { }
internal DecalSceneObject( HandleCreationData _ ) { }
public Texture ColorTexture
{
get => Texture.FromNative( decalNative.m_hColor );
set => decalNative.m_hColor = value?.native ?? default;
}
public Texture NormalTexture
{
get => Texture.FromNative( decalNative.m_hNormal );
set => decalNative.m_hNormal = value?.native ?? default;
}
public Texture RMOTexture
{
get => Texture.FromNative( decalNative.m_hRMO );
set => decalNative.m_hRMO = value?.native ?? default;
}
public Texture HeightTexture
{
get => Texture.FromNative( decalNative.m_hHeight );
set => decalNative.m_hHeight = value?.native ?? default;
}
public Color Color
{
get => decalNative.m_vColorTint;
set => decalNative.m_vColorTint = value;
}
public uint SortOrder
{
get => decalNative.m_nSortOrder;
set => decalNative.m_nSortOrder = value;
}
public uint ExclusionBitMask
{
get => decalNative.m_nExclusionBitMask;
set => decalNative.m_nExclusionBitMask = value;
}
public Texture EmissionTexture
{
get => Texture.FromNative( decalNative.m_hEmission );
set => decalNative.m_hEmission = value?.native ?? default;
}
public float AttenuationAngle
{
get => decalNative.m_flAttenuationAngle;
set => decalNative.m_flAttenuationAngle = value;
}
public float ColorMix
{
get => decalNative.m_flColorMix;
set => decalNative.m_flColorMix = value;
}
public float EmissionEnergy
{
get => decalNative.m_flEmissionEnergy;
set => decalNative.m_flEmissionEnergy = value;
}
public uint SequenceIndex
{
get => decalNative.m_nSequenceIndex;
set => decalNative.m_nSequenceIndex = value;
}
public float ParallaxStrength
{
get => decalNative.m_flParallaxStrength;
set => decalNative.m_flParallaxStrength = value;
}
public int SamplerIndex
{
get => decalNative.m_nSamplerIndex;
set => decalNative.m_nSamplerIndex = value;
}
public DecalSceneObject( SceneWorld world )
{
Assert.IsValid( world );
using ( var h = IHandle.MakeNextHandle( this ) )
{
CSceneSystem.CreateDecal( world );
}
}
internal override void OnNativeInit( CSceneObject ptr )
{
decalNative = (NativeEngine.CDecalSceneObject)ptr;
base.OnNativeInit( ptr );
}
internal override void OnNativeDestroy()
{
decalNative = default;
base.OnNativeDestroy();
}
}