Package com.jme3.material

Examples of com.jme3.material.Material


  }
 
  public static void debugShowBox(AssetManager assetMan, com.jme3.scene.Node root, Vector3f position, ColorRGBA color, float x, float y, float z) {
    Box b = new Box(position, x, y, z);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetMan, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", color);
    geom.setMaterial(mat);
    root.attachChild(geom);
  }
View Full Code Here


  private static void debugShowLine(AssetManager assetMan, com.jme3.scene.Node root, Vector3f start, Vector3f end,
      ColorRGBA color) {
    Line b = new Line(start.add(0f, 1f, 0f), end.add(0f,1f,0f));//, 0.1f, 0.4f, 0.1f);
    b.setLineWidth(2f);
    Geometry geom = new Geometry("Box", b);
    Material mat = new Material(assetMan, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", color);
    geom.setMaterial(mat);
    root.attachChild(geom);   
  }
View Full Code Here

    root.attachChild(geom);   
  }
 
  public static void debugShowMesh(AssetManager assetMan, com.jme3.scene.Node root, TiledNavMesh mesh) {
    int cnt = mesh.mCellArray.length;
    Material mat = new Material(assetMan, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.White);
    Cell c = null;
    Geometry geom = null;
    for(int i=0; i<cnt;i++){
     
//      if(i>2)
View Full Code Here

      Object n = a.getBaseAsset();
      if(n != null){
        if(n instanceof Geometry){
          Asset mat = materials.get(meshArray.get(a));
          if(mat != null){
            Material m = (Material)mat.getBaseAsset();
            if(m != null){
              //prepare rim light shader for selection highlighting
              m.setColor("RimLighting", ColorRGBA.BlackNoAlpha);//new ColorRGBA(1f, 0f, 0f, 12f));//this was for a test had to set the value to 12 for a really good noticable look
              //this must be a clone for hardware skinning
              ((Geometry)n).setMaterial(m.clone());
            } else
              log.severe("Material "+mat.getLocation()+" not found is missing for "+a.getLocation());
          }else
            log.severe("Material is missing for "+a.getLocation());
         
View Full Code Here

   
    Singleton.get().getSceneManager().removeAll();
      Quad b = new Quad(80f,60f);
      b.updateBound();
      Geometry geom = new Geometry("backdrop", b);
      Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Misc/Unshaded.j3md");
      mat.setTexture("ColorMap", Singleton.get().getAssetManager().getJmeAssetMan().loadTexture("start/backdrop.png"));
      geom.setMaterial(mat);
      geom.setLocalTranslation(-40f, -30f, -90f);     
      Singleton.get().getSceneManager().changeTerrainNode(geom,Action.ADD);
     
      Quad b2 = new Quad(38f,29f);
      b2.updateBound();
      Geometry geom2 = new Geometry("wolf", b2);
      Material mat2 = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Misc/Unshaded.j3md");
      mat2.setTexture("ColorMap", Singleton.get().getAssetManager().getJmeAssetMan().loadTexture("start/wolf.png"));
      mat2.getAdditionalRenderState().setBlendMode(BlendMode.Alpha); // activate transparency
      geom2.setMaterial(mat2);
      geom2.setQueueBucket(Bucket.Transparent);
      geom2.setLocalTranslation(-39f, -15f, -90f)
      Singleton.get().getSceneManager().changeTerrainNode(geom2,Action.ADD);
     
View Full Code Here

    Node spatNode = (Node) spatial;
    Node grassLayer = new Node("grass_" + spatial.getName());
    grassLayer.setModelBound(new BoundingBox());

    Texture tex = assetManager.loadTexture(texturePath);
    Material faceMat = new Material(assetManager,
        "/com/l2client/materials/LightingGrass.j3md");
    faceMat.getAdditionalRenderState().setBlendMode(
        RenderState.BlendMode.Alpha);
    faceMat.getAdditionalRenderState().setFaceCullMode(FaceCullMode.Off);
    faceMat.getAdditionalRenderState().setDepthWrite(true);
    faceMat.getAdditionalRenderState().setDepthTest(true);
    faceMat.setTransparent(true);
    faceMat.setTextureParam("DiffuseMap", VarType.Texture2D, tex);
    faceMat.setFloat("AlphaDiscardThreshold", 0.3f);
    // faceMat.setTextureParam("AlphaMap", VarType.Texture2D,tex);
    faceMat.setBoolean("UseAlpha", true);
    if (fadeEnd > 0f) {
      faceMat.setFloat("FadeEnd", fadeEnd);// 300f);
      faceMat.setFloat("FadeRange", fadeRange); // 50f);
      faceMat.setBoolean("FadeEnabled", true);
    }
    faceMat.setBoolean("Swaying", true);
    faceMat.setVector3("SwayData", new Vector3f(1.0f, 0.5f, 300f));// frequency,
                                    // variation,
                                    // third?
    faceMat.setVector2("Wind", new Vector2f(1f, 1f));

    Geometry terrain = null;

    if (spatial instanceof Geometry) {
      terrain = (Geometry) spatial;
View Full Code Here

  }
 
  private void setRimLight(ColorRGBA color, Node node){
    for(Spatial s : node.getChildren()){
      if(s instanceof Geometry){
        Material m = ((Geometry) s).getMaterial();
        m.setColor("RimLighting", color);//new ColorRGBA(1f, 0f, 0f, 12f));
      }
      if(s instanceof Node) {
        setRimLight(color, (Node) s);
      }
    }
View Full Code Here

    Geometry selectionMarker = new Geometry("selection", new Quad(size, size));
    selectionMarker.setLocalTranslation(-0.5f*size, 0.2f, 0.5f*size);
    selectionMarker.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X));

      com.jme3.asset.AssetManager am = Singleton.get().getAssetManager().getJmeAssetMan();
      Material mat = new Material(am, "Common/MatDefs/Light/Lighting.j3md");
      Texture sel = am.loadTexture("models/textures/flare4.png");
      sel.setWrap(WrapMode.Repeat);
      mat.setTexture("DiffuseMap", sel);
      mat.getAdditionalRenderState().setBlendMode(BlendMode.Alpha);
      mat.getAdditionalRenderState().setDepthWrite(false);
      selectionMarker.setMaterial(mat);
      selectionMarker.setQueueBucket(Bucket.Transparent);
      selectionMarker.setShadowMode(ShadowMode.Off);
     
      return selectionMarker; 
View Full Code Here

 
 
  private Node createHealthBar(){
    Node n = new Node("health");
    Geometry frame = new Geometry("health_frame", new Quad(1f, 0.02f));
    Material mat = null;
      com.jme3.asset.AssetManager am = Singleton.get().getAssetManager().getJmeAssetMan();
      mat = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.White);
      frame.setMaterial(mat);
      frame.setQueueBucket(Bucket.Transparent);
      frame.setShadowMode(ShadowMode.Off);
    frame.setLocalTranslation(-0.5f, 0.11f, 0f);
      n.attachChild(frame);
     
    Geometry bar = new Geometry("health_bar", new Quad(1f, 0.1f));
      mat = new Material(am, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        bar.setMaterial(mat);
      bar.setQueueBucket(Bucket.Transparent);
        bar.setShadowMode(ShadowMode.Off);
        bar.setLocalTranslation(-0.5f, 0f, 0f);
      n.attachChild(bar);
View Full Code Here

            // This includes the shared geoemtry itself actually
            for (int i = 0; i < geoms.length; i++) {
              meshes[i] = geoms[i].getMesh().cloneForAnim();

              Geometry g = new Geometry(geoms[i].getName(), meshes[i]);
              Material m = geoms[i].getMaterial();
              g.setMaterial(m);
              materials.add(m);
                model.attachChild(g);
            }
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.