diff --git a/terrain.cc b/terrain.cc index c6190ae..90bd462 100644 --- a/terrain.cc +++ b/terrain.cc @@ -11,17 +11,17 @@ void Terrain::load() { std::ifstream terrain_png(this->filePath); unsigned int width, height, rowNum, columnNum; - terrain_png.seekg(16); - terrain_png.read((char *)&width, 4); - terrain_png.read((char *)&height, 4); - width = ntohl(width); - height = ntohl(height); + terrain_png.seekg(16); //skip part of the header + terrain_png.read((char *)&width, 4); //read width + terrain_png.read((char *)&height, 4); //read height + width = ntohl(width); //convert from host to network byte order + height = ntohl(height); - heightmap = new unsigned int*[height]; - for(rowNum=0; rowNum #include "texture.hh" #include -#include -#include "png.h" -//#include //on windows +//#include //on Windows #include //on Unix class Terrain { @@ -19,7 +17,7 @@ class Terrain { float friction; Texture texture; std::string filePath; - unsigned int** heightmap; + unsigned int** heightmap; //can be accessed like 'unsigned int[][]' }; #endif