00001 #ifndef sw_LevelH
00002 #define sw_LevelH
00003
00004
00005 #include "sw_VertexList.h"
00006 #include "sw_FaceList.h"
00007 #include "sw_globals.h"
00008
00009
00010 #define BoardIntermediatesX 5
00011 #define BoardIntermediatesZ 10
00012
00013 typedef unsigned char uchar;
00014 typedef unsigned int uint;
00015
00016
00027 class CLevel
00028 {
00029 private:
00030 CVertexList Vertices;
00031 CFaceList Faces;
00032 GLfloat *HeightMap,*HD_HeightMap;
00033 TPoint3 List[BoardIntermediatesX*BoardIntermediatesZ];
00034 GLuint Width,Height,Size,HDSize,VNTArrayIndex,ArraySize;
00035 GLfloat xStride,zStride,Scale,yStep;
00036 GLuint TextureID[3];
00037 TPoint2 TextureCoords[C_STEPS_PER_TEXTURE][C_STEPS_PER_TEXTURE];
00038 GLfloat *VertexNormalTextureArray;
00039 bool areTextureBind;
00040
00041 GLvoid CreateVertexArraySpace();
00042 GLvoid CreateArrays();
00043 GLvoid AddVertexData(uint index,TPoint2 tex);
00044 GLfloat GetHDHeight(GLfloat x,GLfloat z);
00045 bool isCollinear(GLfloat x1,GLfloat z1,GLfloat x2,GLfloat z2);
00046 public:
00047 CLevel();
00048 ~CLevel();
00049
00059 GLint LoadFromFile(char *filename);
00060
00068 GLvoid Render(RenderMode rm,uint startrow,uint stoprow);
00069
00070
00071 GLvoid CalcBoardPosition(TBoard *Board,TPlane *p_Plane);
00072
00073
00082 GLint LoadTexture(GLint TextureType,char *filename);
00083
00089 GLint GetHeight();
00090
00099 GLfloat GetHeightAt(GLint h,GLint w);
00100
00109 GLfloat GetHeightAtXZ(GLfloat x,GLfloat z);
00110
00116 GLint GetWidth();
00117
00126 GLfloat GetzStride();
00127
00136 GLfloat GetxStride();
00137
00144 GLfloat GetyStep();
00145 };
00146
00147
00148 #endif