Package crazypants.render

Examples of crazypants.render.BoundingBox


    AxisAlignedBB aabb;
    Block blk = Block.getBlockFromItem(toUse.getItem());
    if(blk != null) {
      aabb = blk.getCollisionBoundingBoxFromPool(world, placeCoord.x, placeCoord.y, placeCoord.z);
    } else {
      BoundingBox bb = new BoundingBox(placeCoord);
      aabb = bb.getAxisAlignedBB();
    }     
    if(aabb != null && aabb.intersectsWith(player.boundingBox)) {
      return false;
    }
    return true;
View Full Code Here


  }
 

  private void doHoover() {

    BoundingBox bb = new BoundingBox(getLocation());
    AxisAlignedBB aabb = AxisAlignedBB.getBoundingBox(bb.minX, bb.minY, bb.minZ, bb.maxX, bb.maxY, bb.maxZ);
    aabb = aabb.expand(RANGE, RANGE, RANGE);
    List<EntityItem> interestingItems = worldObj.selectEntitiesWithinAABB(EntityItem.class, aabb, this);

    for (EntityItem entity : interestingItems) {
View Full Code Here

      RenderUtil.bindBlockTexture();
      Tessellator tes = Tessellator.instance;
      tes.startDrawingQuads();

      float fullness = (float) (tank.getFluidAmount()) / (tank.getCapacity());
      BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.85, 0.96, 0.85);
      bb = bb.scale(1, 0.85 * fullness, 1);
      float ty = -(0.85f - (bb.maxY - bb.minY)) / 2;     
     
     
      Vector3d offset = ForgeDirectionOffsets.offsetScaled(ForgeDirection.values()[gen.facing], -0.075);
      bb = bb.translate((float)offset.x, ty, (float)offset.z);
     
      int brightness;
      if(gen.getWorldObj() == null) {
        brightness = 15 << 20 | 15 << 4;
      } else {
View Full Code Here

    }

    float fudge = 1f;

    //-x side
    BoundingBox bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
    bb = bb.translate(0.5f - (0.334f/2),0,0);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform, world != null);

    bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform, world != null);

    bb = BoundingBox.UNIT_CUBE.scale(0.334, fudge,fudge);
    bb = bb.translate(-0.5f + (0.334f/2),0,0);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, xform, world != null);

    if(vat != null) {
      ccr.renderBlock(world, block, x, y, z, overlayRenderer);
    }
View Full Code Here

      } else {
        gen = null;
      }
    }

    BoundingBox bb;
    boolean scaleX = facing != 4 && facing != 5;
    float scx;
    float scz;

    //middle chunk
    bb = BoundingBox.UNIT_CUBE;
    bb = bb.scale(1, 0.34, 1);
    vt.setFacing(facing);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, null ,world != null);

    scaleX = facing != 4 && facing != 5;
    scx = scaleX ? 0.7f : 1;
    scz = scaleX ? 1 : 0.7f;

    //top 1/3
    bb = BoundingBox.UNIT_CUBE;
    bb = bb.scale(scx, 0.21, scz);
    bb = bb.translate(0, 0.26f, 0);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, null ,world != null);


    //lower 1/3
    bb = BoundingBox.UNIT_CUBE;
    bb = bb.scale(scx, 0.21, scz);
    bb = bb.translate(0, -0.26f, 0);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, null ,world != null);

    //top / bottom connectors
    bb = BoundingBox.UNIT_CUBE.scale(0.35, 1, 0.35);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, null ,world != null);

    //tanks
    float size = 0.64f;
    bb = BoundingBox.UNIT_CUBE.scale(0.98, 1, 0.98);
    scx = scaleX ? size : 1;
    scz = scaleX ? 1 : size;
    bb = bb.scale(scx, 1, scz);

    float tx = scaleX ? 0.5f: 0;
    float tz = scaleX ? 0 : 0.5f;
    bb = bb.translate(tx, 0, tz);

    IIcon tex;
    if(Config.combustionGeneratorUseOpaqueModel) {
      tex = EnderIO.blockCombustionGenerator.getIcon(4,0);
    } else {
      tex = EnderIO.blockFusedQuartz.getDefaultFrameIcon(0);
    }
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt, tex, world != null);

    bb = bb.translate(-tx * 2, 0, -tz * 2);
    TranslatedCubeRenderer.instance.renderBoundingBox(x, y, z, block, bb, vt,tex, world != null);

    if(gen != null) {
      ccr.renderBlock(world, block, x, y, z, overlayRenderer);
    }
