Пример #1
0
  public void draw() {
    // Clear The Screen And The Depth Buffer
    GL11.glClear(GL11.GL_COLOR_BUFFER_BIT | GL11.GL_DEPTH_BUFFER_BIT);

    if (camera != null) {
      camera.updatePosition();
    } else {
      camera = (Camera) object_list.getItem(Camera.CAMERA_NAME);
      if (camera != null) {
        camera.updatePosition();
      } else {
        System.out.println("WARNING: Tried to draw without camera set...");
        return;
      }
    }

    // Draw the 3d stuff
    for (Entity ent : object_list.getEntitiesAndSubEntities()) {
      Boolean should_draw = (Boolean) ent.getProperty(Entity.SHOULD_DRAW);
      if (should_draw == null) should_draw = false;
      if (should_draw) ent.drawProgrammablePipe();
    }

    // Draw the window manager stuff
    if (window_manager != null) window_manager.draw();

    Display.update();
  }
Пример #2
0
 public void setPerspective(float near, float far, float zoomVal) {
   if (camera != null) {
     near_clipping = camera.getNear();
     far_clipping = camera.getFar();
     if (zoomVal <= 1.0 && zoomVal > 0) {
       zoom = zoomVal;
     } else if (zoomVal > 1000.0) {
       zoom = 1.0f;
     } else {
       zoom = 0.1f; // TODO: I guess this is the smallest zoom we'd want?
     }
   }
 }