Package Hexel.math

Examples of Hexel.math.Vector2d


    return this.thingTools.collidesWater(v, zeroOffset, this.fixOffsetTmps);
  }

  public boolean isUnderwater(double x, double y, double z) {
    Vector3i tmp3i = new Vector3i();
    Vector2d tmp2d = new Vector2d();
    return this.thingTools.collidesWater(x, y, z, tmp2d, tmp3i);
  }
View Full Code Here


    Vector3d v = new Vector3d();
    Vector3d step = Vector3d.Sub(t, v);
    step.unit();
    step.times(STEP_SIZE);

    Vector2d tmp2d = new Vector2d();
    Vector3i tmp3i = new Vector3i();

    Vector3i blockPos = new Vector3i();

    while (v.mag() < t.mag()) {
View Full Code Here

    Vector3d v = new Vector3d();
    Vector3d step = Vector3d.Sub(t, v);
    step.unit();
    step.times(STEP_SIZE);

    Vector2d tmp2d = new Vector2d();
    Vector3i tmp3i = new Vector3i();

    Vector3i blockPos = new Vector3i();

    while (v.mag() < t.mag()) {
View Full Code Here

    step.times(STEP_SIZE);

    Vector3i farthestEmpty = new Vector3i();
    Vector3i blockPos = new Vector3i();

    Vector2d tmp2d = new Vector2d();
    Vector3i tmp3i = new Vector3i();

    while (v.mag() < t.mag()) {
      v.add(step);
      HexGeometry.cartesianToBlock(v.x + offset.x, v.y + offset.y, v.z
View Full Code Here

    this.chunks = chunks;
  }
 
  public ArrayList<Vector3i> getBlocksIntersectingThing(final Cuboid c, final FixOffsetTmps fixOffsetTmps){
    Vector3i checkBlockPos = new Vector3i();
    Vector2d tmp = new Vector2d();
    HexGeometry.cartesianToBlock(c.getX(), c.getY(), c.getZ(), tmp, checkBlockPos);
    final ArrayList<Vector3i> blocks = new ArrayList<Vector3i>();
    BlockTools.pointFloodSearch(checkBlockPos, new PointFloodSearchMatcher(){
      @Override
      public boolean matches(Vector3i p) {
View Full Code Here

    Vector3d up = tmps.up;
    for (int i = 0; i < points.length; i++) {
      Vector2i v = points[i];
      Vector2i u = points[(i + 1) % points.length];
      Vector2d vd = tmps.vd;
      Vector2d ud = tmps.ud;
      HexGeometry.hexToCartesian(v.x, v.y, vd);
      HexGeometry.hexToCartesian(u.x, u.y, ud);

      Vector3d plane = tmps.v3d3[i];
      plane.x = vd.x - ud.x;
View Full Code Here

            cz + c.getDepth()));

    double minB = Integer.MAX_VALUE;
    double maxB = Integer.MIN_VALUE;

    Vector2d p = tmps.v2d;

    Vector2i[] points;
    if (blockx % 2 == 0) {
      points = HexGeometry.evenTringlePoints;
    } else {
View Full Code Here

    this.chunks = chunks;
    this.renderer = renderer;
  }

  public void updateVisibility(Camera camera) {
    Vector2d pos = new Vector2d();
    HexGeometry.cartesianToHex(camera.getCameraX(), camera.getCameraY(), pos);

    int cx = (int) Math.floor(pos.x / 16.0);
    int cy = (int) Math.floor(pos.y / 16.0);
    int cz = (int) Math.floor(camera.getCameraZ() / 16.0);
View Full Code Here

      public void actionPerformed(ActionEvent e) {
        Camera camera = Renderer.dbgCamera;
        if (camera != null){
          int x = (int) camera.getCameraX();
          int y = (int) camera.getCameraY();
          Vector2d tmp = new Vector2d();
          Vector3i p = new Vector3i();
          HexGeometry.cartesianToBlock(x, y, 0, tmp, p);
          xshift = p.x;
          yshift = p.y;
        }
View Full Code Here

      if (glChunk == null || glChunk.buffer == null)
        continue;

      gl.glPushMatrix();

      Vector2d hexPosition = new Vector2d();
      HexGeometry.hexToCartesian(position.x, position.y, hexPosition);

      gl.glTranslatef((float) (hexPosition.x * 16),
          (float) (hexPosition.y * 16), position.z * 16);

      gl.glBindBuffer(GL.GL_ARRAY_BUFFER, glChunk.buffer.id[0]);
      gl.glVertexAttribPointer(0, 3, GL.GL_FLOAT, false, 9*4, 0);
      gl.glVertexAttribPointer(1, 2, GL.GL_FLOAT, false, 9*4, 3*4);
      gl.glVertexAttribPointer(2, 4, GL.GL_FLOAT, false, 9*4, 5*4);
      gl.glEnableVertexAttribArray(0);
      gl.glEnableVertexAttribArray(1);
      gl.glEnableVertexAttribArray(2);
     
      float[] mv = new float[16];
      gl.glGetFloatv(GL2.GL_MODELVIEW_MATRIX, mv, 0);
      gl.glUniformMatrix4fv(ssUMVMatrix, 1, false, mv, 0);
      float[] p = new float[16];
      gl.glGetFloatv(GL2.GL_PROJECTION_MATRIX, p, 0);
      gl.glUniformMatrix4fv(ssUPMatrix, 1, false, p, 0);
     
      gl.glUniform1i(ssTex, 0);

      gl.glDrawArrays(GL.GL_TRIANGLES, 0, glChunk.buffer.size / (4 * 9));
     
      gl.glDisableVertexAttribArray(0);
      gl.glDisableVertexAttribArray(1);
      gl.glDisableVertexAttribArray(2);
      gl.glPopMatrix();
    }
    solidsShader.useProgram(gl, false);

    transparentsShader.useProgram(gl, true);
    it = this.glChunkTable.entrySet().iterator();
    while (it.hasNext()) {
      Map.Entry<Vector3i, GLChunk> entry = it.next();
      Vector3i position = entry.getKey();
      GLChunk glChunk = entry.getValue();

      if (glChunk == null || glChunk.buffer == null)
        continue;

      gl.glPushMatrix();

      Vector2d hexPosition = new Vector2d();
      HexGeometry.hexToCartesian(position.x, position.y, hexPosition);

      gl.glTranslatef((float) (hexPosition.x * 16),
          (float) (hexPosition.y * 16), position.z * 16);

 
View Full Code Here

TOP

Related Classes of Hexel.math.Vector2d

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.