Vixen
02b45cc4
csharp
public sealed class AppGraphics

The device, the swapchain and the world's frame, owned by the host.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

The step the host stopped one short of. WorldRenderer was the whole join between a world and a drawn frame — the standard features, the shared geometry, the extraction systems, a SceneRenderHost — and nothing outside a test project constructed one, so every sample opened a device and issued draws by hand and none of them was a game. This is that object put in VixenApp.Run's way, together with the two things it deliberately does not own: a device, and a swapchain to present it through.

What it decides is an order, which is the part a host gets wrong silently. The swapchain image is lent to the frame under a name before the compositor builds, because a graph culls a pass whose target nobody outside it reads; the camera's aspect ratio is set when the swapchain is sized rather than when the frame is drawn, because extraction has already run by then; and the world is drawn before OnRender is offered the same command list, so an application's own passes land on top of the scene rather than under it.

Every step is a public method on a public object. docs/plan/17's rule that nothing in the boot path is inaccessible applies here as much as to the loop: a head that wants two windows, a different swapchain, or a frame recorded into somebody else's command list builds this itself and calls Begin and End where it likes — or skips it and uses WorldRenderer directly, which is all this does.

Fields and properties (13)

  • public IGraphicsDevice Device

    The device everything here lives on.

  • public EffectSystem Effects

    Where variants are compiled or looked up.

  • public WorldRenderer Renderer

    The world's frame: the features, the geometry, the extraction and the host.

  • public RenderView View

    The view the scene's camera fills.

  • public CameraExtractionSystem Camera

    What fills it from the world.

  • public PostProcessVolumeSystem Volumes

    The post-process volumes the camera is inside, folded into one overlay.

  • public RenderStageMask Stages

    Which stages the world's drawables are extracted into.

  • public RenderStageMask ParticleStages

    Which stage the scene's particle emitters are drawn in, or none.

  • public ISwapChain? SwapChain

    The swapchain, once one has been built.

  • public ICommandList? Commands

    The frame's command list, open only between Begin and End.

  • public bool IsLost

    Whether the device has gone and nothing more will be drawn.

  • public int FrameCount

    How many frames have been recorded.

  • public static GraphicsCompositorAsset DefaultFrame

    The frame a project gets before it authors one: one lit pass, into the window.

Methods (8)

  • public AppGraphics(IGraphicsDevice device, GraphicsOptions options, IWindow? window, AssetManager? assets, EffectStore? shaders, EngineLoop? engine, ILoggerFactory logs, bool ownsDevice = true)

    Builds the frame a world is drawn through.

  • public bool Begin()

    Opens the frame: acquires an image, lends it to the document, draws the world.

  • public void End()

    Closes the frame: submits it and presents.

  • public void Recreate(bool force = false)

    Rebuilds the swapchain for the window's current size, if it has changed.

  • public static Int2 FramebufferOf(IWindow window)

    The window's framebuffer size, never zero in either axis.

  • public static ISwapChain SwapChainFor(IGraphicsDevice device, IWindow? window, GraphicsOptions options)

    Creates the swapchain a device presents through.

  • public void Suspend()

    Drops the swapchain, for a platform that has taken the surface away.

  • public void Dispose()

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

Used by (10)

  • ArenaThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • ThirdPersonShooterGameThirdPersonShooter
  • AppBuilderVixen.App.Hosting
  • AppServicesVixen.App.Hosting
  • VixenApplicationVixen.App.Hosting
  • AppBackendTestsVixen.App.Tests
  • GraphicsHostVixen.App
  • HostedRendererTestsVixen.App.Tests
  • RecordingGameVixen.App.Tests