The QuickDraw 3D metafile format (3DMF) is a complete and rich file format that can contain any 3D information the user can create, including all types of geometries and objects, plus textures, lights, shaders, cameras, active renderers, material properties, hierarchical information and more. Both text and binary formats are supported. 3DMF offers a consistent cross-platform (Mac, Windows, Unix) file format. Files saved in the 3DMF metafile format will be equally functional on a PC running Windows, a Power Macintosh running the Mac OS or a workstation running UNIX.
Using the 3DMF file format you can communicate 3D information or its appearance sub-components simply and easily between applications and across any platform.
The 3D Metafile is a file format for 3D graphics applications that make use of the QuickDraw 3D graphics library or other object-based 3D graphics libraries. This document describes the 3D Metafile file format.
The purposes of the metafile are
- to establish a standard file format for 3D graphics files
- to establish canonical forms for descriptions of familiar 3D graphics objects
This standard is put forward to promote compatibility among 3D graphics applications and is meant to facilitate the transfer and exchange of data between distinct applications. The file format also permits a project to be saved to a file in such a way that it may be resumed or altered at a later time.
The metafile file format permits objects to be labeled and referenced. A metafile may also include one or more tables of contents in which such labels and references are listed. A table of contents may provide a complete catalog of the items contained in a metafile and of all cross-references among those items. However, a metafile is not itself a database and does not have the capabilities of a database. Applications that wish to apply the capabilities of a database to the contents of a metafile must connect that file to a preexisting database program.
The canonical forms for descriptions of 3D graphics objects outlined in this document embody an object- and class-based approach to 3D graphics and reflect the structure of the QuickDraw 3D class hierarchy. This approach can be described briefly as follows. First, a number of basic data types are introduced. Next, more complex data types, called objects, are defined in terms of these basic data types. Finally, similar objects are grouped together to form classes of objects, arranged in a hierarchical structure.
Each class of objects, and thus each object, is correlated with a particular node in that structure. We use the terms parent and child to describe the relationships among objects located at immediately adjacent and connected nodes in the structure. For example, a color attribute may be included in a set of attributes that is assigned to a geometric object. In that case, the geometric object is a parent of the attribute set, which in turn is a parent of the color attribute, while the color attribute is a child of the attribute set, which in turn is a child of the geometric object. See the book 3D Graphics Programming With QuickDraw 3D for complete details on this approach to the classification of 3D graphics objects.
The metafile file format includes two mechanisms that allow two or more objects to be grouped together to form a more complex object having as much hierarchical structure as desired. These mechanisms are the container and the group. The format also includes two special objects, file pointers and reference objects, that can be used to instantiate previously specified objects by reference.
Metafile File Structure
A metafile is simply a sequence or list of one or more valid metafile objects. Each metafile must contain exactly one 3D metafile header, and this header must be the first object to occur in the file. Objects following the header may occur in any order permitted by the metafile class hierarchy. Currently, every object that begins in a metafile must be wholly contained in that file; thus, it is not legal to truncate the description of an object at the end of a file.
A metafile may include one or more tables of contents, but need not include any. Should a metafile include more than one table of contents, each table of contents should continue the record provided by the immediately previous table of contents (if such exists) without duplication. A table of contents may contain information about objects occurring before or after it, or both, but should not contain information about any object that either precedes an object mentioned in a previous table of contents or follows an object mentioned in a subsequent table of contents.
There are three principal types of metafile: stream, normal, and database. The type of a metafile is indicated by a flag in the metafile header. See the section "3D Metafile Header" for complete details on these flags.
In a stream file, objects can not be instantiated by reference; the complete specification of an object must occur at each place in the file at which that object is to be instantiated. Objects can be instantiated by reference in normal and database files. In a normal metafile, the complete specification of an object can occur once only; an object can be instantiated multiply only by reference. No such restrictions apply to database files. In a database file, every object that can be instantiated by reference and is not itself a reference object must be listed in a table of contents (whether or not that object has been instantiated by reference).
A stream file can but need not include a table of contents. A database file must include a table of contents. A normal file in which objects are instantiated by reference must include a table of contents; a normal file in which no objects are instantiated by reference can but need not include a table of contents.