prog
This commit is contained in:
@ -1,11 +1,9 @@
|
||||
struct Uniforms {
|
||||
float4x4 projection;
|
||||
float4x4 view;
|
||||
float4x4 model;
|
||||
float4 u_Color;
|
||||
bool u_HasTexture;
|
||||
Sampler2D u_Texture;
|
||||
};
|
||||
uniform float4x4 u_Projection;
|
||||
uniform float4x4 u_View;
|
||||
uniform float4x4 u_Model;
|
||||
uniform float4 u_Color;
|
||||
uniform bool u_HasTexture;
|
||||
uniform Sampler2D u_Texture;
|
||||
|
||||
struct AssembledVertex {
|
||||
float3 position : POSITION;
|
||||
@ -25,8 +23,6 @@ float4 someFunction(float4 color) {
|
||||
return color * float4(0.5, 0.5, 0.5, 1.0);
|
||||
}
|
||||
|
||||
uniform ParameterBlock<Uniforms> uniforms;
|
||||
|
||||
[shader("vertex")]
|
||||
VertexStageOutput vertexMain(
|
||||
AssembledVertex assembledVertex
|
||||
@ -39,7 +35,7 @@ VertexStageOutput vertexMain(
|
||||
|
||||
output.sv_position = mul(
|
||||
float4(position, 1.0),
|
||||
mul(uniforms.model, mul(uniforms.view, uniforms.projection))
|
||||
mul(u_Model, mul(u_View, u_Projection))
|
||||
);
|
||||
|
||||
return output;
|
||||
@ -50,10 +46,10 @@ Fragment fragmentMain(
|
||||
float2 uv: UV
|
||||
) : SV_Target {
|
||||
Fragment output;
|
||||
if(uniforms.u_HasTexture) {
|
||||
output.color = uniforms.u_Texture.Sample(uv) * uniforms.u_Color;
|
||||
if(u_HasTexture) {
|
||||
output.color = u_Texture.Sample(uv) * u_Color;
|
||||
} else {
|
||||
output.color = someFunction(uniforms.u_Color);
|
||||
output.color = someFunction(u_Color);
|
||||
}
|
||||
return output;
|
||||
}
|
Reference in New Issue
Block a user