Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <GLFW\glfw3.h>
- #include <glm\glm.hpp>
- #include <glm\gtc\matrix_transform.hpp>
- #include <glm\gtc\type_ptr.hpp>
- class camera
- {
- public:
- glm::vec3 cameraPos;
- glm::vec3 cameraFront;
- glm::vec3 cameraUp;
- float speed;
- float yaw;
- float pitch;
- camera(glm::vec3 _pos, glm::vec3 _front, glm::vec3 _up, float _speed)
- {
- cameraPos = _pos;
- cameraFront = _front;
- cameraUp = _up;
- speed = _speed;
- }
- glm::mat4 lookAt()
- {
- return glm::lookAt(cameraPos, cameraPos + cameraFront, cameraUp);
- }
- void update()
- {
- glm::vec3 front;
- front.x = cos(glm::radians(pitch)) * cos(glm::radians(yaw));
- front.y = sin(glm::radians(pitch));
- front.z = cos(glm::radians(pitch)) * sin(glm::radians(yaw));
- cameraFront = glm::normalize(front);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment