// v3DWorld  : 3D 공간상의 좌표
// v2DScreen : 2D 스크린상의 좌표
Ogre::Vector4 v3DWorld(-50, 0, -75, 1.0f);
Ogre::Vector4 pos = mCamera->getProjectionMatrix() * mCamera->getViewMatrix() * v3DWorld;
Ogre::Vector2 v2DScreen(pos.x / pos.w, -pos.y / pos.w);    // -1.0 ~ 1.0 사이의 값
    
// 0.0 ~ 1.0 사이의 값으로 조정
v2DScreen.x = (v2DScreen.x + 1.0f) * 0.5f;
v2DScreen.y = (v2DScreen.y + 1.0f) * 0.5f;

unsigned int iWidth, iHeight, iColor;
int iLeft, iTop;
mWindow->getMetrics(iWidth, iHeight, iColor, iLeft, iTop);
// 화면 가로, 세로 크기에 맞추어 스케일링
v2DScreen.x *= iWidth;
v2DScreen.y *= iHeight;


블로그 이미지

영스파파

3D 세상을 만들기 위한 프로그래밍 정보들을 정리하는 공간

,