PoLyGon Format
From Wikipedia, the free encyclopedia
This article does not cite any references or sources. (December 2007) Please help improve this article by adding citations to reliable sources. Unverifiable material may be challenged and removed. |
PoLyGon (abbreviated PLG) is a file format for storing 3D objects. It was originally invented by the people that made REND386. The file is a very simple and easy to read format ideal for very basic flat shaded or wire frame projections.
[edit] General description of the PLG format
Or at least some of its aspects.
The first line describes the object with a name, number of vertices, number of faces/polygons and an optional texture file. Then comes vertex list as X Y Z [U V], where the U V coordinates are optional texture coordinates. The number of vertices foretold in the header has to match the number of lines here. then follows the list of faces that connects vertices into polygons. This is done by referencing to the vertex index as COLOR NUMOFVERTICES VERTINDEX0 VERTINDEX1 VERTINDEX.
As an example, this represents a box...
BOX 8 6 0 0 0 200 0 0 200 200 0 0 200 0 0 200 200 200 200 200 200 0 200 0 0 200 0x11FF 4 0 1 2 3 0x11FF 4 4 5 6 7 0x11FF 4 7 6 1 0 0x11FF 4 6 5 2 1 0x11FF 4 5 4 3 2 0x11FF 4 4 7 0 3
...where line 1 names the object "BOX", tells us that there's 8 vertices and 6 faces. It then lists the vertices on the next 8 lines so that the box stretches from (0, 0, 0) to (200, 200, 200). The last 6 lines creates the faces that you can see with the first string (0x11FF) indicating what color to use, the next number (4) states that there's four vertices creating this face, and that the first face involves (in the given order) vertices 0, 1, 2 and 3, that's (0, 0, 0), (200, 0, 0), (200, 200, 0), and (0, 200, 0).