Planet Heightmaps

From PioneerWiki
Jump to: navigation, search

Height maps live in data/heightmaps/*. There are currently two types. Each type has a different data structure and is modified by a different fractal height/color combo. Type is specified by the second argument to the height_map function in the custom system definition.

Type 0 (eg Earth)

struct HeightMap0Header {
    Uint16 width;
    Uint16 height;
};
struct HeightMap0 {
    HeightMap0Header header;
    Sint16 data[header.width*header.height];
};

Notes:

  • Traditional docs claim height is in metres, but the sign appears to be important. I expect that means 0 is actually some 2^16m (~65km) from the "surface".

Type 1 (eg Moon)

struct HeightMap1Header {
    Uint16 height;
    Uint16 width;
    // height = height * scaling+minheight
    double heightScaling;
    double minh;
};
struct HeightMap1 {
    HeightMap1Header header;
    Uint16 data[header.width*header.height];
};

Notes:

  • Uses scaling and minimum height to provide a wider range of heights
  • Data is unsigned (because of the minimum height)
  • width and height are reversed from Type 0