gpu_get_tex_mip_enable_ext

使用此函数,您可以了解是关闭mipmap、为所有内容启用mipmap还是仅为着色器采样器上的纹理组管理器中选定的纹理组启用mipmap。为着色器采样器提供索引值(由函数shader_get_sampler_index()返回),该函数将返回下面列出的常量之一。

 

语法:

gpu_get_tex_mip_enable_ext(sampler_index);

参数类型描述
sampler_index着色器采样器控制柄要获取的着色器采样器的索引

 

返回:

Constant

常量描述
mip_offMipmapping is disabled.
mip_onMipmapping for all textures is enabled.
mip_markedonlyMipmapping is enabled for textures that have it enabled in the Texture Group options.

 

例子:

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_mip_enable_ext(_sampleIndex) != mip_on)
{
    gpu_set_tex_mip_enable_ext(_sampleIndex, mip_on);
}
texture_set_stage(_sampleIndex , _spriteTex);
shader_reset();

如果尚未启用给定着色器纹理采样器,则上述代码将为其启用mipmap。