屏幕坐标系:左上角为(0, 0)右下角为(1, 1)
OGRE的2D坐标系:左上角为(-1, 1)右下角为(1, -1)
CEGUI坐标系:左上角为(0, 0),单位像素
转换公式(鼠标坐标=>OGRE的2D坐标)
void setCorners(float left, float top, float right, float bottom)
{
left = left * 2 - 1;
right = right * 2 - 1;
top = 1 - top * 2;
bottom = 1 - bottom * 2;
}
对于根据鼠标位置来产生射线:
bool mousePressed(const OIS::MouseEvent &arg, OIS::MouseButtonID id)
{
...
CEGUI::Point mousePos = CEGUI::MouseCurso......
阅读全文