Show / Hide Table of Contents

Namespace Yak2D

Classes

Color

Methods to generate COLOURS but using the american spelling Time will tell if this generates confusion. Perhaps I should stick with the americanised spelling

CustomVeldridBase

Override this base class to enable the creation of a custom rendering stage with exposure to all key components (device, factory, window, commandlist) The render method has access to an optional 4 input textures and single render target The update has raw access to the latest veldrid input snapshot object

Launcher

Welcome to the Yak2D cross platform c# graphics framework!!! To get started, please provide Run() your own implementation of the IApplication interface

StartupConfig

Holds the start up properties for a Yak2D application

TextureBrush

Descriptor object for the properties of a specific Texture use in a fluent interface drawable object The fluent drawing interface currently only supports texture references (not raw unsigned integer ids). Wrap ids if required

Yak2DException

Represents errors that occur in Yak2D library.

Structs

BloomEffectConfiguration

The bloom effect downsamples the source, ignoring colour data below a brightness cut off The downsampled image is then blurred The final result is the source image plus a blend of the downsampled image back on top

Blur1DEffectConfiguration

The directional blur effect downsamples and then blurs the image along a direction

BlurEffectConfiguration

The blur effect downsamples and then blurs the image in both horizontal and vertical directions

Colour

A four component colour, with RGBA values each within 0 to 1 range

ColourEffectConfiguration

Simple colour modification effects Mulitple effects can be combined, the result of one effect is fed into the input source of the next The ordering is: [Clear Surface Background?] -> Single Colour -> GrayScale -> Colourise -> Negative -> Opacity

CrtEffectConfiguration

Mimicks the effect of a Cathode Ray Tube Screen Particularly effective when combined with CRT Mesh shaped render surface (MeshRender stage)

DistortionDrawRequest

Holds data for 2D distortion height map drawing requests A drawing request is comprised of indexed vertices arranged in a triangle list

DistortionEffectConfiguration

The Distortion effect is generated by shifting texture coorindates based on the gradient of a height map, scaled by a chosen factor

DrawRequest

Holds data for 2D drawing requests A drawing request is comprised of indexed vertices arranged in a triangle list

EdgeDetectionConfiguration

Detect edges and produce a grayscale result

MeshRenderLightConfiguration

Mesh render stage allows multiple directional and spotlight lights The lighting model is Phong -> per-pixel lighting

MeshRenderLightingPropertiesConfiguration

Mesh render stage allows multiple directional and spotlight lights The lighting model is Phong -> per-pixel lighting

OldMovieConfiguration

Creates the effect of an old movie reel / projector Includes: Scratch Lines in frames, Noise, Random Vertical Shifting, Dimming, Reel Rolling, Over Exposure Flicker

PixellateConfiguration

Texture Coordinates are rounded so that the image is divided up into a number of squares that each reference the same pixel, thus creating a pixellated effect The Intensity is an interpolation between the pre-transformed texture coordinates and the post transform coordiantes

QuadTexCoords

RectangularCuboidMeshTexCoords

Represents the Texture Coordinates used to map a single Texture onto a 6 sided rectangular cuboid(rectangle type cube) mesh

Coordinate System is LHS, with y upwards and z positive into camera

The faces are set out on the cube such that 1 to 4: side faces, with side one facing along z(into camera) for an unrotated cube mesh(up is positive y) 1 = back face, normal along positive z 2 = right face, normal along positive x 3 = front face, normal along negative z 4 = left face, normal along negative x side 5 is top face.with the top of that 2d area being furthest along positive z in the above example side 6 is bottom face. orientated so that upon rotating the above mentioned around the x axis the top and bottom face would appear the same way up when facing the camera i.e.when unrotated the top of the 2d area will be closest to camera upside down. a little tricky to describe - but should be roughly "as expected"

Most use cases will use the standard / auto generated coordinates.please note the texture is split into 6 regions. 2 rows of 3, with each face assigned as:

[1][2][3] [4][5][6]

ShaderUniformDescription

Description for shader uniforms used in a CustomShader render stage

StaticConfiguration

Creates an evolving static 'noise' effect

StyleEffectGroupConfiguration

A RenderStage that applies stylised effects to a texture source and render to a target Effects are: Pixellate, Edge Detection, Static Noise, Cathode Ray Tube and Old Movie Reel, A combination of all the effects can be applied together In general, effect results are fed into the next effect The order being -> Pixellate -> Edge Detection -> Static -> Old Movie Reel -> CRT This struct contains configuration data for all effects in the stage

