Skip to content

Instantly share code, notes, and snippets.

@nikolaykasyanov
Created September 16, 2011 08:23
Show Gist options
  • Save nikolaykasyanov/1221540 to your computer and use it in GitHub Desktop.
Save nikolaykasyanov/1221540 to your computer and use it in GitHub Desktop.
current VHGT parsing
esm.getHNExact(&rawHeights, sizeof(VHGT), "VHGT");
float base = rawHeights.heightOffset;
int currentHeightIndex = 0;
for (int y = 0; y < LAND_SIZE; y++)
{
uint8_t delta = rawHeights.heightData[currentHeightIndex];
currentHeightIndex++;
base += delta;
landData->heights[y * LAND_SIZE] = base * HEIGHT_SCALE;
float scratch = base;
for (int x = 1; x < LAND_SIZE; x++)
{
uint8_t delta = rawHeights.heightData[currentHeightIndex];
currentHeightIndex++;
scratch += delta;
landData->heights[x + y * LAND_SIZE] = scratch
* HEIGHT_SCALE;
}
}
@nikolaykasyanov
Copy link
Author

thanks for info & hint

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment