Add cubemap arrays, as well as control for generation of MIPs on texture targets.

This commit is contained in:
Areloch 2018-09-16 18:19:04 -05:00
parent 0c3fc59ccc
commit 1f7cf55204
25 changed files with 412 additions and 60 deletions

View file

@ -29,13 +29,14 @@
#include "gfx/gfxTarget.h"
const U32 CubeFaces = 6;
const U32 MaxMipMaps = 13; //todo this needs a proper static value somewhere to sync up with other classes like GBitmap
class GFXD3D11Cubemap : public GFXCubemap
{
public:
virtual void initStatic( GFXTexHandle *faces );
virtual void initStatic( DDSFile *dds );
virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8 );
virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8, U32 mipLevels = 0);
virtual void setToTexUnit( U32 tuNum );
virtual U32 getSize() const { return mTexSize; }
virtual GFXFormat getFormat() const { return mFaceFormat; }
@ -49,8 +50,7 @@ public:
// Get functions
ID3D11ShaderResourceView* getSRView();
ID3D11RenderTargetView* getRTView(U32 faceIdx);
ID3D11RenderTargetView** getRTViewArray();
ID3D11RenderTargetView* getRTView(U32 faceIdx, U32 mipIndex=0);
ID3D11DepthStencilView* getDSView();
ID3D11Texture2D* get2DTex();
@ -61,7 +61,7 @@ private:
ID3D11Texture2D* mTexture;
ID3D11ShaderResourceView* mSRView; // for shader resource input
ID3D11RenderTargetView* mRTView[CubeFaces]; // for render targets, 6 faces of the cubemap
ID3D11RenderTargetView* mRTView[CubeFaces][MaxMipMaps]; // for render targets, 6 faces of the cubemap
ID3D11DepthStencilView* mDSView; //render target view for depth stencil
bool mAutoGenMips;
@ -76,4 +76,27 @@ private:
void _onTextureEvent(GFXTexCallbackCode code);
};
class GFXD3D11CubemapArray : public GFXCubemapArray
{
public:
GFXD3D11CubemapArray();
virtual ~GFXD3D11CubemapArray();
virtual void initStatic(GFXCubemapHandle *cubemaps, const U32 cubemapCount);
virtual void setToTexUnit(U32 tuNum);
ID3D11ShaderResourceView* getSRView() { return mSRView; }
ID3D11Texture2D* get2DTex() { return mTexture; }
// GFXResource interface
virtual void zombify();
virtual void resurrect();
private:
friend class GFXD3D11TextureTarget;
friend class GFXD3D11Device;
ID3D11Texture2D *mTexture;
ID3D11ShaderResourceView* mSRView; // for shader resource input
};
#endif