I'm trying to create a heightfield using the Example08 and reading the info from a raw map.
So, here's the code for the new m_heightField initialization (it's all the same code, now just trying to read raw values)
- Code: Select all
char temp;
std::ifstream inputFile("a.raw", std::ios::binary);
// get length of file:
inputFile.seekg (0, std::ios::end);
int length = inputFile.tellg();
inputFile.seekg (0, std::ios::beg);
// determine the number of rows and cols
int size = (int)sqrt((double)length);
//read from file into vector
for(int j=0;j<size; j++)
{
for (int i=0; i<size; i++)
{
inputFile.get(temp);
m_heightField[j][i] = temp;
}
}
The raw file it's attached in the end, and it looks like this:
And the mesh created is:
As you can see, it looks like the mesh is correct, but on the borders, it does that strange effect, kind of making walls, like if there's too much (or to few) information... I'm not sure where the problem is.. as the code is exactly like in the example (just changing HEIGHT_SIZE to 500+1 to fit my raw).
Any advice will be helpful!
Thanks!