PixelEffect.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #ifndef LOVE_GRAPHICS_EFFECT_H
  2. #define LOVE_GRAPHICS_EFFECT_H
  3. #include <common/Object.h>
  4. #include <string>
  5. #include <map>
  6. #include "Image.h"
  7. #include "Canvas.h"
  8. namespace love
  9. {
  10. namespace graphics
  11. {
  12. namespace opengl
  13. {
  14. // A fragment shader
  15. class PixelEffect : public Volatile // Volatile?
  16. {
  17. public:
  18. PixelEffect(const std::string& code);
  19. virtual ~PixelEffect();
  20. std::string getWarnings() const;
  21. virtual bool loadVolatile();
  22. virtual void unloadVolatile();
  23. void attach();
  24. static void detach();
  25. static bool isSupported();
  26. void sendFloat(const std::string& name, int count, const GLfloat* vec);
  27. void sendMatrix(const std::string& name, int size, const GLfloat* m);
  28. void sendImage(const std::string& name, const Image& image);
  29. void sendCanvas(const std::string& name, const Canvas& canvas);
  30. private:
  31. GLint getUniformLocation(const std::string& name);
  32. void checkSetUniformError();
  33. GLuint _program;
  34. std::string _code; // volatile and stuff
  35. // texture unit pool for setting images
  36. static std::map<std::string, GLint> _texture_unit_pool;
  37. static GLint _current_texture_unit;
  38. static GLint _max_texture_units;
  39. static GLint getTextureUnit(const std::string& name);
  40. };
  41. } // opengl
  42. } // graphics
  43. } // love
  44. #endif // LOVE_GRAPHICS_EFFECT_H