Image.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Copyright (c) 2006-2020 LOVE Development Team
  3. *
  4. * This software is provided 'as-is', without any express or implied
  5. * warranty. In no event will the authors be held liable for any damages
  6. * arising from the use of this software.
  7. *
  8. * Permission is granted to anyone to use this software for any purpose,
  9. * including commercial applications, and to alter it and redistribute it
  10. * freely, subject to the following restrictions:
  11. *
  12. * 1. The origin of this software must not be misrepresented; you must not
  13. * claim that you wrote the original software. If you use this software
  14. * in a product, an acknowledgment in the product documentation would be
  15. * appreciated but is not required.
  16. * 2. Altered source versions must be plainly marked as such, and must not be
  17. * misrepresented as being the original software.
  18. * 3. This notice may not be removed or altered from any source distribution.
  19. **/
  20. #pragma once
  21. // LOVE
  22. #include "graphics/Image.h"
  23. #include "graphics/Volatile.h"
  24. // OpenGL
  25. #include "OpenGL.h"
  26. namespace love
  27. {
  28. namespace graphics
  29. {
  30. namespace opengl
  31. {
  32. class Image final : public love::graphics::Image, public Volatile
  33. {
  34. public:
  35. Image(const Slices &data, const Settings &settings);
  36. Image(TextureType textype, PixelFormat format, int width, int height, int slices, const Settings &settings);
  37. virtual ~Image();
  38. // Implements Volatile.
  39. bool loadVolatile() override;
  40. void unloadVolatile() override;
  41. ptrdiff_t getHandle() const override;
  42. void setSamplerState(const SamplerState &s) override;
  43. private:
  44. void uploadByteData(PixelFormat pixelformat, const void *data, size_t size, int level, int slice, const Rect &r, love::image::ImageDataBase *imgd = nullptr) override;
  45. void generateMipmaps() override;
  46. void loadDefaultTexture();
  47. void loadData();
  48. Slices slices;
  49. // OpenGL texture identifier.
  50. GLuint texture;
  51. }; // Image
  52. } // opengl
  53. } // graphics
  54. } // love