fork(2) download
  1. #ifndef CAMERA_H
  2. #define CAMERA_H
  3.  
  4. #include <GL/glm/glm.hpp> //Include GLM library
  5. #include <GL/glm/gtc/matrix_transform.hpp> //Include header to be able to perform matrix transformations
  6. #include <GL/glm/gtc/type_ptr.hpp> //Get direct pointer to matrix data
  7. #include <GL/freeglut.h>
  8.  
  9. class Camera
  10. {
  11. public:
  12. //Constructors
  13. Camera(); //Default constructor called if no parameter is passed. .
  14. Camera(GLfloat camPosX, GLfloat camPosY, GLfloat camPosZ, //Explicit constructor.
  15. GLfloat camTargetX, GLfloat camTargetY, GLfloat camTargetZ);
  16.  
  17. glm::mat4 createViewMatrix(); //Create the view matrix
  18.  
  19. //Camera rotation
  20. /*void yawRotation(GLfloat angle); //Yaw rotation
  21. void pitchRotation(GLfloat angle); //Pitch rotation limited to +- 90 degrees
  22.  
  23. //Camera movements
  24. void moveForward(GLfloat moveSpeed);
  25. void moveBackward(GLfloat moveSpeed);
  26. void moveLeft(GLfloat moveSpeed);
  27. void moveRight(GLfloat moveSpeed);
  28. void moveUp(GLfloat moveSpeed);
  29. void moveDown(GLfloat moveSpeed);*/
  30.  
  31. private:
  32. glm::vec3 cameraPosition; //Position of camera in the world
  33. glm::vec3 cameraTarget; //Target of the camera in the world
  34.  
  35. //GLfloat degToRad(GLfloat angle); //Convert degrees to radians
  36. //glm::vec3 cartesianToSpherical(glm::vec3 cartesianCoord); //Convert cartesian coordinates to spherical coordinates
  37. //glm::vec3 sphericalToCartesian(glm::vec3 sphericalCoord); //Convert spherical coordinates to cartesian coordinates
  38. };
  39. #endif
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:4:48: error: GL/glm/glm.hpp: No such file or directory
prog.cpp:5:105: error: GL/glm/gtc/matrix_transform.hpp: No such file or directory
prog.cpp:6:71: error: GL/glm/gtc/type_ptr.hpp: No such file or directory
prog.cpp:7:25: error: GL/freeglut.h: No such file or directory
prog.cpp:14: error: expected `)' before ‘camPosX’
prog.cpp:17: error: ‘glm’ has not been declared
prog.cpp:17: error: ISO C++ forbids declaration of ‘mat4’ with no type
prog.cpp:17: error: expected ‘;’ before ‘createViewMatrix’
prog.cpp:32: error: ‘glm’ has not been declared
prog.cpp:32: error: ISO C++ forbids declaration of ‘vec3’ with no type
prog.cpp:32: error: expected ‘;’ before ‘cameraPosition’
prog.cpp:33: error: ‘glm’ has not been declared
prog.cpp:33: error: ISO C++ forbids declaration of ‘vec3’ with no type
prog.cpp:33: error: expected ‘;’ before ‘cameraTarget’
stdout
Standard output is empty