Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ustawKamere(GLint _uniView) {
- float cameraSpeed = 0.0009f;
- //aktualizowanie zmiennej opisującej położenie kamery
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down)){
- cameraPos -= cameraSpeed * cameraFront;
- }
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up)){
- cameraPos += cameraSpeed * cameraFront;
- }
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right)){
- obrot += cameraSpeed;
- cameraFront.x = sin(obrot);
- cameraFront.z = -cos(obrot);
- }
- if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left)){
- obrot -= cameraSpeed;
- cameraFront.x = sin(obrot);
- cameraFront.z = -cos(obrot);
- }
- glm::mat4 view;
- //funkcja tworząca macierz widoku
- view = glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
- glUniformMatrix4fv(_uniView, 1, GL_FALSE, glm::value_ptr(view));
- //wysłanie macierzy do karty graficznej
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement