1995 Cyber Vision. Kai Gunter Brandt Michael Krohnsgt 37c 5037 SOLHEIMSVIKEN - NORWAY ----------------------------------------------------------------------------- Vista Landscape Format ----------------------------------------------------------------------------- For those of you who may want to create your own landscapes the following describes the 'uncompressed' Vista landscape format. If you wish to compress your landscapes you will have to load them into Vista and then save them back out.. Vista automatically compresses landscapes when saving them. Uncompressed Vista landscapes consist of a 2048 byte header followed by a two dimensional array of elevation data. The header may described by the following C structures: struct COLORMAP { unsigned char zero; /* unused, set to 0 */ unsigned char red; /* 8 bit red color value */ unsigned char green; /* 8 bit green color value */ unsigned char blue; /* 8 bit blue color value */ }; struct DEM_HEADER { unsigned char id[32]; /* null terminated string */ unsigned char name[32]; /* null terminated string */ unsigned char comment[64]; /* null terminated string */ long compression; /* 0=not, 1=compressed */ long header_type; /* 0=plain, 1=extended */ unsigned char reserved[888]; /* pad to 1024 */ struct COLORMAP CMAP[256]; /* 256 */ }; short MOUNT[258][258]; The header consists of a 32 byte ascii identifier, a 32 byte ascii landscape name, a 64 byte ascii landscape description (comment), a compression mode flag, a header type flag, 888 reserved bytes, and a 1024 byte color table. The identifier field MUST be 'Vista DEM File' padded with NULLs to fill the field. The identifier is case sensitive. Vista will NOT attempt to load a file without a matching identifier. The name field MUST be NULL terminated so it can contain at most 31 printable characters. The name field will appear on the 'About Landscape' screen obtained from the menu item of the same name. #define WATER_BLUE 32 #define SKYE_BLUE 33 #define TREE1 34 #define TREE2 35 #define TREE3 36 #define TREE4 37 #define DIRT1 38 #define DIRT2 39 #define DIRT3 40 #define DIRT4 41 #define SNOW1 42 #define SNOW2 43 #define SNOW3 44 #define SNOW4 45 #define CLIFF_ROCK1 46 #define CLIFF_ROCK2 47 #define CLIFF_ROCK3 48 #define CLIFF_ROCK4 49 #define SAND_YELLOW 50 #define RIVER_WATER1 51 #define RIVER_WATER2 52 #define RIVER_WATER3 53 #define RIVER_WATER4 54 #define RIVER_WATER5 55 /* 56-255 not used, reserved for future enhancement */ These colors can be changed by the user via the color palette screen or by loading a landscape colormap. You may fill them as necessary or load your landscape, change the colormap (or load a colormap) and save the new colormap out with your landscape. The MOUNT[258][258] is simply a list of elevations (16 bit shorts, a total of 133128 bytes) starting at the southwest corner, proceeding along the 'X' axis to the east, then the next row etc. Topographic view: +------------------------/ /---------------------+ |word66306 word133127| | | | | / / / / | | | | |word00258 word00259 word00514| |word00000 word00001 word00257| +----------------------/ /----------------------+ The comment field MUST be NULL terminated so it can contain at most 63 printable characters. The comment field will appear on the 'About Landscape' screen obtained from the menu item of the same name. The compression mode flag should be set to 0 to indicate a Vista 1.0, basic format, header. In the future other values may be used to indicate that the reserved bytes contain valid data. The following 888 bytes are reserved and undefined at this time. We suggest filling them with all zeros. The color map array is an array of 256 elements of four bytes each. The first byte of each element is unused and should be 0. The second is byte contains the red (0=0 intensity, 255=max intensity) intensity, the third byte is the green intensity and the fourth is the blue intensity. Each element contains the color values used for different polygon types in Vista. The types are defined in the following order: #define HAM_PAL00 0 /* first 16 used as the HAM palette */ #define HAM_PAL01 1 /* may be overridden by user */ #define HAM_PAL02 2 #define HAM_PAL03 3 #define HAM_PAL04 4 #define HAM_PAL05 5 #define HAM_PAL06 6 #define HAM_PAL07 7 #define HAM_PAL08 8 #define HAM_PAL09 9 #define HAM_PAL10 10 #define HAM_PAL11 11 #define HAM_PAL12 12 #define HAM_PAL13 13 #define HAM_PAL14 14 #define HAM_PAL15 15 /* 16-22 not used, reserved for future enhancement */ #define EXPOSURE 23 #define CONTRAST 24 #define SKY_HAZE 25 #define HAZE_COLOR 26 /* 27-31 not used, reserved for future enhancement */ We recmommend that all values range from 0 to 16000 at the most. The 3D engine may not work for values outside that range. Vista, at this time, will assume that each point is seperated by 30 meters but that the elevation elements are in (1) meters. If the data you wish does not conform to these specifications you will need to scale it appropriately. For example the elevation data 4, 10, 6, 6... will be interpreted by Vista as follows: (not to scale) 10 | | | | 6 6 | | | 4 meters | | | | | | | | | | | | | | | | | | | +------------+------------+------------+------------+----> (30 meters) (30 meters) (30 meters) (30 meters)........ If your data is spaced at 10 meters you will have to multiply all your elevations by 3 to obtain the proper aspect ration. On the other hand you may be happy withe the 3x vertical exageration..... Vista will display X and Y coordinates as if there is 30 meters between points, and the Z dimension as the values that are imported from the landscape file.