Package com.jme3.material

Examples of com.jme3.material.Material


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


    return word;
  }
 
  private Spatial loadLetter(String letter) {
        Spatial sletter = (Spatial) assetManager.loadModel("Text/"+letter+".mesh.xml");
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    sletter.setMaterial(mat);
    return sletter;
  }
View Full Code Here

        //set viewport to render to offscreen framebuffer
        offView.setOutputFrameBuffer(offBuffer);

        // setup framebuffer's scene
        Box boxMesh = new Box(Vector3f.ZERO, 1,1,1);
        Material material = assetManager.loadMaterial("Interface/Logo/Logo.j3m");
        offBox = new Geometry("box", boxMesh);
        offBox.setMaterial(material);

        // attach the scene to the viewport to be rendered
        offView.attachScene(offBox);
View Full Code Here

        //setup main scene
        //Geometry quad = new Geometry("box", new Box(Vector3f.ZERO, 1,1,1));
        Geometry g = new Geometry("Bubble", new Bubble(1f, 4f));
        Texture offTex = setupOffscreenView();

        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", offTex);
        g.setMaterial(mat);
        rootNode.attachChild(g);
        inputManager.addMapping(TOGGLE_UPDATE, new KeyTrigger(KeyInput.KEY_SPACE));
        inputManager.addListener(this, TOGGLE_UPDATE);
    }
View Full Code Here

    b.setMode(Mesh.Mode.Points);
    b.setPointSize(10f);
    b.setStatic();
    */
    Geometry g = new Geometry("Bubble", b);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
    rootNode.attachChild(g);
   
    /*
    DirectionalLight sun = new DirectionalLight();
View Full Code Here

  public void simpleInitApp() {
    Ring r = new Ring(3f, 0.5f);
    r.setPointSize(10f);
    r.setStatic();
    Geometry g = new Geometry("geo_ring", r);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/SolidColor.j3md");
    mat.setColor("Color", ColorRGBA.Blue);
    mat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    g.setMaterial(mat);
    rootNode.attachChild(g);

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection(new Vector3f(1,0,-2).normalizeLocal());
View Full Code Here

  }
 
  private void genPlanet() {
    Sphere planetSphere = new Sphere(48, 48, size, false, false);
    //Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
      Texture tex = assetManager.loadTexture("Textures/"+texture);
      planetSphere.setTextureMode(Sphere.TextureMode.Projected); // better quality on spheres
      TangentBinormalGenerator.generate(planetSphere);           // for lighting effect
      mat.setTexture("DiffuseMap", tex);
      mat.setFloat("Shininess", 0.0001f);
      planet = new Geometry("geo_"+name, planetSphere);
      planet.setMaterial(mat);
      planet.setShadowMode(ShadowMode.CastAndReceive);
      this.attachChild(planet);
     
      Sphere planetAtmosphere = new Sphere(48, 48, size*1.1f, false, true);
      Material matAtmosphere = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
      matAtmosphere.setColor("Color", new ColorRGBA(0,0,1,0.1f));
      matAtmosphere.getAdditionalRenderState().setBlendMode(BlendMode.AlphaAdditive);
      atmosphere = new Geometry("geo_"+name+"_atmosphere", planetAtmosphere);
      atmosphere.setMaterial(matAtmosphere);
      this.attachChild(atmosphere);
  }
View Full Code Here

        stateManager.attach(bulletAppState);

        Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry g = new Geometry("b", b);
        BoxCollisionShape boxCollisionShape = new BoxCollisionShape(new Vector3f(1, 1, 1));
        g.setMaterial(new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md" ));
        g.addControl(new RigidBodyControl(boxCollisionShape, 1));
        g.getControl(RigidBodyControl.class).setKinematic(true);
        bulletAppState.getPhysicsSpace().add(g);
        rootNode.attachChild(g);
View Full Code Here

    }

    private void updateTexture() {
        Geometry g = Util.getGeometryFromNode(spatial);
        if (g != null) {
            Material m = g.getMaterial();
            m.setColor("Ambient", color);
            m.setColor("Diffuse", color);
        }
    }
View Full Code Here

        }
    }

    private void loadMaterials(MonkeyMaterial[] monkeyMaterials) {
        for (MonkeyMaterial monkeyMaterial : monkeyMaterials) {
            Material m = assetManager.loadMaterial(monkeyMaterial.getPathToMaterial());
            materialMap.put(monkeyMaterial, m);
            preloadManager.preload(m);
        }
    }
View Full Code Here

TOP

Related Classes of com.jme3.material.Material

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.