Esempio n. 1
0
  private void renderModels() {

    Shader.getCurrentShader().setProjectionMatrix(projectionMatrix);
    Shader.getCurrentShader().setViewMatrix(viewMatrix);

    for (int x = -10; x < 10; x += 8) {
      for (int z = -10; z < 10; z += 8) {
        Matrix4f m = new Matrix4f();
        m = m.translate(new Vector3f(x, 0, z));
        m = m.rotate(modelAngle.getY(), new Vector3f(0, 1, 0));
        Shader.getCurrentShader().setModelMatrix(m);
        bunny.draw();
      }
    }

    /*for (int x=-10; x<10; x+=10) {
        for (int z=-10; z<10; z+=10) {
            Matrix4f m=new Matrix4f();
            m=m.translate(new Vector3f(x, 0f, z));
            m=m.rotate(modelAngle.getY()+((x+10)*20+z)*0.1f, new Vector3f(0, 1, 0));
            Shader.getCurrentShader()
                    .setUniformMat4f(Shader.getCurrentShader().modelMatrixUniformId, m);
            bunny.draw();
        }
    }*/

    Shader.getCurrentShader().setModelMatrix(identity);
    terrain.draw();
  }
Esempio n. 2
0
 private void destroyOpenGL() {
   Shader.defaultShader.delete();
   Shader.plainShader.delete();
   Shader.distance.delete();
   Shader.waterMixdown.delete();
   terrain.delete();
   bunny.delete();
   bus.delete();
   plane.delete();
   skybox.delete();
   window.delete();
 }
Esempio n. 3
0
 private void renderSkybox() {
   Shader.plainShader.setModelMatrix(
       new Matrix4f()
           .rotate(
               (float) ((System.currentTimeMillis() % 240000) / 240000f * Math.PI * 2),
               new Vector3f(0, 1, 0))
           .translate(cameraPos));
   Shader.plainShader.setViewMatrix(viewMatrix);
   Shader.plainShader.setProjectionMatrix(projectionMatrix);
   skybox.draw();
 }