Package org.jdesktop.wonderland.modules.jmecolladaloader.common.cell.state

Examples of org.jdesktop.wonderland.modules.jmecolladaloader.common.cell.state.LoaderData


    }

    public Node loadDeployedModel(DeployedModel deployedModel, Entity rootEntity) {
        InputStream in = null;
        try {
            LoaderData data=null;
            if (deployedModel.getLoaderDataURL()==null) {
                logger.warning("No Loader data for model "+deployedModel.getModelURL());
            } else if (deployedModel.getLoaderData() == null) {
                URL url = AssetUtils.getAssetURL(deployedModel.getLoaderDataURL());
                in = url.openStream();
                if (in==null) {
                    logger.severe("Unable to get loader data "+url.toExternalForm());
                } else {
                    try {
                        data = LoaderData.decode(in);
                        deployedModel.setLoaderData(data);
                    } catch (JAXBException ex) {
                        Logger.getLogger(JmeColladaLoader.class.getName()).log(Level.SEVERE, "Error parsing loader data "+url.toExternalForm(), ex);
                    }
                    in.close();
                }
            }

            logger.info("LOADING DEPLOYED MODEL "+deployedModel.getModelURL());
           
            if (deployedModel.getModelURL().endsWith(".gz"))
                in = new GZIPInputStream(AssetUtils.getAssetURL(deployedModel.getModelURL()).openStream());
            else
                in = AssetUtils.getAssetURL(deployedModel.getModelURL()).openStream();

            String baseURL = deployedModel.getModelURL();
            baseURL = baseURL.substring(0, baseURL.lastIndexOf('/'));

            Node modelBG;
            Map<String, String> deployedTextures = null;
            if (data!=null)
                deployedTextures = data.getDeployedTextures();

            ResourceLocator resourceLocator = getDeployedResourceLocator(deployedTextures, baseURL);

            if (resourceLocator!=null) {
                ResourceLocatorTool.addThreadResourceLocator(
View Full Code Here


    public DeployedModel deployToModule(File moduleRootDir, ImportedModel importedModel) throws IOException {
        try {
            String modelName = getFilename(importedModel.getOriginalURL().toURI().getPath());
            HashMap<String, String> textureDeploymentMapping = new HashMap();
            DeployedModel deployedModel = new DeployedModel(importedModel.getOriginalURL(), this);
            LoaderData data = new LoaderData();
            data.setDeployedTextures(textureDeploymentMapping);
            data.setModelLoaderClassname(this.getClass().getName());
            deployedModel.setLoaderData(data);

            // TODO replace getName with getModuleName(moduleRootDir)
            String moduleName = moduleRootDir.getName();
View Full Code Here

    }
   
    protected void deployDeploymentData(File targetDir,
            DeployedModel deployedModel,
            String filename) {
        LoaderData data = (LoaderData) deployedModel.getLoaderData();
//        System.err.println("CREATING deploymentData "+filename);
        File deploymentDataFile = new File(targetDir, filename+".dep");
        File loaderDataFile = new File(targetDir, filename+".ldr");
        try {
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(deploymentDataFile));
            try {
                deployedModel.encode(out);
            } catch (JAXBException ex) {
                Logger.getLogger(JmeColladaLoader.class.getName()).log(Level.SEVERE, null, ex);
            }
            out.close();
        } catch(IOException e) {

        }

        try {
            BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(loaderDataFile));
            try {
                data.encode(out);
            } catch (JAXBException ex) {
                Logger.getLogger(JmeColladaLoader.class.getName()).log(Level.SEVERE, null, ex);
            }
            out.close();
        } catch(IOException e) {
View Full Code Here

        // see if this is the loader data URL
        if (model.getLoaderDataURL() != null) {
            URL modelLoaderURL = AssetUtils.getAssetURL(model.getLoaderDataURL());
            if (modelLoaderURL.equals(url)) {
                try {
                    LoaderData data = LoaderData.decode(loaded);
                    URL modelURL = AssetUtils.getAssetURL(model.getModelURL());
                    for (String textureURL : data.getDeployedTextures().values()) {
                        out.add(new URL(modelURL, textureURL));
                    }
                } catch (JAXBException ex) {
                    throw new IOException(ex);
                }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.jmecolladaloader.common.cell.state.LoaderData

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.