| 1 | struct VertexInput { |
| 2 | float2 positions; |
| 3 | float3 colors; |
| 4 | float2 texCoord; |
| 5 | }; |
| 6 | |
| 7 | struct UniformBuffer { |
| 8 | float4x4 model; |
| 9 | float4x4 view; |
| 10 | float4x4 proj; |
| 11 | }; |
| 12 | ConstantBuffer<UniformBuffer> ubo; |
| 13 | |
| 14 | struct VertexOutput { |
| 15 | float4 pos: SV_Position; |
| 16 | float3 color; |
| 17 | float2 texCoord; |
| 18 | }; |
| 19 | |
| 20 | [shader("vertex")] |
| 21 | VertexOutput vertMain(VertexInput inVert) { |
| 22 | VertexOutput outVert; |
| 23 | outVert.pos = mul(ubo.proj, mul(ubo.view, mul(ubo.model, float4(inVert.positions, 0.0, 1.0)))); |
| 24 | outVert.color = inVert.colors; |
| 25 | outVert.texCoord = inVert.texCoord; |
| 26 | return outVert; |
| 27 | } |
| 28 | |
| 29 | Sampler2D texture; |
| 30 | |
| 31 | [shader("fragment")] |
| 32 | float4 fragMain(VertexOutput inVert) : SV_Target { |
| 33 | |
| 34 | |
| 35 | return texture.Sample(inVert.texCoord); |
| 36 | } |