Tutorial 16: Frustum Culling 연습문제
To Do Exercises
1. Recompile and run the program. Use the left and right arrow key to move the camera and update the render count in the upper left corner.
2. Load the cube model instead and change the cull check to CheckCube.
3. Create some different models and test which of the culling checks works best for them.
1. 프로그램을 다시 컴파일하고 실행해 보십시오. 왼쪽/오른쪽 화살표 키를 이용하여 카메라를 움직이고 왼쪽 위 화면에 구체 수가 나오는지 확인하십시오.

2. CheckCube 함수를 확인하기 위해 정육면체 모델을 로드하도록 해 보십시오.
graphicsclass.cpp
bool GraphicsClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
{
..............................생략..............................
result = m_Model->Initialize(m_D3D->GetDevice(),
L"../rastertek/data/seafloor.dds", "../rastertek/data/cube2.txt");
..............................생략..............................
graphicsclass.cpp
bool GraphicsClass::Render()
{
.................................생략.................................
renderModel = m_Frustum->CheckCube(positionX, positionY, positionZ, radius);
.................................생략.................................
}

참고로 cube2.txt 는 Tutorial 8 : 'Loading Mayas 2011 Models' 연습문제에서 블랜더를 paser한 모델입니다.
3. 몇 가지 다른 모델들을 만들고 어느 모양을 이용한 컬링 방식이 가장 좋은지 찾아 보십시오.
성능을 평가하기 위해 이전 튜토리얼 15 : FPS, CPU, Usage and Timer를 재사용하였다.
fps와 cpu를 출력하기 위해 아래의 파일들을 사용하면 된다.
참고, 아래의 cpp파일들 중 파일입출력 경로가 ../rastertek/... 이런식으로 되어있는 곳은 본인의 폴더명에 맞게 수정하면 된다. 원문에서는 ../Engine/... 으로 되어있다.
그리고 여기서부터는 model.txt를 사용함.
graphicsclass.cpp
bool GraphicsClass::Initialize(int screenWidth, int screenHeight, HWND hwnd)
{
..............................생략..............................
result = m_Model->Initialize(m_D3D->GetDevice(),
L"../rastertek/data/seafloor.dds", "../rastertek/data/model.txt");
..............................생략..............................
- CheckPoint 사용
graphicsclass.cpp
bool GraphicsClass::Render()
{
.................................생략.................................
renderModel = m_Frustum->CheckPoint(positionX, positionY, positionZ);
.................................생략.................................
}

카메라에서 모델이 사라지는게 눈으로 보이기 때문에 실제 인게임에서는 몰입도를 방해할 것 같다.
- CheckCube사용
graphicsclass.cpp
bool GraphicsClass::Render()
{
.................................생략.................................
renderModel = m_Frustum->CheckCube(positionX, positionY, positionZ, radius);
.................................생략.................................
}

CheckPoint에 비해 모델들이 사라지는게 안보여서 오히려 좋았다.
- CheckSphere 사용
graphicsclass.cpp
bool GraphicsClass::Render()
{
.................................생략.................................
renderModel = m_Frustum->CheckSphere(positionX, positionY, positionZ, radius);
.................................생략.................................
}

개인적으로 CheckCube와 큰 차이를 못느꼈다. 다만 우연인지 CPU사용량이 조금 올라간 느낌은 있다.