DarkBASIC Professional Help File

DX11 GET DEFAULT VERTEX SHADER

Retrieves a simple default vertex shader loaded by the engine at startup.
For most any purpose you will want to write your own shaders instead, but the default ones lets you
get simple, single-texture models on the screen for quick mockups.
The default vertex shader uses the following vertex layout / input structure:

struct vs_in {
float4 pos : POSITION;
float4 colour : COLOR0;
float2 texcoord : TEXCOORD;
float4x4 matWorld : INSTANCEWORLD;
float4x4 matWVP : INSTANCEWVP;
}

The last two matrices in the input struct are important to take note of; these are supplied to all
vertex shaders by the engine, so you will need to have them at the end of all your vertex input structs.
Take note that they are automatically appended to the end of your vertex layouts so you should not include them
there however.
The reason for sending these as part of the vertex input data is that it is the only way (besides a large array in a cbuffer) to
provide per-instance data. The engine will pre-calculate these and add them to all objects; they are in fact not provided per
vertex but rather (as you would expect) per instance so you don't have to worry about any extraneous bandwidth usage for sending these.
For the sake of coherence, non-instanced objects are considered as single instances so this is the way to get the world / world view projection
matrices for all meshes you render.

Syntax

    Return Dword = DX11 GET DEFAULT VERTEX SHADER()

Parameters

    This function does not take any parameters.

Returns

The default vertex shader.

See also

VERTEXSHADER Functions Menu
DX11 Function Categories