Renderer

Description

sealed class Tinman.Engine.Rendering.Util.Renderer

Derived from

Disposable abstract
IBeginEnd
ILineThickness

The Renderer class provides methods for performing basic 3D drawing.

To perform 3D drawing with a Renderer object, the following steps are required:

  1. Create a Renderer object and pass an existing IGraphicsContext object.

  2. Set the viewport bounds via Bounds or Fullscreen.

  3. Configure the view transform by setting CameraParameters.ViewProjectionMatrix and CameraParameters.ViewProjectionFar of RendererParameters.Camera of Parameters.

  4. Begin a new render cycle by calling IBeginEnd.Begin. The calls to IBeginEnd.Begin and IBeginEnd.End may be nested and must be balanced.

  5. Use ILineThickness.LineThickness, PushTransform and PopTransform to update the render state.

  6. Call DrawPrimitiveBegin to begin a new graphics primitive.

  7. Call DrawPrimitiveVertex1 to add vertices to the current graphics primitive.

  8. Call DrawPrimitiveEnd to finish the current graphics primitive.

  9. Use DrawBox, DrawBoxSoup and DrawCuboid to draw geometric objects.

  10. End the current render cycle by calling IBeginEnd.End.

From ISceneEntityView.Render3D, only the steps 5 to 9 need to be performed.

Public / Constructors

Renderer


public constructor Renderer → (1)

context in : IGraphicsContext

[not-null]
The graphics context to use.

Creates a new instance of Renderer.

RenderException

If a graphics subsystem error has occurred.

Public / Methods

Draw​Box


[BeginEnd]
public method DrawBox → (3)

box in : Box3D

The box to draw.

colorFace in : int64

The color to use for faces or transparent to skip.

colorLine in : int64

The color to use for lines or transparent to skip.

Draws the faces and edges of the given (axis-aligned) box.

This method delegates to DrawPrimitive*, drawing a Primitive.TriangleList for the box faces (using colorFace in) and a Primitive.LineList for the box edges (using colorLine in).

Draw​Box​Soup


[BeginEnd]
public method DrawBoxSoup → (3)

boxSoup in : BoxSoup

[not-null]
The box soup to draw.

colorFace in : int64

The color to use for faces (see BoxSoup.Faces) or transparent to skip.

colorLine in : int64

The color to use for lines (see BoxSoup.Edges) or transparent to skip.

Draws the given box soup.

This method delegates to DrawPrimitive*, drawing a Primitive.TriangleList for the box faces (using colorFace in) and a Primitive.LineList for the box edges (using colorLine in).

Draw​Cuboid


[BeginEnd]
public method DrawCuboid → (3)

cuboid in : Cuboid

The cuboid to draw.

colorFace in : int64

The color to use for faces or transparent to skip.

colorLine in : int64

The color to use for lines or transparent to skip.

Draws the given cuboid.

This method delegates to DrawPrimitive*, drawing a Primitive.TriangleList for the cuboid faces (using colorFace in) and a Primitive.LineList for the cuboid edges (using colorLine in).

Draw​Primitive​Begin


[BeginEnd]
public method DrawPrimitiveBegin → (1)

primitive in : Primitive

The primitive to render.

Begins to render a 3D primitive.

Draw​Primitive​End


[BeginEnd]
public method DrawPrimitiveEnd → ()

Finishes rendering of the current 3D primitive.

Draw​Primitive​Vertex

3 overloads


[BeginEnd]
public method DrawPrimitiveVertex1 → (2)

in : Vec3D

Coordinate of vertex, in world-space.

color opt : int64 = Colors.White

The vertex color.

Specifies the next vertex for the current 3D primitive.


[BeginEnd]
public method DrawPrimitiveVertex2 → (2)

in : Vec3F

Coordinate of vertex, in world-space.

color opt : int64 = Colors.White

The vertex color.

Specifies the next vertex for the current 3D primitive.


[BeginEnd]
public method DrawPrimitiveVertex3 → (4)

in : float64

X-coordinate of vertex, in world-space.

in : float64

Y-coordinate of vertex, in world-space.

in : float64

Z-coordinate of vertex, in world-space.

color opt : int64 = Colors.White

The vertex color.

Specifies the next vertex for the current 3D primitive.

Fullscreen


public method Fullscreen → ()

returns → Renderer

this

Sets the Bounds of this Renderer object to full-screen (i.e. the size of the current render target, see IGraphicsContext.Size).

Pop​Transform


[BeginEnd]
public method PopTransform → ()

Restores the previous transformation.

Push​Transform


[BeginEnd]
public method PushTransform → (1)

transform in : AffineTransform

The transformation to append.

Appends the given transformation to the current one and uses the result for all subsequent 3D primitives.

Reset


public method Reset → ()

Resets the render state to default values.

This method is called automatically when the outermost call to IBeginEnd.Begin is made and when Bounds is set between calls to IBeginEnd.Begin and IBeginEnd.End. The following render state is reset:

Public / Attributes

Bounds


public attribute Bounds → (get,set)

value : Box2I

The screen bounds.

The screen bounds of this renderer object on the render target of the graphics context.

See also

Renderer.Reset

Parameters


public attribute Parameters → (get)

value : RendererParameters

[not-null]
The renderer parameters.

Returns the renderer parameters.

Transform


public attribute Transform → (get,set)

value : AffineTransform

The current transformation.

Sets the current transformation and clears the transformation stack.