SSAOShader.h 946 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef SSAOSHADER_H
  2. #define SSAOSHADER_H
  3. #include "client/engine/shader/ShaderProgram.h"
  4. class SSAOShader
  5. {
  6. public:
  7. SSAOShader();
  8. virtual ~SSAOShader();
  9. bool init();
  10. void resize();
  11. void preRender(const float* projMatrix);
  12. void bindTexture(unsigned int textureUnit);
  13. void bindNoiseTexture(unsigned int textureUnit);
  14. void setNumberOfSamples(int amount);
  15. int getNumberOfSamples() const;
  16. void setSampleRadius(float sampleRadius);
  17. float getSampleRadius() const;
  18. private:
  19. // shader
  20. ShaderProgram program;
  21. // framebuffer
  22. GLuint framebuffer = 0;
  23. // textures
  24. GLuint texture = 0;
  25. GLuint noiseTexture = 0;
  26. // uniform data
  27. int numberOfSamples = 32;
  28. float radius = 2.5f;
  29. // uniforms locations
  30. GLint unifProjMatrix = 0;
  31. GLint unifNumberOfSamples = 0;
  32. GLint unifRadius = 0;
  33. GLint unifWidth = 0;
  34. GLint unifHeight = 0;
  35. };
  36. #endif