Package com.jme3.material

Examples of com.jme3.material.Material


      }
     
     
      Box b = new Box(.5f,1f,.5f);
      Geometry walker = new Geometry("wakler", b);
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        walker.setMaterial(mat);
        Entity e = placeObject(new Vector3f(257f,2.2f,0f), new Vector3f(389f,0f,0f));
        if(e != null){
          e.attachChild(walker);
          rootNode.attachChild(e);
          this.walker = e;
        }

     
      Box b2 = new Box(.6f, .3f, .6f);
      Geometry g2 = new Geometry("tgt", b2);
      Material mat2 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat2.setColor("Color", ColorRGBA.Green);
        g2.setMaterial(mat2);
        Vector3f p = new Vector3f(256f,2.2f,0f);
        enm.snapToGround(p);
        g2.setLocalTranslation(p);
      rootNode.attachChild(g2);
View Full Code Here


        sin.getAssetManager().loadAsset(b, true);
        if(b.getBaseAsset() instanceof Spatial ) {
          Spatial n = (Spatial)b.getBaseAsset();
//      Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.randomColor());
        Material mat = new Material(Singleton.get().getAssetManager().getJmeAssetMan(), "Common/MatDefs/Light/Lighting.j3md");
        mat.setBoolean("UseMaterialColors",true);   
        mat.setColor("Diffuse",ColorRGBA.randomColor());
        n.setLocalTranslation(Tile.getWorldPositionOfXTile(121)+IArea.TERRAIN_SIZE_HALF, 0f,Tile.getWorldPositionOfZTile(177)-IArea.TERRAIN_SIZE_HALF);
          n.setMaterial(mat);
          rootNode.attachChild(n);
        }
        /*       System.out.println("tile x=121 should be world -9984:"+getWorldPositionOfXTile(121));
View Full Code Here

   
    private Spatial getQuad(float size, float x, float y, float z){
      Quad q = new Quad(size,size,true);
        //Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", q);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("com/l2client/test/material/chterraingrass01_n.dds"));
        geom.setMaterial(mat);
//        geom.setLocalTranslation((-0.5f*size)+x,(-0.5f*size)+y,z); 
        geom.rotate(-FastMath.HALF_PI, 0, 0);
        geom.setLocalTranslation((-0.5f*size)+x,y,(0.5f*size)+z);
       
View Full Code Here

   
    private Spatial getQuad(float size, float x, float y, float z){
      Quad q = new Quad(size,size,true);
        //Box b = new Box(Vector3f.ZERO, 1, 1, 1);
        Geometry geom = new Geometry("Box", q);
        Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setTexture("ColorMap", assetManager.loadTexture("com/l2client/test/material/chterraingrass01_n.dds"));
        geom.setMaterial(mat);
//        geom.setLocalTranslation((-0.5f*size)+x,(-0.5f*size)+y,z); 
        geom.rotate(-FastMath.HALF_PI, 0, 0);
        geom.setLocalTranslation((-0.5f*size)+x,y,(0.5f*size)+z);
       
View Full Code Here

      }

      @Override
      public void simpleInitApp() {

          Material material = new Material(assetManager, "com/l2client/materials/LightingScrolling.j3md");

          Texture grass = assetManager.loadTexture("Textures/Terrain/splat/grass.jpg");
          grass.setWrap(WrapMode.Repeat);
          material.setTexture("DiffuseMap", grass);
          Texture normal = assetManager.loadTexture("Textures/Terrain/splat/grass_normal.jpg");
          normal.setWrap(WrapMode.Repeat);
          material.setTexture("NormalMap", normal);
          material.setFloat("ScrollSpeed", 0.1f);
          material.setVector2("ScrollDirection", new Vector2f(0.1f,0.3f));

          // CREATE HEIGHTMAP
          AbstractHeightMap heightmap = null;
          try {
              //heightmap = new HillHeightMap(1025, 1000, 50, 100, (byte) 3);
View Full Code Here

      cam.setFrustumNear(1f);
      flyCam.setMoveSpeed(50f);
     
      Box b = new Box(1f, 2f, 1f);
      Geometry g = new Geometry("RefBox", b);
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        g.setMaterial(mat);
        g.setLocalTranslation(256f,2.2f,0f);
      rootNode.attachChild(g);
     
      rootNode.attachChild(scene);
View Full Code Here

      addNavWithMesh(em,"/export/7_2.obj");
      addNavWithMesh(em,"/export/7_3.obj");
     
      Box b = new Box(1f, 2f, 1f);
      Geometry g = new Geometry("RefBox", b);
      Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        mat.setColor("Color", ColorRGBA.Red);
        g.setMaterial(mat);
        g.setLocalTranslation(256f,2.2f,0f);
      rootNode.attachChild(g);
    }
View Full Code Here

  private void addNavWithMesh(EntityNavigationManager em, String file) {
    try {
//      NavigationMesh m = getNavMesh(meshFile+".jnv", 128, x, y, z);

      Geometry grid = (Geometry) assetManager.loadAsset(file+".j3o");
       Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            mat.setColor("Color", ColorRGBA.randomColor());
      grid.setMaterial(mat);
      TangentBinormalGenerator.fixTileNormals(grid.getMesh(), IArea.TERRAIN_SIZE_HALF, 0.05f);
      TangentBinormalGenerator.generate(grid.getMesh(), false);
      grid.updateGeometricState();
      rootNode.attachChild(grid);
View Full Code Here

 
  private Material matWireframe;
 
    public void simpleInitApp() {
     
        matWireframe = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        matWireframe.setColor("Color", ColorRGBA.Green);
        matWireframe.getAdditionalRenderState().setWireframe(true);
   
      man.loadParts("megaset.csv");
      templates = man.getTemplates();
View Full Code Here

  protected void addSkeletons(){
    for(Node n : nodes){
      SkeletonControl con = n.getControl(SkeletonControl.class);
      if(con != null) {
            SkeletonDebugger skeletonDebug = new SkeletonDebugger("skeletondebug", con.getSkeleton());
            Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
            mat.getAdditionalRenderState().setWireframe(true);
            mat.setColor("Color", ColorRGBA.Red);
            mat.getAdditionalRenderState().setDepthTest(false);
            skeletonDebug.setMaterial(mat);
            n.attachChild(skeletonDebug);
      }
    }
  }
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.