B.2 MGLD format

MGLD is textual file, which contain all required information for drawing 3D image, i.e. it contain vertexes with colors and normales, primitives with all properties, textures, and glyph descriptions. MGLD file can be imported or viewed separately, without parsing data files itself.

MGLD file start from string

MGLD npnts nprim ntxtr nglfs # optional description

which contain signature ‘MGLD’ and number of points npnts, number of primitives nprim, number of textures ntxtr, number of glyph descriptions nglfs, and optional description. Empty strings and string with ‘#’ are ignored.

Next, file contain npnts strings with points coordinates and colors. The format of each string is

x y z c t ta u v w r g b a

Here x, y, z are coordinates, c, t are color indexes in texture, ta is normalized t according to current alpha setting, u, v, w are coordinates of normal vector (can be NAN if disabled), r, g, b, a are RGBA color values.

Next, file contain nprim strings with properties of primitives. The format of each string is

type n1 n2 n3 n4 id s w p

Here type is kind of primitive (0 - mark, 1 - line, 2 - triangle, 3 - quadrangle, 4 - glyph), n1...n4 is index of point for vertexes, id is primitive identification number, s and w are size and width if applicable, p is scaling factor for glyphs.

Next, file contain ntxtr strings with descriptions of textures. The format of each string is

smooth alpha colors

Here smooth set to enable smoothing between colors, alpha set to use half-transparent texture, colors contain color scheme itself as it described in Color scheme.

Finally, file contain nglfs entries with description of each glyph used in the figure. The format of entries are

nT nL
xA yA xB yB xC yC ...
xP yP ...

Here nT is the number of triangles; nL is the number of line vertexes; xA, yA, xB, yB, xC, yC are coordinates of triangles; and xP, yP, xQ, yQ are coordinates of lines. Line coordinate xP=0x3fff, yP=0x3fff denote line breaking.