summaryrefslogtreecommitdiff
path: root/common/terrain.h
diff options
context:
space:
mode:
authorleo2002-10-14 22:56:06 +0000
committerleo2002-10-14 22:56:06 +0000
commit6628cf60d9ec6e1a0aebe305c6b46afdb0f80cb1 (patch)
treeb81e0d4ab598ce61a32dc4381bd762575b4cba7c /common/terrain.h
parent45273a61618d447ad27f255299e14ba1daf7f5fa (diff)
Reorganized the terrain classes a bit.
git-svn-id: http://svn.leocad.org/trunk@312 c7d43263-9d01-0410-8a33-9dba5d9f93d6
Diffstat (limited to 'common/terrain.h')
-rw-r--r--common/terrain.h37
1 files changed, 14 insertions, 23 deletions
diff --git a/common/terrain.h b/common/terrain.h
index 9c41e29..fabedef 100644
--- a/common/terrain.h
+++ b/common/terrain.h
@@ -7,25 +7,15 @@
#include "defines.h"
-typedef struct {
- float corners[8][3];
- float minX, minY, minZ;
- float maxX, maxY, maxZ;
-
- void InitBox(float minX, float maxX, float minY, float maxY, float minZ, float maxZ);
-} PATCHBOX;
+class File;
+class Camera;
+class Texture;
-typedef struct PATCH
+class TerrainPatch
{
- PATCH()
- {
- vertex = NULL;
- normals = NULL;
- coords = NULL;
- index = NULL;
- steps = 10;
- visible = true;
- };
+public:
+ TerrainPatch ();
+ ~TerrainPatch ();
float control[48]; // 4x4 grid
unsigned short steps;
@@ -35,15 +25,16 @@ typedef struct PATCH
float* coords;
unsigned short* index;
- PATCHBOX box;
bool visible;
+
+ void InitBox(float minX, float maxX, float minY, float maxY, float minZ, float maxZ);
+ bool BoxIsOutside(const float plane[4]) const;
void Tesselate(bool bNormals);
void FreeMemory();
-} PATCH;
-class File;
-class Camera;
-class Texture;
+protected:
+ float corners[8][3];
+};
class Terrain
{
@@ -81,7 +72,7 @@ protected:
void FindVisiblePatches(Camera* pCam, float aspect);
float** m_pControl;
- PATCH** m_Patches;
+ TerrainPatch** m_Patches;
int m_uPatches;
int m_vPatches;
float m_uSize;