Files
sbox-public/engine/Sandbox.Engine/Resources/Material/Material.Features.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

27 lines
673 B
C#

namespace Sandbox;
public partial class Material
{
/// <summary>
/// Set a feature flag on the material. This is usually used to enable/disable shader permutations.
/// This is kind of a define, also known as a combo.
/// </summary>
public void SetFeature( string name, int value )
{
if ( GetFeature( name ) == value )
return;
native.Set( name, new Vector4( value, 0, 0, 0 ) );
native.ReloadStaticCombos();
}
/// <summary>
/// Get a feature flag on the material. This is usually used to enable/disable shader permutations.
/// </summary>
public int GetFeature( string name )
{
var val = native.GetVector4( name );
return val.x.CeilToInt();
}
}