45 lines
956 B
Plaintext
45 lines
956 B
Plaintext
|
|
const static float4 vertexPos[] = {
|
|
float4(0.0f, 0.5f, 0.5f, 1.0f),
|
|
float4(-0.5f, -0.5f, 0.5f, 1.0f),
|
|
float4(0.5f, -0.5f, 0.5f, 1.0f),
|
|
};
|
|
const static float4 vertexColors[] = {
|
|
float4(1.0f, 0.0f, 0.0f, 1.0f),
|
|
float4(0.0f, 1.0f, 0.0f, 1.0f),
|
|
float4(0.0f, 0.0f, 1.0f, 1.0f),
|
|
};
|
|
|
|
struct VertexOut {
|
|
float4 outPosition : SV_Position;
|
|
float4 vertexColor : CoarseColor;
|
|
};
|
|
|
|
struct CameraData {
|
|
float4x4 model;
|
|
float4x4 view;
|
|
float4x4 proj;
|
|
};
|
|
|
|
ParameterBlock<CameraData> camera;
|
|
|
|
[shader("vertex")]
|
|
VertexOut VertexMain(
|
|
uint vertexId: SV_VertexID,
|
|
float4 position,
|
|
float4 color,
|
|
) {
|
|
VertexOut output;
|
|
output.outPosition = mul(camera.proj, mul(camera.view, mul(camera.model, position)));
|
|
output.vertexColor = color;
|
|
return output;
|
|
}
|
|
|
|
[shader("fragment")]
|
|
float4 FragmentMain(
|
|
float4 interpolatedColors: CoarseColor,
|
|
) : SV_Target0 {
|
|
return float4(interpolatedColors.rgb, 1.0f);
|
|
}
|
|
|