mri.v3ds
v0.1

3D Studio 3ds-file loader package.

See:
          Description

3D Studio 3ds-file loader package.

mri.v3ds API specification

Copyright (c) 2001 by Mats Byggmästar mats.byggmastar@multi.fi


The mri.v3ds 3ds-file loader package is intended for importing 3D vector animations, created with 3D Studio R4, into a 3D engine.

The native file format used by 3D Studio for storing the 3D vector animations are binary files with the extension .3ds. The 3ds-file contain all information from the 3D editor and the keyframer (meshes, materials, cameras, tracks, etc.). The internal structure of the 3ds-file is hirerchical. The hirearchy is made out of data chunks, which can contain sub-chunks. The sub-chunks can contain new sub-chunks, and so on. Each data chunk starts with a 6-byte header which consists of a 2-byte id field and 4-byte length field. The length field includes the size of the header (6 byte). After the header follows an optional payload field that can contain new sub-chunks or data related to the 3D vector animation.

Scene3ds is the toplevel class in this package. It has constructors that takes an input 3ds-file as parameter. The Scene3ds class parses the data chunks in the input file and builds a memory representation of the various parameters using the helper classes; Vertex3ds, Face3ds, Mesh3ds, Camera3ds, etc. After the file has been parsed and the Scene3ds object created successfully, the object can be passed to a 3D engine for further processing and visualization.

Example. Load and parse a local 3ds-file called "animation.3ds":
import mri.v3ds.*;
import java.io.*;
...
    Scene3ds scene;

    try {
        scene = new Scene3ds(new File("animation.3ds"));
    }
    catch(Exception3ds e) {
        // Something went wrong!
    }		
The Scene3ds class has a set of constructors that takes a TextDecode3ds object as parameter. By using these constructors, text decode of the 3ds-file can be extracted. The parser will generate text as each data chunk is parsed. The text is stored in the TextDecode3ds object. This feature is useful during 3D engine debugging.

Note! 3D Studio stores the Y and Z coordinates swapped in the 3ds-file. The coordinates are swapped back by the Scene3ds class during the parsing stage for all the relevant parameters; vertices, matrices and tracks.



mri.v3ds
v0.1