예제 #1
0
		void Manipulator::update(TouchEvent &touch_event) {
			unsigned char  type = touch_event._event_type;
			if((type & (1 << 6)) && (type & (1<<7))) {
				if((type & 1) && (type & 2)){









					// do nothing
				}else if(type & 1){

					rotateTrackball(touch_event._x1, touch_event._y1,_last_cord1._v[0], _last_cord1._v[1]);
				}else if(type & 2){

					rotateTrackball(touch_event._x2, touch_event._y2,_last_cord2._v[0], _last_cord2._v[1]);
				}
			}
			updateLastPoint(touch_event);
		}
예제 #2
0
void motion(int x, int y)
{
    int dx, dy;

    dx = x - ox;
    dy = y - oy;

    ox = x;
    oy = y;

    switch(trackballMode) {
	case ROTATE:
	    rotateTrackball(dx, dy, xform.rotation);
	    break;

	case SCALEX:
	    xform.scale[0] += (dx + dy) / 20.0f;
	    break;

	case SCALEY:
	    xform.scale[1] += (dx + dy) / 20.0f;
	    break;

	case SCALEZ:
	    xform.scale[2] += (dx + dy) / 20.0f;
	    break;

	case TRANSLATEXY:
	    xform.translation[0] += dx / 20.0f;
	    xform.translation[1] -= dy / 20.0f;
	    break;

	case TRANSLATEZ:
	    xform.translation[2] += (dx + dy) / 20.0f;
	    break;
    }
    glutPostRedisplay();
}