GPU 텍스처 최대 비등방성 레벨 가져오기
이 문서는 gpu_get_tex_max_aniso_ext
함수에 대해 설명합니다. 이 함수를 사용하면 셰이더 샘플러에서 tf_anisotropicfilter
모드를 사용할 때 현재 최대 비등방성 레벨을 가져올 수 있습니다. 이 함수는 shader_get_sampler_index()
함수로 반환된 셰이더 샘플러의 핸들을 인수로 받으며, 1에서 16 사이의 값을 반환합니다.
문법
gpu_get_tex_max_aniso_ext(sampler_index);
인수 설명
인수 이름 | 타입 | 설명 |
---|---|---|
sampler_index | Shader Sampler Handle | 가져올 셰이더 샘플러의 핸들 |
반환값
- 실수값 (기본값: 16)
예제 코드
다음 코드는 주어진 셰이더 텍스처 샘플러의 최대 비등방성 레벨을 8로 설정합니다. 만약 이미 8로 설정되어 있지 않다면, 설정을 변경합니다.
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_aniso_ext(_sampleIndex) != 8) {
gpu_set_tex_max_aniso_ext(_sampleIndex, 8);
}
texture_set_stage(_sampleIndex, _spriteTex);
shader_reset();
활용 예제
예제 1: 비등방성 필터링 설정
var _sampleIndex = shader_get_sampler_index(shd_Texture, "s_Texture");
if (gpu_get_tex_max_aniso_ext(_sampleIndex) < 4) {
gpu_set_tex_max_aniso_ext(_sampleIndex, 4);
}
예제 2: 텍스처 단계 설정
var _sampleIndex = shader_get_sampler_index(shd_Effect, "s_Effect");
var _texture = sprite_get_texture(sprite_index, 1);
texture_set_stage(_sampleIndex, _texture);
예제 3: 비등방성 레벨 확인
var _sampleIndex = shader_get_sampler_index(shd_Reflection, "s_Reflection");
var maxAniso = gpu_get_tex_max_aniso_ext(_sampleIndex);
show_message("현재 최대 비등방성 레벨: " + string(maxAniso));
이 문서에서는 gpu_get_tex_max_aniso_ext
함수의 사용법과 예제를 통해 비등방성 필터링을 설정하는 방법을 설명했습니다.