TextureData

Holds Texture Dimensions and Pixel Data

TransformResult

Holds the result of a Transform from or too Window Position

Vertex2D

Vertex data used in 2D drawing operations

Vertex3D

Vertex data used in 3D mesh rendering operations

Interfaces

IApplication

The interface that user apps must implement. The framework calls the methods which define the broad program flow

IBackend

Platform API operations

IBaseDrawable

The base object type for the shape drawing fluent interface Each of the object's methods represent a possible fill type for shape drawing The fluent type interface is designed for simple, rapid, iterative shape drawing It currently only supports texture references (not raw unsigned integer ids). Wrap ids if required

IBloomStage

A RenderStage that applies a bloom effect to a texture source and render to a target Brightness threshold, additive mix amount with source and number of blur component samples can be configured for the stage The source texture is downsampled and threhold clipped onto a smaller surface before being blurred and re-mixed with the original Holds the unsiged 64 bit integer framework id for the stage

IBlur1DStage

A RenderStage that applies a directional (1d) blur effect to a texture source and render to a target For non-directional blur, use the standard Blur effect instead Blur direction, fractional mix amount with source and number of blur component samples can be configured for the stage Holds the unsiged 64 bit integer framework id for the stage

IBlurStage

A RenderStage that applies a blur effect to a texture source and render to a target The blur is applied in both x and y texture coordinate directions, it is not a directional blur - use Blur1D effect instead in that scenario Fractional mix amount with source and number of blur component samples can be configured for the stage Holds the unsiged 64 bit integer framework id for the stage

ICamera

A Camera reference (2D or 3D) Holds the unsiged 64 bit integer framework id for the resource

ICamera2D

A reference for a Camera used in 2D Drawing Holds the unsiged 64 bit integer framework id for the resource

ICamera3D

A reference for a Camera used in 3D Rendering Holds the unsiged 64 bit integer framework id for the resource

ICameras

Camera Operations: Creation, Configuration and Destruction 2D Cameras are used by Drawing Stages (IDrawStage and IDistortionStage) 3D Cameras are used by the MeshRender Stage

IColourEffectsStage

A RenderStage that applies simple colour modification effects to a texture source and render to a target Effects are: single colour mix, grayscale, negative, colourise and opacity A combination of all the effects can be applied together Holds the unsiged 64 bit integer framework id for the stage

ICommonMeshBuilder

Provides functions to generate the Vertex3D arrays for a selection of mesh types for the MeshRender stage

ICommonOperations

Angle conversion, 2d vector rotation and helpers for generating line, arrow and regular polygon vertex positions and indices lists

IConstructedDrawable

Represents a fluent interface object that is in a drawable state Contains methods represent additional modifier options for further shape modification The fluent type interface is designed for simple, rapid, iterative shape drawing It currently only supports references (not raw unsigned integer ids). Wrap ids if required

ICoordinateTransforms

Functions to transform positions between World, Screen and Window coordinates

ICustomShaderStage

A reference for a user defined shader effect stage The user defines the shader code, constrained by a set maximum number of texture and uniform configuration variable inputs Holds the unsiged 64 bit integer framework id for the stage

ICustomVeldridStage

A reference for a user defined stage of custom veldrid logic, enabling operations or integrations that require complete access to veldrid library functions Holds the unsiged 64 bit integer framework id for the stage

IDisplay

Display / Window Operations: Resolution, Position, Title, State

IDistortionCollection

IDistortionHelper

Provides tools to help the generation of height map distortion textures, as well as simple distotion sprite evolution and lifecycle manager

IDistortionStage

A RenderStage that applies a distortion effect to a texture source and render to a target The per-pixel distortion amount is generated from a distortion height map The distortion height map is drawn each frame, in a similar way that DrawStage draw requests are generated, queued and sorted The final distortion amount per-pixel is scaled by a configurable scalar quantity Holds the unsiged 64 bit integer framework id for the stage

IDistortionTextureGenerator

Generate Textures suitable for use in distortion drawing (Rgba and Float32)

IDrawing

Drawing Operations Build draw queues containing lists of triangles and their properties (colouring and texturing, layer, coordinate space and depth) Draw queues exist for standard drawing (DrawStage) as well as drawing to distortion height maps (DistortionStage) Bitmap font rendering is supported

