Torque3D Documentation / _generateds / renderTerrainMgr.h

renderTerrainMgr.h

Engine/source/renderInstance/renderTerrainMgr.h

More...

Classes:

class

The render instance for terrain cells.

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 _RENDERTERRAINMGR_H_
 25#define _RENDERTERRAINMGR_H_
 26
 27#ifndef _RENDERBINMANAGER_H_
 28#include "renderInstance/renderBinManager.h"
 29#endif
 30#ifndef _GFXVERTEXBUFFER_H_
 31#include "gfx/gfxVertexBuffer.h"
 32#endif
 33#ifndef _GFXPRIMITIVEBUFFER_H_
 34#include "gfx/gfxPrimitiveBuffer.h"
 35#endif
 36
 37class TerrCell;
 38class GFXTextureObject;
 39class TerrainCellMaterial;
 40
 41
 42/// The render instance for terrain cells.
 43struct TerrainRenderInst : public RenderInst
 44{
 45   GFXVertexBuffer *vertBuff;
 46
 47   GFXPrimitiveBuffer *primBuff;
 48
 49   GFXPrimitive prim;
 50
 51   BaseMatInstance *mat;
 52
 53   const MatrixF *objectToWorldXfm;
 54
 55   TerrainCellMaterial *cellMat;
 56
 57   /// The lights we pass to the material for 
 58   /// this cell in order light importance.
 59   LightInfo *lights[8];
 60
 61   void clear()
 62   {
 63      dMemset( this, 0, sizeof( TerrainRenderInst ) );   
 64      type = RenderPassManager::RIT_Terrain;      
 65   }
 66};
 67
 68
 69///
 70class RenderTerrainMgr : public RenderBinManager
 71{
 72   typedef RenderBinManager Parent;
 73
 74protected:
 75
 76   Vector<TerrainRenderInst*> mInstVector;
 77
 78   static bool smRenderWireframe;
 79
 80   static S32 smCellsRendered;
 81   static S32 smOverrideCells;
 82   static S32 smDrawCalls;
 83
 84   static bool _clearStats( GFXDevice::GFXDeviceEventType type );
 85
 86   // RenderBinManager
 87   virtual void internalAddElement( RenderInst *inst );
 88
 89public:
 90
 91   RenderTerrainMgr();
 92   RenderTerrainMgr( F32 renderOrder, F32 processAddOrder );
 93   virtual ~RenderTerrainMgr();
 94
 95   // ConsoleObject
 96   static void initPersistFields();
 97   DECLARE_CONOBJECT(RenderTerrainMgr);
 98
 99   // RenderBinManager
100   virtual void sort();
101   virtual void render( SceneRenderState *state );
102   virtual void clear();
103
104};
105
106#endif // _RENDERTERRAINMGR_H_
107