Table of Contents:
OBJ2WCP is a command line application that converts models from Wavefront OBJ format to an IFF source code file, which can then be compiled by WCPPascal into a Wing Commander Prophecy/Secret Ops IFF mesh. OBJ2WCP is written in Java and the source code is available in the download.
First, you must place any OBJ and MTL files into the same directory as the converter. Having the bitmaps in the same folder is not required. To start the program, use your OS command line to go to the directory of the program and type:
Simply type in the model name and the starting MAT number, then watch it go! After the program is done, compile and build the .pas file with WCP Pascal.
Preconditions: The OBJ mesh must be fully triangulated, the model and material must be in the same folder, starting MAT number can be no longer than 8 digits, all materials must have textures, OBJ/MTL filename cannot have spaces, all vertices must have UV coordinates, all faces must have a vt reference.
The program works by looking for the material library file in the OBJ file, reading the material library and all materials, then reading the rest of the OBJ file. The program stores vertex/normal/face data in arrays, then streams out the IFF file by converting each string representing each line to an array of bytes and passing it to the file output stream.
The progress of each individual aspect of the program is shown on the progress chart below. Note that this chart may be updated at any time.
In the future, I may add a few features, including:
- Group parsing, for LODs and Capship Components
OBJ2WCP is licensed under the following terms:
Updated 2011/01/05 - unknown1 value is now calculated properly. Thanks, gr1mre4per!
OBJ2WCP 1.2 is available for download here: obj2wcp_1.2.zip (14.7 kb)