Advertisement
adwas33

Untitled

Mar 21st, 2022
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. void ustawKamere(GLint _uniView) {
  2. float cameraSpeed = 0.0009f;
  3. //aktualizowanie zmiennej opisującej położenie kamery
  4. if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
  5. cameraPos -= cameraSpeed * cameraFront;
  6. }
  7. if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
  8. cameraPos += cameraSpeed * cameraFront;
  9. }
  10. if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
  11. obrot += cameraSpeed;
  12. cameraFront.x = sin(obrot);
  13. cameraFront.z = -cos(obrot);
  14. }
  15. if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
  16. obrot -= cameraSpeed;
  17. cameraFront.x = sin(obrot);
  18. cameraFront.z = -cos(obrot);
  19. }
  20. glm::mat4 view;
  21. //funkcja tworząca macierz widoku
  22. view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
  23. glUniformMatrix4fv(_uniView, 1, GL_FALSE, glm::value_ptr(view));
  24. //wysłanie macierzy do karty graficznej
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement