Search in sources :

Example 1 with Quaternion

use of com.ardor3d.math.Quaternion in project energy3d by concord-consortium.

the class Scene method exportObj.

public void exportObj(final File file) throws Exception {
    try {
        final List<Mesh> objs = new ArrayList<Mesh>();
        for (final HousePart part : parts) {
            part.addPrintMeshes(objs);
        }
        final Quaternion rotate = new Quaternion(-1, 0, 0, 1);
        for (final Mesh mesh : objs) {
            mesh.getMeshData().rotatePoints(rotate);
            if (mesh.getMeshData().getNormalBuffer() != null) {
                mesh.getMeshData().rotateNormals(rotate);
            }
            mesh.updateModelBound();
        }
        final String s = file.toString();
        new ObjExporter().save(objs, new File(s), new File(s.substring(0, s.lastIndexOf(".")) + ".mtl"), null);
    } catch (final Throwable t) {
        BugReporter.report(t);
    }
}
Also used : Quaternion(com.ardor3d.math.Quaternion) ArrayList(java.util.ArrayList) Mesh(com.ardor3d.scenegraph.Mesh) ObjExporter(com.ardor3d.extension.model.obj.ObjExporter) File(java.io.File) HousePart(org.concord.energy3d.model.HousePart)

Aggregations

ObjExporter (com.ardor3d.extension.model.obj.ObjExporter)1 Quaternion (com.ardor3d.math.Quaternion)1 Mesh (com.ardor3d.scenegraph.Mesh)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HousePart (org.concord.energy3d.model.HousePart)1