graphics.undefineEffect()

类型 函数
graphics.*
返回值
修订 版本 2024.3703
关键词 着色器,效果,图形
另请参阅 自定义着色器效果 (指南)
滤镜 / 生成器 / 复合 (指南)

概述

此函数允许您取消定义/释放自定义着色器效果。

语法

graphics.undefineEffect( effect )
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" )