Shader: Replace select_opt by const_select
This commit is contained in:
@@ -55,13 +55,22 @@ struct FragOut
|
||||
[entry(frag)]
|
||||
fn main(input: FragIn) -> FragOut
|
||||
{
|
||||
let diffuseColor = settings.DiffuseColor;
|
||||
const if (HAS_DIFFUSE_TEXTURE)
|
||||
// TODO: diffuseColor *= MaterialDiffuseMap.Sample(input.uv)
|
||||
diffuseColor = diffuseColor * MaterialDiffuseMap.Sample(input.uv);
|
||||
|
||||
const if (HAS_ALPHA_TEXTURE)
|
||||
// TODO: diffuseColor.w *= MaterialAlphaMap.Sample(input.uv)).x
|
||||
diffuseColor = vec4<f32>(diffuseColor.x, diffuseColor.y, diffuseColor.z, ((MaterialAlphaMap.Sample(input.uv)).x) * diffuseColor.w);
|
||||
|
||||
const if (ALPHA_TEST)
|
||||
{
|
||||
if (diffuseColor.w < settings.AlphaThreshold)
|
||||
discard;
|
||||
}
|
||||
|
||||
let output: FragOut;
|
||||
let diffuseColor = select_opt(HAS_DIFFUSE_TEXTURE, MaterialDiffuseMap.Sample(input.uv) * settings.DiffuseColor, settings.DiffuseColor);
|
||||
let diffuseColor = select_opt(HAS_ALPHA_TEXTURE, vec4<f32>(diffuseColor.x, diffuseColor.y, diffuseColor.z, ((MaterialAlphaMap.Sample(input.uv)).x) * diffuseColor.w), diffuseColor);
|
||||
|
||||
if (select_opt(ALPHA_TEST, diffuseColor.w < settings.AlphaThreshold, false))
|
||||
discard;
|
||||
|
||||
output.RenderTarget0 = diffuseColor;
|
||||
return output;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user