// --------------------------------- static private void MouseEndTrackBall(int x, int y) { // y = camera.viewHeight - y; if (gTrackball) { // if we are currently tracking, end trackball if (gTrackBallRotation[0] != 0.0) { TrackBall.addToRotationTrackball(gTrackBallRotation, view.worldRotation); } gTrackBallRotation[0] = gTrackBallRotation[1] = gTrackBallRotation[2] = gTrackBallRotation[3] = 0.0f; } }
static public void mouseDragged(int button, int x, int y) { //y = camera.viewHeight - y; if (button > 0) { if (TrackBall.gTrackball) { TrackBall.rollToTrackball(x, y, ref gTrackBallRotation); } else if (TrackBall.gDolly) { mouseDolly(x, y); } else if (TrackBall.gPan) { mousePan(x, y); } } }
//----------------------------------------------------------------------------- static public void mouseDown(int mousex, int mousey) // trackball { if (gDolly) // send to pan { MouseDollyStart(mousex, mousey); } else if (gPan) // send to dolly { MousePanStart(mousex, mousey); } else { // y = camera.viewHeight - y; gDolly = false; // no dolly gPan = false; // no pan gTrackball = true; TrackBall.startTrackball(mousex, mousey, 0, 0, view.Width, view.Height); } }
// --------------------------------- static public void mouseUp() { if (gDolly) { // end dolly gDolly = false; } else if (gPan) { // end pan gPan = false; } else if (gTrackball) { // end trackball gTrackball = false; if (gTrackBallRotation[0] != 0.0) { TrackBall.addToRotationTrackball(gTrackBallRotation, view.worldRotation); } gTrackBallRotation[0] = gTrackBallRotation[1] = gTrackBallRotation[2] = gTrackBallRotation[3] = 0.0f; } }