Shader.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #ifndef CAMERA_H
  2. #define CAMERA_H
  3. #include "../math/Vector3D.h"
  4. #include "../math/Matrix3D.h"
  5. #include "../math/Matrix3DStack.h"
  6. class Shader
  7. {
  8. public:
  9. Shader();
  10. Shader(const Shader& orig);
  11. virtual ~Shader();
  12. void set3DMode(float lag);
  13. void set2DMode();
  14. void storeCamera();
  15. void setCamera(float x, float y, float z, float length, float width);
  16. const Vector3D& getFront() const;
  17. const Vector3D& getBack() const;
  18. const Vector3D& getRight() const;
  19. const Vector3D& getLeft() const;
  20. const Vector3D& getUp() const;
  21. const Vector3D& getDown() const;
  22. void setTextureEnabled(bool use);
  23. void setColorEnabled(bool use);
  24. void setMixColorEnabled(bool use);
  25. void setMixColor(float r, float g, float b, float a);
  26. void setTextMode();
  27. void setUseBlending(bool use);
  28. // model matrix operations
  29. void pop();
  30. void push();
  31. void setToIdentity();
  32. void scale(float sx, float sy, float sz);
  33. void translate(float tx, float ty, float tz);
  34. void translateX(float tx);
  35. void translateY(float ty);
  36. void translateZ(float tz);
  37. void translateTo(float tx, float ty, float tz);
  38. void rotate(float xDegrees, float yDegrees, float zDegrees);
  39. void rotateX(float degrees);
  40. void rotateY(float degrees);
  41. void rotateZ(float degrees);
  42. void updateModelMatrix();
  43. private:
  44. Matrix3D proj;
  45. int unifProjMatrix = 0;
  46. Matrix3D view;
  47. int unifViewMatrix = 0;
  48. Matrix3DStack model;
  49. int unifModelMatrix = 0;
  50. Vector3D oldCamera;
  51. Vector3D camera;
  52. float oldLengthAngle;
  53. float lengthAngle;
  54. float oldWidthAngle;
  55. float widthAngle;
  56. Vector3D front;
  57. Vector3D back;
  58. Vector3D right;
  59. Vector3D left;
  60. Vector3D up;
  61. Vector3D down;
  62. float fovY = 60;
  63. float nearClip = 0.1f;
  64. float farClip = 1000.0f;
  65. int unifUseTexture = 0;
  66. int unifUseColor = 0;
  67. int unifUseMixColor = 0;
  68. int unifMixColorLoc = 0;
  69. };
  70. #endif