IDrawingHelpers

Drawing Helpers for Common Shapes Quad, Regular Polygon, Line and Arrow drawing functions Includes Fluent Interface for building and modifying shape drawing in steps

IDrawStage

A RenderStage that collects, sorts and processes 2d drawing requests Holds the unsiged 64 bit integer framework id for the stage

IFont

A Font reference Holds the unsiged 64 bit integer framework id for the resource

IFonts

Font Operations: Load, Destroy and Count

IFps

Provides current per-second rates for update and draw/render iteration loops

IFrameworkMessenger

An interface for framework messages. The default implementation outputs to console (and only for a DEBUG build). The user may define their own to redirect messages generated by the framework

IHelpers

Helper objects to support / simplify rendering stages

IInput

Input Operations Yak2D supports Keyboard, Mouse and Gamepad input

IKeyed

All framework object references provided to users are ultimately simple objects that hold unsigned int64 ID keys. Each reference inherrits from this base intereface. The type system is used to help avoid keys being used incorrectly: each object type has it's own empty interface that inherrits from IKeyed (perhaps an anti-pattern). The actual int64 keys are not hidden from the user, so key 'abuse' can occur; but allows custom storage of key values if desired. The framework allows raw keys to be provided to it's service methods, but the user must ensure keys are used for the correct item types Note: The framework does not internally hold references to the IKeyed Objects provided to the user on resource creation, it only stores the unsigned int64 Note: When resources are lost (and the framework requests resource [re-]creation), all old keys will become invalid. It is not guaranteed that keys will not be reused, but it is unlikley (multiple universe lifespan type expected periods)

ILine

The Line object type for the shape drawing fluent interface A line can be converted into an arrow The fluent type interface is designed for simple, rapid, iterative shape drawing

IMeshRenderStage

A RenderStage that will render a 3D Textured Mesh Ambient, Directional and Spotlights can be configured for the stage, along with the Mesh to render Holds the unsiged 64 bit integer framework id for the stage

IMixStage

A RenderStage that enables the mixing of up to four textures together The general mix factors per texture are defined in the configuration A further 'per-pixel' mixing scalar can be defined using mixTexture Holds the unsiged 64 bit integer framework id for the stage

IPersistentDistortionQueue

A Distortion Effect Persistent Draw Queue reference Holds the unsiged 64 bit integer framework id for the resource

IPersistentDrawQueue

A Persistent Draw Queue reference Holds the unsiged 64 bit integer framework id for the resource

IRenderQueue

Builds the rendering queue Each call to this object will add a step to the queue

IRenderStage

A reference that can represent any type of RenderStage Holds the unsiged 64 bit integer framework id for the stage

IRenderTarget

A Render Target reference Holds the unsiged 64 bit integer framework id for the resource

IServices

Provides access to all Yak2D core components

IShape

The shape object type for the shape drawing fluent interface Each of the object's methods represent a possible fill type for shape drawing The fluent type interface is designed for simple, rapid, iterative shape drawing

IStages

Render Stage Operations Creation, configuration and destruction of render stages and viewports

IStyleEffectsStage

A RenderStage that applies stylised effects to a texture source and render to a target Effects are: Pixellate, Edge Detection, Cathode Ray Tube and Old Movie Reel, A combination of all the effects can be applied together Holds the unsiged 64 bit integer framework id for the stage

ISurfaceCopyStage

A RenderStage that performs a GPU to CPU copy of Surface Pixel Data A Surface being either a Texture or RenderTarget Cannot copy from window main render target (TO CHECK) The stage requires the creation of an internal staging texture. This is sized to the source texture The texture size can be pre-set to avoid texture creation at render, but it will be re-created if the size does not match the eventual source texture copied from The Stage item itself holds the callback delegate that is called with the pixel data once rendering is complete Holds the unsiged 64 bit integer framework id for the stage

ISurfaces

GPU Surface Operations Texture and Render Target Creation and Destruction A surface is either a Texture or a RenderTarget A RenderTarget can be drawn too, a Texture cannot Both RenderTarget and Textures can be used as Textures (pixel sources)

ITexture

A Texture reference Holds the unsiged 64 bit integer framework id for the resource

ITextured

The Filled object type for the shape drawing fluent interface Each of the object's methods represent a possible shape type for shape drawing The fluent type interface is designed for simple, rapid, iterative shape drawing

ITransformable

