类型 函数 库 graphics.* 返回值 无 修订 版本 2024.3703 关键词 着色器,效果,图形 另请参阅 自定义着色器效果 (指南) 滤镜 / 生成器 / 复合 (指南)
此函数允许您取消定义/释放自定义着色器效果。
graphics.undefineEffect( effect )
字符串。 自定义着色器效果的全名,例如"<类别>.<组>.<名称>"
local kernel = {}
kernel.category = "filter"
kernel.name = "myBrighten"
kernel.fragment =
[[
P_COLOR vec4 FragmentKernel( P_UV vec2 texCoord )
{
P_COLOR float brightness = 0.5;
P_COLOR vec4 texColor = texture2D( CoronaSampler0, texCoord );
// Pre-multiply the alpha to brightness
brightness = brightness * texColor.a;
// Add the brightness
texColor.rgb += brightness;
// Modulate by the display object's combined alpha/tint
return CoronaColorScale( result );
}
]]
graphics.defineEffect( kernel )
-- When the effect is no longer needed, it can be undefined
graphics.undefineEffect( "filter.custom.myBrighten" )