Esempio n. 1
0
  /**
   * Set up the system properties needed to run the browser. This involves registering all the
   * properties needed for content and protocol handlers used by the URI system. Only needs to be
   * run once at startup.
   */
  private void setupProperties(final String textureQuality) {
    try {
      AccessController.doPrivileged(
          new PrivilegedExceptionAction() {
            public Object run() {
              String prop = System.getProperty("uri.content.handler.pkgs", "");
              if (prop.indexOf("vlc.net.content") == -1) {
                System.setProperty("uri.content.handler.pkgs", "vlc.net.content");
              }

              prop = System.getProperty("uri.protocol.handler.pkgs", "");
              if (prop.indexOf("vlc.net.protocol") == -1) {
                System.setProperty("uri.protocol.handler.pkgs", "vlc.net.protocol");
              }

              BrowserCore core = mainCanvas.getUniverse();
              WorldLoaderManager wlm = mainCanvas.getWorldLoaderManager();

              ContentHandlerFactory c_fac = URI.getContentHandlerFactory();

              if (!(c_fac instanceof VRMLContentHandlerFactory)) {
                c_fac = new VRMLContentHandlerFactory(core, wlm);
                URI.setContentHandlerFactory(c_fac);
              }

              FileNameMap fn_map = URI.getFileNameMap();
              if (!(fn_map instanceof VRMLFileNameMap)) {
                fn_map = new VRMLFileNameMap(fn_map);
                URI.setFileNameMap(fn_map);
              }

              if (textureQuality.equals("medium")) {
                System.setProperty("org.web3d.vrml.renderer.common.nodes.shape.useMipMaps", "true");
                System.setProperty(
                    "org.web3d.vrml.renderer.common.nodes.shape.anisotropicDegree", "2");
              } else if (textureQuality.equals("high")) {
                System.setProperty("org.web3d.vrml.renderer.common.nodes.shape.useMipMaps", "true");
                System.setProperty(
                    "org.web3d.vrml.renderer.common.nodes.shape.anisotropicDegree", "16");
              }

              return null;
            }
          });
    } catch (PrivilegedActionException pae) {
      console.warningReport(PROPERTY_SETUP_ERR, null);
    }
  }