使用此函数,您可以了解是关闭mipmap、为所有内容启用mipmap还是仅为着色器采样器上的纹理组管理器中选定的纹理组启用mipmap。为着色器采样器提供索引值(由函数shader_get_sampler_index()返回),该函数将返回下面列出的常量之一。
gpu_get_tex_mip_enable_ext(sampler_index);
参数 | 类型 | 描述 |
---|---|---|
sampler_index | 着色器采样器控制柄 | 要获取的着色器采样器的索引 |
常量 | 描述 |
---|---|
mip_off | Mipmapping is disabled. |
mip_on | Mipmapping for all textures is enabled. |
mip_markedonly | Mipmapping 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。