C# Class Sparrow.Core.RenderSupport

Afficher le fichier Open project: fmotagarcia/sparrow-sharp Class Usage Examples

Méthodes publiques

Méthode Description
AddDrawCalls ( int count ) : void

Raises the number of draw calls by a specific value. Call this method in custom render methods to keep the statistics display in sync.

ApplyBlendMode ( bool premultipliedAlpha ) : void

Activates the current blend mode.

BatchQuad ( Quad quad ) : void

Adds a quad or image to the current batch of unrendered quads. If there is a state change, all previous quads are rendered at once, and the batch is reset. Note that the values for alpha and blend mode are taken from the current render state, not the quad.

CheckForOpenGLError ( ) : uint

Checks for an OpenGL error. If there is one, it is logged an the error code is returned.

Clear ( uint color, float alpha = 0.0f ) : void

Clears OpenGL's color buffer with a specified color.

FinishQuadBatch ( ) : void

Renders the current quad batch and resets it.

NextFrame ( ) : void

Resets the render state stack to the default.

PopClipRect ( ) : void

Restores the clipping rectangle that was last pushed to the stack.

PopState ( ) : void

Restores the previous render state.

PurgeBuffers ( ) : void

Clears all vertex and index buffers, releasing the associated memory. Useful in low-memory situations. Don't call from within a render method!

PushClipRect ( Rectangle clipRect ) : Rectangle

The clipping rectangle can be used to limit rendering in the current render target to a certain area. This method expects the rectangle in stage coordinates. Internally, it uses the 'glScissor' command of OpenGL, which works with pixel coordinates. Any pushed rectangle is intersected with the previous rectangle; the method returns that intersection.

PushState ( Matrix matrix, float alpha, uint blendMode ) : void

Adds a new render state to the stack. The passed matrix is prepended to the modelview matrix; the alpha value is multiplied with the current alpha; the blend mode replaces the existing mode (except 'BlendMode.Auto', which will cause the current mode to prevail).

RenderSupport ( ) : System
SetupOrthographicProjection ( float left, float right, float top, float bottom ) : void

Sets up the projection matrix for ortographic 2D rendering.

Private Methods

Méthode Description
ApplyClipRect ( ) : void

Updates the scissor rectangle using the current clipping rectangle. This method is called automatically when either the projection matrix or the clipping rectangle changes.

Method Details

AddDrawCalls() public méthode

Raises the number of draw calls by a specific value. Call this method in custom render methods to keep the statistics display in sync.
public AddDrawCalls ( int count ) : void
count int
Résultat void

ApplyBlendMode() public méthode

Activates the current blend mode.
public ApplyBlendMode ( bool premultipliedAlpha ) : void
premultipliedAlpha bool
Résultat void

BatchQuad() public méthode

Adds a quad or image to the current batch of unrendered quads. If there is a state change, all previous quads are rendered at once, and the batch is reset. Note that the values for alpha and blend mode are taken from the current render state, not the quad.
public BatchQuad ( Quad quad ) : void
quad Quad
Résultat void

CheckForOpenGLError() public static méthode

Checks for an OpenGL error. If there is one, it is logged an the error code is returned.
public static CheckForOpenGLError ( ) : uint
Résultat uint

Clear() public méthode

Clears OpenGL's color buffer with a specified color.
public Clear ( uint color, float alpha = 0.0f ) : void
color uint
alpha float
Résultat void

FinishQuadBatch() public méthode

Renders the current quad batch and resets it.
public FinishQuadBatch ( ) : void
Résultat void

NextFrame() public méthode

Resets the render state stack to the default.
public NextFrame ( ) : void
Résultat void

PopClipRect() public méthode

Restores the clipping rectangle that was last pushed to the stack.
public PopClipRect ( ) : void
Résultat void

PopState() public méthode

Restores the previous render state.
public PopState ( ) : void
Résultat void

PurgeBuffers() public méthode

Clears all vertex and index buffers, releasing the associated memory. Useful in low-memory situations. Don't call from within a render method!
public PurgeBuffers ( ) : void
Résultat void

PushClipRect() public méthode

The clipping rectangle can be used to limit rendering in the current render target to a certain area. This method expects the rectangle in stage coordinates. Internally, it uses the 'glScissor' command of OpenGL, which works with pixel coordinates. Any pushed rectangle is intersected with the previous rectangle; the method returns that intersection.
public PushClipRect ( Rectangle clipRect ) : Rectangle
clipRect Sparrow.Geom.Rectangle
Résultat Sparrow.Geom.Rectangle

PushState() public méthode

Adds a new render state to the stack. The passed matrix is prepended to the modelview matrix; the alpha value is multiplied with the current alpha; the blend mode replaces the existing mode (except 'BlendMode.Auto', which will cause the current mode to prevail).
public PushState ( Matrix matrix, float alpha, uint blendMode ) : void
matrix Matrix
alpha float
blendMode uint
Résultat void

RenderSupport() public méthode

public RenderSupport ( ) : System
Résultat System

SetupOrthographicProjection() public méthode

Sets up the projection matrix for ortographic 2D rendering.
public SetupOrthographicProjection ( float left, float right, float top, float bottom ) : void
left float
right float
top float
bottom float
Résultat void