// 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;
'Ogre3D' 카테고리의 다른 글
setTextureVScroll() 함수가 실행이 안 되는 경우 (0) | 2011.03.24 |
---|---|
그림자 처리에서 제외시 처리 사항 (0) | 2011.01.12 |
Ogre 쉐이더 설정 방법 - 칼라, 흑백 전환 쉐이더 코드 (0) | 2010.12.27 |
Ogre에서 2D 화면 좌표를 3D 공간 좌표로 변환하는 방법 (0) | 2010.12.20 |
Ogre에서 화면에 2D 오브젝트 그리기 (0) | 2010.12.20 |