Package net.minecraft.client.renderer

Examples of net.minecraft.client.renderer.Tessellator


    }

    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);

              corner.x += (float) (edge.offsetX * 0.5 * bbb.sizeX()) - (Math.signum(edge.offsetX) * xLen / 2f * bbb.sizeX()) * 2f;
              corner.y += (float) (edge.offsetY * 0.5 * bbb.sizeY()) - (Math.signum(edge.offsetY) * yLen / 2f * bbb.sizeY()) * 2f;
              corner.z += (float) (edge.offsetZ * 0.5 * bbb.sizeZ()) - (Math.signum(edge.offsetZ) * zLen / 2f * bbb.sizeZ()) * 2f;

              //polyOffset

              RenderUtil.getUvForCorner(uv, corner, 0, 0, 0, face, texture);

              tes.addVertexWithUV(corner.x, corner.y, corner.z, uv.x, uv.y);
            }
          }

        }
      }
View Full Code Here


    if(((LiquidConduit) conduit).getTank().getFilledRatio() <= 0) {
      return;
    }

    Collection<CollidableComponent> components = conduit.getCollidableComponents();
    Tessellator tessellator = Tessellator.instance;

    calculateRatios((LiquidConduit) conduit);
    transmissionScaleFactor = conduit.getTransmitionGeometryScale();

    IIcon tex;
    for (CollidableComponent component : components) {
      if(renderComponent(component)) {
        float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(component));
        if(isNSEWUD(component.dir) &&
            conduit.getTransmitionTextureForState(component) != null) {

          tessellator.setColorOpaque_F(1, 1, 1);
          tex = conduit.getTransmitionTextureForState(component);

          BoundingBox[] cubes = toCubes(component.bound);
          for (BoundingBox cube : cubes) {
            drawSection(cube, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, true);
View Full Code Here

      IPowerConduit pc = (IPowerConduit) conduit;
      ConnectionMode conMode = pc.getConnectionMode(component.dir);
      if(conduit.containsExternalConnection(component.dir) && pc.getExtractionRedstoneMode(component.dir) != RedstoneControlMode.IGNORE
          && conMode != ConnectionMode.DISABLED) {
        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 {
      super.renderConduit(tex, conduit, component, selfIllum);
    }
  }
View Full Code Here

      }

      if(conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
        tex = EnderIO.blockConduitBundle.getConnectorIcon();
        List<Vertex> corners = component.bound.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
        Tessellator tessellator = Tessellator.instance;
        for (Vertex c : corners) {
          addVecWithUV(c.xyz, c.uv.x, c.uv.y);
        }
        //back face
        for (int i = corners.size() - 1; i >= 0; i--) {
View Full Code Here

      }

      if(conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
        tex = EnderIO.blockConduitBundle.getConnectorIcon();
        List<Vertex> corners = component.bound.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
        Tessellator tessellator = Tessellator.instance;
        for (Vertex c : corners) {
          addVecWithUV(c.xyz, c.uv.x, c.uv.y);
        }
        //back face
        for (int i = corners.size() - 1; i >= 0; i--) {
View Full Code Here

  @Override
  public void renderEntity(ConduitBundleRenderer conduitBundleRenderer, IConduitBundle te, IConduit conduit, double x, double y, double z, float partialTick,
      float worldLight) {

    Collection<CollidableComponent> components = conduit.getCollidableComponents();
    Tessellator tessellator = Tessellator.instance;

    transmissionScaleFactor = conduit.getTransmitionGeometryScale();

    IIcon tex;
    for (CollidableComponent component : components) {
      if(renderComponent(component)) {
        float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(component));
        if(isNSEWUD(component.dir) &&
            conduit.getTransmitionTextureForState(component) != null) {
          tessellator.setBrightness((int) (worldLight));
          tex = conduit.getTransmitionTextureForState(component);
          renderTransmission(conduit, tex, component, selfIllum);
        }

        tex = conduit.getTextureForState(component);
        if(tex != null) {
          tessellator.setBrightness((int) (worldLight));
          renderConduit(tex, conduit, component, selfIllum);
        }
      }

    }
View Full Code Here

      drawSection(bb, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV(), component.dir, false);

      if(conduit.getConnectionMode(component.dir) == ConnectionMode.DISABLED) {
        tex = EnderIO.blockConduitBundle.getConnectorIcon();
        List<Vertex> corners = component.bound.getCornersWithUvForFace(component.dir, tex.getMinU(), tex.getMaxU(), tex.getMinV(), tex.getMaxV());
        Tessellator tessellator = Tessellator.instance;
        for (Vertex c : corners) {
          addVecWithUV(c.xyz, c.uv.x, c.uv.y);
        }
      }
View Full Code Here

    return dir == NORTH || dir == SOUTH || dir == EAST || dir == WEST || dir == UP || dir == DOWN;
  }

  protected void drawSection(BoundingBox bound, float minU, float maxU, float minV, float maxV, ForgeDirection dir, boolean isTransmission) {

    Tessellator tessellator = Tessellator.instance;

    if(isTransmission) {
      setVerticesForTransmission(bound, dir);
    } else {
      setupVertices(bound);
    }

    if(dir == NORTH || dir == UP || dir == EAST) { // maintain consistent
                                                   // texture
      // dir relative to the cneter
      // of the conduit
      float tmp = minU;
      minU = maxU;
      maxU = tmp;
    }

    boolean rotateSides = dir == UP || dir == DOWN;
    boolean rotateTopBottom = dir == NORTH || dir == SOUTH;
    float cm;
    if(dir != NORTH && dir != SOUTH) {
      tessellator.setNormal(0, 0, -1);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.NORTH);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateSides) {
        addVecWithUV(verts[1], maxU, maxV);
        addVecWithUV(verts[0], maxU, minV);
        addVecWithUV(verts[3], minU, minV);
        addVecWithUV(verts[2], minU, maxV);
      } else {
        addVecWithUV(verts[1], minU, minV);
        addVecWithUV(verts[0], maxU, minV);
        addVecWithUV(verts[3], maxU, maxV);
        addVecWithUV(verts[2], minU, maxV);
      }
      if(dir == WEST || dir == EAST) {
        float tmp = minU;
        minU = maxU;
        maxU = tmp;
      }
      tessellator.setNormal(0, 0, 1);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.SOUTH);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateSides) {
        addVecWithUV(verts[4], maxU, maxV);
        addVecWithUV(verts[5], maxU, minV);
        addVecWithUV(verts[6], minU, minV);
        addVecWithUV(verts[7], minU, maxV);
      } else {
        addVecWithUV(verts[4], minU, minV);
        addVecWithUV(verts[5], maxU, minV);
        addVecWithUV(verts[6], maxU, maxV);
        addVecWithUV(verts[7], minU, maxV);
      }
      if(dir == WEST || dir == EAST) {
        float tmp = minU;
        minU = maxU;
        maxU = tmp;
      }
    }

    if(dir != UP && dir != DOWN) {

      tessellator.setNormal(0, 1, 0);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.UP);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateTopBottom) {
        addVecWithUV(verts[6], maxU, maxV);
        addVecWithUV(verts[2], minU, maxV);
        addVecWithUV(verts[3], minU, minV);
        addVecWithUV(verts[7], maxU, minV);
      } else {
        addVecWithUV(verts[6], minU, minV);
        addVecWithUV(verts[2], minU, maxV);
        addVecWithUV(verts[3], maxU, maxV);
        addVecWithUV(verts[7], maxU, minV);
      }

      tessellator.setNormal(0, -1, 0);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.DOWN);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateTopBottom) {
        addVecWithUV(verts[0], minU, minV);
        addVecWithUV(verts[1], minU, maxV);
        addVecWithUV(verts[5], maxU, maxV);
        addVecWithUV(verts[4], maxU, minV);
      } else {
        addVecWithUV(verts[0], maxU, maxV);
        addVecWithUV(verts[1], minU, maxV);
        addVecWithUV(verts[5], minU, minV);
        addVecWithUV(verts[4], maxU, minV);
      }
    }

    if(dir != EAST && dir != WEST) {

      tessellator.setNormal(1, 0, 0);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.EAST);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateSides) {
        addVecWithUV(verts[2], minU, maxV);
        addVecWithUV(verts[6], minU, minV);
        addVecWithUV(verts[5], maxU, minV);
        addVecWithUV(verts[1], maxU, maxV);
      } else {
        addVecWithUV(verts[2], minU, maxV);
        addVecWithUV(verts[6], maxU, maxV);
        addVecWithUV(verts[5], maxU, minV);
        addVecWithUV(verts[1], minU, minV);
      }

      tessellator.setNormal(-1, 0, 0);
      if(!isTransmission) {
        cm = RenderUtil.getColorMultiplierForFace(ForgeDirection.WEST);
        tessellator.setColorOpaque_F(cm, cm, cm);
      }
      if(rotateSides) {
        addVecWithUV(verts[0], maxU, maxV);
        addVecWithUV(verts[4], maxU, minV);
        addVecWithUV(verts[7], minU, minV);
        addVecWithUV(verts[3], minU, maxV);
      } else {
        addVecWithUV(verts[0], minU, minV);
        addVecWithUV(verts[4], maxU, minV);
        addVecWithUV(verts[7], maxU, maxV);
        addVecWithUV(verts[3], minU, maxV);
      }
    }
    tessellator.setColorOpaque_F(1, 1, 1);
  }
