Files
cup_edit/materials/unlit.mat
2024-11-21 12:30:20 +08:00

57 lines
1.3 KiB
Plaintext

material {
name : unlit,
requires : [ uv0 ],
parameters : [
{
type : sampler2d,
name : baseColorMap
},
{
type : float4,
name : baseColorFactor
},
{
type : int,
name : baseColorIndex
},
{
type: float2,
name: uvScale
},
{
type: float,
name: vertexScale
}
],
depthWrite : true,
depthCulling : true,
shadingModel : unlit,
blending: opaque,
culling: none,
instanced: false,
vertexDomain: object,
}
fragment {
void material(inout MaterialInputs material) {
prepareMaterial(material);
material.baseColor = materialParams.baseColorFactor;
if (materialParams.baseColorIndex > -1) {
highp float2 uv = getUV0();
uv.y = 1.0 - uv.y;
uv *= materialParams.uvScale;
material.baseColor *= texture(materialParams_baseColorMap, uv);
}
}
}
vertex {
void materialVertex(inout MaterialVertexInputs material) {
float4 position = getPosition();
position.xyz *= materialParams.vertexScale;
material.worldPosition = getWorldFromModelMatrix() * position;
}
}