Package com.jmex.model.collada

Examples of com.jmex.model.collada.ThreadSafeColladaImporter


    private Node loadModel(InputStream in,
                            String name,
                            boolean applyColladaAxisAndScale,
                            ThreadSafeColladaImporter.LoaderErrorListener listener) {
        Node modelNode;
        ThreadSafeColladaImporter importer = new ThreadSafeColladaImporter(name);
        importer.setErrorListener(listener);
        importer.load(in);
        modelNode = importer.getModel();

        CullState culls = DisplaySystem.getDisplaySystem().getRenderer().createCullState();
        culls.setCullFace(CullState.Face.Back);
        modelNode.setRenderState(culls);

        if (applyColladaAxisAndScale) {
            // Adjust the scene transform to match the scale and axis specified in
            // the collada file
            float unitMeter = importer.getInstance().getUnitMeter();
            modelNode.setLocalScale(unitMeter);

            String upAxis = importer.getInstance().getUpAxis();
            if ("Z_UP".equals(upAxis)) {
                modelNode.setLocalRotation(new Quaternion(new float[] {-(float)Math.PI/2, 0f, 0f}));
            } else if ("X_UP".equals(upAxis)) {
                modelNode.setLocalRotation(new Quaternion(new float[] {0f, 0f, (float)Math.PI/2}));
            } // Y_UP is the Wonderland default
        }

        importer.cleanUp();

        setupBounds(modelNode);

//        TreeScan.findNode(modelNode, new ProcessNodeInterface() {
//
View Full Code Here


        modelFiles.add(filename);
       
        ZipEntry modelEntry = zipFile.getEntry(filename);
        BufferedInputStream in = new BufferedInputStream(zipFile.getInputStream(modelEntry));

        ThreadSafeColladaImporter importer = new ThreadSafeColladaImporter(filename);
        importer.setErrorListener(errorListener);
        importer.load(in);
        Node modelNode = importer.getModel();

        // Adjust the scene transform to match the scale and axis specified in
        // the collada file
        float unitMeter = importer.getInstance().getUnitMeter();
        modelNode.setLocalScale(unitMeter);

        String upAxis = importer.getInstance().getUpAxis();
        if (upAxis.equals("Z_UP")) {
            modelNode.setLocalRotation(new Quaternion(new float[] {-(float)Math.PI/2, 0f, 0f}));
        } else if (upAxis.equals("X_UP")) {
            modelNode.setLocalRotation(new Quaternion(new float[] {0f, 0f, (float)Math.PI/2}));
        } // Y_UP is the Wonderland default

        importer.cleanUp();

        setupBounds(modelNode);
        return modelNode;
    }
View Full Code Here

TOP

Related Classes of com.jmex.model.collada.ThreadSafeColladaImporter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.