Torque3D Documentation / _generateds / gfxD3D11Cubemap.h

gfxD3D11Cubemap.h

Engine/source/gfx/D3D11/gfxD3D11Cubemap.h

More...

Classes:

Detailed Description

Public Variables

const U32 CubeFaces 
const U32 MaxMipMaps 
  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 _GFXD3D11CUBEMAP_H_
 25#define _GFXD3D11CUBEMAP_H_
 26
 27#include "gfx/D3D11/gfxD3D11Device.h"
 28#include "gfx/gfxCubemap.h"
 29#include "gfx/gfxResource.h"
 30#include "gfx/gfxTarget.h"
 31
 32const U32 CubeFaces = 6;
 33const U32 MaxMipMaps = 13; //todo this needs a proper static value somewhere to sync up with other classes like GBitmap
 34
 35class GFXD3D11Cubemap : public GFXCubemap
 36{
 37public:
 38   virtual void initStatic( GFXTexHandle *faces );
 39   virtual void initStatic( DDSFile *dds );
 40   virtual void initDynamic( U32 texSize, GFXFormat faceFormat = GFXFormatR8G8B8A8, U32 mipLevels = 0);
 41   virtual void setToTexUnit( U32 tuNum );
 42   virtual U32 getSize() const { return mTexSize; }
 43   virtual GFXFormat getFormat() const { return mFaceFormat; }
 44
 45   GFXD3D11Cubemap();
 46   virtual ~GFXD3D11Cubemap();
 47
 48   // GFXResource interface
 49   virtual void zombify();
 50   virtual void resurrect();
 51
 52   virtual bool isInitialized() { return mTexture ? true : false; }
 53
 54   // Get functions
 55   ID3D11ShaderResourceView* getSRView();
 56   ID3D11RenderTargetView* getRTView(U32 faceIdx, U32 mipIndex=0);
 57   ID3D11DepthStencilView* getDSView();
 58   ID3D11Texture2D* get2DTex();
 59
 60private:
 61
 62   friend class GFXD3D11TextureTarget;
 63   friend class GFXD3D11Device;
 64
 65   ID3D11Texture2D* mTexture;
 66   ID3D11ShaderResourceView* mSRView; // for shader resource input
 67   ID3D11RenderTargetView* mRTView[CubeFaces][MaxMipMaps]; // for render targets, 6 faces of the cubemap
 68   ID3D11DepthStencilView* mDSView; //render target view for depth stencil
 69
 70   bool mAutoGenMips;
 71   bool mDynamic;
 72   U32  mTexSize;
 73   GFXFormat mFaceFormat;
 74   
 75   void releaseSurfaces();
 76
 77   /// The callback used to get texture events.
 78   /// @see GFXTextureManager::addEventDelegate
 79   void _onTextureEvent(GFXTexCallbackCode code);
 80};
 81
 82class GFXD3D11CubemapArray : public GFXCubemapArray
 83{
 84public:
 85   GFXD3D11CubemapArray();
 86   virtual ~GFXD3D11CubemapArray();
 87   virtual void init(GFXCubemapHandle *cubemaps, const U32 cubemapCount);
 88   virtual void init(const U32 cubemapCount, const U32 cubemapFaceSize, const GFXFormat format);
 89   virtual void updateTexture(const GFXCubemapHandle &cubemap, const U32 slot);
 90   virtual void copyTo(GFXCubemapArray *pDstCubemap);
 91   virtual void setToTexUnit(U32 tuNum);
 92
 93   ID3D11ShaderResourceView* getSRView() { return mSRView; }
 94   ID3D11Texture2D* get2DTex() { return mTexture; }
 95
 96   // GFXResource interface
 97   virtual void zombify();
 98   virtual void resurrect();
 99
100private:
101   friend class GFXD3D11TextureTarget;
102   friend class GFXD3D11Device;
103
104   ID3D11Texture2D *mTexture;
105   ID3D11ShaderResourceView* mSRView; // for shader resource input
106};
107
108#endif
109