Stride

OPEN / CLOSE
  • Features
  • Blog
  • Documentation
  • Community
(icon) Download

  • Discord
  • Facebook
  • Twitter
  • YouTube

LANGUAGE

OPEN / CLOSE
  • English
  • 日本語
    Show / Hide Table of Contents

    Sprite3DBatch Class

    Namespace: Stride.Graphics
    Assembly: Stride.Graphics.dll

    A batcher for sprite in the 3D world.

    System.Object → DisposeBase → ComponentBase → BatchBase<Sprite3DBatch.Sprite3DDrawInfo> → Sprite3DBatch
    Derived from Sprite3DBatch:

    public class Sprite3DBatch : BatchBase<Sprite3DBatch.Sprite3DDrawInfo>, IDisposable, IComponent, IReferencable, ICollectorHolder
    Name Description
    Constructors
    Sprite3DBatch(GraphicsDevice, Int32, Int32)

    Creates a new instance of Sprite3DBatch.

    Methods
    Begin(GraphicsContext, Matrix, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, EffectInstance, Int32)

    Begins a 3D sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a view-projection matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.Default, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

    Draw(Texture, ref Matrix, ref RectangleF, ref Vector2, ref Color4, ImageOrientation, SwizzleMode, Nullable<Single>)

    Draw a 3D sprite (or add it to the draw list depending on the sortMode).

    PrepareForRendering()
    UpdateBufferValuesFromElementInfo(ref BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32)
    | Improve this Doc View Source

    Constructors


    Sprite3DBatch(GraphicsDevice, Int32, Int32)

    Creates a new instance of Sprite3DBatch.

    public Sprite3DBatch(GraphicsDevice device, int bufferElementCount = 1024, int batchCapacity = 64)
    Parameters
    Type Name Description
    GraphicsDevice device
    System.Int32 bufferElementCount

    The maximum number element that can be batched in one time.

    System.Int32 batchCapacity

    The batch capacity default to 64.

    | Improve this Doc View Source

    Methods


    Begin(GraphicsContext, Matrix, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, EffectInstance, Int32)

    Begins a 3D sprite batch rendering using the specified sorting mode and blend state, sampler, depth stencil, rasterizer state objects, plus a custom effect and a view-projection matrix. Passing null for any of the state objects selects the default default state objects (BlendState.AlphaBlend, DepthStencilState.Default, RasterizerState.CullCounterClockwise, SamplerState.LinearClamp). Passing a null effect selects the default SpriteBatch Class shader.

    public void Begin(GraphicsContext graphicsContext, Matrix viewProjection, SpriteSortMode sortMode = SpriteSortMode.Deferred, BlendStateDescription? blendState = null, SamplerState samplerState = null, DepthStencilStateDescription? depthStencilState = null, RasterizerStateDescription? rasterizerState = null, EffectInstance effect = null, int stencilValue = 0)
    Parameters
    Type Name Description
    GraphicsContext graphicsContext

    The graphics context to use.

    Matrix viewProjection

    The view-projection matrix to use for the batch session

    SpriteSortMode sortMode

    The sprite drawing order to use for the batch session

    System.Nullable<BlendStateDescription> blendState

    The blending state to use for the batch session

    SamplerState samplerState

    The sampling state to use for the batch session

    System.Nullable<DepthStencilStateDescription> depthStencilState

    The depth stencil state to use for the batch session

    System.Nullable<RasterizerStateDescription> rasterizerState

    The rasterizer state to use for the batch session

    EffectInstance effect

    The effect to use for the batch session

    System.Int32 stencilValue

    The value of the stencil buffer to take as reference for the batch session


    Draw(Texture, ref Matrix, ref RectangleF, ref Vector2, ref Color4, ImageOrientation, SwizzleMode, Nullable<Single>)

    Draw a 3D sprite (or add it to the draw list depending on the sortMode).

    public void Draw(Texture texture, ref Matrix worldMatrix, ref RectangleF sourceRectangle, ref Vector2 elementSize, ref Color4 color, ImageOrientation imageOrientation = ImageOrientation.AsIs, SwizzleMode swizzle = SwizzleMode.None, float? depth = null)
    Parameters
    Type Name Description
    Texture texture

    The texture to use during the draw

    Matrix worldMatrix

    The world matrix of the element

    RectangleF sourceRectangle

    The rectangle indicating the source region of the texture to use

    Vector2 elementSize

    The size of the sprite in the object space

    Color4 color

    The color to apply to the texture image.

    ImageOrientation imageOrientation

    The rotation to apply on the image uv

    SwizzleMode swizzle

    Swizzle mode indicating the swizzle use when sampling the texture in the shader

    System.Nullable<System.Single> depth

    The depth of the element. If null, it is calculated using world and view-projection matrix.


    PrepareForRendering()

    protected override void PrepareForRendering()
    Overrides
    Stride.Graphics.BatchBase<Stride.Graphics.Sprite3DBatch.Sprite3DDrawInfo>.PrepareForRendering()

    UpdateBufferValuesFromElementInfo(ref BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.ElementInfo, IntPtr, IntPtr, Int32)

    protected override void UpdateBufferValuesFromElementInfo(ref BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.ElementInfo elementInfo, IntPtr vertexPointer, IntPtr indexPointer, int vexterStartOffset)
    Parameters
    Type Name Description
    BatchBase.ElementInfo<> elementInfo
    System.IntPtr vertexPointer
    System.IntPtr indexPointer
    System.Int32 vexterStartOffset
    Overrides
    Stride.Graphics.BatchBase<Stride.Graphics.Sprite3DBatch.Sprite3DDrawInfo>.UpdateBufferValuesFromElementInfo(Stride.Graphics.BatchBase.ElementInfo<>, System.IntPtr, System.IntPtr, System.Int32)

    Inherited Members

    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.ResourceContextPool
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.ResourceContext
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.mutablePipeline
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.graphicsDevice
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.blendState
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.rasterizerState
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.samplerState
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.depthStencilState
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.stencilReferenceValue
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.sortMode
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.Effect
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.GraphicsContext
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.DefaultEffect
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.DefaultEffectSRgb
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.TextureComparer
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.BackToFrontComparer
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.FrontToBackComparer
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.Destroy()
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.Parameters
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.Begin(GraphicsContext, EffectInstance, SpriteSortMode, Nullable<BlendStateDescription>, SamplerState, Nullable<DepthStencilStateDescription>, Nullable<RasterizerStateDescription>, Int32)
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.CheckBeginHasBeenCalled(String)
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.CheckEndHasBeenCalled(String)
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.End()
    BatchBase<Sprite3DBatch.Sprite3DDrawInfo>.Draw(Texture, BatchBase.ElementInfo<>)
    ComponentBase.Tags
    ComponentBase.Name
    ComponentBase.ICollectorHolder.Collector
    ComponentBase.OnNameChanged()
    ComponentBase.ToString()
    DisposeBase.Dispose()
    DisposeBase.IsDisposed
    DisposeBase.IReferencable.ReferenceCount
    DisposeBase.IReferencable.AddReference()
    DisposeBase.IReferencable.Release()
    DisposeBase.OnAddReference()
    DisposeBase.OnReleaseReference()

    Extension Methods

    ComponentBaseExtensions.DisposeBy<T>(T, ICollectorHolder)
    ComponentBaseExtensions.RemoveDisposeBy<T>(T, ICollectorHolder)
    • Improve this Doc
    • View Source
    In This Article

    Back to top

    Copyright © 2019-2021 .NET Foundation and Contributors
    Supported by the .NET Foundation