Torque3D Documentation / _generateds / imposterCapture.h

imposterCapture.h

Engine/source/util/imposterCapture.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 _IMPOSTERCAPTURE_H_
 25#define _IMPOSTERCAPTURE_H_
 26
 27#ifndef _MATHTYPES_H_
 28#include "math/mathTypes.h"
 29#endif
 30#ifndef _MPOINT3_H_
 31#include "math/mPoint3.h"
 32#endif
 33#ifndef _MMATRIX_H_
 34#include "math/mMatrix.h"
 35#endif
 36#ifndef _TVECTOR_H_
 37#include "core/util/tVector.h"
 38#endif
 39#ifndef _TSRENDERDATA_H_
 40#include "ts/tsRenderState.h"
 41#endif
 42#ifndef _GFXTEXTUREHANDLE_H_
 43#include "gfx/gfxTextureHandle.h"
 44#endif
 45
 46class GBitmap;
 47class SceneRenderState;
 48class TSShapeInstance;
 49class GFXTextureTarget;
 50class RenderPassManager;
 51class RenderMeshMgr;
 52
 53
 54class ImposterCapture
 55{
 56   
 57protected:
 58
 59   S32 mDl;
 60   S32 mDim;
 61
 62   /// The bounding radius of the shape used to size the billboard.
 63   F32 mRadius;
 64
 65   /// 
 66   Point3F mCenter;
 67
 68   GBitmap *mBlackBmp;
 69   GBitmap *mWhiteBmp;
 70
 71   GFXTexHandle mBlackTex;
 72   GFXTexHandle mWhiteTex;
 73   GFXTexHandle mNormalTex;
 74   GFXTexHandle mDepthBuffer;
 75
 76   SceneRenderState *mState;
 77   TSShapeInstance *mShapeInstance;
 78   TSRenderState mRData;
 79
 80   GFXTextureTarget *mRenderTarget;
 81
 82   RenderPassManager *mRenderPass;
 83   RenderMeshMgr     *mMeshRenderBin;
 84
 85   void _colorAverageFilter(  U32 dimensions, const U8 *inBmpBits, U8 *outBmpBits );
 86   void _renderToTexture( GFXTexHandle texHandle, GBitmap *outBitmap, const ColorI &color ); 
 87
 88   void _separateAlpha( GBitmap *imposterOut );
 89
 90   void _convertDXT5nm( GBitmap *imposterOut );
 91
 92public:
 93
 94   ImposterCapture();
 95
 96   ~ImposterCapture();
 97
 98   void begin( TSShapeInstance *shapeInst,
 99               S32 dl, 
100               S32 dim,
101               F32 radius,
102               const Point3F &center );
103
104   void capture(  const MatrixF &rotMatrix, 
105                  GBitmap **imposterOut,
106                  GBitmap **normalMapOut );
107
108   void end();
109
110};
111
112#endif // _IMPOSTERCAPTURE_H_
113