45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
material {
|
|
name : BakedColorWithMutableConstants,
|
|
requires : [
|
|
color
|
|
],
|
|
constants : [
|
|
{
|
|
name: swizzle,
|
|
type: bool,
|
|
mutable: true,
|
|
default: true,
|
|
},
|
|
{
|
|
name: darken,
|
|
type: bool,
|
|
mutable: true,
|
|
},
|
|
{
|
|
// In generated shader sources, we first specify immutable
|
|
// specialization constants, then mutable specialization constants.
|
|
// By including this dummy constant, we offset the ID of the first
|
|
// mutable constant by one. This is done here purely for testing
|
|
// purposes.
|
|
name: dummy,
|
|
type: bool,
|
|
}
|
|
],
|
|
shadingModel : unlit,
|
|
culling : none,
|
|
}
|
|
|
|
fragment {
|
|
void material(inout MaterialInputs material) {
|
|
prepareMaterial(material);
|
|
if (materialConstants_swizzle) {
|
|
material.baseColor = getColor().gbra;
|
|
} else {
|
|
material.baseColor = getColor();
|
|
}
|
|
if (materialConstants_darken) {
|
|
material.baseColor.rgb *= 0.5;
|
|
}
|
|
}
|
|
}
|