GSI


protected bool mLMBDown = false;
const float ROTATE = 0.2f;
const float TRANSLATE = 1;
Point mLastPosition;
Vector3 mTranslation = Vector3.ZERO;

.....

void mogrepanel_MouseDown(object sender, MouseEventArgs e)
{
    mLMBDown = true;
    mLastPosition = e.Location;
}

void mogrepanel_MouseUp(object sender, MouseEventArgs e)
{
    mLMBDown = false;
}

void mogrepanel_MouseMove(object sender, MouseEventArgs e)
{
    mTranslation = Vector3.ZERO;

    if (e.Button == MouseButtons.Left)
    {
        float x = mLastPosition.X - e.Location.X;
        float y = mLastPosition.Y - e.Location.Y;

        // 화면을 Dolly 모드 처럼 구현하기
        mogreWin.camera.Yaw(new Degree(x * ROTATE));
        mogreWin.camera.Pitch(new Degree(y * ROTATE));
    }
    else if (e.Button == MouseButtons.Right)
    {
        float y = mLastPosition.Y - e.Location.Y;

        mTranslation.z = y * TRANSLATE;

        // 화면을 줌인, 줌아웃 처리 하는 것
        mogreWin.camera.Position += mogreWin.camera.Orientation * mTranslation;
    }
    else if (e.Button == MouseButtons.Middle)
    {
        float x = mLastPosition.X - e.Location.X;
        float y = mLastPosition.Y - e.Location.Y;

        mTranslation.x = x * TRANSLATE;
        mTranslation.y = -(y * TRANSLATE);

        // 화면을 좌우상하 움직이는 것
        mogreWin.camera.Position += mTranslation;
    }

    mogreWin.Paint();

    mLastPosition = e.Location;
}

Posted by gsi
: