WorldShader.h 936 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #ifndef WORLDSHADER_H
  2. #define WORLDSHADER_H
  3. #include "client/engine/shader/ShaderProgram.h"
  4. class WorldShader
  5. {
  6. public:
  7. WorldShader();
  8. virtual ~WorldShader();
  9. bool init();
  10. void resize();
  11. void preRender(const float* projMatrix);
  12. void bindPositionTexture(unsigned int textureUnit);
  13. void bindNormalTexture(unsigned int textureUnit);
  14. void bindColorTexture(unsigned int textureUnit);
  15. void bindDepthTexture(unsigned int textureUnit);
  16. void setViewMatrix(const float* data);
  17. void setModelMatrix(const float* data);
  18. private:
  19. // shader
  20. ShaderProgram program;
  21. // framebuffer
  22. GLuint framebuffer = 0;
  23. // textures
  24. GLuint positionTexture = 0;
  25. GLuint normalTexture = 0;
  26. GLuint colorTexture = 0;
  27. GLuint depthTexture = 0;
  28. // uniforms locations
  29. GLint unifProjMatrix = 0;
  30. GLint unifViewMatrix = 0;
  31. GLint unifModelMatrix = 0;
  32. };
  33. #endif