Example #1
0
 void run() {
   startTime = System.currentTimeMillis();
   while (true) {
     re.updateScreen(null);
     re.getKeyboardHandler().Update();
     //			try {
     //				Thread.sleep(5);
     //			}
     //			catch (InterruptedException e) {
     //			}
   }
 }
Example #2
0
  void updateScreen() {
    re.BeginFrame(0.0f);

    switch (currentState) {
      case 0:
        re.DrawStretchPic(0, 0, viddef.getWidth(), viddef.getHeight(), "conback");
        re.DrawPic(viddef.getWidth() / 2 - 50, viddef.getHeight() / 2, "loading");
        currentState = 1;
        break;
      case 1:
        // register the map
        re.SetSky("space1", 0, new float[] {0, 0, 0});
        re.BeginRegistration("ColorTest");
        re.EndRegistration();
        currentState = 2;
        // break;
      default:
        if (framecount % 500 == 0) {
          long time = System.currentTimeMillis();
          fps = 500000.0f / (time - start);
          start = time;
        }
        String text = fps + " fps";

        testMap();

        drawString(10, viddef.getHeight() - 16, text);
    }

    re.EndFrame();
    framecount++;
  }
Example #3
0
  void init() {

    Qcommon.Init(new String[] {"$Id: DebugCulling.java,v 1.6 2008-03-02 14:56:21 cawe Exp $"});
    // sehr wichtig !!!
    VID.Shutdown();

    this.re = Renderer.getDriver("jogl");

    re.Init(0, 0);

    viddef = Globals.viddef;
  }
Example #4
0
 private void drawString(int x, int y, String text) {
   for (int i = 0; i < text.length(); i++) {
     re.DrawChar(x + 8 * i, y, (int) text.charAt(i));
   }
 }
Example #5
-1
  private void testMap() {

    if (refdef == null) {
      refdef = new refdef_t();

      refdef.x = 0;
      refdef.y = 0;
      refdef.width = viddef.getWidth();
      refdef.height = viddef.getHeight();
      refdef.fov_x = fov_x;
      refdef.fov_y = CalcFov(fov_x, refdef.width - 10, refdef.height - 10);
      refdef.vieworg = new float[] {0, 0, 0};

      refdef.viewangles[0] = 0;
      refdef.viewangles[1] = 90;
      refdef.viewangles[2] = 0;

      refdef.blend = new float[] {0.0f, 0.0f, 0.0f, 0.0f};

      refdef.areabits = null; // draw all
      //			refdef.areabits = new byte[Defines.MAX_MAP_AREAS / 8];
      //			Arrays.fill(refdef.areabits, (byte) 0xFF);

      refdef.num_entities = 0;
      refdef.entities = null;

      lightstyle_t light = new lightstyle_t();
      light.rgb = new float[] {1.0f, 1.0f, 1.0f};
      light.white = 3.0f;

      refdef.lightstyles = new lightstyle_t[Defines.MAX_LIGHTSTYLES];
      for (int i = 0; i < Defines.MAX_LIGHTSTYLES; i++) {
        refdef.lightstyles[i] = new lightstyle_t();
        refdef.lightstyles[i].rgb = new float[] {1.0f, 1.0f, 1.0f};
        refdef.lightstyles[i].white = 3.0f; // r + g + b
      }
    }

    refdef.time = time() * 0.001f;

    refdef.viewangles[0] += KBD.my * 0.1f;
    refdef.viewangles[1] -= KBD.mx * 0.1f;

    refdef.vieworg[0] = 0; // + 30 * (float)Math.sin(time() * 0.0005f);
    refdef.vieworg[1] = -79;
    refdef.vieworg[2] = -131;

    // wichtig da aufloesung 1/8
    // --> ebenen schneiden nie genau die sicht
    refdef.vieworg[0] += 1.0f / 16;
    refdef.vieworg[1] += 1.0f / 16;
    refdef.vieworg[2] += 1.0f / 16;

    re.RenderFrame(refdef);
  }