本文整理汇总了C++中CoordinateSystem::moveDown方法的典型用法代码示例。如果您正苦于以下问题:C++ CoordinateSystem::moveDown方法的具体用法?C++ CoordinateSystem::moveDown怎么用?C++ CoordinateSystem::moveDown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoordinateSystem
的用法示例。
在下文中一共展示了CoordinateSystem::moveDown方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: keyboard
void keyboard(unsigned char key, int x, int y)
{
Vector3 origin = Vector3::ZERO;
Vector3 direction_to_origin;
switch (key)
{
case 27: // on [ESC]
exit(0); // normal exit
break;
case ' ':
camera.moveForward(0.5);
break;
case 'w':
camera.moveUp(0.5);
break;
case 'a':
camera.moveLeft(0.5);
break;
case 's':
camera.moveDown(0.5);
break;
case 'd':
camera.moveRight(0.5);
break;
case 'h':
direction_to_origin = origin - camera.getPosition();
camera.rotateToVector(direction_to_origin, 0.1);
break;
case ',':
camera.setRoll(0.1);
break;
case '.':
camera.setRoll(-0.1);
break;
case '/':
camera.moveBackward(0.5);
break;
}
}
示例2: update
void update()
{
if (key_pressed[' '])
{
camera.moveForward(MOVE_SPEED);
}
if (key_pressed['w'] || key_pressed['W'])
{
camera.moveUp(MOVE_SPEED);
}
if (key_pressed['a'] || key_pressed['A'])
{
camera.moveLeft(MOVE_SPEED);
}
if (key_pressed['s'] || key_pressed['S'])
{
camera.moveDown(MOVE_SPEED);
}
if (key_pressed['d'] || key_pressed['D'])
{
camera.moveRight(MOVE_SPEED);
}
if (key_pressed['h'])
{
Vector3 origin = Vector3::ZERO;
Vector3 direction_to_origin;
direction_to_origin = origin - camera.getPosition();
camera.rotateToVector(direction_to_origin, THETA);
}
if (key_pressed[','] || key_pressed['<'])
{
camera.setRoll(THETA);
}
if (key_pressed['.'] || key_pressed['>'])
{
camera.setRoll(-THETA);
}
if (key_pressed['/'] || key_pressed['?'])
{
camera.moveBackward(MOVE_SPEED);
}
if (special_key_pressed[GLUT_KEY_RIGHT])
{
camera.setYaw(-THETA);
}
if (special_key_pressed[GLUT_KEY_LEFT])
{
camera.setYaw(THETA);
}
if (special_key_pressed[GLUT_KEY_UP])
{
camera.setPitch(THETA);
}
if (special_key_pressed[GLUT_KEY_DOWN])
{
camera.setPitch(-THETA);
}
sleep(1.0 / 60.0);
glutPostRedisplay();
}