Class Effect
Used to set and query shader effects, and to choose techniques.
public class Effect : GraphicsResource, IDisposable
- Inheritance
-
Effect
- Implements
- Derived
- Inherited Members
Constructors
Effect(Effect)
Creates a clone of the Effect.
protected Effect(Effect cloneSource)
Parameters
Effect(GraphicsDevice, byte[])
Creates a new instance of Effect.
public Effect(GraphicsDevice graphicsDevice, byte[] effectCode)
Parameters
graphicsDeviceGraphicsDeviceGraphics device
effectCodebyte[]The effect code.
Remarks
The index and count parameters do not need to take the header of the file into account; this will be calculated first,
and the index and count will be adjusted to point to the effect content after the header.
Therefore,do not enter the size of the header into those parameters! This is done for you!
Exceptions
- Exception
Invoked when the
effectCodeis not a valid MGFX effect file or is for an incompatible version of MonoGame.- ArgumentException
This
effectCodeis invalid.
Effect(GraphicsDevice, byte[], int, int)
Creates a new instance of Effect.
public Effect(GraphicsDevice graphicsDevice, byte[] effectCode, int index, int count)
Parameters
graphicsDeviceGraphicsDeviceGraphics device
effectCodebyte[]The effect code.
indexintStart position to read from in the
effectCodearray.countintNumber of bytes to read from the
effectCodearray.
Remarks
The index and count parameters do not need to take the header of the file into account; this will be calculated first,
and the index and count will be adjusted to point to the effect content after the header.
Therefore,do not enter the size of the header into those parameters! This is done for you!
Exceptions
- Exception
Invoked when the
effectCodeis not a valid MGFX effect file or is for an incompatible version of MonoGame.- ArgumentException
This
effectCodeis invalid.
Properties
CurrentTechnique
Gets or sets the active technique.
public EffectTechnique CurrentTechnique { get; set; }
Property Value
Remarks
If there are multiple techiques in an effect and you want to use a new technique in the next pass, you must set CurrentTechnique to the new technique before making the rendering pass.
Parameters
Gets a collection of shader parameters used for this effect.
public EffectParameterCollection Parameters { get; }
Property Value
Techniques
Gets a collection of shader techniques that are defined for this effect.
public EffectTechniqueCollection Techniques { get; }
Property Value
Methods
Clone()
Returns a deep copy of the effect where immutable types are shared and mutable data is duplicated.
public virtual Effect Clone()
Returns
- Effect
The cloned effect.
Remarks
See "Cloning an Effect" in MSDN: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476138(v=vs.85).aspx
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
protected override void Dispose(bool disposing)
Parameters
disposingbool
GraphicsDeviceResetting()
The GraphicsDevice is resetting, so GPU resources must be recreated.
protected override void GraphicsDeviceResetting()
OnApply()
Applies the effect state just prior to rendering the effect.
protected virtual void OnApply()