From 6628cf60d9ec6e1a0aebe305c6b46afdb0f80cb1 Mon Sep 17 00:00:00 2001 From: leo Date: Mon, 14 Oct 2002 22:56:06 +0000 Subject: Reorganized the terrain classes a bit. git-svn-id: http://svn.leocad.org/trunk@312 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- common/terrain.h | 37 ++++++++++++++----------------------- 1 file changed, 14 insertions(+), 23 deletions(-) (limited to 'common/terrain.h') 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; -- cgit v1.2.3