RAS_IOffScreen.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * ***** BEGIN GPL LICENSE BLOCK *****
  3. *
  4. * This program is free software; you can redistribute it and/or
  5. * modify it under the terms of the GNU General Public License
  6. * as published by the Free Software Foundation; either version 2
  7. * of the License, or (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program; if not, write to the Free Software Foundation,
  16. * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. *
  18. * The Original Code is Copyright (C) 2015, Blender Foundation
  19. * All rights reserved.
  20. *
  21. * The Original Code is: all of this file.
  22. *
  23. * Contributor(s): Blender Foundation.
  24. *
  25. * ***** END GPL LICENSE BLOCK *****
  26. */
  27. /** \file RAS_IOffScreen.h
  28. * \ingroup bgerast
  29. */
  30. #ifndef __RAS_OFFSCREEN_H__
  31. #define __RAS_OFFSCREEN_H__
  32. #include "EXP_Python.h"
  33. class RAS_ICanvas;
  34. class MT_Transform;
  35. struct Image;
  36. class RAS_IOffScreen
  37. {
  38. public:
  39. enum RAS_OFS_BIND_MODE {
  40. RAS_OFS_BIND_RENDER = 0,
  41. RAS_OFS_BIND_READ,
  42. };
  43. enum RAS_OFS_RENDER_TARGET {
  44. RAS_OFS_RENDER_BUFFER = 0, // use render buffer as render target
  45. RAS_OFS_RENDER_TEXTURE, // use texture as render target
  46. };
  47. int m_width;
  48. int m_height;
  49. int m_samples;
  50. int m_color; // if used, holds the texture object, 0 if not used
  51. virtual ~RAS_IOffScreen() {}
  52. virtual bool Create(int width, int height, int samples, RAS_OFS_RENDER_TARGET target) = 0;
  53. virtual void Destroy() = 0;
  54. virtual void Bind(RAS_OFS_BIND_MODE mode) = 0;
  55. virtual void Blit() = 0;
  56. virtual void Unbind() = 0;
  57. virtual void MipMap() = 0;
  58. virtual int GetWidth() { return m_width; }
  59. virtual int GetHeight() { return m_height; }
  60. virtual int GetSamples() { return m_samples; }
  61. virtual int GetColor() { return m_color; }
  62. };
  63. #ifdef WITH_PYTHON
  64. typedef struct {
  65. PyObject_HEAD
  66. RAS_IOffScreen *ofs;
  67. } PyRASOffScreen;
  68. extern PyTypeObject PyRASOffScreen_Type;
  69. #endif
  70. #endif /* __RAS_OFFSCREEN_H__ */