kungfoomasta
19-02-2008 03:41:29
I'm trying to use the heightmap data directly to create my PhysX heightfield object, and as you will see, the shape does not match the terrain:
From the looks of it, the Shape is rotated and mirrored...
Code:
This question is mostly aimed at CABAListic: How should I be iterating through the heightmap values? It doesn't seem like I can take this approach, right?
Is it possible to request the heightmap data be iterated like this to build the terrain in the future? I realize it wont' work on a Terrain level, but if I could use this approach per Tile that would be awesome. I remember you saying you were going to make Tiles more accessible. If they gave access to their heightmap data and I could simply iterate through it to create a tile shape, that would be ideal.
From the looks of it, the Shape is rotated and mirrored...
Code:
ET::TerrainInfo* i = mTerrainComponent->mTerrainInfo;
std::vector<float> heightData = i->getHeightmapData();
for(std::vector<float>::iterator it = heightData.begin(); it != heightData.end(); ++it)
{
NxHeightFieldSample* currentSample = (NxHeightFieldSample*)currentByte;
currentSample->height = static_cast<NxI16>(((*it) * 65535) - 32768);
currentSample->materialIndex0 = 0;
currentSample->materialIndex1 = 0;
currentSample->tessFlag = 0;
currentByte += mNxHeightFieldDesc.sampleStride;
}
This question is mostly aimed at CABAListic: How should I be iterating through the heightmap values? It doesn't seem like I can take this approach, right?
Is it possible to request the heightmap data be iterated like this to build the terrain in the future? I realize it wont' work on a Terrain level, but if I could use this approach per Tile that would be awesome. I remember you saying you were going to make Tiles more accessible. If they gave access to their heightmap data and I could simply iterate through it to create a tile shape, that would be ideal.