Class Render

Namespace
Elegy.RenderSystem.API
Assembly
Elegy.RenderSystem.dll

The rendering system.

public static class Render
Inheritance
Render
Inherited Members

Fields

OutputDescBackbuffer

public static readonly OutputDescription OutputDescBackbuffer

Field Value

OutputDescription

OutputDescDepthOnly

public static readonly OutputDescription OutputDescDepthOnly

Field Value

OutputDescription

OutputDescNormal

public static readonly OutputDescription OutputDescNormal

Field Value

OutputDescription

RenderStyle

The style to render the world with.

public static IRenderStyle? RenderStyle

Field Value

IRenderStyle

Properties

CpuFrametime

Last CPU frametime.

public static double CpuFrametime { get; }

Property Value

double

Device

The graphics device. Updates buffers, swaps stuff, all kinds of GPU things.

public static GraphicsDevice Device { get; }

Property Value

GraphicsDevice

Factory

The graphics resource factory. Creates buffers, shaders and all kinds of stuff.

public static ResourceFactory Factory { get; }

Property Value

ResourceFactory

GpuFrametime

Last GPU frametime.

public static double GpuFrametime { get; }

Property Value

double

LastFrameTime

Point in time when the last frame was rendered.

public static double LastFrameTime { get; }

Property Value

double

MaterialTemplates

public static IReadOnlyCollection<MaterialTemplate> MaterialTemplates { get; }

Property Value

IReadOnlyCollection<MaterialTemplate>

Methods

BeginFrame()

Starts the frame timers, clears stuff etc.

public static void BeginFrame()

CreateBatch()

Creates a render batch.

public static Batch CreateBatch()

Returns

Batch

CreateBillboard()

Creates a billboard.

public static Billboard CreateBillboard()

Returns

Billboard

CreateEntity(bool)

Creates a render entity.

public static MeshEntity CreateEntity(bool animated)

Parameters

animated bool

Returns

MeshEntity

CreateGraphicsDevice(string[], string[])

public static GraphicsDevice? CreateGraphicsDevice(string[] extraInstanceExtensions, string[] extraDeviceExtensions)

Parameters

extraInstanceExtensions string[]
extraDeviceExtensions string[]

Returns

GraphicsDevice

CreateLight()

Creates a render light.

public static Light CreateLight()

Returns

Light

CreateMaterial(MaterialDefinition)

Creates a render material.

public static RenderMaterial? CreateMaterial(MaterialDefinition materialDefinition)

Parameters

materialDefinition MaterialDefinition

Returns

RenderMaterial

CreateMesh(Model)

Creates a render mesh.

public static Mesh CreateMesh(Model modelData)

Parameters

modelData Model

Returns

Mesh

CreateTexture(TextureMetadata, Span<byte>)

Creates a render texture.

public static RenderTexture CreateTexture(TextureMetadata metadata, Span<byte> data)

Parameters

metadata TextureMetadata
data Span<byte>

Returns

RenderTexture

CreateView(Texture)

Creates a render view from a render target texture.

public static View CreateView(Texture renderTarget)

Parameters

renderTarget Texture

Returns

View

CreateView(IWindow)

Creates a render view from a window.

public static View CreateView(IWindow window)

Parameters

window IWindow

Returns

View

CreateVolume()

Creates a renderable volume.

public static Volume CreateVolume()

Returns

Volume

DebugLine(Vector3, Vector3, Vector4, float, float)

Submits a 3D debug line for debug rendering.

public static void DebugLine(Vector3 start, Vector3 end, Vector4 colour, float lifetime = -3.4028235E+38, float thickness = 1)

Parameters

start Vector3
end Vector3
colour Vector4
lifetime float
thickness float

DebugLine(Vector3, Vector3, float, float)

Submits a 3D debug line for debug rendering.

public static void DebugLine(Vector3 start, Vector3 end, float lifetime = -3.4028235E+38, float thickness = 1)

Parameters

start Vector3
end Vector3
lifetime float
thickness float

