C# Класс Sparrow.Core.RenderSupport

Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

AddDrawCalls() публичный Метод

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
Результат void

ApplyBlendMode() публичный Метод

Activates the current blend mode.
public ApplyBlendMode ( bool premultipliedAlpha ) : void
premultipliedAlpha bool
Результат void

BatchQuad() публичный Метод

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
Результат void

CheckForOpenGLError() публичный статический Метод

Checks for an OpenGL error. If there is one, it is logged an the error code is returned.
public static CheckForOpenGLError ( ) : uint
Результат uint

Clear() публичный Метод

Clears OpenGL's color buffer with a specified color.
public Clear ( uint color, float alpha = 0.0f ) : void
color uint
alpha float
Результат void

FinishQuadBatch() публичный Метод

Renders the current quad batch and resets it.
public FinishQuadBatch ( ) : void
Результат void

NextFrame() публичный Метод

Resets the render state stack to the default.
public NextFrame ( ) : void
Результат void

PopClipRect() публичный Метод

Restores the clipping rectangle that was last pushed to the stack.
public PopClipRect ( ) : void
Результат void

PopState() публичный Метод

Restores the previous render state.
public PopState ( ) : void
Результат void

PurgeBuffers() публичный Метод

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
Результат void

PushClipRect() публичный Метод

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
Результат Sparrow.Geom.Rectangle

PushState() публичный Метод

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
Результат void

RenderSupport() публичный Метод

public RenderSupport ( ) : System
Результат System

SetupOrthographicProjection() публичный Метод

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
Результат void