2003-11-03 17:22:45 +01:00
|
|
|
//***********************************************************
|
|
|
|
//
|
|
|
|
// Name: Patch.Cpp
|
|
|
|
// Last Update: 23/2/02
|
|
|
|
// Author: Poya Manouchehri
|
|
|
|
//
|
|
|
|
// Description: CPatch is a smaller portion of the terrain.
|
|
|
|
// It handles the ROAM implementation and its
|
|
|
|
// own rendering.
|
|
|
|
//
|
|
|
|
//***********************************************************
|
|
|
|
|
2003-11-24 23:52:23 +01:00
|
|
|
#include "Patch.h"
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
|
|
|
|
CPatch::CPatch ()
|
|
|
|
{
|
|
|
|
m_pVertices = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
CPatch::~CPatch ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
//Initialize the patch
|
|
|
|
void CPatch::Initialize (STerrainVertex *first_vertex)
|
|
|
|
{
|
2003-12-27 08:24:41 +01:00
|
|
|
int j;
|
|
|
|
|
2003-11-03 17:22:45 +01:00
|
|
|
m_pVertices = first_vertex;
|
|
|
|
|
2003-11-25 21:09:57 +01:00
|
|
|
m_Bounds.SetEmpty();
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2003-12-27 08:24:41 +01:00
|
|
|
for (j=0; j<PATCH_SIZE+1; j++)
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
for (int i=0; i<PATCH_SIZE+1; i++)
|
|
|
|
{
|
2003-11-25 21:09:57 +01:00
|
|
|
m_Bounds+=m_pVertices[j*MAP_SIZE + i].m_Position;
|
2003-11-03 17:22:45 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-12-27 08:24:41 +01:00
|
|
|
for (j=0; j<16; j++)
|
2003-11-03 17:22:45 +01:00
|
|
|
{
|
|
|
|
for (int i=0; i<16; i++)
|
|
|
|
{
|
|
|
|
int pos = (j*MAP_SIZE) + (i);
|
|
|
|
m_MiniPatches[j][i].Initialize ( &m_pVertices[pos] );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|