DebugLineScreen(Vector2, Vector2, Vector4, float, float)

Submits a 2D debug line for debug rendering.

public static void DebugLineScreen(Vector2 start, Vector2 end, Vector4 colour, float lifetime = -3.4028235E+38, float thickness = 1)

Parameters

start Vector2
end Vector2
colour Vector4
lifetime float
thickness float

DebugLineScreen(Vector2, Vector2, float, float)

Submits a 2D debug line for debug rendering.

public static void DebugLineScreen(Vector2 start, Vector2 end, float lifetime = -3.4028235E+38, float thickness = 1)

Parameters

start Vector2
end Vector2
lifetime float
thickness float

EndFrame()

Finishes the frame, timers etc.

public static void EndFrame()

FreeBatch(ref Batch?)

Frees a render batch.

public static bool FreeBatch(ref Batch? batch)

Parameters

batch Batch

Returns

bool

FreeBillboard(ref Billboard?)

Frees a billboard.

public static bool FreeBillboard(ref Billboard? billboard)

Parameters

billboard Billboard

Returns

bool

FreeEntity(MeshEntity)

Frees a render entity.

public static bool FreeEntity(MeshEntity entity)

Parameters

entity MeshEntity

Returns

bool

FreeLight(ref Light?)

Frees a render light.

public static bool FreeLight(ref Light? light)

Parameters

light Light

Returns

bool

FreeMaterial(ref RenderMaterial?)

Frees a render material.

public static bool FreeMaterial(ref RenderMaterial? material)

Parameters

material RenderMaterial

Returns

bool

FreeMesh(ref Mesh?)

Frees a render mesh.

public static bool FreeMesh(ref Mesh? mesh)

Parameters

mesh Mesh

Returns

bool

FreeTexture(ref RenderTexture?)

Frees a render texture.

public static bool FreeTexture(ref RenderTexture? texture)

Parameters

texture RenderTexture

Returns

bool

FreeView(ref View?)

Frees a view.

public static bool FreeView(ref View? view)

Parameters

view View

Returns

bool

FreeVolume(ref Volume?)

Frees a renderable volume.

public static bool FreeVolume(ref Volume? volume)

Parameters

volume Volume

Returns

bool

GetCurrentWindowView()

Gets the current window's view, if any.

public static View? GetCurrentWindowView()

Returns

View

GetGlobalParameter(string)

public static MaterialParameter? GetGlobalParameter(string name)

Parameters

name string

Returns

MaterialParameter

GetGlobalParameterIndex(string)

public static GlobalParameterIndex GetGlobalParameterIndex(string name)

Parameters

name string

Returns

GlobalParameterIndex

GetGlobalParameterSet(MaterialParameterSet)

public static MaterialParameterSet? GetGlobalParameterSet(MaterialParameterSet set)

Parameters

set MaterialParameterSet

Returns

MaterialParameterSet

GetGlobalParameterSet(string)

public static MaterialParameterSet? GetGlobalParameterSet(string parameterName)

Parameters

parameterName string

Returns

MaterialParameterSet

GetMaterialTemplate(string)

public static MaterialTemplate GetMaterialTemplate(string name)

Parameters

name string

Returns

MaterialTemplate

GetOrCreateDefaultView(int, int, int)

Creates a window to render into.

public static View? GetOrCreateDefaultView(int width, int height, int rate = 60)

Parameters

width int
height int
rate int

Returns

View

GetView(IWindow)

Gets the window's view, if any.

public static View? GetView(IWindow window)

Parameters

window IWindow

Returns

View

HasMaterialTemplate(string)

public static bool HasMaterialTemplate(string name)

Parameters

name string

Returns

bool

Init(in LaunchConfig)

public static bool Init(in LaunchConfig config)

Parameters

config LaunchConfig

Returns

bool

LoadMaterial(string)

Loads or finds a render material by name.

public static RenderMaterial LoadMaterial(string name)

Parameters

name string

Returns

RenderMaterial

LoadMesh(string)

