@:directlyUsed@:src({
@param var texture:Sampler2D;
@param var matrix:Mat4;
@const var useAlpha:Bool;
@const var useMask:Bool;
@const var maskInvert:Bool;
@const var hasSecondMatrix:Bool;
@param var matrix2:Mat4;
@param var mask:Sampler2D;
@param var maskMatA:Vec3;
@param var maskMatB:Vec3;
@param var maskPower:Float;
@param var maskChannel:Vec4;
function apply(color:Vec4, mat:Mat4):Vec4 {
return useAlpha ? color * mat : vec4(color.rgb, 1.) * mat;
};
function fragment() {
if (useMask) {
var color = texture.get(input.uv);
var uv = vec3(input.uv, 1);
var k = pow(mask.get(vec2(uv.dot(maskMatA), uv.dot(maskMatB))).dot(maskChannel), maskPower);
var color2 = hasSecondMatrix ? apply(color, matrix2) : color;
output.color = maskInvert ? mix(color2, apply(color, matrix), k) : mix(apply(color, matrix), color2, k);
} else output.color = apply(texture.get(input.uv), matrix);
};
})@:build(hxsl.Macros.buildShader())@:autoBuild(hxsl.Macros.buildShader())