Пример #1
0
  public void render() {
    updateNearbyChunkMeshes(false);

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

    renderChunks();
  }
Пример #2
0
 @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);
 }
Пример #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();
      }
    }
  }
Пример #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) {
    }
  }