35 lines
695 B
Plaintext
35 lines
695 B
Plaintext
struct VSInput {
|
|
float3 inPosition;
|
|
float3 inColor;
|
|
float2 inTexCoord;
|
|
};
|
|
|
|
struct UniformBuffer {
|
|
float4x4 model;
|
|
float4x4 view;
|
|
float4x4 proj;
|
|
};
|
|
ConstantBuffer<UniformBuffer> ubo;
|
|
|
|
struct VSOutput {
|
|
float4 pos : SV_Position;
|
|
float3 color;
|
|
float2 fragTexCoord;
|
|
};
|
|
|
|
[shader("vertex")]
|
|
VSOutput vertMain(VSInput input) {
|
|
VSOutput output;
|
|
output.color = input.inColor;
|
|
output.pos = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(input.inPosition, 1.0))));
|
|
output.fragTexCoord = input.inTexCoord;
|
|
return output;
|
|
}
|
|
|
|
Sampler2D texture;
|
|
|
|
[shader("fragment")]
|
|
float4 fragMain(VSOutput vertIn) : SV_Target {
|
|
return texture.Sample(vertIn.fragTexCoord);
|
|
}
|