C# Class Squared.Render.RenderCoordinator

Inheritance: IDisposable
Show file Open project: sq/Fracture Class Usage Examples

Public Properties

Property Type Description
CreateResourceLock object
EnableThreading bool
Manager RenderManager
PrepareLock object
ThreadGroup ThreadGroup
UseResourceLock object
WorkStopwatch Stopwatch

Public Methods

Method Description
AfterPresent ( System.Action action ) : void

Queues an operation to occur immediately after Present.

BeforePresent ( System.Action action ) : void

Queues an operation to occur immediately before Present, after all drawing commands have been issued.

BeginDraw ( ) : bool
Dispose ( ) : void
DisposeResource ( IDisposable resource ) : void
EndDraw ( ) : void
RenderCoordinator ( IGraphicsDeviceService deviceService, Thread mainThread, ThreadGroup threadGroup ) : System

Constructs a render coordinator. A render manager and synchronous draw methods are automatically provided for you.

RenderCoordinator ( RenderManager manager, Func synchronousBeginDraw, System.Action synchronousEndDraw ) : System

Constructs a render coordinator.

SynchronousDrawToRenderTarget ( RenderTarget2D renderTarget, DefaultMaterialSet materials, Action drawBehavior ) : bool

Synchronously renders a complete frame to the specified render target. Automatically sets up the device's viewport and the view transform of your materials and restores them afterwards.

WaitForActiveDraw ( ) : bool

Protected Methods

Method Description
CheckMainThread ( bool allowThreading ) : void
DefaultBeginDraw ( ) : bool
DefaultEndDraw ( ) : void
OnDeviceReset ( object sender, EventArgs args ) : void
OnDeviceResetting ( object sender, EventArgs args ) : void
PrepareFrame ( Frame frame, bool threaded ) : void
PrepareNextFrame ( Frame newFrame, bool threaded ) : void

Finishes preparing the current Frame and readies it to be sent to the graphics device for rendering.

RenderFrameToDraw ( bool endDraw ) : void
RunAfterPresentHandlers ( ) : void
RunBeforePresentHandlers ( ) : void
ThreadedDraw ( ) : void

Private Methods

Method Description
CoreInitialize ( ) : void
FlushDisposeList ( List list ) : void
FlushPendingDisposes ( ) : void
RenderFrame ( Frame frame, bool acquireLock ) : void
WaitForActiveDraws ( ) : bool
WaitForActiveSynchronousDraw ( ) : bool
WaitForPendingWork ( ) : void

Method Details

AfterPresent() public method

Queues an operation to occur immediately after Present.
public AfterPresent ( System.Action action ) : void
action System.Action
return void

BeforePresent() public method

Queues an operation to occur immediately before Present, after all drawing commands have been issued.
public BeforePresent ( System.Action action ) : void
action System.Action
return void

BeginDraw() public method

public BeginDraw ( ) : bool
return bool

CheckMainThread() protected method

protected CheckMainThread ( bool allowThreading ) : void
allowThreading bool
return void

DefaultBeginDraw() protected method

protected DefaultBeginDraw ( ) : bool
return bool

DefaultEndDraw() protected method

protected DefaultEndDraw ( ) : void
return void

Dispose() public method

public Dispose ( ) : void
return void

DisposeResource() public method

public DisposeResource ( IDisposable resource ) : void
resource IDisposable
return void

EndDraw() public method

public EndDraw ( ) : void
return void

OnDeviceReset() protected method

protected OnDeviceReset ( object sender, EventArgs args ) : void
sender object
args System.EventArgs
return void

OnDeviceResetting() protected method

protected OnDeviceResetting ( object sender, EventArgs args ) : void
sender object
args System.EventArgs
return void

PrepareFrame() protected method

protected PrepareFrame ( Frame frame, bool threaded ) : void
frame Frame
threaded bool
return void

PrepareNextFrame() protected method

Finishes preparing the current Frame and readies it to be sent to the graphics device for rendering.
protected PrepareNextFrame ( Frame newFrame, bool threaded ) : void
newFrame Frame
threaded bool
return void

RenderCoordinator() public method

Constructs a render coordinator. A render manager and synchronous draw methods are automatically provided for you.
public RenderCoordinator ( IGraphicsDeviceService deviceService, Thread mainThread, ThreadGroup threadGroup ) : System
deviceService IGraphicsDeviceService
mainThread Thread
threadGroup ThreadGroup
return System

RenderCoordinator() public method

Constructs a render coordinator.
public RenderCoordinator ( RenderManager manager, Func synchronousBeginDraw, System.Action synchronousEndDraw ) : System
manager RenderManager The render manager responsible for creating frames and dispatching them to the graphics device.
synchronousBeginDraw Func The function responsible for synchronously beginning a rendering operation. This will be invoked on the rendering thread.
synchronousEndDraw System.Action The function responsible for synchronously ending a rendering operation and presenting it to the screen. This will be invoked on the rendering thread.
return System

RenderFrameToDraw() protected method

protected RenderFrameToDraw ( bool endDraw ) : void
endDraw bool
return void

RunAfterPresentHandlers() protected method

protected RunAfterPresentHandlers ( ) : void
return void

RunBeforePresentHandlers() protected method

protected RunBeforePresentHandlers ( ) : void
return void

SynchronousDrawToRenderTarget() public method

Synchronously renders a complete frame to the specified render target. Automatically sets up the device's viewport and the view transform of your materials and restores them afterwards.
public SynchronousDrawToRenderTarget ( RenderTarget2D renderTarget, DefaultMaterialSet materials, Action drawBehavior ) : bool
renderTarget Microsoft.Xna.Framework.Graphics.RenderTarget2D
materials DefaultMaterialSet
drawBehavior Action
return bool

ThreadedDraw() protected method

protected ThreadedDraw ( ) : void
return void

WaitForActiveDraw() public method

public WaitForActiveDraw ( ) : bool
return bool

Property Details

CreateResourceLock public property

You must acquire this lock before applying changes to the device, creating objects, or loading content.
public object CreateResourceLock
return object

EnableThreading public property

If set to false, threads will not be used for rendering.
public bool EnableThreading
return bool

Manager public property

public RenderManager Manager
return RenderManager

PrepareLock public property

This lock is held during frame preparation.
public object PrepareLock
return object

ThreadGroup public property

public ThreadGroup ThreadGroup
return ThreadGroup

UseResourceLock public property

You must acquire this lock before rendering or resetting the device.
public object UseResourceLock
return object

WorkStopwatch public property

public Stopwatch WorkStopwatch
return Stopwatch