Exemplo n.º 1
0
  public void LoadWorld() throws IOException {
    // Here we load the world from a .3ds file
    // g_World.carregaObjeto("arenaobj_Scene2.obj", true, false, g_World);
    // g_World.carregaObjeto("arenaobj_10.obj", true, false, g_World);

    // g_World.carregaObjeto(g_World, "Jupiter2_CrashlandModel.3ds");
    // g_World.carregaObjeto(g_World, "Park.3ds");
    g_World.load("collision_arena.3DS");
    // g_World.carregaObjeto(g_World, "teste.3DS");

    // The maximum amount of triangles per node.  If a node has equal or less
    // than this, stop subdividing and store the face indices in that node
    // g_Octree.g_MaxTriangles = 20;
    // The current amount of end nodes in our tree (The nodes with vertices stored in them)
    // g_World.getPObject(6).setMaterialID(0);

    // This stores the amount of nodes that are in the frustum
    // g_Octree.g_TotalNodesDrawn = 0;

    // The maximum amount of subdivisions allowed (Levels of subdivision)
    // g_Octree.g_MaxSubdivisions = 4;

    // The number of Nodes we've checked for collision.
    // g_Octree.g_iNumNodesCollided = 0;

    // System.out.println("antes de passar: " + teste.abc);
    // System.out.println("antes de passar  x: " + temp.x + "y: " + temp.y + "z: " + temp.z);
    // Nothing new, setup the Octree normally.
    // g_Octree.getSceneDimensions(g_World, teste);

    // System.out.println("depois de passar: " +teste.abc);
    octree.getSceneDimensions(g_World);

    // System.out.println("depois de passar  x: " + temp.x + "y: " + temp.y + "z: " + temp.z);

    int TotalTriangleCount = octree.getSceneTriangleCount(g_World);
    octree.createNode(g_World, TotalTriangleCount, octree.getCenter(), octree.getWidth());
    octree.setDisplayListID(glGenLists(Octree.totalNodesCount));
    octree.createDisplayList(octree, g_World, octree.getDisplayListID());

    // Hide our cursor since we are using first person camera mode
    Mouse.setGrabbed(true);

    // glEnable(GL_COLOR_MATERIAL);						// Allow color
  }