BatchBase<TDrawInfo> Class
Namespace: Stride.Graphics
Assembly: Stride.Graphics.dll
Base class to batch a group of draw calls into one.
public abstract class BatchBase<TDrawInfo> : ComponentBase, IDisposable, IComponent, IReferencable, ICollectorHolder where TDrawInfo : struct
Type Parameters
Name |
Description |
TDrawInfo |
A structure containing all the required information to draw one element of the batch.
|
Name |
Description |
Constructors
|
|
BatchBase(GraphicsDevice, EffectBytecode, EffectBytecode, BatchBase<TDrawInfo>.ResourceBufferInfo, VertexDeclaration, Int32) |
|
Fields
|
|
blendState |
|
|
DefaultEffect |
|
|
DefaultEffectSRgb |
|
|
depthStencilState |
|
|
graphicsDevice |
|
|
mutablePipeline |
|
|
rasterizerState |
|
|
ResourceContext |
|
|
ResourceContextPool |
|
|
samplerState |
|
|
sortMode |
|
|
stencilReferenceValue |
|
Properties
|
|
BackToFrontComparer |
|
|
Effect |
The effect used for the current Begin/End session.
|
|
FrontToBackComparer |
|
|
GraphicsContext |
|
|
Parameters |
Gets the parameters applied on the SpriteBatch effect.
|
|
TextureComparer |
|
Methods
|
|
Begin(GraphicsContext, EffectInstance, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, Int32) |
Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects and a custom effect.
Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, depthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp).
Passing a null effect selects the default effect shader.
|
|
CheckBeginHasBeenCalled(String) |
|
|
CheckEndHasBeenCalled(String) |
|
|
Destroy() |
|
|
Draw(Texture, in BatchBase<TDrawInfo>.ElementInfo) |
|
|
End() |
Flushes the sprite batch and restores the device state to how it was before Begin was called.
|
|
PrepareForRendering() |
|
|
UpdateBufferValuesFromElementInfo(ref BatchBase<TDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32) |
Update the mapped vertex and index buffer values using the provided element info.
|
|
Improve this Doc
View Source
Constructors
BatchBase(GraphicsDevice, EffectBytecode, EffectBytecode, BatchBase<TDrawInfo>.ResourceBufferInfo, VertexDeclaration, Int32)
protected BatchBase(GraphicsDevice device, EffectBytecode defaultEffectByteCode, EffectBytecode defaultEffectByteCodeSRgb, BatchBase<TDrawInfo>.ResourceBufferInfo resourceBufferInfo, VertexDeclaration vertexDeclaration, int indexSize = 2)
Parameters
|
Improve this Doc
View Source
Fields
blendState
protected BlendStateDescription? blendState
Field Value
DefaultEffect
protected readonly EffectInstance DefaultEffect
Field Value
DefaultEffectSRgb
protected readonly EffectInstance DefaultEffectSRgb
Field Value
depthStencilState
protected DepthStencilStateDescription? depthStencilState
Field Value
graphicsDevice
protected GraphicsDevice graphicsDevice
Field Value
mutablePipeline
protected MutablePipelineState mutablePipeline
Field Value
rasterizerState
protected RasterizerStateDescription? rasterizerState
Field Value
ResourceContext
protected BatchBase<TDrawInfo>.DeviceResourceContext ResourceContext
Field Value
ResourceContextPool
protected readonly ThreadLocal<BatchBase<TDrawInfo>.DeviceResourceContext> ResourceContextPool
Field Value
samplerState
protected SamplerState samplerState
Field Value
sortMode
protected SpriteSortMode sortMode
Field Value
stencilReferenceValue
protected int stencilReferenceValue
Field Value
Type |
Description |
System.Int32 |
|
|
Improve this Doc
View Source
Properties
BackToFrontComparer
protected BatchBase<TDrawInfo>.QueueComparer<BatchBase<TDrawInfo>.ElementInfo> BackToFrontComparer { get; set; }
Property Value
Effect
The effect used for the current Begin/End session.
protected EffectInstance Effect { get; }
Property Value
FrontToBackComparer
protected BatchBase<TDrawInfo>.QueueComparer<BatchBase<TDrawInfo>.ElementInfo> FrontToBackComparer { get; set; }
Property Value
GraphicsContext
protected GraphicsContext GraphicsContext { get; }
Property Value
Parameters
Gets the parameters applied on the SpriteBatch effect.
public ParameterCollection Parameters { get; }
Property Value
TextureComparer
protected BatchBase<TDrawInfo>.TextureIdComparer TextureComparer { get; set; }
Property Value
|
Improve this Doc
View Source
Methods
Begin(GraphicsContext, EffectInstance, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, Int32)
Begins a sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects and a custom effect.
Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, depthStencilState.None, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp).
Passing a null effect selects the default effect shader.
protected void Begin(GraphicsContext graphicsContext, EffectInstance effect, SpriteSortMode sessionSortMode, BlendStateDescription? sessionBlendState, SamplerState sessionSamplerState, DepthStencilStateDescription? sessionDepthStencilState, RasterizerStateDescription? sessionRasterizerState, int stencilValue)
Parameters
Type |
Name |
Description |
GraphicsContext |
graphicsContext |
The graphics context to use.
|
EffectInstance |
effect |
The effect to use for this begin/end draw session (default effect if null)
|
SpriteSortMode |
sessionSortMode |
Sprite drawing order used for the Begin/End session.
|
System.Nullable<BlendStateDescription> |
sessionBlendState |
Blending state used for the Begin/End session
|
SamplerState |
sessionSamplerState |
Texture sampling used for the Begin/End session
|
System.Nullable<DepthStencilStateDescription> |
sessionDepthStencilState |
Depth and stencil state used for the Begin/End session
|
System.Nullable<RasterizerStateDescription> |
sessionRasterizerState |
Rasterization state used for the Begin/End session
|
System.Int32 |
stencilValue |
The value of the stencil buffer to take as reference for the Begin/End session
|
Exceptions
Type |
Condition |
System.InvalidOperationException |
Only one SpriteBatch at a time can use SpriteSortMode.Immediate
|
CheckBeginHasBeenCalled(String)
protected void CheckBeginHasBeenCalled(string functionName)
Parameters
Type |
Name |
Description |
System.String |
functionName |
|
CheckEndHasBeenCalled(String)
protected void CheckEndHasBeenCalled(string functionName)
Parameters
Type |
Name |
Description |
System.String |
functionName |
|
Destroy()
protected override void Destroy()
Overrides
Draw(Texture, in BatchBase<TDrawInfo>.ElementInfo)
protected void Draw(Texture texture, in BatchBase<TDrawInfo>.ElementInfo elementInfo)
Parameters
End()
Flushes the sprite batch and restores the device state to how it was before Begin was called.
PrepareForRendering()
protected virtual void PrepareForRendering()
UpdateBufferValuesFromElementInfo(ref BatchBase<TDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32)
Update the mapped vertex and index buffer values using the provided element info.
protected abstract void UpdateBufferValuesFromElementInfo(ref BatchBase<TDrawInfo>.ElementInfo elementInfo, IntPtr vertexPointer, IntPtr indexPointer, int vexterStartOffset)
Parameters
Type |
Name |
Description |
BatchBase.ElementInfo<> |
elementInfo |
The structure containing the information about the element to draw.
|
System.IntPtr |
vertexPointer |
The pointer to the vertex array buffer to update.
|
System.IntPtr |
indexPointer |
The pointer to the index array buffer to update. This value is null if the index buffer used is static.
|
System.Int32 |
vexterStartOffset |
The offset in the vertex buffer where the vertex of the element starts
|
Extension Methods