Represents a fluent interface object that is in a drawable state, but can also be scaled and rotated in addition to the operations possible on a IConstructedDrawable type Contains methods for those scaling and rotation operations The fluent type interface is designed for simple, rapid, iterative shape drawing

IViewport

A Viewport reference Holds the unsiged 64 bit integer framework id for the resource

Enums

AssetSourceEnum

Assets (Textures, Fonts) can be either embedded as resources or included in the application output directory Embedded resources must be part of the assembly that provides the implementation of IApplication to the framework launcher

Below note that angle brackets have been replaced with () to avoid xml formatting complaints An example of .csproj content that would embed in the application assembly all files in the Textures folder (found in the .csproj root folder): (ItemGroup) (EmbeddedResource Include="Textures**"/) (/ItemGroup)

An example of .csproj content that would include in the output directory all of the files in the Fonts folder (found in the .csproj root folder): (ItemGroup) (Content Include="$(MSBuildThisFileDirectory)Fonts**") (CopyToOutputDirectory)PreserveNewest(/CopyToOutputDirectory)(Link)Fonts%(RecursiveDir)%(FileName)%(Extension)(/Link)(/Content)(/ItemGroup) The () around MSBuildThisFileDirectory are correct, the rest should be replaced with angled brackets

Currently it is not possible to provide an absolute file path to the application to load an asset from any location

BlendState

How pixel colours are combined when a source pixel is drawn onto a target pixel

CoordinateSpace

DrawRequests (DrawStage and DistortionStage) are transformed to World or Screen Coordinates by the properties of the chosen Camera2D at render time Screen coordinates are (0,0) in the middle of the Camera's view and extend half of the camera's virtual resolution along the x and y axis The axis are positive X to the right, and positive Y upwards in terms of screen orientation The top left corner of the screen is therefore location (-0.5 VirtualResolutionX, +0.5 VirtualResolutionY) The camera's resolution is virtual (not pixel based), as when a DrawStage is rendered onto a RenderTarget, the camera's view is rendered across the entire RenderTarget (or current viewport portion) If the virtual resolution does not match the pixel resolution of the RenderTarget or Viewport, then the resultant render is scaled to the target shape This enables window / system resolution to remain seperate from the logical positioning of objects in both Screen and World space

World coordinates are similar, but rendering position is transformed by both the camera's zoom and world focus point (and rotation) World axis are also (when the camera is not rotated) positive x to the right, and positive y upwards in terms of on-screen direction

DisplayState

Application desktop window state

FillType

Represents the Triangle Fill Type of a DrawRequest (when submitted to a DrawStage)

FrameworkMessage

Framework messages inform the user application of an important state change

GamepadAxis

Enumeration of gamepad axes (xbox style) Identical to Veldrid Enum

GamepadButton

Enumeration of gamepad buttons (xbox style) Identical to Veldrid Enum

GraphicsApi

Represents the various Graphics APIs

ImageFormat

Image file type

KeyCode

Enumeration of keyboard keys Identical to Veldrid Enum

LifeCycle

Defines the looping (or not) properties of an item held in a distortion collection

LightType

The Light type used in MeshRender Stages (Phong lighting model)

MouseButton

Simple enumeration of buttons Identical to Veldrid Enum

ResizeSamplerType

Sampling method used when re-sizing / re-sampling an image during bloom and blur stages

SamplerType

Texture Sampler Filter Type. A filter type is chosen at Gpu Surface creation time (Textures and RenderTargets)

ShaderUniformType

Descriptor for Custom User Shader stage uniform type

SineWavePoint

Labels defining points on a sinusoidal curve

TextJustify

Text justification for DrawString

TextureCoordinateMode

Texture Coordinate Wrap Behaviour Yak2D does not support border pixel or solid colour texture coordinate wrap

TextureMixDirection

Dual texturing descriptor for use in DrawingHelpers fluent draw interface

TextureScaling

Texture scaling / repetition descriptor for use in DrawingHelpers fluent draw interface

UpdatePeriod

Framework Update Loop time period type A fixed timestep, as small as possible, is generally advised to give more stable simulations Please note, that if the user has requested the framework processes fractional catch up update iterations before drawing, not all update timesteps will be of an equal length. It maybe preferrable to avoid fractional pre-draw updates and implement some draw update motion interpolation to achieve additional smoothness at the risk of error correction / deviation from the next update simulation step

In This Article
Back to top yak2D - Alex Paterson