Creates/loads a render mesh from a file.

public static Mesh LoadMesh(string name)

Parameters

name string

Returns

Mesh

PostInit()

public static bool PostInit()

Returns

bool

PresentView(in View)

Presents the view to its window.

public static void PresentView(in View view)

Parameters

view View

RenderFrame(View)

Renders everything for a given view.

public static void RenderFrame(View view)

Parameters

view View

The view to render from. Will render and update an Silk.NET.Windowing.IWindow.

RenderFrame(IWindow)

Renders everything for a given window.

public static void RenderFrame(IWindow window)

Parameters

window IWindow

The window to render into.

RenderView(in View)

Draws a view to the backbuffer.

public static void RenderView(in View view)

Parameters

view View

SetGlobalParameter(GlobalParameterIndex, RenderTexture)

public static void SetGlobalParameter(GlobalParameterIndex id, RenderTexture value)

Parameters

id GlobalParameterIndex
value RenderTexture

SetGlobalParameter(GlobalParameterIndex, bool)

public static void SetGlobalParameter(GlobalParameterIndex id, bool value)

Parameters

id GlobalParameterIndex
value bool

SetGlobalParameter(GlobalParameterIndex, int)

public static void SetGlobalParameter(GlobalParameterIndex id, int value)

Parameters

id GlobalParameterIndex
value int

SetGlobalParameter(GlobalParameterIndex, Matrix4x4)

public static void SetGlobalParameter(GlobalParameterIndex id, Matrix4x4 value)

Parameters

id GlobalParameterIndex
value Matrix4x4

SetGlobalParameter(GlobalParameterIndex, Vector2)

public static void SetGlobalParameter(GlobalParameterIndex id, Vector2 value)

Parameters

id GlobalParameterIndex
value Vector2

SetGlobalParameter(GlobalParameterIndex, Vector3)

public static void SetGlobalParameter(GlobalParameterIndex id, Vector3 value)

Parameters

id GlobalParameterIndex
value Vector3

SetGlobalParameter(GlobalParameterIndex, Vector4)

public static void SetGlobalParameter(GlobalParameterIndex id, Vector4 value)

Parameters

id GlobalParameterIndex
value Vector4

SetGlobalParameter(GlobalParameterIndex, float)

public static void SetGlobalParameter(GlobalParameterIndex id, float value)

Parameters

id GlobalParameterIndex
value float

SetGlobalParameter(GlobalParameterIndex, Sampler)

public static void SetGlobalParameter(GlobalParameterIndex id, Sampler value)

Parameters

id GlobalParameterIndex
value Sampler

SetInstanceResourceSets(CommandList, MaterialParameterPool, ShaderVariant)

public static void SetInstanceResourceSets(CommandList commands, MaterialParameterPool perInstancePool, ShaderVariant shaderVariant)

Parameters

commands CommandList
perInstancePool MaterialParameterPool
shaderVariant ShaderVariant

SetMaterialResourceSets(CommandList, RenderMaterial, ShaderVariant)

public static void SetMaterialResourceSets(CommandList commands, RenderMaterial material, ShaderVariant shaderVariant)

Parameters

commands CommandList
material RenderMaterial
shaderVariant ShaderVariant

SetMaterialResourceSetsIndividual(CommandList, int[], ReadOnlySpan<MaterialParameterSet>)

public static void SetMaterialResourceSetsIndividual(CommandList commands, int[] mappings, ReadOnlySpan<MaterialParameterSet> parameterSets)

Parameters

commands CommandList
mappings int[]
parameterSets ReadOnlySpan<MaterialParameterSet>

SetRenderView(CommandList, in View)

public static void SetRenderView(CommandList commands, in View view)

Parameters

commands CommandList
view View

Shutdown()

public static void Shutdown()

UpdateBuffers()

Updates all MeshEntity, View etc. instances if their render data changed.

public static void UpdateBuffers()

Events

OnRender

What to render every frame.

public static event Action? OnRender

Event Type

Action