GPU 텍스처 최대 비등방성 설정
이 문서에서는 gpu_set_tex_max_aniso_ext
함수에 대해 설명합니다. 이 함수는 셰이더 샘플러에서 비등방성 필터 모드를 사용할 때 최대 비등방성 수준을 설정하는 데 사용됩니다. 비등방성 필터링에 대한 자세한 내용은 gpu_get_tex_mip_filter()
함수를 참조하세요.
함수 설명
구문
gpu_set_tex_max_aniso_ext(sampler_index, maxaniso);
인수 설명
인수 이름 | 타입 | 설명 |
---|---|---|
sampler_index | Shader Sampler Handle | 설정할 셰이더 샘플러의 핸들입니다. shader_get_sampler_index() 함수로 반환됩니다. |
maxaniso | Real | 사용할 최대 비등방성 수준 (기본값: 16)입니다. |
반환 값
- N/A
예제 코드
아래 코드는 주어진 셰이더 텍스처 샘플러에 대해 최대 비등방성 수준을 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");
gpu_set_tex_max_aniso_ext(_sampleIndex, 16);
예제 2: 비등방성 수준 변경
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);
}
예제 3: 여러 텍스처에 비등방성 필터링 적용
var _sampleIndex1 = shader_get_sampler_index(shd_Texture1, "s_Texture");
var _sampleIndex2 = shader_get_sampler_index(shd_Texture2, "s_Texture");
gpu_set_tex_max_aniso_ext(_sampleIndex1, 8);
gpu_set_tex_max_aniso_ext(_sampleIndex2, 8);
예제 4: 비등방성 필터링 해제
var _sampleIndex = shader_get_sampler_index(shd_Texture, "s_Texture");
gpu_set_tex_max_aniso_ext(_sampleIndex, 1);
이 문서에서는 gpu_set_tex_max_aniso_ext
함수의 사용법과 다양한 활용 예제를 살펴보았습니다.