2003-11-03 17:22:45 +01:00
|
|
|
//***********************************************************
|
|
|
|
//
|
2003-11-24 23:52:23 +01:00
|
|
|
// Name: Terrain.h
|
2003-11-03 17:22:45 +01:00
|
|
|
// Last Update: 23/2/02
|
|
|
|
// Author: Poya Manouchehri
|
|
|
|
//
|
|
|
|
// Description: CTerrain handles the terrain portion of the
|
|
|
|
// engine. It holds open the file to the terrain
|
|
|
|
// information, so terrain data can be loaded
|
|
|
|
// dynamically. We use a ROAM method to render
|
|
|
|
// the terrain, ie using binary triangle trees.
|
|
|
|
// The terrain consists of smaller PATCHS, which
|
|
|
|
// do most of the work.
|
|
|
|
//
|
|
|
|
//***********************************************************
|
|
|
|
|
|
|
|
#ifndef TERRAIN_H
|
|
|
|
#define TERRAIN_H
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2003-11-24 23:52:23 +01:00
|
|
|
#include "Patch.h"
|
|
|
|
#include "Vector3D.h"
|
2003-11-03 17:22:45 +01:00
|
|
|
|
2003-11-25 21:13:39 +01:00
|
|
|
class CLightEnv;
|
|
|
|
|
2003-11-03 17:22:45 +01:00
|
|
|
extern bool g_HillShading;
|
|
|
|
|
|
|
|
class CTerrain
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CTerrain ();
|
|
|
|
~CTerrain ();
|
|
|
|
|
2003-11-25 21:13:39 +01:00
|
|
|
bool Load(char *filename);
|
|
|
|
bool InitFromHeightmap(const u8* data);
|
2003-11-03 17:22:45 +01:00
|
|
|
|
|
|
|
// protected:
|
|
|
|
//the patches currently loaded
|
|
|
|
CPatch m_Patches[NUM_PATCHES_PER_SIDE][NUM_PATCHES_PER_SIDE];
|
|
|
|
STerrainVertex *m_pVertices;
|
|
|
|
|
|
|
|
|
|
|
|
// protected:
|
2003-11-25 21:13:39 +01:00
|
|
|
void CalcNormals();
|
|
|
|
void CalcLighting(const CLightEnv& env);
|
2003-11-03 17:22:45 +01:00
|
|
|
void SetNeighbors();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|