Package com.jme3.material

Examples of com.jme3.material.MaterialList


    @Override
    public void simpleInitApp() {
        Spatial teapot = assetManager.loadModel("Models/Teapot/Teapot.obj");
      
        teapot.setLocalScale(2f);
        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        mat.setFloat("m_Shininess", 32f);
        mat.setBoolean("m_UseMaterialColors", true);

        mat.setColor("m_Ambient",  ColorRGBA.Black);
        mat.setColor("m_Diffuse",  ColorRGBA.Green);
        mat.setColor("m_Specular", ColorRGBA.Red);
       
        teapot.setMaterial(mat);
        rootNode.attachChild(teapot);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
View Full Code Here


    b.setStatic();
    */
    Geometry g = new Geometry("Bubble", b);
    g.rotate(FastMath.HALF_PI, 0, FastMath.HALF_PI);
    //g.scale(1, 1, -1);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Texture tex = assetManager.loadTexture("Textures/test3.png");
    mat.setTexture("ColorMap", tex);
    //mat.setColor("Color", ColorRGBA.Blue);
    //mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
   
    rootNode.attachChild(g);
View Full Code Here

    init(radius, color);
  }
 
  private void init(float radius, ColorRGBA color) {
    //super("planet_marker", new Circle(radius*2));     
    Material mat = new Material(Pollux.get().getAssetManager(), "Common/MatDefs/Misc/ColoredTextured.j3md");
    mat.setColor("Color", color);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    //mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
    //this.setQueueBucket(Bucket.Transparent);
    this.setMaterial(mat);
    hideMark();
  }
View Full Code Here

    //Spatial sky = SkyFactory.createSky(assetManager, "Textures/Stars_Sphere_big.jpg", true);
    //bgNode.attachChild(sky);

    sphere.updateModelBound();
    sphere.setQueueBucket(Bucket.Sky);
    Material sky = new Material(assetManager, "Common/MatDefs/Misc/Sky.j3md");
    TextureKey key = new TextureKey("Textures/Sky/Stars.dds", true);
    key.setGenerateMips(true);
    key.setAsCube(true);
    Texture tex = assetManager.loadTexture(key);
    sky.setTexture("m_Texture", tex);
    sky.setVector3("m_NormalScale", Vector3f.UNIT_XYZ);
    sphere.setMaterial(sky);
    sphere.setCullHint(Spatial.CullHint.Never);
    bgNode.attachChild(sphere);
  }
View Full Code Here

        flame.setHighLife(1f);
        flame.setInitialVelocity(new Vector3f(0, 7, 0));
        flame.setVelocityVariation(1f);
        flame.setImagesX(2);
        flame.setImagesY(2);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Particle.j3md");
        mat.setTexture("Texture", assetManager.loadTexture("Effects/Explosion/flame.png"));
        mat.setBoolean("PointSprite", true);
        flame.setMaterial(mat);
        return flame;
  }
View Full Code Here

    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

            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

   
    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

        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

    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

Related Classes of com.jme3.material.MaterialList

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.