Torque3D Documentation / _generateds / renderFormatChanger.h

renderFormatChanger.h

Engine/source/renderInstance/renderFormatChanger.h

More...

Classes:

Detailed Description

  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
 24#ifndef _RENDERFORMATCHANGER_H_
 25#define _RENDERFORMATCHANGER_H_
 26
 27#ifndef _RENDERPASSSTATETOKEN_H_
 28#include "renderInstance/renderPassStateToken.h"
 29#endif
 30#ifndef _MATTEXTURETARGET_H_
 31#include "materials/matTextureTarget.h"
 32#endif
 33
 34class PostEffect;
 35
 36
 37class RenderFormatToken : public RenderPassStateToken
 38{
 39   typedef RenderPassStateToken Parent;
 40
 41public:
 42   enum FormatTokenState
 43   {
 44      FTSDisabled,
 45      FTSWaiting,
 46      FTSActive,
 47      FTSComplete,
 48   };
 49
 50   const static U32 TargetChainLength = 1;
 51
 52protected:
 53
 54   FormatTokenState mFCState;
 55   GFXFormat mColorFormat;
 56   GFXFormat mDepthFormat;
 57   bool mTargetUpdatePending;
 58   U32 mTargetChainIdx;
 59   Point2I mTargetSize;
 60   S32 mTargetAALevel;
 61   SimObjectPtr<PostEffect> mCopyPostEffect;
 62   SimObjectPtr<PostEffect> mResolvePostEffect;
 63
 64   NamedTexTarget mTarget;
 65
 66   GFXTexHandle mTargetColorTexture[TargetChainLength];
 67   GFXTexHandle mTargetDepthStencilTexture[TargetChainLength];
 68   GFXTextureTargetRef mTargetChain[TargetChainLength];
 69
 70   GFXTexHandle mStoredPassZTarget;
 71   
 72   void _updateTargets();
 73   void _teardownTargets();
 74
 75   void _onTextureEvent( GFXTexCallbackCode code );
 76   virtual bool _handleGFXEvent(GFXDevice::GFXDeviceEventType event);
 77
 78   static bool _setFmt( void *object, const char *index, const char *data );
 79   static const char* _getCopyPostEffect( void* object, const char* data );
 80   static const char* _getResolvePostEffect( void* object, const char* data );
 81   static bool _setCopyPostEffect( void* object, const char* index, const char* data );
 82   static bool _setResolvePostEffect( void* object, const char* index, const char* data );
 83   
 84public:
 85
 86   DECLARE_CONOBJECT(RenderFormatToken);
 87   static void initPersistFields();
 88   virtual bool onAdd();
 89   virtual void onRemove();
 90
 91   RenderFormatToken();
 92   virtual ~RenderFormatToken();
 93
 94   virtual void process(SceneRenderState *state, RenderPassStateBin *callingBin);
 95   virtual void reset();
 96   virtual void enable(bool enabled = true);
 97   virtual bool isEnabled() const;
 98};
 99
100#endif // _RENDERFORMATCHANGER_H_
101