Created
September 16, 2011 08:23
-
-
Save nikolaykasyanov/1221540 to your computer and use it in GitHub Desktop.
current VHGT parsing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks for info & hint