void camera() {
if (GetKeyState(VK_UP) < 0)
rotateX = ++rotateX > 180 ? 180 : rotateX;
if (GetKeyState(VK_DOWN) < 0)
rotateX = --rotateX < 0 ? 0 : rotateX;
if (GetKeyState(VK_LEFT) < 0)
rotateZ++;
if (GetKeyState(VK_RIGHT) < 0)
rotateZ--;
float sinugol = sin(rotateZ * M_PI / 180);
float cosugol = cos(rotateZ * M_PI / 180);
float speed = 0;
if (GetKeyState('W') < 0)
speed = 0.1;
if (GetKeyState('S') < 0)
speed = -0.1;
if (sinugol < 0.5f && cosugol > 0.5f) {
sinugol = -sinugol;
cosugol = -cosugol;
}
if (sinugol < 0.5f && cosugol < 0.5f) {
sinugol = -sinugol;
cosugol = -cosugol;
}
if (sinugol > 0.5f && cosugol > 0.5f) {
sinugol = abs(sinugol);
cosugol = abs(cosugol);
}
if (sinugol > 0.5f && cosugol < 0.5f) {
sinugol = abs(sinugol);
cosugol = abs(cosugol);
}
if (speed != 0)
{
x += sinugol * speed;
y += cosugol * speed;
}
glRotatef(-rotateX, 1, 0, 0);
glRotatef(-rotateZ, 0, 0, 1);
glTranslatef(x, y, -3);
std::cout << sinugol << " " << cosugol << std::endl;
}
что здесь не так?