/* orxonox - the future of 3D-vertical-scrollers Copyright (C) 2004 orx This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. ### File Specific: main-programmer: bottac@ee.ethz.ch */ #include "vertex_array_model.h" #define texRate 32 #define texRatef 4.0f #define tileSize 64 class SDL_Surface; class Vector; class Material; class PNode; class Texture; class HeightMap; class Tile { public: void draw(); void drawHighRes(); void drawLowRes(); int getRes(); int setHighRes(bool b); Tile(int i1, int j1, int i2, int j2, HeightMap* hm ) ; Tile(); float x; float z; virtual ~Tile(); private: HeightMap* hmref; VertexArrayModel* highResModel; VertexArrayModel* lowResModel; int highRes; int lowRes; void load(int i1, int j1, int i2, int i2, HeightMap* hm, VertexArrayModel* model, int Res); }; class HeightMap : public VertexArrayModel { public: void draw(); void load(); void load(int Mode); void load(const std::string&, int Mode); void scale( Vector V); void setAbsCoor(Vector V); float getHeight(float x, float y); float getNormal(float x, float y); HeightMap(); HeightMap(const std::string&); HeightMap(const std::string&, const std::string&); virtual ~HeightMap(); friend class Tile; private: SDL_Surface* heightMap; SDL_Surface* colourMap; unsigned char* heights; unsigned char* colours; void generateNormalVectorField(); void drawRect(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight ); void fixBoarder(int xBottomLeft, int yBottomLeft, int xTopRight, int yTopRight); Vector ** normalVectorField ; Tile *** tiles; Vector camCoords; Vector offsetCoords; Material * tmp_mat; Material* red_mat; Texture* texture; const PNode* camera; float scaleX ; float scaleY ; float scaleZ ; float shiftX ; // to be removed float shiftY ; // to be removed float shiftZ ; // to be removed float offsetX; float offsetY; float offsetZ; int cmScaleX; int cmScaleY; bool hasColourMap; inline int abs(int val) { if(val < 0) val = -val; return val; } inline int max(int x, int y) { return (x>y)? x:y; } inline int min(int x, int y) { return (x