00001 #include <list>
00002
00003 typedef enum
00004 {
00005 HeightOverrideAlways,
00006 HeightOverrideNever,
00007 HeightOverrideIfHigher,
00008 HeightOverrideIfLower
00009 } height_override_t;
00010
00011
00012 class TerrainPatch
00013 {
00014 protected:
00015 float *corners[3];
00016 float vectors[3][3];
00017
00018 public:
00019 TerrainPatch(float *c0, float *c1, float *c2);
00020 bool detectHit(float x, float y);
00021 void getNormal(float *normal);
00022 float getHeight(float *point);
00023 bool getAll(float *point, float *normal, float *height);
00024 virtual void draw(void) = 0;
00025
00026 };
00027
00028 class TerrainOverlay
00029 {
00030 public:
00031 class TerrainOverlay *next;
00032 bool drawn;
00033
00034 protected:
00035 float *vertex_array;
00036 float *uv_array;
00037 int *index_array;
00038 int indices;
00039 unsigned int tex;
00040 std::list<TerrainPatch*> patch_list;
00041
00042 height_override_t height_mode;
00043
00044 public:
00045 TerrainOverlay(int vertex_count, float *vertices, int index_count,
00046 int *indices, float *uv1, float *uv2);
00047 virtual ~TerrainOverlay() {}
00048 height_override_t getHeightMode(void) {return height_mode;}
00049 void finalize(void);
00050 virtual bool draw(void);
00051 };
00052
00053
00054 class TerrainOverlayMultiTex: public TerrainOverlay
00055 {
00056 public:
00057 float *uv_array2;
00058 unsigned int tex2;
00059
00060 TerrainOverlayMultiTex(int vertex_count, float *vertices, int index_count,
00061 int *indices, float *uv1, float *uv2);
00062 virtual ~TerrainOverlayMultiTex() {}
00063 bool draw(void);
00064 };