示例#1
0
  private static void createSide(
      BoundingBoxMap<BoundingBoxMap<ShapeManipulator>> output,
      ForgeDirection face,
      ShapeManipulator middleClick,
      ShapeManipulator horMinClick,
      ShapeManipulator horPlusClick,
      ShapeManipulator vertMinClick,
      ShapeManipulator vertPlusClick) {
    final BlockTextureTransform transform = new BlockTextureTransform(face);

    final BoundingBoxMap<ShapeManipulator> subBoxes = BoundingBoxMap.create();

    addButton(transform, subBoxes, 1, 6, 5, 10, horPlusClick);
    addButton(transform, subBoxes, 6, 1, 10, 5, vertMinClick);
    addButton(transform, subBoxes, 11, 6, 15, 10, horMinClick);
    addButton(transform, subBoxes, 6, 11, 10, 15, vertPlusClick);

    addButton(transform, subBoxes, 6, 6, 10, 10, middleClick);

    final BlockTextureTransform.WorldCoords overboxMin =
        transform.textureCoordsToWorldVec(P, P, -SELECTION_BOX_DEPTH);
    final BlockTextureTransform.WorldCoords overboxMax =
        transform.textureCoordsToWorldVec(1 - P, 1 - P, SELECTION_BOX_DEPTH);
    output.addBox(
        AabbUtils.createAabb(
            overboxMin.x, overboxMin.y, overboxMin.z, overboxMax.x, overboxMax.y, overboxMax.z),
        subBoxes);
  }
示例#2
0
 private static void addButton(
     BlockTextureTransform transform,
     BoundingBoxMap<ShapeManipulator> output,
     int left,
     int top,
     int right,
     int bottom,
     ShapeManipulator action) {
   final BlockTextureTransform.WorldCoords min =
       transform.textureCoordsToWorldVec(left * P, top * P, -SELECTION_BOX_DEPTH);
   final BlockTextureTransform.WorldCoords max =
       transform.textureCoordsToWorldVec(right * P, bottom * P, SELECTION_BOX_DEPTH);
   output.addBox(AabbUtils.createAabb(min.x, min.y, min.z, max.x, max.y, max.z), action);
 }