2
0

BsD3D11RenderTexture.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #include "BsD3D11RenderTexture.h"
  4. #include "BsD3D11TextureView.h"
  5. namespace BansheeEngine
  6. {
  7. D3D11RenderTextureCore::D3D11RenderTextureCore(const RENDER_TEXTURE_CORE_DESC& desc)
  8. :RenderTextureCore(desc), mProperties(desc, false)
  9. {
  10. }
  11. void D3D11RenderTextureCore::getCustomAttribute(const String& name, void* data) const
  12. {
  13. if(name == "RTV")
  14. {
  15. ID3D11RenderTargetView** rtvs = (ID3D11RenderTargetView **)data;
  16. D3D11TextureView* textureView = static_cast<D3D11TextureView*>(mColorSurface.get());
  17. *rtvs = textureView->getRTV();
  18. }
  19. else if(name == "DSV")
  20. {
  21. if (mDepthStencilSurface == nullptr)
  22. return;
  23. ID3D11DepthStencilView** dsv = (ID3D11DepthStencilView **)data;
  24. D3D11TextureView* depthStencilView = static_cast<D3D11TextureView*>(mDepthStencilSurface.get());
  25. *dsv = depthStencilView->getDSV(false);
  26. }
  27. else if (name == "RODSV")
  28. {
  29. if (mDepthStencilSurface == nullptr)
  30. return;
  31. ID3D11DepthStencilView** dsv = (ID3D11DepthStencilView **)data;
  32. D3D11TextureView* depthStencilView = static_cast<D3D11TextureView*>(mDepthStencilSurface.get());
  33. *dsv = depthStencilView->getDSV(true);
  34. }
  35. }
  36. D3D11RenderTexture::D3D11RenderTexture(const RENDER_TEXTURE_DESC& desc)
  37. :RenderTexture(desc), mProperties(desc, false)
  38. {
  39. }
  40. }