Package com.jme3.scene

Examples of com.jme3.scene.Geometry


      return (TiledNavMesh) BinaryImporter.getInstance().load(new File(file));
    }
   
    private TiledNavMesh getMeshNav(String file, float size, float x, float y, float z){
    TiledNavMesh m;
    Geometry g00 = (Geometry) assetManager.loadAsset(file);
    if(g00 == null){
      System.out.println("Asset for "+file+"is missing");
      return null;
    }
    g00.setLocalTranslation(x,y,z);
    g00.updateGeometricState();
    m = new TiledNavMesh();
       
    m.loadFromGeom(g00);
    return m;
    }
View Full Code Here


        viewPort.setBackgroundColor(ColorRGBA.DarkGray);

        Spatial bumpy = (Spatial) assetManager.loadModel("Models/MonkeyHead/MonkeyHead.mesh.xml");
        rootNode.attachChild(bumpy);

        lightMdl = new Geometry("Light", new Sphere(10, 10, 0.1f));
        lightMdl.setMaterial(assetManager.loadMaterial("Common/Materials/RedColor.j3m"));
        rootNode.attachChild(lightMdl);

        // flourescent main light
        pl = new PointLight();
View Full Code Here

    }  }

  public static void loadSave(DesktopAssetManager assetManager, String file, Vector3f transl)
      throws IOException {
    TiledNavMesh m;
    Geometry g00 = (Geometry) assetManager.loadAsset(file);
    if(g00 == null){
      System.out.println("Asset for "+file+"is missing");
      return;
    }
    g00.setLocalTranslation(transl);
    g00.updateGeometricState();
    m = new TiledNavMesh();
   
    long eT = 0L;
    long sT =  System.currentTimeMillis();         
    m.loadFromGeom(g00);
View Full Code Here

      cam.setFrustumFar(1000f);
      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);
      sm.setRoot(scene);
    }
View Full Code Here

      addNavWithMesh(em,"/export/7_1.obj");
      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);
      TiledNavMesh m = (TiledNavMesh) assetManager.loadAsset(file+".jnv");//BinaryImporter.getInstance().load(new File(file+".jnv"));
      em.attachMesh(m);
    } catch (Exception e) {
      // TODO Auto-generated catch block
View Full Code Here

        Node a = s.getParent();
        if(a==null)return;
        BoundingVolume bound = ((Geometry) s).getModelBound();
        if(bound instanceof BoundingBox) {
        Box b = new Box(bound.getCenter(), ((BoundingBox) bound).getXExtent(), ((BoundingBox) bound).getYExtent(), ((BoundingBox) bound).getZExtent());
        Geometry g = new Geometry(null, b);
        g.setLocalTransform(s.getWorldTransform());
        g.setMaterial(matWireframe);
        bboxes.attachChild(g);
        }
      }
      if(s instanceof Node) {
        addBBoxes((Node) s);
View Full Code Here

            inputManager.getCursorPosition(), 0.3f);
        direction.subtractLocal(origin).normalizeLocal();
       
        Line li = new Line(origin.clone(), origin.add(direction.mult(30f)));
//        li.setLineWidth(3f);
        Geometry g = new Geometry(null, li);
      g.setMaterial(matWireframe);
      bboxes.attachChild(g);

        Ray ray = new Ray(origin, direction);
        CollisionResults results = new CollisionResults();
View Full Code Here

        if(a==null)return;
        BoundingVolume bound = ((Geometry) s).getModelBound();
        if(bound instanceof BoundingBox) {
          BoundingBox bb = ((BoundingBox) bound);
          WireBox b = new WireBox(bb.getXExtent(), bb.getYExtent(), bb.getZExtent());
          Geometry g = new Geometry(null, b);
          Transform t = s.getWorldTransform().clone();
//          Vector3f pos = t.getTranslation();
//          pos.addLocal(bb.getCenter());
//          t.setTranslation(pos);
          g.getLocalTransform().set(t);
          g.setMaterial(matWireframe);
          bboxes.attachChild(g);
        }
      }
      if(s instanceof Node) {
        addBBoxes((Node) s);
View Full Code Here

        app.start();
    }
   
    private void addReferences(){
      Box b1 = new Box(new Vector3f(1f,0f,1f), .5f, .5f, .5f);
      Geometry g1 = new Geometry("1,0,0",b1);
      g1.setMaterial(matBones);
      rootNode.attachChild(g1);
     
      Box b2 = new Box(new Vector3f(1f,0f,0f), .5f, .5f, .5f);
      Geometry g2 = new Geometry("0,0,1",b2);
      g2.setMaterial(matWireframe);
      rootNode.attachChild(g2);
     
    }
View Full Code Here

TOP

Related Classes of com.jme3.scene.Geometry

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.