@Override
  public void render() {
    super.render();

    // output the current FPS
    fpsLogger.log();
  }
Beispiel #2
0
  public void render() {

    logger.log();

    final float delta = Gdx.graphics.getDeltaTime();
    camController.update(delta);

    timer += delta;
    for (int i = 0; i < lightManager.pointLights.size; i++) {
      final Vector3 v = lightManager.pointLights.get(i).position;
      v.x += MathUtils.sin(timer) * 0.01f;
      v.z += MathUtils.cos(timer) * 0.01f;
      lightManager.pointLights.get(i).color.b = MathUtils.sin(timer) * 0.25f + 0.25f;
    }

    animInstance.time += delta;
    if (Gdx.input.justTouched()) {
      currAnimIdx++;
      if (currAnimIdx == model3.getAnimations().length) currAnimIdx = 0;
      animInstance.animation = model3.getAnimations()[currAnimIdx].name;
      animInstance.time = 0;
    }
    if (animInstance.time > model3.getAnimations()[currAnimIdx].totalDuration) {
      animInstance.time = 0;
    }

    Gdx.gl.glEnable(GL10.GL_CULL_FACE);
    Gdx.gl.glFrontFace(GL10.GL_CCW);
    Gdx.gl.glCullFace(GL10.GL_FRONT);

    Gdx.gl.glEnable(GL10.GL_DEPTH_TEST);
    Gdx.gl.glDepthMask(true);

    Gdx.gl.glClearColor(0, 0.1f, 0.2f, 0);
    Gdx.gl.glClear(
        GL10.GL_COLOR_BUFFER_BIT
            | GL10.GL_DEPTH_BUFFER_BIT
            | (Gdx.graphics.getBufferFormat().coverageSampling
                ? GL20.GL_COVERAGE_BUFFER_BIT_NV
                : 0));

    protoRenderer.begin();

    protoRenderer.draw(model3, animInstance);

    protoRenderer.end();
    Gdx.gl.glCullFace(GL10.GL_BACK);
    protoRenderer.begin();
    protoRenderer.draw(model, instance);
    protoRenderer.draw(model, instance2);
    protoRenderer.draw(model2, instance2);
    protoRenderer.end();
  }
Beispiel #3
0
  public void render(float runtime) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    // render models
    currentCamera.update();

    // GLProfiler.reset();
    planetmap.render();
    // System.out.println(GLProfiler.drawCalls+"");

    // render UIs
    UIObject.beginRender();
    for (int i = uiItems.size - 1; i >= 0; i--) {
      uiItems.get(i).render(runtime);
    }
    UIObject.endRender();

    fpsLog.log();
  }
Beispiel #4
0
  @Override
  public void render(float delta) {
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    logger.log();

    stage.draw();
    stage.act();
    stage.getRoot().getColor().a = 0f;

    batch.begin();

    font.draw(batch, stage.getCuvant().toUpperCase(), 15, 790);
    font.draw(batch, totalPointsStr, 420, 790);

    if (stage.eCuvant()) {
      font.setColor(Color.GREEN);
    }

    if (drawTween) {
      tweenFont.draw(batch, "+" + points, tweenFont.getX(), tweenFont.getY());
    }

    // playButton.setAlpha(0.5f);
    // batch.draw(playButton, 220, 750);

    batch.end();

    // draw the line
    shapeRend.begin(ShapeType.Line);
    shapeRend.setColor(Color.ORANGE);
    shapeRend.line(0, 745, 480, 745);
    shapeRend.end();

    manager.update(delta);

    showMenu();
  }
Beispiel #5
0
  @Override
  public void render() {
    Gdx.gl.glClearColor(1f, 1f, 1f, 1f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    if (reloadProject) {
      int spriteSize = sprites.size();
      for (int i = 0; i < spriteSize; i++) {
        sprites.get(i).pause();
      }
      stage.clear();
      SoundManager.getInstance().clear();

      Sprite sprite;
      if (spriteSize > 0) {
        sprites.get(0).look.setLookData(createWhiteBackgroundLookData());
      }
      for (int i = 0; i < spriteSize; i++) {
        sprite = sprites.get(i);
        sprite.resetSprite();
        sprite.look.createBrightnessContrastShader();
        stage.addActor(sprite.look);
        sprite.pause();
      }
      stage.addActor(passepartout);

      paused = true;
      firstStart = true;
      reloadProject = false;
      synchronized (stageDialog) {
        stageDialog.notify();
      }
    }

    batch.setProjectionMatrix(camera.combined);

    if (firstStart) {
      int spriteSize = sprites.size();
      if (spriteSize > 0) {
        sprites.get(0).look.setLookData(createWhiteBackgroundLookData());
      }
      Sprite sprite;
      for (int i = 0; i < spriteSize; i++) {
        sprite = sprites.get(i);
        sprite.createStartScriptActionSequence();
        if (!sprite.getLookDataList().isEmpty()) {
          sprite.look.setLookData(sprite.getLookDataList().get(0));
        }
      }
      firstStart = false;
    }
    if (!paused) {
      float deltaTime = Gdx.graphics.getDeltaTime();

      /*
       * Necessary for UiTests, when EMMA - code coverage is enabled.
       *
       * Without setting DYNAMIC_SAMPLING_RATE_FOR_ACTIONS to false(via reflection), before
       * the UiTest enters the stage, random segmentation faults(triggered by EMMA) will occur.
       *
       * Can be removed, when EMMA is replaced by an other code coverage tool, or when a
       * future EMMA - update will fix the bugs.
       */
      if (DYNAMIC_SAMPLING_RATE_FOR_ACTIONS == false) {
        stage.act(deltaTime);
      } else {
        float optimizedDeltaTime = deltaTime / deltaActionTimeDivisor;
        long timeBeforeActionsUpdate = SystemClock.uptimeMillis();
        while (deltaTime > 0f) {
          stage.act(optimizedDeltaTime);
          deltaTime -= optimizedDeltaTime;
        }
        long executionTimeOfActionsUpdate = SystemClock.uptimeMillis() - timeBeforeActionsUpdate;
        if (executionTimeOfActionsUpdate <= ACTIONS_COMPUTATION_TIME_MAXIMUM) {
          deltaActionTimeDivisor += 1f;
          deltaActionTimeDivisor = Math.min(DELTA_ACTIONS_DIVIDER_MAXIMUM, deltaActionTimeDivisor);
        } else {
          deltaActionTimeDivisor -= 1f;
          deltaActionTimeDivisor = Math.max(1f, deltaActionTimeDivisor);
        }
      }
    }

    if (!finished) {
      stage.draw();
    }

    if (makeAutomaticScreenshot) {
      if (skipFirstFrameForAutomaticScreenshot) {
        skipFirstFrameForAutomaticScreenshot = false;
      } else {
        thumbnail =
            ScreenUtils.getFrameBufferPixels(
                screenshotX, screenshotY, screenshotWidth, screenshotHeight, true);
        makeAutomaticScreenshot = false;
      }
    }

    if (makeScreenshot) {
      screenshot =
          ScreenUtils.getFrameBufferPixels(
              screenshotX, screenshotY, screenshotWidth, screenshotHeight, true);
      makeScreenshot = false;
    }

    if (axesOn && !finished) {
      drawAxes();
    }

    if (DEBUG) {
      fpsLogger.log();
    }

    if (makeTestPixels) {
      testPixels = ScreenUtils.getFrameBufferPixels(testX, testY, testWidth, testHeight, false);
      makeTestPixels = false;
    }
  }
Beispiel #6
0
 public void writeFPS() {
   if (enableLog) fpsLogger.log();
 }