mirror of
https://github.com/Facepunch/sbox-public.git
synced 2026-01-21 04:40:00 -05:00
This commit imports the C# engine code and game files, excluding C++ source code. [Source-Commit: ceb3d758046e50faa6258bc3b658a30c97743268]
27 lines
673 B
C#
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();
|
|
}
|
|
}
|