Class ShaderDataProvider
- Namespace
- ValveResourceFormat.IO
- Assembly
- ValveResourceFormat.dll
Provides shader data by querying compiled shader files, with optional fallback to basic hardcoded mappings.
public class ShaderDataProvider : IShaderDataProviderInheritance
Implements
Inherited Members
Constructors
ShaderDataProvider(IFileLoader, bool)
Initializes a new instance of the ValveResourceFormat.IO.ShaderDataProvider class.
public ShaderDataProvider(IFileLoader fileLoader, bool useFallback = true)Parameters
fileLoaderIFileLoader-
The file loader used to load shader files.
useFallbackbool-
Whether to use the basic provider as a fallback when shader files are unavailable.
Methods
GetInputsForTexture(string, Material)
Gets the input texture channels and names for a given texture type in a material.
public IEnumerable<(ChannelMapping Channel, string Name)> GetInputsForTexture(string textureType, Material material)Parameters
textureTypestring-
The type of texture to query.
materialMaterial-
The material containing the texture.
Returns
- IEnumerable<(ChannelMapping Channel, string Name)>
-
A collection of channel mappings and their corresponding input names.
Remarks
Returns texture inputs for the specified texture type, falling back to basic provider if available.
GetMaterialFeatureState(Material)
Extracts the material feature state from integer parameters.
public static IDictionary<string, byte> GetMaterialFeatureState(Material material)Parameters
materialMaterial-
The material to extract feature state from.
Returns
- IDictionary<string, byte>
-
A dictionary of feature names (with 'F_' prefix) and their values.
GetStaticConfiguration_ForFeatureState(VfxProgramData, VfxProgramData, IDictionary<string, byte>, IDictionary<string, byte>)
Produce a static configuration that fits the material's feature state. This configuration can be used to select one of the static variants contained in the shader file.
public static (int[] StaticConfig, long StaticComboId) GetStaticConfiguration_ForFeatureState(VfxProgramData features, VfxProgramData program, IDictionary<string, byte> featureParams, IDictionary<string, byte> staticParams = null)Parameters
featuresVfxProgramData-
Features vcs file that contains the feature definitions.
programVfxProgramData-
Stage for which the configuration will be generated.
featureParamsIDictionary<string, byte>-
Feature parameters have the 'F_' prefix.
staticParamsIDictionary<string, byte>-
Statics (not tied to a feature) that you want to override. Static parameters have the 'S_' prefix.
Returns
- (int[] StaticConfig, long StaticComboId)
-
A tuple containing the static configuration array and the corresponding static combo identifier.
GetSuffixForInputTexture(string, Material)
Gets the file suffix for a given input texture name.
public string GetSuffixForInputTexture(string inputName, Material material)Parameters
inputNamestring-
The name of the input texture.
materialMaterial-
The material containing the texture.
Returns
- string
-
The suffix string for the input texture, or null if not found.
Remarks
Returns the filename suffix for the input texture, falling back to basic provider if available.
TryReduceStaticConfiguration(VfxProgramData, int[], out int[])
Removes switches that would point to a non-existent static combo.
public static bool TryReduceStaticConfiguration(VfxProgramData program, int[] staticConfiguration, out int[] reducedConfiguration)Parameters
programVfxProgramData-
The file that contains the combos and combo rules.
staticConfigurationint[]-
The original static configuration.
reducedConfigurationint[]-
The reduced configuration with invalid switches removed.
Returns
- bool
-
True if the configuration was modified, false otherwise.