//Sample data file: /* ncols 10 nrows 9 xllcenter 1562450.0 yllcenter 6723100.0 cellsize 50.0 nodata_value -32766 70.5 70.2 69.2 68.5 70.2 71.0 68.5 70.5 71.6 70.1 71.5 70.5 69.4 68.3 67.2 67.2 70.2 71.7 69.9 69.0 70.8 69.9 68.9 68.0 67.0 67.2 69.9 70.6 69.2 68.5 70.0 69.6 69.3 69.0 68.7 68.4 68.2 68.0 67.8 67.6 69.5 69.2 68.9 68.7 68.6 68.4 68.3 68.1 68.0 67.9 69.4 69.1 68.8 68.6 68.5 68.3 68.2 68.1 68.0 67.9 69.5 69.2 68.8 68.5 68.1 67.8 67.4 67.0 66.7 66.9 69.7 68.4 69.0 71.2 70.0 69.4 68.8 68.2 67.6 67.0 71.7 71.4 71.1 70.7 70.3 69.9 69.4 69.0 68.6 68.2 */ //The header data has been parsed and removed from "lines" by now, so this function only sees lines with height values. private void parseHeightValues(List lines){ final int lineCount = lines.size(); final int nrows = nrows(); final int ncols = ncols(); final float scaleFactor = 1.0f; final float cellsize = 1.0f;//((float) cellsize()); final float centeroffset = cellsize * 0.5f; vertices = new Vertex[ncols*nrows]; int index = 0; for(int row = 0; row < nrows; row++){ final String[] values = split(lines.get(row)); final int colCount = values.length; final float y = (row * cellsize) + centeroffset; for(int col = 0; col < ncols; col++){ final float x = (col * cellsize) + centeroffset; final float height = parseHeightValue(values[col]); final Vertex vert = new Vertex(x*scaleFactor, height*scaleFactor, y*scaleFactor); final float s = (row / (float)(nrows-1)); final float t = (col / (float)(ncols-1)); vert.texcoords(s, t); vertices[index++] = vert; } } } void generateVertexIndices(){ final int nrows = nrows(); final int ncols = ncols(); final int nfaces = (nrows-1)*(ncols-1); //the number of rectangles needed to be drawn for n rows and n cols of verts. final int sizeOfBuffer = nfaces*2*3; //two triangles per rectangular face. int index = 0; indices = new int[sizeOfBuffer]; for (int j=0; j