Vixen
02b45cc4
csharp
public sealed class WorldRenderer

Everything between a world and a drawn frame, assembled.

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

Remarks

The join an application was missing. The scene half was finished — components, extraction systems, a residency cache — and so was the frame half, and nothing put them together: a game had to construct four features, a geometry buffer, a residency, two extraction systems and a host, in an order, and get every reference between them right. The samples opened a device and issued draws instead, which is why none of them is a game.

What it is not is a policy. It creates the standard features and the standard extraction, and it decides nothing about the frame: the compositor comes from a document, the stages come with it, and the content comes from wherever the application mounted it. A project that wants a different set adds to Host and skips Register.

The order it enforces is the one worth enforcing. Extraction runs in SystemPhase.PreRender after the transforms are written, so an object is culled against where it is this frame rather than where it was last one; the compositor then collects the views and runs the render system's own phases. Both of those are decisions somebody has already made correctly, and this is where a second host stops being able to make them again differently.

Fields and properties (28)

  • public IGraphicsDevice Device

    The device everything here lives on.

  • public SceneRenderHost Host

    The frame: a compositor, a graph and the render system.

  • public DescriptorAllocator MaterialDescriptors

    Where a material's own descriptor set is allocated from, frame by frame.

  • public int UploadedBytes

    How many bytes of geometry have been copied to the device.

  • public SamplerCache Samplers

    The samplers the frame's nodes share.

  • public SceneConstants SceneBlock

    The frame's set 0: the lighting environment every shading pass reads.

  • public SceneLighting SceneEnvironment

    What the scene contributes to it: the sky, the probes, the sun.

  • public EnvironmentTexture? Environment

    The prefiltered sky to copy up before the frame that samples it, or null for a host that uploads its own.

  • public ViewConstants ViewBlock

    The camera's set 1, which fills itself from whichever view is being drawn.

  • public GeometryBuffer Geometry

    The shared vertex and index memory every scene mesh is suballocated from.

  • public GeometryResidency Residency

    What decides which meshes are in it, and shares one slice between every user.

  • public MeshRenderFeature Meshes

    The feature that draws them.

  • public MaterialRenderFeature Materials

    The materials they are drawn with.

  • public TransformRenderFeature Transforms

    Their world matrices.

  • public MotionVectorRenderFeature Motion

    And where those matrices were last frame, for the velocity pass.

  • public ForwardLightingRenderFeature Lighting

    The lights that reach them.

  • public ParticleRenderFeature Particles

    The feature that draws VfxSystems, for a frame with a stage to put them in.

  • public MaterialRenderFeature ParticleMaterials

    The materials Particles is drawn with, which are not Materials.

  • public IMeshSource? Source

    Where the geometry a mesh reference names comes from.

  • public IMaterialSource? Painter

    Where the material a reference names comes from.

  • public BindlessTable? Table

    The frame's texture table, on a device that has one.

  • public AssetTextureSource? Painted

    Where a material's textures come from, once content is mounted.

  • public VirtualGeometrySystem? Clusters

    The virtualized stack, if this renderer was given one.

  • public IVirtualGeometrySource? Hierarchies

    Where the cluster hierarchy a mesh reference names comes from.

  • public MeshExtractionSystem? Extraction

    The extraction the last Register added, or null.

  • public VfxExtractionSystem? Emitters

    The emitter bridge the last Register added, or null.

  • public IVfxEffectSource? VfxEffects

    Where the effect a VfxEmitter names comes from.

  • public Material ParticleMaterial

    What every emitter's particles are drawn with.

Methods (5)

  • public WorldRenderer(IGraphicsDevice device, EffectSystem effects, int vertexCapacity = 1048576, int indexCapacity = 2097152)

    Builds the standard renderer for a world.

  • public void Mount(AssetManager assets)

    Points the renderer at a content manager, so mesh references resolve.

  • public void Register(EngineLoop loop, RenderStageMask stages, RenderStageMask particleStages = default(RenderStageMask))

    Adds the extraction systems to a loop, so the world's entities reach the render system.

  • public void Draw(ICommandList commands)

    Draws the frame, having first put the content work the frame needs on the list.

  • public void Dispose()

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

Used by (5)

  • ArenaThirdPersonShooter
  • ArenaIlluminationThirdPersonShooter
  • AppGraphicsVixen.App.Hosting
  • WorldRendererTestsVixen.Engine.Renderer.Tests
  • HostedRendererTestsVixen.App.Tests