View Full Code Here

    if(icon != null) {
      float fullness = tank.getFilledRatio();
      y += 0.01f; // prevent bottom side z-fighting
      float scale = 0.98f;
      float yScale = 0.98f * fullness;
      BoundingBox bb = BoundingBox.UNIT_CUBE.scale(scale, yScale , scale);
      bb = bb.translate(0, -(1 - yScale)/2, 0);

      GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
      GL11.glEnable(GL11.GL_CULL_FACE);
      GL11.glDisable(GL11.GL_LIGHTING);
      GL11.glEnable(GL11.GL_BLEND);
View Full Code Here

      if(texture == null) {
        return;
      }
    }

    BoundingBox bbb;
    if(scaleFactor == 1) {
      bbb = component.bound;
    } else {
      double xScale = Math.abs(component.dir.offsetX) == 1 ? 1 : scaleFactor;
      double yScale = Math.abs(component.dir.offsetY) == 1 ? 1 : scaleFactor;
      double zScale = Math.abs(component.dir.offsetZ) == 1 ? 1 : scaleFactor;
      bbb = component.bound.scale(xScale, yScale, zScale);
    }

    for (ForgeDirection face : ForgeDirection.VALID_DIRECTIONS) {
      if(face != component.dir && face != component.dir.getOpposite()) {

        Tessellator tes = Tessellator.instance;
        tes.setNormal(face.offsetX, face.offsetY, face.offsetZ);
        Vector3d offset = ForgeDirectionOffsets.offsetScaled(face, -0.005);

        Vector2f uv = new Vector2f();
        List<ForgeDirection> edges = RenderUtil.getEdgesForFace(face);
        for (ForgeDirection edge : edges) {
          if(edge != component.dir && edge != component.dir.getOpposite()) {
            float xLen = 1 - Math.abs(edge.offsetX) * outlineWidth;
            float yLen = 1 - Math.abs(edge.offsetY) * outlineWidth;
            float zLen = 1 - Math.abs(edge.offsetZ) * outlineWidth;
            BoundingBox bb = bbb.scale(xLen, yLen, zLen);

            List<Vector3f> corners = bb.getCornersForFace(face);

            for (Vector3f unitCorn : corners) {
              Vector3d corner = new Vector3d(unitCorn);
              corner.add(offset);

View Full Code Here

        int c = ((IPowerConduit) conduit).getExtractionSignalColor(component.dir).getColor();
        Tessellator tessellator = Tessellator.instance;
        tessellator.setColorOpaque_I(c);

        Offset offset = conduit.getBundle().getOffset(IPowerConduit.class, component.dir);
        BoundingBox bound = component.bound;
        if(conMode != ConnectionMode.IN_OUT) {
          Vector3d trans = ForgeDirectionOffsets.offsetScaled(component.dir, -0.075);
          bound = bound.translate(trans);
        }
        CubeRenderer.render(bound, tex);
        tessellator.setColorOpaque(255, 255, 255);
      }
    } else {
View Full Code Here

      float scaleFactor = 0.75f;
      float xLen = Math.abs(component.dir.offsetX) == 1 ? 1 : scaleFactor;
      float yLen = Math.abs(component.dir.offsetY) == 1 ? 1 : scaleFactor;
      float zLen = Math.abs(component.dir.offsetZ) == 1 ? 1 : scaleFactor;

      BoundingBox cube = component.bound;
      BoundingBox bb = cube.scale(xLen, yLen, zLen);

      for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
        if(d != component.dir && d != component.dir.getOpposite()) {

          ForgeDirection vDir = RenderUtil.getVDirForFace(d);
          if(component.dir == ForgeDirection.UP || component.dir == ForgeDirection.DOWN) {
            vDir = RenderUtil.getUDirForFace(d);
          } else if((component.dir == ForgeDirection.NORTH || component.dir == ForgeDirection.SOUTH) && d.offsetY != 0) {
            vDir = RenderUtil.getUDirForFace(d);
          }

          float minU = texture.getMinU();
          float maxU = texture.getMaxU();
          float minV = texture.getMinV();
          float maxV = texture.getMaxV();

          float sideScale = Math.max(bb.sizeX(), bb.sizeY()) * 2 / 16f;
          sideScale = Math.max(sideScale, bb.sizeZ() * 2 / 16f);
          float width = Math.min(bb.sizeX(), bb.sizeY()) * 15f / 16f;

          List<Vertex> corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
          moveEdgeCorners(corners, vDir, width);
          moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
          for (Vertex c : corners) {
            addVecWithUV(c.xyz, c.uv.x, c.uv.y);
          }

          corners = bb.getCornersWithUvForFace(d, minU, maxU, minV, maxV);
          moveEdgeCorners(corners, vDir.getOpposite(), width);
          moveEdgeCorners(corners, component.dir.getOpposite(), sideScale);
          for (Vertex c : corners) {
            addVecWithUV(c.xyz, c.uv.x, c.uv.y);
          }
View Full Code Here

    if(!(te instanceof IConduitBundle)) {
      return null;
    }
    IConduitBundle con = (IConduitBundle) te;

    BoundingBox minBB = new BoundingBox(1, 1, 1, 0, 0, 0);
    if(!ConduitUtil.isSolidFacadeRendered(con, EnderIO.proxy.getClientPlayer())) {

      Collection<CollidableComponent> bounds = con.getCollidableComponents();
      for (CollidableComponent bnd : bounds) {
        minBB = minBB.expandBy(bnd.bound);
      }

    } else {
      minBB = new BoundingBox(0, 0, 0, 1, 1, 1);
    }

    if(!minBB.isValid()) {
      minBB = new BoundingBox(0, 0, 0, 1, 1, 1);
    }

    return AxisAlignedBB.getBoundingBox(x + minBB.minX, y + minBB.minY,
        z + minBB.minZ, x + minBB.maxX, y + minBB.maxY, z +
            minBB.maxZ);
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.