Examples of MaterialList


Examples of com.jme3.material.MaterialList

    File[] fList = file.listFiles(materialFilter);
    //spool all materials
    for (File name : fList) {
      try {
       
        MaterialList mats = (MaterialList) assetMan.loadAsset(name.getAbsolutePath());
        for(String id : mats.keySet()){
          Material m = mats.get(id);
          m.setName(id);
          String ass = "mats/"+file.getName()+"/"+id+ ".j3o";
//          m.setAssetName(ass);
        BinaryExporter.getInstance().save(m,
            new File(path + File.separatorChar + file.getName() + File.separatorChar + id+ ".j3o"));
View Full Code Here

Examples of com.jme3.material.MaterialList

            List<Statement> statements) throws IOException{
        this.assetManager = assetManager;
        this.matExts = matExts;
        this.key = key;
       
        list = new MaterialList();
       
        for (Statement statement : statements){
            if (statement.getLine().startsWith("import")){
                // ignore
                continue;
View Full Code Here

Examples of com.jme3.material.MaterialList

   
    private MaterialList load(AssetManager assetManager, AssetKey key, InputStream in) throws IOException{
        folderName = key.getFolder();
        this.assetManager = assetManager;
       
        MaterialList list = null;
        List<Statement> statements = BlockLanguageParser.parse(in);
       
        for (Statement statement : statements){
            if (statement.getLine().startsWith("import")){
                MaterialExtensionSet matExts = null;
                if (key instanceof OgreMaterialKey){
                     matExts = ((OgreMaterialKey)key).getMaterialExtensionSet();
                }

                if (matExts == null){
                    throw new IOException("Must specify MaterialExtensionSet when loading\n"+
                                          "Ogre3D materials with extended materials");
                }

                list = new MaterialExtensionLoader().load(assetManager, key, matExts, statements);
                break;
            }else if (statement.getLine().startsWith("material")){
                if (list == null){
                    list = new MaterialList();
                }
                String[] split = statement.getLine().split(" ", 2);
                matName = split[1].trim();
                readMaterial(statement);
                Material mat = compileMaterial();
                list.put(matName, mat);
            }
        }
       
        return list;
    }
View Full Code Here

Examples of com.jme3.material.MaterialList

        reset();
       
        this.key = info.getKey();
        this.assetManager = info.getManager();
        folderName = info.getKey().getFolder();
        matList = new MaterialList();

        InputStream in = null;
        try {
            in = info.openStream();
            scan = new Scanner(in);
            scan.useLocale(Locale.US);
           
            while (readLine());
        } finally {
            if (in != null){
                in.close();
            }
        }
       
        if (matName != null){
            // still have a material in the vars
            createMaterial();
            resetMaterial();
        }
       
        MaterialList list = matList;

       

        return list;
    }
View Full Code Here

Examples of com.jme3.material.MaterialList

    public void startElement(String uri, String localName, String qName, Attributes attribs) throws SAXException {
        if (qName.equals("externals")) {
            checkTopNode("scene");
           
            // Has an externals block, create material list.
            materialList = new MaterialList();
        } else if (qName.equals("item")) {
            checkTopNode("externals");
            if (!attribs.getValue("type").equals("material")) {
                // This is not a material external. Ignore it.
                ignoreItem = true;
            }
        } else if (qName.equals("file")) {
            checkTopNode("item");

            if (!ignoreItem) {
                String materialPath = attribs.getValue("name");
                String materialName = new File(materialPath).getName();
                String matFile = folderName + materialName;
                try {
                    MaterialList loadedMaterialList = (MaterialList) assetManager.loadAsset(new OgreMaterialKey(matFile));
                    materialList.putAll(loadedMaterialList);
                } catch (AssetNotFoundException ex) {
                    logger.log(Level.WARNING, "Cannot locate material file: {0}", matFile);
                }
            }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.