BsD3D11RenderTexture.cpp 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #include "BsD3D11RenderTexture.h"
  2. #include "BsD3D11RenderSystem.h"
  3. #include "BsD3D11Device.h"
  4. #include "BsD3D11Texture.h"
  5. #include "BsD3D11Mappings.h"
  6. #include "BsD3D11TextureView.h"
  7. #include "BsTextureManager.h"
  8. #include "BsException.h"
  9. namespace BansheeEngine
  10. {
  11. D3D11RenderTextureCore::D3D11RenderTextureCore(D3D11RenderTexture* parent, RenderTextureProperties* properties, const RENDER_SURFACE_DESC& colorSurfaceDesc,
  12. const RENDER_SURFACE_DESC& depthStencilSurfaceDesc)
  13. :RenderTextureCore(parent, properties, colorSurfaceDesc, depthStencilSurfaceDesc)
  14. { }
  15. void D3D11RenderTextureCore::getCustomAttribute(const String& name, void* pData) const
  16. {
  17. if(name == "RTV")
  18. {
  19. ID3D11RenderTargetView** pRTVs = (ID3D11RenderTargetView **)pData;
  20. D3D11TextureView* textureView = static_cast<D3D11TextureView*>(mColorSurface.get());
  21. *pRTVs = textureView->getRTV();
  22. return;
  23. }
  24. else if(name == "DSV")
  25. {
  26. ID3D11DepthStencilView** pDSV = (ID3D11DepthStencilView **)pData;
  27. D3D11TextureView* depthStencilView = static_cast<D3D11TextureView*>(mDepthStencilSurface.get());
  28. *pDSV = depthStencilView->getDSV();
  29. return;
  30. }
  31. }
  32. RenderTargetProperties* D3D11RenderTexture::createProperties() const
  33. {
  34. return bs_new<RenderTextureProperties>();
  35. }
  36. SPtr<CoreObjectCore> D3D11RenderTexture::createCore() const
  37. {
  38. RenderTextureProperties* coreProperties = bs_new<RenderTextureProperties>();
  39. RenderTextureProperties* myProperties = static_cast<RenderTextureProperties*>(mProperties);
  40. *coreProperties = *myProperties;
  41. return bs_shared_ptr<D3D11RenderTextureCore>(const_cast<D3D11RenderTexture*>(this),
  42. coreProperties, mColorSurfaceDesc, mDepthStencilSurfaceDesc);
  43. }
  44. }