Simple game engine with complete export to scripting language
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ShaderManager.h 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. #ifndef BLUECORE_SHADER_MANAGER_H
  2. #define BLUECORE_SHADER_MANAGER_H
  3. #include <map>
  4. #include <string>
  5. #include "GL/glew.h"
  6. #include "Utilities/Referenced.h"
  7. #include "TextureManager.h"
  8. #include "RenderWindow.h"
  9. namespace BlueCore {
  10. typedef GLhandleARB ShaderProgram;
  11. typedef GLhandleARB VertexShader;
  12. typedef GLhandleARB FragmentShader;
  13. class ShaderManager : public Referenced, public sigslot::has_slots<>
  14. {
  15. typedef std::map<std::string, VertexShader> VertexShaderMap;
  16. typedef std::map<std::string, FragmentShader> FragmentShaderMap;
  17. typedef std::map<std::string, ShaderProgram> ShaderProgramMap;
  18. VertexShaderMap vertex_shader;
  19. FragmentShaderMap fragment_shader;
  20. ShaderProgramMap shader_programs;
  21. VertexShader loadVertexShader(const std::string &name);
  22. FragmentShader loadFragmentShader(const std::string &name);
  23. bool _usingShaders;
  24. ref_ptr<RenderWindow> _RenderWindow;
  25. void shutdown();
  26. void WindowCloseSlot();
  27. public:
  28. ShaderManager (RenderWindow* renderwindow);
  29. virtual ~ShaderManager();
  30. bool usingShaders();
  31. ShaderProgram loadShaderProgram(const std::string &name);
  32. void useShaderProgram(ShaderProgram shader_program);
  33. void useTexture(ShaderProgram shader_program, unsigned int texture,
  34. const std::string &name);
  35. /*
  36. void useTangentBuffer(ShaderProgram shader_program,
  37. TangentBuffer *tangent_buffer, const std::string &name);
  38. void disableTangentBuffer(ShaderProgram shader_program,
  39. const std::string &name);*/
  40. };
  41. } // namespace BlueCore
  42. #endif