net.jinx.video.model
Class ImportExportUtil

java.lang.Object
  extended by net.jinx.video.model.ImportExportUtil

public class ImportExportUtil
extends java.lang.Object

Contains methods for importing and exporting Models in 3rd-party formats.
This currently supports exporting to Wavefront .obj format and POV-Ray's mesh2 data structure.
There are a few caveats when exporting Models to other formats. First, there's no way to carry textures over, but the texture coordinates will make the transition. Second, any kind of line-based MeshElement isn't likely to carry over and even if it does, it probably won't work the same. I suggest you not use lines in your Models anyway. Third, Coloration objects attached to the Model won't always carry over (currently they don't carry over at all). Fourth, some model formats require tessalating all geometry into triangles, so things may not look exactly the same.
I'll offer a little advice on building Models for export. One, stick to using Triangles MeshElements only; this will save you from unexpected oddities showing up in your models after export. Two, don't use a Coloration, but instead use a texture. This should work with any modeler program, as most of the modeling world loves textures and doesn't even consider any other kind of coloring scheme.

API Stability: Alpha.


Method Summary
static void exportPOVRayMesh2(java.io.OutputStream o, Model m)
          Exports an ascii POV-Ray file using a Model object as the source of geometry data for building a mesh2 structure.
static void exportWavefrontOBJ(java.io.OutputStream o, Model m)
          Exports an ascii Wavefront .obj file using a Model object as the source of geometry data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exportPOVRayMesh2

public static void exportPOVRayMesh2(java.io.OutputStream o,
                                     Model m)
Exports an ascii POV-Ray file using a Model object as the source of geometry data for building a mesh2 structure. Line-based MeshElements are NOT exported, but are instead skipped. I suggest not using them at all if you're planning to export.

With a little bit of work the resulting file can easily be given a camera, light source and the model can be given some kind of coloring, making a complete scene.

NOTE: This method doesn't export any of the detail of coloration or texturing past the raw texture coordinates. You'll have to redo this.

Parameters:
o - the OutputStream to send the export data through.
m - the Model object for geometry data.

exportWavefrontOBJ

public static void exportWavefrontOBJ(java.io.OutputStream o,
                                      Model m)
Exports an ascii Wavefront .obj file using a Model object as the source of geometry data. Line-based MeshElements are exported, but they will not behave the same. I suggest not using them at all if you're planning to export.

Parameters:
o - the OutputStream to send the export data through.
m - the Model object for geometry data.