View Full Code Here

    return res;
  }

  public void renderConduits(IConduitBundle bundle, double x, double y, double z, float partialTick, float brightness) {

    Tessellator tessellator = Tessellator.instance;
    tessellator.setColorOpaque_F(1, 1, 1);
    tessellator.addTranslation((float) x, (float) y, (float) z);

    // Conduits
    Set<ForgeDirection> externals = new HashSet<ForgeDirection>();
    EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;

    List<BoundingBox> wireBounds = new ArrayList<BoundingBox>();

    for (IConduit con : bundle.getConduits()) {

      if(ConduitUtil.renderConduit(player, con)) {
        ConduitRenderer renderer = EnderIO.proxy.getRendererForConduit(con);
        renderer.renderEntity(this, bundle, con, x, y, z, partialTick, brightness);
        Set<ForgeDirection> extCons = con.getExternalConnections();
        for (ForgeDirection dir : extCons) {
          if(con.getConnectionMode(dir) != ConnectionMode.DISABLED && con.getConnectionMode(dir) != ConnectionMode.NOT_SET) {
            externals.add(dir);
          }
        }
      } else if(con != null) {
        Collection<CollidableComponent> components = con.getCollidableComponents();
        for (CollidableComponent component : components) {
          wireBounds.add(component.bound);
        }
      }

    }

    // Internal conectors between conduits
    List<CollidableComponent> connectors = bundle.getConnectors();
    for (CollidableComponent component : connectors) {
      if(component.conduitType != null) {
        IConduit conduit = bundle.getConduit(component.conduitType);
        if(conduit != null) {
          if(ConduitUtil.renderConduit(player, component.conduitType)) {
            tessellator.setBrightness((int) (brightness));
            CubeRenderer.render(component.bound, conduit.getTextureForState(component), true);
          } else {
            wireBounds.add(component.bound);
          }
        }

      } else if(ConduitUtil.getDisplayMode(player) == ConduitDisplayMode.ALL) {
        IIcon tex = EnderIO.blockConduitBundle.getConnectorIcon();
        CubeRenderer.render(component.bound, tex);
      }
    }

    //render these after the 'normal' conduits so help with proper blending
    for (BoundingBox wireBound : wireBounds) {
      Tessellator.instance.setColorRGBA_F(1, 1, 1, 0.25f);
      CubeRenderer.render(wireBound, EnderIO.blockConduitFacade.getIcon(0, 0));
    }

    Tessellator.instance.setColorRGBA_F(1, 1, 1, 1f);
    // External connection terminations
    for (ForgeDirection dir : externals) {
      renderExternalConnection(dir);
    }

    tessellator.addTranslation(-(float) x, -(float) y, -(float) z);

  }
View Full Code Here

    super.renderEntity(conduitBundleRenderer, bundle, conduit, x, y, z, partialTick, worldLight);

    RedstoneSwitch sw = (RedstoneSwitch) conduit;

    Tessellator tessellator = Tessellator.instance;
    float selfIllum = Math.max(worldLight, conduit.getSelfIlluminationForState(null));
    tessellator.setColorOpaque_F(selfIllum, selfIllum, selfIllum);

    IIcon[] icons = new IIcon[6];
    for (int i = 0; i < icons.length; i++) {
      icons[i] = EnderIO.blockConduitBundle.getConnectorIcon();
    }
View Full Code Here

TOP

Related Classes of net.minecraft.client.renderer.Tessellator

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.