使用此函数,您可以获得当前设置的最大mipmap级别,该级别将用于给定着色器采样器。为着色器采样器提供索引值(由函数shader_get_sampler_index()返回),该函数将返回当前最大mipmap级别,其中值0表示最高分辨率,1表示使用第一个mipmap,2表示第二个mipmap等...请注意,这对于在渲染纹理时避免出血瑕疵非常有用,例如,将纹理页面边界设置为8 px,然后将最大mipmap级别设置为3将确保在较大的渲染距离下不会出现任何出血问题。
gpu_get_tex_max_mip_ext(sampler_index);
参数 | 类型 | 描述 |
---|---|---|
sampler_index | 着色器采样器控制柄 | 要获取的着色器采样器的索引 |
Real (default: 16)
var _sampleIndex = shader_get_sampler_index(shd_Glass, "s_Background");
var _spriteTex = sprite_get_texture(sprite_index, 0);
shader_set(shd_Glass);
if (gpu_get_tex_max_mip_ext(_sampleIndex) != 4)
{
gpu_set_tex_max_mip_ext(_sampleIndex, 4);
}
texture_set_stage(_sampleIndex , _spriteTex);
shader_reset();
上述代码将给定着色器纹理采样器的最大mipmap级别设置为4(如果尚未将其设置为4)。