Shader.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 setNormalsEnabled(bool use);
  28. void setUseBlending(bool use);
  29. // model matrix operations
  30. void pop();
  31. void push();
  32. void setToIdentity();
  33. void scale(float sx, float sy, float sz);
  34. void translate(float tx, float ty, float tz);
  35. void translateX(float tx);
  36. void translateY(float ty);
  37. void translateZ(float tz);
  38. void translateTo(float tx, float ty, float tz);
  39. void rotate(float xDegrees, float yDegrees, float zDegrees);
  40. void rotateX(float degrees);
  41. void rotateY(float degrees);
  42. void rotateZ(float degrees);
  43. void updateModelMatrix();
  44. private:
  45. Matrix3D proj;
  46. int unifProjMatrix = 0;
  47. Matrix3D view;
  48. int unifViewMatrix = 0;
  49. Matrix3DStack model;
  50. int unifModelMatrix = 0;
  51. Vector3D oldCamera;
  52. Vector3D camera;
  53. float oldLengthAngle;
  54. float lengthAngle;
  55. float oldWidthAngle;
  56. float widthAngle;
  57. Vector3D front;
  58. Vector3D back;
  59. Vector3D right;
  60. Vector3D left;
  61. Vector3D up;
  62. Vector3D down;
  63. float fovY = 60;
  64. float nearClip = 0.1f;
  65. float farClip = 1000.0f;
  66. int unifUseTexture = 0;
  67. int unifUseColor = 0;
  68. int unifUseMixColor = 0;
  69. int unifMixColorLoc = 0;
  70. int unifUseNormals = 0;
  71. };
  72. #endif