Leaf

From DoomWiki.org

Doom level format

Extensions:

LEAFS is the name of a WAD lump which is a component of levels in the Sony PlayStation ports of Doom and Final Doom, and in Doom 64 for the Nintendo 64. It is also used by Doom64 EX, but does not exist in other ports nor in vanilla Doom. It was generated automatically by a dedicated node builder created by Williams Entertainment programmer Aaron Seeler, with technical advice from John Carmack, and implements a concept similar to GL nodes, providing fully closed polygons for use as the floor and ceiling of each subsector.

A leaf is collection of segs and vertexes for a subsector. There are one such collection for each subsector, in the same order as the SSECTORS lump.

Leaf structure[edit]

A leaf is of this form:

Offset Size (bytes) Description
0 2 Number n of vertex/seg references
2 n * 4 References

Each reference is of this form:

Offset Size (bytes) Description
0 2 Vertex number
2 2 Seg number

The order in which the segs and vertices are referenced should correspond to a clockwise order for each subsector, allowing the engine to easily transform subsectors into convex polygons. This also means that the node builder should have created the subsectors with the same constraints as for generating GL nodes, as a concave subsector simply cannot become a convex polygon.

Sources[edit]