Package com.l2client.navigation

Examples of com.l2client.navigation.TiledNavMesh


      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
      e.printStackTrace();
    }
View Full Code Here


  private void addNavWithMesh(EntityNavigationManager em, String meshFile,
      int x, int y, int z) {
    try {
//      NavigationMesh m = getNavMesh(meshFile+".jnv", 128, x, y, z);
      TiledNavMesh m = getMeshNav(meshFile, IArea.TERRAIN_SIZE, x, y, z);
      em.attachMesh(m);
      Geometry grid = (Geometry) assetManager.loadAsset(meshFile);
      grid.setLocalTranslation(x, y, z);
//          Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.LightGray);
View Full Code Here

    private TiledNavMesh getNavMesh(String file, float size, float x, float y, float z) throws IOException{
      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

    m.loadFromGeom(g00);
    return m;
    }
   
    private TiledNavMesh getNavMesh(String name, Vector3f worldtrans){
      TiledNavMesh m = new TiledNavMesh();
      m.loadFromData(new Vector3f[] {new Vector3f(-IArea.TERRAIN_SIZE_HALF,0,IArea.TERRAIN_SIZE_HALF),new Vector3f(-IArea.TERRAIN_SIZE_HALF,0,-IArea.TERRAIN_SIZE_HALF), new Vector3f(IArea.TERRAIN_SIZE_HALF,0,-IArea.TERRAIN_SIZE_HALF), new Vector3f(IArea.TERRAIN_SIZE_HALF,0,IArea.TERRAIN_SIZE_HALF)}, new short[][] {{0,2,1},{0,3,2}}, worldtrans);
      return m;
    }
View Full Code Here

  private void addNavWithMesh(EntityNavigationManager em, String meshFile,
      int x, int y, int z) {
    try {
//      NavigationMesh m = getNavMesh(meshFile+".jnv", 128, x, y, z);
      TiledNavMesh m = getMeshNav(meshFile, 128, x, y, z);
      em.attachMesh(m);
      Geometry grid = (Geometry) assetManager.loadAsset(meshFile);
      grid.setLocalTranslation(x, y, z);
//          Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
//          mat.setColor("Color", ColorRGBA.LightGray);
View Full Code Here

    private TiledNavMesh getNavMesh(String file, float size, float x, float y, float z) throws IOException{
      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

    m.loadFromGeom(g00);
    return m;
    }
   
    private TiledNavMesh getNavMesh(String name, Vector3f worldtrans){
      TiledNavMesh m = new TiledNavMesh();
      m.loadFromData(new Vector3f[] {new Vector3f(-64,0,64),new Vector3f(-64,0,-64), new Vector3f(64,0,-64), new Vector3f(64,0,64)}, new short[][] {{0,2,1},{0,3,2}}, worldtrans);
      return m;
    }
View Full Code Here

  /**
   * @param args
   */
  public static void main(String[] args) {
    TiledNavMesh m;
    try {
      DesktopAssetManager assetManager = new DesktopAssetManager(true);
      loadSave(assetManager, "grid.0_0.j3o", Vector3f.ZERO);
      loadSave(assetManager, "grid.0_1.j3o", new Vector3f(0,0,-128));
      loadSave(assetManager, "grid.1_0.j3o", new Vector3f(128,0,0));
View Full Code Here

      e.printStackTrace();
    }  }

  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);
    int cells = m.TotalCells();
    eT =System.currentTimeMillis();         
    System.out.println("Navmesh building from "+file+"took "+(eT-sT)+" milli seconds for "+cells+" cells");
    BinaryExporter.getInstance().save(m, new File(file+".jnv"));
    sT = System.currentTimeMillis();
    m = (TiledNavMesh) BinaryImporter.getInstance().load(new File(file+".jnv"));
View Full Code Here

  public void testSelf(){
    Singleton.get().init(null);
      EntityNavigationManager em = Singleton.get().getNavManager();

       
        TiledNavMesh n1 = getNavMesh("0/0", Vector3f.ZERO);
        em.attachMesh(n1);
        TiledNavMesh n2 = getNavMesh(""+IArea.TERRAIN_SIZE+"/0", new Vector3f(IArea.TERRAIN_SIZE,0,0));
        em.attachMesh(n2);
        TiledNavMesh n3 = getNavMesh("0/-"+IArea.TERRAIN_SIZE, new Vector3f(0,0,-IArea.TERRAIN_SIZE));
        em.attachMesh(n3);       

        TiledNavMesh n11 = em.getNavMesh(10,10);
        System.out.println("Navmesh with 10/10 in it is:"+n11+" ? 0/0 ?");
        assertEquals(n1, n11);
        TiledNavMesh n22 = em.getNavMesh(IArea.TERRAIN_SIZE+10,10);
        System.out.println("Navmesh with "+(IArea.TERRAIN_SIZE+10)+"/10 in it is:"+n22+" ? "+IArea.TERRAIN_SIZE+"/0 ?");
        assertEquals(n2, n22);
        TiledNavMesh n33 = em.getNavMesh(10,-IArea.TERRAIN_SIZE+10);
        System.out.println("Navmesh with 10/-"+(IArea.TERRAIN_SIZE+10)+" in it is:"+n33+" ? 0/-"+IArea.TERRAIN_SIZE+" ?");
        assertEquals(n3, n33);
        TiledNavMesh n44 = em.getNavMesh(10,10);
        assertEquals(n11, n44);

        Vector3f sPos = new Vector3f(10,0,10);
        Vector3f ePos = new Vector3f(30,0,30);
        Path p = null;
View Full Code Here

TOP

Related Classes of com.l2client.navigation.TiledNavMesh

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.