コード例 #1
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /*
   * ================== SCR_Init ==================
   */
  static void Init() {
    scr_viewsize = ConsoleVariables.Get("viewsize", "100", CVAR_ARCHIVE);
    scr_conspeed = ConsoleVariables.Get("scr_conspeed", "3", 0);
    scr_showturtle = ConsoleVariables.Get("scr_showturtle", "0", 0);
    scr_showpause = ConsoleVariables.Get("scr_showpause", "1", 0);
    scr_centertime = ConsoleVariables.Get("scr_centertime", "2.5", 0);
    scr_printspeed = ConsoleVariables.Get("scr_printspeed", "8", 0);
    scr_netgraph = ConsoleVariables.Get("netgraph", "1", 0);
    scr_timegraph = ConsoleVariables.Get("timegraph", "1", 0);
    scr_debuggraph = ConsoleVariables.Get("debuggraph", "1", 0);
    scr_graphheight = ConsoleVariables.Get("graphheight", "32", 0);
    scr_graphscale = ConsoleVariables.Get("graphscale", "1", 0);
    scr_graphshift = ConsoleVariables.Get("graphshift", "0", 0);
    scr_drawall = ConsoleVariables.Get("scr_drawall", "1", 0);
    fps = ConsoleVariables.Get("fps", "1", 0);

    //
    // register our commands
    //
    Commands.addCommand(
        "timerefresh",
        new ExecutableCommand() {
          public void execute() {
            TimeRefresh_f();
          }
        });
    Commands.addCommand(
        "loading",
        new ExecutableCommand() {
          public void execute() {
            Loading_f();
          }
        });
    Commands.addCommand(
        "sizeup",
        new ExecutableCommand() {
          public void execute() {
            SizeUp_f();
          }
        });
    Commands.addCommand(
        "sizedown",
        new ExecutableCommand() {
          public void execute() {
            SizeDown_f();
          }
        });
    Commands.addCommand(
        "sky",
        new ExecutableCommand() {
          public void execute() {
            Sky_f();
          }
        });

    scr_initialized = true;
  }
コード例 #2
0
  /** @see com.googlecode.gwtquake.shared.client.Renderer#Shutdown() */
  public void Shutdown() {
    Commands.RemoveCommand("modellist");
    Commands.RemoveCommand("screenshot");
    Commands.RemoveCommand("imagelist");
    Commands.RemoveCommand("gl_strings");

    Models.Mod_FreeAll();

    Images.GL_ShutdownImages();

    /*
     * shut down OS specific OpenGL stuff like contexts, etc.
     */
    GlState.gl.shutdow();
  }
コード例 #3
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /*
   * ================ SCR_TimeRefresh_f ================
   */
  static void TimeRefresh_f() {
    int i;
    int start, stop;
    float time;

    if (cls.state != ca_active) return;

    start = Timer.Milliseconds();

    if (Commands.Argc() == 2) { // run without page flipping
      re.BeginFrame(0);
      for (i = 0; i < 128; i++) {
        cl.refdef.viewangles[1] = i / 128.0f * 360.0f;
        re.RenderFrame(cl.refdef);
      }
      re.EndFrame();
    } else {
      for (i = 0; i < 128; i++) {
        cl.refdef.viewangles[1] = i / 128.0f * 360.0f;

        re.BeginFrame(0);
        re.RenderFrame(cl.refdef);
        re.EndFrame();
      }
    }

    stop = Timer.Milliseconds();
    time = (stop - start) / 1000.0f;
    Com.Printf("%f seconds (%f fps)\n", new Vargs(2).add(time).add(128.0f / time));
  }
コード例 #4
0
ファイル: Screen.java プロジェクト: ETH-CAT/quake2-gwt-port
  /*
   * ================= SCR_Sky_f
   *
   * Set a specific sky and rotation speed =================
   */
  static void Sky_f() {
    float rotate;
    float[] axis = {0, 0, 0};

    if (Commands.Argc() < 2) {
      Com.Printf("Usage: sky <basename> <rotate> <axis x y z>\n");
      return;
    }
    if (Commands.Argc() > 2) rotate = Float.parseFloat(Commands.Argv(2));
    else rotate = 0;
    if (Commands.Argc() == 6) {
      axis[0] = Float.parseFloat(Commands.Argv(3));
      axis[1] = Float.parseFloat(Commands.Argv(4));
      axis[2] = Float.parseFloat(Commands.Argv(5));
    } else {
      axis[0] = 0;
      axis[1] = 0;
      axis[2] = 1;
    }

    re.SetSky(Commands.Argv(1), rotate, axis);
  }
コード例 #5
0
ファイル: Com.java プロジェクト: ETH-CAT/quake2-gwt-port
 public void execute() throws LongJmpException {
   Error(Constants.ERR_FATAL, Commands.Argv(1));
 }
コード例 #6
0
  /** @see com.googlecode.gwtquake.shared.client.Renderer#Init() */
  public boolean Init(int vid_xpos, int vid_ypos) {
    // pre init
    assert (GlConstants.SIN.length == 256) : "warpsin table bug";

    Window.Printf(Constants.PRINT_ALL, "ref_gl version: " + GlConstants.REF_VERSION + '\n');
    Images.Draw_GetPalette();
    GlConfig.init();

    Commands.addCommand(
        "imagelist",
        new ExecutableCommand() {
          public void execute() {
            Images.GL_ImageList_f();
          }
        });

    Commands.addCommand(
        "screenshot",
        new ExecutableCommand() {
          public void execute() {
            Misc.GL_ScreenShot_f();
          }
        });
    Commands.addCommand(
        "modellist",
        new ExecutableCommand() {
          public void execute() {
            Models.Mod_Modellist_f();
          }
        });
    Commands.addCommand(
        "gl_strings",
        new ExecutableCommand() {
          public void execute() {
            Misc.GL_Strings_f();
          }
        });

    // set our "safe" modes
    GlState.prev_mode = 3;

    // create the window and set up the context
    if (!R_SetMode()) {
      Window.Printf(Constants.PRINT_ALL, "ref_gl::R_Init() - could not R_SetMode()\n");
      return false;
    }

    // post init
    GlState.qglPointParameterfEXT = true;

    Misc.GL_SetDefaultState();

    Images.GL_InitImages();
    Models.Mod_Init();
    Particles.R_InitParticleTexture();
    Drawing.Draw_InitLocal();

    int err = GlState.gl.glGetError();
    if (err != Gl1Context.GL_NO_ERROR) {
      Window.Printf(
          Constants.PRINT_ALL,
          "glGetError() = 0x%x\n\t%s\n",
          new Vargs(2).add(err).add("" + GlState.gl.glGetString(err)));
      //	return false;
    }
    return true;
  }