almost done with ShaderData
This commit is contained in:
@ -1,18 +1,13 @@
|
||||
struct Transforms {
|
||||
struct Uniforms {
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4x4 model;
|
||||
}
|
||||
|
||||
struct Colors {
|
||||
float4 color;
|
||||
bool hasTexture;
|
||||
float4 colors[4];
|
||||
int somethingElse;
|
||||
Sampler2D texture;
|
||||
}
|
||||
|
||||
uniform Transforms transforms;
|
||||
uniform Colors colors;
|
||||
uniform Uniforms uniforms;
|
||||
|
||||
struct AssembledVertex {
|
||||
float3 position : POSITION;
|
||||
@ -40,7 +35,7 @@ VertexStageOutput vertexMain(
|
||||
|
||||
output.sv_position = mul(
|
||||
float4(position, 1.0),
|
||||
mul(transforms.model, mul(transforms.view, transforms.projection))
|
||||
mul(uniforms.model, mul(uniforms.view, uniforms.projection))
|
||||
);
|
||||
|
||||
return output;
|
||||
@ -51,10 +46,11 @@ Fragment fragmentMain(
|
||||
float2 uv: UV
|
||||
) : SV_Target {
|
||||
Fragment output;
|
||||
if (colors.hasTexture) {
|
||||
output.color = colors.texture.Sample(uv) * colors.colors[0];
|
||||
if (uniforms.hasTexture) {
|
||||
output.color = uniforms.texture.Sample(uv) * uniforms.color;
|
||||
} else {
|
||||
output.color = colors.colors[0] - float4(colors.somethingElse, 0, 0, 0);
|
||||
output.color = uniforms.color;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
Reference in New Issue
Block a user