mirror of
https://github.com/izzy2lost/vba10.git
synced 2026-03-26 18:15:30 -07:00
40 lines
935 B
HLSL
40 lines
935 B
HLSL
// A constant buffer that stores the three basic column-major matrices for composing geometry.
|
|
cbuffer ModelViewProjectionConstantBuffer : register(b0)
|
|
{
|
|
matrix model;
|
|
matrix view;
|
|
matrix projection;
|
|
};
|
|
|
|
// Per-vertex data used as input to the vertex shader.
|
|
struct VertexShaderInput
|
|
{
|
|
float3 pos : POSITION;
|
|
float3 color : COLOR0;
|
|
};
|
|
|
|
// Per-pixel color data passed through the pixel shader.
|
|
struct PixelShaderInput
|
|
{
|
|
float4 pos : SV_POSITION;
|
|
float3 color : COLOR0;
|
|
};
|
|
|
|
// Simple shader to do vertex processing on the GPU.
|
|
PixelShaderInput main(VertexShaderInput input)
|
|
{
|
|
PixelShaderInput output;
|
|
float4 pos = float4(input.pos, 1.0f);
|
|
|
|
// Transform the vertex position into projected space.
|
|
pos = mul(pos, model);
|
|
pos = mul(pos, view);
|
|
pos = mul(pos, projection);
|
|
output.pos = pos;
|
|
|
|
// Pass the color through without modification.
|
|
output.color = input.color;
|
|
|
|
return output;
|
|
}
|