9 #ifndef DUNE_RENDER_TARGET
10 #define DUNE_RENDER_TARGET
13 #include <DirectXMath.h>
33 ID3D11Device* device_;
34 ID3D11RenderTargetView* rtview_;
35 ID3D11DepthStencilView* dsview_;
38 std::vector<BYTE> cached_copy_;
41 virtual void do_create(ID3D11Device* device, D3D11_TEXTURE2D_DESC desc, D3D11_SUBRESOURCE_DATA* subresource);
48 ID3D11RenderTargetView*
const rtv()
const {
return rtview_; }
51 ID3D11DepthStencilView*
const dsv()
const {
return dsview_; }
62 void resize(UINT width, UINT height);
67 void update(ID3D11DeviceContext* context);
70 void copy(
const BYTE*
data,
size_t num_bytes);
76 return reinterpret_cast<T
>(&cached_copy_[0]);
86 void load_static_target(ID3D11Device* device,
const tstring& filename, render_target& t);
89 #endif // RENDER_TARGET
T data()
Returns a pointer to the internal CPU texture cache.
Definition: render_target.h:74
void update(ID3D11DeviceContext *context)
If this texture is cached, this method will copy the CPU side cache to the render_target texture...
Definition: render_target.cpp:115
virtual void destroy()
Destroy the shader_resource and free all memory.
Definition: render_target.cpp:98
void enable_cached(bool c)
Enable caching. If this is true, creating this object will copy the initial subresource to a cache...
Definition: render_target.h:81
A render target wrapper.
Definition: render_target.h:30
void copy(const BYTE *data, size_t num_bytes)
Copy a data array of num_bytes size into the internal CPU cache.
Definition: render_target.cpp:110
Wrapper for a Direct3D texture object.
Definition: texture.h:25
bool cached()
Enable caching. If this is true, creating this object will copy the initial subresource to a cache...
Definition: render_target.h:82