2007-05-07 18:33:24 +02:00
|
|
|
/**
|
|
|
|
* =========================================================================
|
|
|
|
* File : Patch.h
|
|
|
|
* Project : 0 A.D.
|
|
|
|
* Description : A patch of terrain holding NxN MiniPatch tiles
|
|
|
|
* =========================================================================
|
|
|
|
*/
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
#ifndef INCLUDED_PATCH
|
|
|
|
#define INCLUDED_PATCH
|
2004-06-08 14:10:51 +02:00
|
|
|
|
2006-06-09 18:44:16 +02:00
|
|
|
#include "MiniPatch.h"
|
|
|
|
#include "RenderableObject.h"
|
|
|
|
|
|
|
|
class CTerrain;
|
|
|
|
|
2004-06-08 14:10:51 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Terrain Constants:
|
|
|
|
//
|
|
|
|
// PATCH_SIZE: number of tiles in each patch
|
2007-05-10 22:47:17 +02:00
|
|
|
const int PATCH_SIZE = 16;
|
2004-05-29 22:56:24 +02:00
|
|
|
|
2007-05-10 22:47:17 +02:00
|
|
|
/// neighbor IDs for CPatch
|
|
|
|
enum CPatchNeighbors
|
|
|
|
{
|
|
|
|
CPATCH_NEIGHTBOR_LEFT_TOP = 0,
|
|
|
|
CPATCH_NEIGHTBOR_TOP = 1,
|
|
|
|
CPATCH_NEIGHTBOR_RIGHT_TOP = 2,
|
|
|
|
CPATCH_NEIGHTBOR_LEFT = 3,
|
|
|
|
CPATCH_NEIGHTBOR_RIGHT = 4,
|
|
|
|
CPATCH_NEIGHTBOR_LEFT_BOTTOM = 5,
|
|
|
|
CPATCH_NEIGHTBOR_BOTTOM = 6,
|
|
|
|
CPATCH_NEIGHTBOR_RIGHT_BOTTOM = 7
|
|
|
|
};
|
2007-05-06 09:58:16 +02:00
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
///////////////////////////////////////////////////////////////////////////////
|
2004-06-07 21:59:20 +02:00
|
|
|
// CPatch: a single terrain patch, PATCH_SIZE tiles square
|
2004-05-29 22:56:24 +02:00
|
|
|
class CPatch : public CRenderableObject
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
// constructor
|
|
|
|
CPatch();
|
|
|
|
// destructor
|
|
|
|
~CPatch();
|
|
|
|
|
|
|
|
// initialize the patch
|
|
|
|
void Initialize(CTerrain* parent,u32 x,u32 z);
|
|
|
|
// calculate and store bounds of this patch
|
|
|
|
void CalcBounds();
|
|
|
|
|
2007-05-10 22:47:17 +02:00
|
|
|
// is already in the DrawList
|
2007-05-06 09:58:16 +02:00
|
|
|
bool m_bWillBeDrawn;
|
|
|
|
|
2004-05-29 22:56:24 +02:00
|
|
|
public:
|
|
|
|
// minipatches (tiles) making up the patch
|
2004-06-07 21:59:20 +02:00
|
|
|
CMiniPatch m_MiniPatches[PATCH_SIZE][PATCH_SIZE];
|
2004-05-29 22:56:24 +02:00
|
|
|
// position of patch in parent terrain grid
|
|
|
|
u32 m_X,m_Z;
|
|
|
|
// parent terrain
|
|
|
|
CTerrain* m_Parent;
|
2007-05-10 17:28:59 +02:00
|
|
|
|
2007-05-06 09:58:16 +02:00
|
|
|
// draw state...
|
2007-05-10 17:28:59 +02:00
|
|
|
void setDrawState(bool value) { m_bWillBeDrawn = value; };
|
|
|
|
bool getDrawState() { return m_bWillBeDrawn; };
|
2004-05-29 22:56:24 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
2007-05-06 09:58:16 +02:00
|
|
|
|
2007-05-07 18:33:24 +02:00
|
|
|
|