Beispiel #1
0
  public void replace_scene(String scene_desc) {
    String clean_desc;
    int crt = 0;
    int pos;

    if (scene_desc == null) {
      System.err.println("\nreplace_scene() scene_desc = null\n");
      return;
    }

    int lng = scene_desc.length();

    // user_interface.addInfo("\n scene_desc length=");
    // user_interface.addInfo(lng);

    // user_interface.addInfo("\n---" + scene_desc.substring(0,5) + "---\n");
    // user_interface.addInfo("\n===" + scene_desc.substring(lng-6) + "===\n");

    plug_in.replaceScene(scene_desc);
    // user_interface.addInfo("!\n End of replace\n");

    scene_desc = null;
    // scene = null;

    // Runtime.getRuntime().gc(); // force immediate gc

  }
Beispiel #2
0
  public void new_scene(String content) {
    int pos, begin_pos;
    String vrml_camera;

    vrml_camera = null;

    begin_pos = content.indexOf("DEF World");
    if (begin_pos > 0) // ViewPoint message present
    {
      pos = content.indexOf('}');
      vrml_camera = content.substring(begin_pos, pos + 1);
      // content = content.substring(pos+1);
    }
    replace_scene(content);
    if (vrml_camera != null) plug_in.set_viewpoint(vrml_camera);
    plug_in.bind_view();
  }
Beispiel #3
0
  public void start() {
    plug_in = new PlugIn();
    plug_in.init();

    scene_graph = new SceneGraph();
    scene_graph.init();

    www_conn = new WWWConnection();
    www_conn.init();

    update_users();
    set_dynamic_usr();

    // if(hostsrv != null) user_interface.printInfo(hostsrv);
    // user_interface.addInfo(http_port);

  }
Beispiel #4
0
  public void set_viewpoint(String view) {
    String position;
    String[] position_el;
    String orientation;
    String[] orientation_el;
    String fieldOfView;
    int begin_pos, pos, i;
    Float tmp_f;
    float[] pos_val = null;
    float[] or_val = null;
    float fv_val = -1;

    // user_interface.addInfo(view);
    begin_pos = view.indexOf("position");
    if (begin_pos > 0) {
      position_el = new String[4];
      pos_val = new float[3];
      position = view.substring(begin_pos);
      begin_pos = 0;
      // user_interface.addInfo("\n position_el: ");
      pos = position.indexOf('\t', begin_pos);
      // position_el[0] = position.substring(begin_pos,pos);
      // user_interface.addInfo(position_el[0]);
      // user_interface.addInfo("|");
      begin_pos = pos + 1;
      for (i = 0; i < 3; i++) {
        pos = position.indexOf(" ", begin_pos);
        position_el[i] = position.substring(begin_pos, pos);
        tmp_f = Float.valueOf(position_el[i]);
        pos_val[i] = tmp_f.floatValue();
        // user_interface.addInfo(pos_val[i]);
        // user_interface.addInfo("|");
        begin_pos = pos + 1;
      }
    }
    begin_pos = view.indexOf("orientation");
    if (begin_pos > 0) {
      orientation_el = new String[5];
      or_val = new float[4];
      orientation = view.substring(begin_pos);
      begin_pos = 0;
      // user_interface.addInfo("\n orientation_el: ");
      pos = orientation.indexOf('\t', begin_pos);
      // orientation_el[0] = orientation.substring(begin_pos,pos);
      // user_interface.addInfo(orientation_el[0]);
      // user_interface.addInfo("|");
      begin_pos = pos + 1;
      for (i = 0; i < 3; i++) {
        pos = orientation.indexOf(" ", begin_pos);
        orientation_el[i] = orientation.substring(begin_pos, pos);
        tmp_f = Float.valueOf(orientation_el[i]);
        or_val[i] = tmp_f.floatValue();
        // user_interface.addInfo(or_val[i]);
        // user_interface.addInfo("|");
        begin_pos = pos + 1;
      }
      pos = orientation.indexOf(" ", begin_pos + 1);
      orientation_el[3] = orientation.substring(begin_pos, pos);
      tmp_f = Float.valueOf(orientation_el[3]);
      or_val[3] = tmp_f.floatValue();
      // user_interface.addInfo(or_val[3]);
      // user_interface.addInfo("|");
      begin_pos = pos + 1;
    }
    begin_pos = view.indexOf("fieldOf");
    if (begin_pos > 0) {
      fieldOfView = view.substring(begin_pos);
      begin_pos = fieldOfView.indexOf(" ");
      pos = fieldOfView.indexOf(" ", begin_pos + 1);
      tmp_f = Float.valueOf(fieldOfView.substring(begin_pos, pos));
      fv_val = tmp_f.floatValue();
      // user_interface.addInfo("\nfieldOfView = ");
      // user_interface.addInfo(fv_val);
      // user_interface.addInfo("|\n");
    }
    // user_interface.addInfo("\n======================\n");
    plug_in.set_viewpoint(pos_val, or_val, fv_val);
  }
Beispiel #5
0
 public void load_URL(String id) {
   plug_in.load_URL(id);
 }
Beispiel #6
0
 public void init_scene() {
   scene_graph.ClearScene();
   plug_in.init_scene();
 }
Beispiel #7
0
 public void update_xxx() {
   plug_in.set_timestep(0);
 }