Class EffectSystem
The effect system.
public class EffectSystem : GameSystemBase, IDisposable, ICollectorHolder, IGameSystemBase, IComponent, IReferencable, IUpdateable, IDrawable, IContentable
- Inheritance
-
objectEffectSystem
- Implements
- Inherited Members
- Extension Methods
Constructors
EffectSystem(IServiceRegistry)
Initializes a new instance of the EffectSystem class.
public EffectSystem(IServiceRegistry services)
Parameters
servicesIServiceRegistryThe services.
Properties
Compiler
public IEffectCompiler Compiler { get; set; }
Property Value
FileProvider
Gets or sets the database file provider, to use for loading effects and shader sources.
public IVirtualFileProvider FileProvider { get; }
Property Value
- IVirtualFileProvider
The database file provider.
Methods
Destroy()
Disposes the object's resources.
protected override void Destroy()
Remarks
Override in a derived class to implement disposal logic specific to it.
This method is automatically called whenever a call to Dispose() (or to Release()) has decreased the internal reference count to zero, meaning no other objects (hopefully) hold a reference to this one and its resources can be safely released.
GetShaderFromParameters(string, CompilerParameters)
Get the shader from the database based on the parameters used for its compilation.
protected CompilerResults GetShaderFromParameters(string effectName, CompilerParameters parameters)
Parameters
effectNamestringName of the effect.
parametersCompilerParametersThe parameters.
Returns
- CompilerResults
The EffectBytecode if found.
Initialize()
Initializes the Game System.
public override void Initialize()
Remarks
This method is called when the component is added to the Game. This can be used for tasks like querying for services the component needs and setting up non-graphics resources (as here the Graphics Device may have not been initialized yet).
IsValid(Effect)
public bool IsValid(Effect effect)
Parameters
effectEffect
Returns
LoadEffect(string, CompilerParameters)
Loads the effect.
public TaskOrResult<Effect> LoadEffect(string effectName, CompilerParameters compilerParameters)
Parameters
effectNamestringName of the effect.
compilerParametersCompilerParametersThe compiler parameters.
Returns
- TaskOrResult<Effect>
A new instance of an effect.
Exceptions
- InvalidOperationException
Could not compile shader. Need fallback.
SetCompilationMode(CompilationMode)
public void SetCompilationMode(CompilationMode compilationMode)
Parameters
compilationModeCompilationMode
Update(GameTime)
This method is called when this game component is updated.
public override void Update(GameTime gameTime)
Parameters
gameTimeGameTimeThe current timing.