Hi guys,
I'm writing a game in Ogre, and I wrote my own simple terrain generator. It takes an array of ints and produces a board-game like terrain, with gridlines.
That is (mostly) working fine, what I cant get to work is the heightmap generation. See image below - its in the right place, and its the right size, and it seems to correspond in a rough way, but its almost like its traversing through the float array in a different fashion to me. So its out of order.
Yes, it is too high, I did that on purpose to make it easier to see the difference between the terrain and the heightmap.
If it helps, once I've generated the terrain, I generate a vector of Ogre::Vector3's, which are used to build the grid (also manual objects). The vector is single dimensional, I just arrive at the single dimension coordinate by doing (SideLength * z) + x.
I generate the float array by traversing through my Vector3 vector, and use the y coordinate of each Vector3. I'm confused as to why the heightmap is so different, because as you can see, the grid lines are correct.
Any ideas?
EDIT: fixed my own problem. Needed to add 1 to the sidelength that I pass into the constructor, because there is one more vertex than there are squares per side, if that makes any sense. Ie, if the terrain were 1 square in size, it would have 4 vertices, and if it were 4 squares, it would have 9 vertices.
Now for some reason my Ogre head goes right through the terrain - next problem!