void CameraDefaultCtrl::onMouseMove(float x, float y)
	{
		if(m_bLeftDrag)
		{
			Vector2 nowPt(x,y);
			Vector2 delta = nowPt - m_lastDragPt;

			m_yaw += delta.x*2;
			m_pitch += delta.y*2;

			updateViewMat();

			m_lastDragPt.x = x;
			m_lastDragPt.y = y;
		}
		else if(m_bRightDrag)
		{
			Vector3 vX(1, 0, 0);
			Vector3 vZ(0, 0, 1);

			Vector2 nowPt(x,y);
			Vector2 delta = nowPt - m_lastDragPt;


			delta *= m_moveSpeed;
			m_lookAt -= vX*delta.x;
			m_lookAt -= vZ*delta.y;

			updateViewMat();

			m_lastDragPt = nowPt;
		}
	}
Beispiel #2
0
void Roam::turn(int direct) {
    int dX[4] = { 1, -1, 0, 0 };
    int dY[4] = { 0, 0, 1, -1 };
    CPoint nowPt(5 * dX[direct], 5 * dY[direct]);
    CPoint prePt(0, 0);
    rotateCenter(nowPt, prePt);
}