Torque3D Documentation / _generateds / gfxD3D11TextureObject.h

gfxD3D11TextureObject.h

Engine/source/gfx/D3D11/gfxD3D11TextureObject.h

More...

Classes:

Detailed Description

 1
 2//-----------------------------------------------------------------------------
 3// Copyright (c) 2015 GarageGames, LLC
 4//
 5// Permission is hereby granted, free of charge, to any person obtaining a copy
 6// of this software and associated documentation files (the "Software"), to
 7// deal in the Software without restriction, including without limitation the
 8// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 9// sell copies of the Software, and to permit persons to whom the Software is
10// furnished to do so, subject to the following conditions:
11//
12// The above copyright notice and this permission notice shall be included in
13// all copies or substantial portions of the Software.
14//
15// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
21// IN THE SOFTWARE.
22//-----------------------------------------------------------------------------
23
24#ifndef _GFXD3D11TEXTUREOBJECT_H_
25#define _GFXD3D11TEXTUREOBJECT_H_
26
27#include "gfx/D3D11/gfxD3D11Device.h"
28#include "gfx/gfxTextureHandle.h"
29#include "gfx/gfxTextureManager.h"
30
31class GFXD3D11TextureObject : public GFXTextureObject
32{
33protected:
34   static U32 mTexCount;
35   GFXTexHandle mLockTex;
36   DXGI_MAPPED_RECT mLockRect;
37   bool mLocked;
38
39   U32 mLockedSubresource;
40   ID3D11Resource *mD3DTexture;
41
42   // used for z buffers...
43   ID3D11Texture2D *mD3DSurface;
44
45   ID3D11ShaderResourceView* mSRView; // for shader resource input
46   ID3D11RenderTargetView* mRTView; // for render targets
47   ID3D11DepthStencilView* mDSView; //render target view for depth stencil
48
49public:
50
51   GFXD3D11TextureObject( GFXDevice * d, GFXTextureProfile *profile);
52   ~GFXD3D11TextureObject();
53
54   ID3D11Resource*      getResource(){ return mD3DTexture; }
55   ID3D11Texture2D*     get2DTex(){ return (ID3D11Texture2D*) mD3DTexture; }
56   ID3D11Texture2D**    get2DTexPtr(){ return (ID3D11Texture2D**) &mD3DTexture; }
57   ID3D11Texture3D*     get3DTex(){ return (ID3D11Texture3D*) mD3DTexture; }
58   ID3D11Texture3D** get3DTexPtr(){ return (ID3D11Texture3D**) &mD3DTexture; }
59   
60   ID3D11ShaderResourceView* getSRView();
61   ID3D11RenderTargetView* getRTView();
62   ID3D11DepthStencilView* getDSView();
63
64   ID3D11ShaderResourceView** getSRViewPtr();
65   ID3D11RenderTargetView** getRTViewPtr();
66   ID3D11DepthStencilView** getDSViewPtr();
67  
68
69   void release();
70
71   bool isManaged; //setting to true tells this texture not to be released from being zombify
72
73   virtual GFXLockedRect * lock(U32 mipLevel = 0, RectI *inRect = NULL);
74   virtual void unlock(U32 mipLevel = 0 );
75
76   virtual bool         copyToBmp(GBitmap* bmp);
77   ID3D11Texture2D*     getSurface() {return mD3DSurface;}
78   ID3D11Texture2D** getSurfacePtr() {return &mD3DSurface;}
79
80   // GFXResource
81   void zombify();
82   void resurrect();
83
84#ifdef TORQUE_DEBUG
85   virtual void pureVirtualCrash() {};
86#endif
87};
88
89
90#endif
91