Package crazypants.render

Examples of crazypants.render.BoundingBox


    minZ = fix(minZ);
    maxX = fix(maxX);
    maxY = fix(maxY);
    maxZ = fix(maxZ);

    BoundingBox bb = new BoundingBox(minX, minY, minZ, maxX, maxY, maxZ);
    bb = bb.fixMinMax();

    return bb;
  }
View Full Code Here


    return EXTERNAL_CONNECTOR_BOUNDS.get(dir);
  }

  public BoundingBox getBoundingBox(Class<? extends IConduit> type, ForgeDirection dir, boolean isStub, Offset offset) {
    GeometryKey key = new GeometryKey(dir, isStub, offset, type);
    BoundingBox result = boundsCache.get(key);
    if(result == null) {
      result = createConduitBounds(type, key);
      boundsCache.put(key, result);
    }
    return result;
View Full Code Here

    nonUniformScale.x = 0.8 * (1 - Math.abs(nonUniformScale.x));
    nonUniformScale.y = 0.8 * (1 - Math.abs(nonUniformScale.y));
    nonUniformScale.z = 0.8 * (1 - Math.abs(nonUniformScale.z));

    BoundingBox bb = CORE_BOUNDS;
    bb = bb.scale(nonUniformScale.x, nonUniformScale.y, nonUniformScale.z);

    double offsetFromEnd = Math.min(bb.sizeX(), bb.sizeY());
    offsetFromEnd = Math.min(offsetFromEnd, bb.sizeZ());
    offsetFromEnd = Math.max(offsetFromEnd, 0.075);
    double transMag = 0.5 - (offsetFromEnd * 1.2);

    Vector3d trans = ForgeDirectionOffsets.forDirCopy(dir);
    trans.scale(transMag);
    bb = bb.translate(trans);
    bb = bb.translate(getTranslation(dir, offset));
    return bb;
  }
View Full Code Here

  private BoundingBox createConduitBounds(Class<? extends IConduit> type, GeometryKey key) {
    return createConduitBounds(type, key.dir, key.isStub, key.offset);
  }

  private BoundingBox createConduitBounds(Class<? extends IConduit> type, ForgeDirection dir, boolean isStub, Offset offset) {
    BoundingBox bb = CORE_BOUNDS;

    Vector3d min = bb.getMin();
    Vector3d max = bb.getMax();

    switch (dir) {
    case WEST:
      min.x = isStub ? Math.max(0, bb.minX - STUB_WIDTH) : 0;
      max.x = bb.minX;
      break;
    case EAST:
      min.x = bb.maxX;
      max.x = isStub ? Math.min(1, bb.maxX + STUB_WIDTH) : 1;
      break;
    case DOWN:
      min.y = isStub ? Math.max(0, bb.minY - STUB_HEIGHT) : 0;
      max.y = bb.minY;
      break;
    case UP:
      max.y = isStub ? Math.min(1, bb.maxY + STUB_HEIGHT) : 1;
      min.y = bb.maxY;
      break;
    case NORTH:
      min.z = isStub ? Math.max(0.0F, bb.minZ - STUB_WIDTH) : 0;
      max.z = bb.minZ;
      break;
    case SOUTH:
      max.z = isStub ? Math.min(1F, bb.maxZ + STUB_WIDTH) : 1;
      min.z = bb.maxZ;
      break;
    default:
      break;
    }

    Vector3d trans = getTranslation(dir, offset);
    min.add(trans);
    max.add(trans);
    bb = new BoundingBox(VecmathUtil.clamp(min, 0, 1), VecmathUtil.clamp(max, 0, 1));
    return bb;
  }
View Full Code Here

TOP

Related Classes of crazypants.render.BoundingBox

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.