//fires on mouse move when button is down. 
void mouseMove(int x, int y)
{
	cout << "x:" << x << "||y:" << y << endl;
	if (leftMouseDown)
	{
		if (last_x_pos > x )
		{
			//isMovingLeft = true;
			s.move(-0.1f, 0);
		}
		else if (last_x_pos < x)
		{
			s.move(0.1f, 0);
		}
		//s.move((last_x_pos - x) / 10.0f, 0);
		last_x_pos = x;
	}
}
void keyboard(unsigned char key, int x, int y)
{
   //user interaction here
	switch(key)
	{
	case 'o':
		s.hide();
		break;
	
	case 'p':
		s.show();
		break;

	case 'w':
		s.move(0.1, 0.1);
		break;
	case 'a':
		break;
	case 's':
		s.move(0, -0.1);
		break;
	case 'd':
		break;
	case 'r':
		changeColor[0] = 1;
		changeColor[1] = 0;
		changeColor[2] = 0;
		break;
	case 'g':
		changeColor[0] = 0;
		changeColor[1] = 1;
		changeColor[2] = 0;
		break;
	}

	//s.setColor(changeColor);

	
	glutPostRedisplay();
}
Пример #3
0
void keyboard(unsigned char key, int x, int y)
{
   //user interaction here

	switch(key)
	{
	case 'a':
		viewer[0] -= 0.5f;
	
		break;

		case 'w':
			viewer[1] += 0.5f;
		break;

		case 's':
			viewer[1] -= 0.5f;
		break;

		case 'd':
			viewer[0] += 0.5f;
		break;
		case 'q':
			viewer[2] -= 0.5f;
		break;
	
		case 'e':
			viewer[2] += 0.5f;
		
			break;

			case 'j':
			light_one[1] -= 5.0f;
		break;
		case 'k':
			light_one[1] += 5.0f;
		break;

		
			case 'i':
			light_one[2] -= 5.0f;
		break;
		case 'm':
			light_one[2] += 5.0f;
		break;
		case'1':
			x_pos -= 0.5;
			break;
		case'2':
			x_pos += 0.5;
			break;
		case 'o':
			s.hide();
			break;
		case 'p':
			s.show();
			break;
		case 'W':
			s.move(0,0.1);
			break;
		case 'S':
			s.move(0,-0.1);
			break;
			case 'A':
				s.move(0.1,0);
			break;
			case'D':
				s.move(-0.1,0);
			break;
			case 'r':
				changeColor[0]= 1;
				changeColor[1]= 0;
				changeColor[2]= 0;
				break;
			case 'g': 
				changeColor[1]+= 0.1;
	}
	s.setColor(changeColor);
		glutPostRedisplay();
}