surface_has_depth 함수 설명
surface_has_depth
함수는 주어진 서피스가 깊이 버퍼를 가지고 있는지를 반환합니다. 깊이 버퍼가 생성되면 스텐실 버퍼도 생성될 수 있으므로, 깊이 버퍼와 관련된 기능입니다. 이 함수를 사용하여 서피스가 깊이 버퍼를 포함하고 있는지 확인할 수 있습니다.
문법
surface_has_depth(surface)
인수
인수 | 유형 | 설명 |
---|---|---|
surface | Surface | 확인할 서피스 |
반환 값
반환 값 | 유형 | 설명 |
---|---|---|
Boolean | 서피스가 깊이 버퍼를 가지고 있으면 true, 아니면 false |
예제
var _has_depth = surface_has_depth(surf_colour);
if (!_has_depth) {
show_debug_message("surf_colour has no depth buffer.");
}
위의 코드는 surface_has_depth
를 호출하여 surf_colour
라는 변수에 저장된 서피스가 깊이 버퍼를 가지고 있는지 확인하고, 결과를 _has_depth
라는 지역 변수에 저장합니다. 만약 서피스가 깊이 버퍼를 가지고 있지 않다면, 디버그 메시지가 표시됩니다.
활용 예제
예제 1: 깊이 버퍼가 있는 서피스 사용
var surf = surface_create(800, 600);
surface_depth_disable(surf, true); // 깊이 버퍼 사용 설정
if (surface_has_depth(surf)) {
show_debug_message("서피스는 깊이 버퍼를 가지고 있습니다.");
}
예제 2: 깊이 버퍼가 없는 서피스 처리
var surf = surface_create(800, 600);
surface_depth_disable(surf, false); // 깊이 버퍼 사용 비활성화
if (!surface_has_depth(surf)) {
show_debug_message("서피스는 깊이 버퍼가 없습니다.");
}
예제 3: 여러 서피스의 깊이 버퍼 확인
var surf1 = surface_create(800, 600);
var surf2 = surface_create(800, 600);
surface_depth_disable(surf1, true);
surface_depth_disable(surf2, false);
if (surface_has_depth(surf1)) {
show_debug_message("surf1은 깊이 버퍼를 가지고 있습니다.");
}
if (!surface_has_depth(surf2)) {
show_debug_message("surf2는 깊이 버퍼가 없습니다.");
}
이 문서에서는 surface_has_depth
함수의 사용법과 다양한 활용 예제를 설명했습니다.