BsD3D9RenderTexture.h 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #pragma once
  2. #include "BsD3D9Prerequisites.h"
  3. #include "BsD3D9Resource.h"
  4. #include "BsRenderTexture.h"
  5. namespace BansheeEngine
  6. {
  7. class D3D9RenderTexture;
  8. /**
  9. * @brief DirectX 9 implementation of a render texture.
  10. *
  11. * @note Core thread only.
  12. */
  13. class BS_D3D9_EXPORT D3D9RenderTextureCore : public RenderTextureCore, public D3D9Resource
  14. {
  15. public:
  16. D3D9RenderTextureCore(D3D9RenderTexture* parent, RenderTextureProperties* properties, const RENDER_SURFACE_DESC& colorSurfaceDesc,
  17. const RENDER_SURFACE_DESC& depthStencilSurfaceDesc);
  18. virtual ~D3D9RenderTextureCore();
  19. /**
  20. * @copydoc RenderTextureCore::getCustomAttribute
  21. */
  22. virtual void getCustomAttribute(const String& name, void* pData) const;
  23. /**
  24. * @copydoc D3D9Resource::notifyOnDeviceCreate
  25. */
  26. virtual void notifyOnDeviceCreate(IDirect3DDevice9* d3d9Device);
  27. /**
  28. * @copydoc D3D9Resource::notifyOnDeviceDestroy
  29. */
  30. virtual void notifyOnDeviceDestroy(IDirect3DDevice9* d3d9Device);
  31. /**
  32. * @copydoc D3D9Resource::notifyOnDeviceLost
  33. */
  34. virtual void notifyOnDeviceLost(IDirect3DDevice9* d3d9Device);
  35. /**
  36. * @copydoc D3D9Resource::notifyOnDeviceReset
  37. */
  38. virtual void notifyOnDeviceReset(IDirect3DDevice9* d3d9Device);
  39. protected:
  40. friend class D3D9RenderTexture;
  41. /**
  42. * @brief Initializes the internal color and depth surfaces.
  43. */
  44. void initializeSurfaces();
  45. /**
  46. * @brief Releases the internal color and depth surfaces.
  47. */
  48. void releaseSurfaces();
  49. protected:
  50. IDirect3DSurface9* mDX9ColorSurface;
  51. IDirect3DSurface9* mDX9DepthStencilSurface;
  52. bool mIsBindableToShader;
  53. };
  54. /**
  55. * @brief DirectX 9 implementation of a render texture.
  56. *
  57. * @note Sim thread only.
  58. */
  59. class BS_D3D9_EXPORT D3D9RenderTexture : public RenderTexture
  60. {
  61. public:
  62. virtual ~D3D9RenderTexture() { }
  63. protected:
  64. friend class D3D9TextureManager;
  65. D3D9RenderTexture() { }
  66. /**
  67. * @copydoc RenderTexture::createProperties
  68. */
  69. virtual RenderTargetProperties* createProperties() const;
  70. /**
  71. * @copydoc RenderTexture::createCore
  72. */
  73. virtual RenderTextureCore* createCore(RenderTextureProperties* properties, const RENDER_SURFACE_DESC& colorSurfaceDesc,
  74. const RENDER_SURFACE_DESC& depthStencilSurfaceDesc);
  75. };
  76. }