Technically working shaders.
This commit is contained in:
@ -1,13 +1,9 @@
|
||||
struct Uniforms {
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4x4 model;
|
||||
float4 color;
|
||||
bool hasTexture;
|
||||
Sampler2D texture;
|
||||
}
|
||||
|
||||
uniform Uniforms uniforms;
|
||||
uniform float4x4 projection;
|
||||
uniform float4x4 view;
|
||||
uniform float4x4 model;
|
||||
uniform float4 color;
|
||||
uniform bool hasTexture;
|
||||
uniform Sampler2D texture;
|
||||
|
||||
struct AssembledVertex {
|
||||
float3 position : POSITION;
|
||||
@ -35,7 +31,7 @@ VertexStageOutput vertexMain(
|
||||
|
||||
output.sv_position = mul(
|
||||
float4(position, 1.0),
|
||||
mul(uniforms.model, mul(uniforms.view, uniforms.projection))
|
||||
mul(model, mul(view, projection))
|
||||
);
|
||||
|
||||
return output;
|
||||
@ -46,10 +42,11 @@ Fragment fragmentMain(
|
||||
float2 uv: UV
|
||||
) : SV_Target {
|
||||
Fragment output;
|
||||
if (uniforms.hasTexture) {
|
||||
output.color = uniforms.texture.Sample(uv) * uniforms.color;
|
||||
|
||||
if (hasTexture) {
|
||||
output.color = texture.Sample(uv) * color;
|
||||
} else {
|
||||
output.color = uniforms.color;
|
||||
output.color = color;
|
||||
}
|
||||
|
||||
return output;
|
Reference in New Issue
Block a user