Package nexus.model.structs

Examples of nexus.model.structs.Vector3


    assertEquals(false, world.chunks.inBounds(new Vector3(0f, -1f, 0f)));
  }

  @Test
  public void inBoundsLowEdge() {
    assertEquals(true, world.chunks.inBounds(new Vector3(0f, 0f, 0f)));
  }
View Full Code Here


    assertEquals(true, world.chunks.inBounds(new Vector3(0f, 0f, 0f)));
  }
 
  @Test
  public void inBoundsInside() {
    assertEquals(true, world.chunks.inBounds(new Vector3(0f, 1f, 0f)));
  }
View Full Code Here

    assertEquals(true, world.chunks.inBounds(new Vector3(0f, 1f, 0f)));
  }
 
  @Test
  public void inBoundsAbove() {
    assertEquals(false, world.chunks.inBounds(new Vector3(0f, Chunk.HEIGHT, 0f)));
  }
View Full Code Here

    assertEquals(false, world.chunks.inBounds(new Vector3(0f, Chunk.HEIGHT, 0f)));
  }

  @Test
  public void inBoundsHighEdge() {
    assertEquals(true, world.chunks.inBounds(new Vector3(0f, Chunk.HEIGHT - 1, 0f)));
  }
View Full Code Here

    }
   
    this.model.camera.update();
   
    for (float i = 0f; i < MAX_SELECT_DISTANCE; i += 0.1f) {
      Vector3 target = model.camera.eye.add(model.camera.unitFocal.scale((float) i));

      if (model.chunks.inBounds(target) && model.chunks.getBlock(target).visible()) {
        if (target != model.chunks.selected) {
          model.chunks.getBlock(model.chunks.selected).getMask().setDrawOutline(false);
          model.chunks.getBlock(target).getMask().setDrawOutline(true);
          model.chunks.selected = target;
        }
       
        if (Mouse.isButtonDown(0)) {
          model.chunks.setBlock(new Air(model.chunks.selected, 1.0f));
        }
       
        if (Mouse.isButtonDown(1)) {
          Block newBlock = new Solid(model.chunks.getBlock(model.chunks.selected).a.add(new Vector3(0f, 1f, 0f)), 1.0f, new Greyscale(16.0f, 0.0f));
          model.chunks.setBlock(newBlock);
        }
       
        break;
      }
View Full Code Here

     
//      this.model.requestChunk(new Vector3(0, 0, 0));
     
      for(int i = -this.renderDistance; i <= this.renderDistance; i++) {
        for(int j = -this.renderDistance; j <= this.renderDistance; j++) {
          Chunk chunk = this.model.chunks.getChunk(this.model.camera.eye.add(new Vector3(i, 0, j).scale(16f)));
          chunk.drawBlocks();
        }
      }
     
      Display.update();
View Full Code Here

    return this.faces[i];
  }
 
  public VertexContainer makeFace(int i) {
    if (i == index.TOP.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(new Vector3(block.a.x, block.b.y, block.a.z), block.b));
    } else if (i == index.BOTTOM.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(block.a, new Vector3(block.b.x, block.a.y, block.b.z)));
    } else if (i == index.RIGHT.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(new Vector3(block.b.x, block.a.y, block.a.z), block.b));
    } else if (i == index.LEFT.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(block.a, new Vector3(block.a.x, block.b.y, block.b.z)));
    } else if (i == index.NEAR.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(block.a, new Vector3(block.b.x, block.b.y, block.a.z)));
    } else if (i == index.FAR.ordinal()) {
      return new VertexContainer(Planes.makeQuad2f(new Vector3(block.a.x, block.a.y, block.b.z), block.b));
    } else {
      throw new IllegalArgumentException(i + " is out of range");
    }
  }
View Full Code Here

   * @param a
   * @param b
   */
  @Deprecated
  public static void rectPrism2f(Vector3 a, Vector3 b) {
    outlineQuad2f(a, new Vector3(b.x, b.y, a.z));
    outlineQuad2f(a, new Vector3(b.x, a.y, b.z));
    outlineQuad2f(b, new Vector3(a.x, a.y, b.z));
    outlineQuad2f(b, new Vector3(a.x, b.y, a.z));
  }
View Full Code Here

   * @return float[] that, when parsed as triangles, will for a quad
   */
  public static float[] makeQuad2f(Vector3 a, Vector3 b) {
    if (a.x <= b.x && a.y <= b.y && a.z <= b.z) {
      if (a.x == b.x) {
        return Vector3.combine(new Vector3[] { a, b, new Vector3(a.x, b.y, a.z), b, a, new Vector3(a.x, a.y, b.z)});
      } else if (a.y == b.y) {
        return Vector3.combine(new Vector3[] { a, b, new Vector3(a.x, a.y, b.z), b, a, new Vector3(b.x, a.y, a.z)});
      } else if (a.z == b.z) {
        return Vector3.combine(new Vector3[] { a, b, new Vector3(a.x, b.y, a.z), b, a, new Vector3(b.x, a.y, a.z)});
      } else {
        throw new IllegalArgumentException("vertices must be orthagonal: " + a.toString() + ", " + b.toString());
      }
    } else {
      throw new IllegalArgumentException("all values of a must be smaller than those of b");
View Full Code Here

public class PlanesTest {
 
  @Test(expected=IllegalArgumentException.class)
  public void makeQuad2fSwappedArguments() {
    Vector3 a = new Vector3(0, 0, 0);
    Vector3 b = new Vector3(1, 1, 1);
   
    Planes.makeQuad2f(b, a);
  }
View Full Code Here

TOP

Related Classes of nexus.model.structs.Vector3

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.