Exemple #1
0
  public void render() {
    updateNearbyChunkMeshes(false);

    material.getShader().setUniform("View", client.getActiveCamera().getView());
    material.getShader().setUniform("Projection", client.getActiveCamera().getProjection());

    renderChunks();
  }
 @Override
 public void draw(RenderMaterial material, int startVert, int endVert) {
   if (getVertexCount() <= 0) {
     throw new IllegalStateException("Cannot render 0 verticies");
   }
   ((SpoutShader) material.getShader()).checkAttributes(attributesUsed);
   doDraw(material, startVert, endVert);
 }
Exemple #3
0
  private void renderChunks() {
    for (ChunkMeshBatch renderer : chunkRenderers) {
      material.getShader().setUniform("Model", renderer.getTransform());

      // It's hard to look right
      // at the world baby
      // But here's my frustrum
      // so cull me maybe?
      if (client.getActiveCamera().getFrustum().intersects(renderer)) {
        renderer.render();
      }
    }
  }
Exemple #4
0
  public void render(float dt) {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    if (Mouse.isButtonDown(0)) {
      if (!Mouse.isGrabbed()) Mouse.setGrabbed(true);
    } else Mouse.setGrabbed(false);

    // worldRenderer.render();
    try {
      // System.out.println("view "+activeCamera.getView().toString());
      Transform loc = new Transform(new Point(null, 0f, 0f, 0f), Quaternion.IDENTITY, Vector3.ONE);
      mat.getShader().setUniform("View", activeCamera.getView());
      mat.getShader().setUniform("Projection", activeCamera.getProjection());
      mat.getShader().setUniform("Model", loc.toMatrix());
      renderer.draw(mat);

      gui.begin();
      gui.draw(mat, .25f, .25f, .25f, .25f);
      gui.render();
    } catch (Exception e) {
    }
  }