Example #1
0
  public Box(float width, float height, float depth /* , DrawMode drawMode */) {

    outlineFrontFace = new ArrayList<PVector>();
    outlineBackFace = new ArrayList<PVector>();
    pointCloud = new ArrayList<YPoint>();

    // Names for vars are Top||Bottom Left||Right || Back||Font
    PVector tlf = new PVector();
    PVector trf = new PVector();

    PVector blf = new PVector();
    PVector brf = new PVector();

    PVector blb = new PVector();
    PVector brb = new PVector();

    PVector tlb = new PVector();
    PVector trb = new PVector();

    tlf.add(width / 2, -height / 2, depth / 2);
    trf.add(-width / 2, -height / 2, depth / 2);

    blf.add(width / 2, height / 2, depth / 2);
    brf.add(-width / 2, height / 2, depth / 2);

    blb.add(width / 2, height / 2, -depth / 2);
    brb.add(-width / 2, height / 2, -depth / 2);

    tlb.add(width / 2, -height / 2, -depth / 2);
    trb.add(-width / 2, -height / 2, -depth / 2);

    // this.drawMode = drawMode;

    outlineFrontFace.add(POV.project(tlf));
    outlineFrontFace.add(POV.project(trf));
    outlineFrontFace.add(POV.project(brf));
    outlineFrontFace.add(POV.project(blf));

    outlineBackFace.add(POV.project(tlb));
    outlineBackFace.add(POV.project(trb));
    outlineBackFace.add(POV.project(brb));
    outlineBackFace.add(POV.project(blb));

    addFaceToPointCloud(outlineFrontFace);
    addFaceToPointCloud(outlineBackFace);
    joinFaces();
  }
  public static void iterate() {
    // Dealing with the user input

    UserInterface.iterate();
    UserInterface soul = new UserInterface();
    soul.update(getPlayerEntity());

    // Dealing with the Camera
    WorldShapes.setCamera(mainCamera);
    mainCamera.setZoom(mainCamera.getZoom() * Math.pow(1.001, Mouse.getDWheel()));
    mainCamera.followParticle(mainCamera.world.Entity_HashMap.get("player").getParticle());
    mainCamera.iterate();
    mainCamera.entityDrag(); // Deals with dragging points

    // Update the physics
    updateWorld(worldOne);

    // Rendering and stuff
    Render.testResize();

    FrameBufferObject.setFrameBuffer(
        extra_frame.getFrameBufferIdentifier()); // applies the extra framebuffer
    mainCamera.render();
    FrameBufferObject.setFrameBuffer(0); // applies the normal screen

    // Drawing the framebuffer
    HUDShapes.drawTexturedQuad(
        0,
        0,
        Display.getWidth(),
        Display.getHeight(),
        extra_frame.getTexture(),
        Display.getWidth(),
        Display.getHeight());
    Display.update();
  }
Example #3
0
 public void draw() {
   Iterator<YPoint> i = pointCloud.iterator();
   while (i.hasNext()) {
     POV.dot(i.next());
   }
 }