Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_RENDERSYSTEM_DIRECT3D11TEXTURE_H__
00009 #define __SP_RENDERSYSTEM_DIRECT3D11TEXTURE_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "RenderSystem/spTextureBase.hpp"
00014
00015 #if defined(SP_COMPILE_WITH_DIRECT3D11)
00016
00017
00018 #include <d3d11.h>
00019 #include <d3dx11.h>
00020
00021
00022 namespace sp
00023 {
00024 namespace video
00025 {
00026
00027
00028 class Direct3D11RenderSystem;
00029
00030 class SP_EXPORT Direct3D11Texture : public Texture
00031 {
00032
00033 public:
00034
00035 Direct3D11Texture(
00036 ID3D11Device* D3DDevice, ID3D11DeviceContext* D3DDeviceContext,
00037 const STextureCreationFlags &CreationFlags
00038 );
00039 ~Direct3D11Texture();
00040
00041
00042
00043 bool valid() const;
00044
00045 void setHardwareFormat(const EHWTextureFormats HardwareFormat);
00046
00047 void setFilter(const ETextureFilters Filter);
00048 void setFilter(const ETextureFilters MagFilter, const ETextureFilters MinFilter);
00049 void setMagFilter(const ETextureFilters Filter);
00050 void setMinFilter(const ETextureFilters Filter);
00051
00052 void setMipMapFilter(const ETextureMipMapFilters MipMapFilter);
00053
00054 void setWrapMode(const ETextureWrapModes Wrap);
00055 void setWrapMode(
00056 const ETextureWrapModes WrapU, const ETextureWrapModes WrapV, const ETextureWrapModes WrapW = TEXWRAP_REPEAT
00057 );
00058
00059 void bind(s32 Level = 0) const;
00060 void unbind(s32 Level = 0) const;
00061
00062 bool shareImageBuffer();
00063 bool updateImageBuffer();
00064
00065 private:
00066
00067 friend class Direct3D11RenderSystem;
00068
00069
00070
00071 void releaseResources();
00072
00073 void setupTextureFormats(DXGI_FORMAT &DxFormat);
00074 bool createHWTexture();
00075
00076 void updateTextureImage();
00077 bool updateSamplerState();
00078
00079 bool updateRenderTarget();
00080 void updateMultiRenderTargets();
00081
00082
00083
00084 ID3D11Device* D3DDevice_;
00085 ID3D11DeviceContext* D3DDeviceContext_;
00086
00087 ID3D11Resource* D3DResource_;
00088 ID3D11Texture1D* HWTexture1D_;
00089 ID3D11Texture2D* HWTexture2D_;
00090 ID3D11Texture3D* HWTexture3D_;
00091 ID3D11Texture2D* DepthTexture_;
00092
00093 ID3D11ShaderResourceView* ShaderResourceView_;
00094 ID3D11RenderTargetView* RenderTargetView_;
00095 ID3D11RenderTargetView* RenderTargetViewCubeMap_[6];
00096 ID3D11DepthStencilView* DepthStencilView_;
00097 ID3D11SamplerState* SamplerSate_;
00098
00099 std::vector<ID3D11RenderTargetView*> MRTRenderTargetViewList_;
00100
00101 };
00102
00103
00104 }
00105
00106 }
00107
00108
00109 #endif
00110
00111 #endif
00112
00113
00114
00115