gfxD3D9StateBlock.h
Engine/source/gfx/D3D9/gfxD3D9StateBlock.h
Classes:
class
Public Typedefs
GFXD3D9StateBlockRef
Detailed Description
Public Typedefs
typedef StrongRefPtr< GFXD3D9StateBlock > GFXD3D9StateBlockRef
1 2//----------------------------------------------------------------------------- 3// Copyright (c) 2012 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#ifndef _GFXD3D9STATEBLOCK_H_ 24#define _GFXD3D9STATEBLOCK_H_ 25 26#ifndef _GFXSTATEBLOCK_H_ 27#include "gfx/gfxStateBlock.h" 28#endif 29 30struct IDirect3DDevice9; 31class GFXD3D9StateBlock : public GFXStateBlock 32{ 33public: 34 // 35 // GFXD3D9StateBlock interface 36 // 37 38 GFXD3D9StateBlock(const GFXStateBlockDesc& desc, IDirect3DDevice9 *d3dDevice); 39 virtual ~GFXD3D9StateBlock(); 40 41 /// Called by D3D9 device to active this state block. 42 /// @param oldState The current state, used to make sure we don't set redundant states on the device. Pass NULL to reset all states. 43 void activate(GFXD3D9StateBlock* oldState); 44 45 46 // 47 // GFXStateBlock interface 48 // 49 50 /// Returns the hash value of the desc that created this block 51 virtual U32 getHashValue() const; 52 53 /// Returns a GFXStateBlockDesc that this block represents 54 virtual const GFXStateBlockDesc& getDesc() const; 55 56 // 57 // GFXResource 58 // 59 virtual void zombify() { } 60 /// When called the resource should restore all device sensitive information destroyed by zombify() 61 virtual void resurrect() { } 62private: 63 GFXStateBlockDesc mDesc; 64 U32 mCachedHashValue; 65 IDirect3DDevice9 *mD3DDevice; ///< Handle for D3DDevice 66 // Cached D3D specific things, these are "calculated" from GFXStateBlock 67 U32 mColorMask; 68 U32 mZBias; 69 U32 mZSlopeBias; 70}; 71 72typedef StrongRefPtr<GFXD3D9StateBlock> GFXD3D9StateBlockRef; 73 74#endif 75
