Esempio n. 1
0
  @Override
  public void draw(int mouseX, int mouseY) // 4 pixel border?
      {
    super.draw(mouseX, mouseY);
    if (!((GuiWorkspace) workspace).projectManager.projects.isEmpty() && !minimized) {
      ProjectInfo project =
          ((GuiWorkspace) workspace)
              .projectManager.projects.get(
                  ((GuiWorkspace) workspace).projectManager.selectedProject);
      double w = width - (BORDER_SIZE * 2);
      double h = height - BORDER_SIZE - 22 - 15 - 12;
      double rW = w / (double) project.textureWidth;
      double rH = h / (double) project.textureHeight;

      double max = Math.min(rW, rH);
      double offX = (w - (project.textureWidth * max)) / 2D;
      double offY = (h - (project.textureHeight * max)) / 2D;

      double pX = posX + BORDER_SIZE + offX;
      double pY = posY + offY + 15;
      double w1 = (project.textureWidth * max);
      double h1 = (project.textureHeight * max);

      RendererHelper.drawColourOnScreen(200, 200, 200, 255, pX, pY, w1, h1, 0D);

      if (image != null) {
        GlStateManager.bindTexture(imageId);
        Tessellator tessellator = Tessellator.getInstance();
        WorldRenderer worldRenderer = tessellator.getWorldRenderer();
        worldRenderer.startDrawingQuads();
        worldRenderer.addVertexWithUV(pX, pY + h1, 0, 0.0D, 1.0D);
        worldRenderer.addVertexWithUV(pX + w1, pY + h1, 0, 1.0D, 1.0D);
        worldRenderer.addVertexWithUV(pX + w1, pY, 0, 1.0D, 0.0D);
        worldRenderer.addVertexWithUV(pX, pY, 0, 0.0D, 0.0D);
        tessellator.draw();
      }

      RendererHelper.endGlScissor();
      RendererHelper.startGlScissor((int) pX, (int) pY, (int) w1, (int) h1);

      GlStateManager.enableBlend();
      GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

      GlStateManager.alphaFunc(GL11.GL_GREATER, 0.00625F);

      for (ElementListTree.Tree tree : ((GuiWorkspace) workspace).windowModelTree.modelList.trees) {
        if (tree.attachedObject instanceof CubeInfo) {
          CubeInfo info = (CubeInfo) tree.attachedObject;
          int alpha = tree.selected ? 125 : 25;
          double ratio = (project.textureWidth / w1);
          RendererHelper.drawColourOnScreen(
              255,
              0,
              0,
              alpha,
              pX + info.txOffset[0] / ratio,
              pY + info.txOffset[1] / ratio + info.dimensions[2] / ratio,
              info.dimensions[2] / ratio,
              info.dimensions[1] / ratio,
              0D);
          RendererHelper.drawColourOnScreen(
              0,
              0,
              255,
              alpha,
              pX + info.txOffset[0] / ratio + info.dimensions[2] / ratio,
              pY + info.txOffset[1] / ratio + info.dimensions[2] / ratio,
              info.dimensions[0] / ratio,
              info.dimensions[1] / ratio,
              0D);
          RendererHelper.drawColourOnScreen(
              170,
              0,
              0,
              alpha,
              pX
                  + info.txOffset[0] / ratio
                  + info.dimensions[2] / ratio
                  + info.dimensions[0] / ratio,
              pY + info.txOffset[1] / ratio + info.dimensions[2] / ratio,
              info.dimensions[2] / ratio,
              info.dimensions[1] / ratio,
              0D);
          RendererHelper.drawColourOnScreen(
              0,
              0,
              170,
              alpha,
              pX
                  + info.txOffset[0] / ratio
                  + info.dimensions[2] / ratio
                  + info.dimensions[0] / ratio
                  + info.dimensions[2] / ratio,
              pY + info.txOffset[1] / ratio + info.dimensions[2] / ratio,
              info.dimensions[0] / ratio,
              info.dimensions[1] / ratio,
              0D);
          RendererHelper.drawColourOnScreen(
              0,
              255,
              0,
              alpha,
              pX + info.txOffset[0] / ratio + info.dimensions[2] / ratio,
              pY + info.txOffset[1] / ratio,
              info.dimensions[0] / ratio,
              info.dimensions[2] / ratio,
              0D);
          RendererHelper.drawColourOnScreen(
              0,
              170,
              0,
              alpha,
              pX
                  + info.txOffset[0] / ratio
                  + info.dimensions[2] / ratio
                  + info.dimensions[0] / ratio,
              pY + info.txOffset[1] / ratio,
              info.dimensions[0] / ratio,
              info.dimensions[2] / ratio,
              0D);
        }
      }

      GlStateManager.alphaFunc(GL11.GL_GREATER, 0.1F);
      GlStateManager.disableBlend();

      RendererHelper.endGlScissor();
      if (this.isTab) {
        RendererHelper.startGlScissor(
            this.posX + 1, this.posY + 1 + 12, this.getWidth() - 2, this.getHeight() - 2 - 12);
      } else {
        RendererHelper.startGlScissor(
            this.posX + 1, this.posY + 1, this.getWidth() - 2, this.getHeight() - 2);
      }

      if (imageId == -1) {
        workspace
            .getFontRenderer()
            .drawString(
                StatCollector.translateToLocal("window.texture.noTexture"),
                posX + 4,
                posY + height - BORDER_SIZE - 12 - 20,
                Theme.getAsHex(workspace.currentTheme.font),
                false);
      } else if (project.textureFile != null) {
        workspace
            .getFontRenderer()
            .drawString(
                project.textureFile.getName(),
                posX + 4,
                posY + height - BORDER_SIZE - 12 - 20,
                Theme.getAsHex(workspace.currentTheme.font),
                false);
      } else {
        workspace
            .getFontRenderer()
            .drawString(
                StatCollector.translateToLocal("window.texture.remoteTexture"),
                posX + 4,
                posY + height - BORDER_SIZE - 12 - 20,
                Theme.getAsHex(workspace.currentTheme.font),
                false);
      }
    }
  }
Esempio n. 2
0
  public void drawPlayerOnGui(int par1, int par2, int par3, float par4, float par5) {
    if (stand != null) {
      RenderHelper.enableGUIStandardItemLighting();
      GlStateManager.enableColorMaterial();
      GlStateManager.pushMatrix();

      //	        GlStateManager.disableAlpha();

      GlStateManager.translate((float) par1, (float) par2, 50.0F);

      GlStateManager.translate(23F, -20.0F, 0.0F);
      GlStateManager.scale((float) (-par3), (float) par3, (float) par3);
      GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);

      GlStateManager.rotate(-80.0F, 0.0F, 1.0F, 0.0F);
      GlStateManager.rotate(-10.0F, 0.0F, 0.0F, 1.0F);
      //	        GlStateManager.rotate(-((float)Math.atan((double)(0.0F / 40.0F))) * 20.0F, 1.0F,
      // 0.0F, 0.0F);

      Minecraft.getMinecraft().getRenderManager().playerViewY = 180.0F;

      GlStateManager.translate(0.5D, 0.5D, 0.5D);
      GlStateManager.translate(0.0D, -0.5D, 0.0D);
      GlStateManager.rotate(
          -((float) Math.atan((double) (par4 / 40.0F))) * 20.0F, 0.0F, 1.0F, 0.0F);
      GlStateManager.rotate(
          -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 0.0F, 0.0F, -1.0F);
      GlStateManager.translate(0.0D, 0.5D, 0.0D);
      if (stand.orientation == 0) {
        GlStateManager.rotate(180F, 0.0F, 1.0F, 0.0F);
      } else if (stand.orientation == 1) {
        GlStateManager.rotate(-90F, 0.0F, 1.0F, 0.0F);
      } else if (stand.orientation == 3) {
        GlStateManager.rotate(90F, 0.0F, 1.0F, 0.0F);
      }

      GlStateManager.enableNormalize();

      this.mc.getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
      IBlockState state =
          HatStand.blockHatStand
              .getDefaultState()
              .withProperty(
                  BlockHatStand.TYPE,
                  stand.hasBase
                      ? stand.hasStand
                          ? stand.hatName.isEmpty() ? 0 : 1
                          : stand.isOnFloor ? 2 : EnumFacing.getFront(stand.sideOn).ordinal() + 2
                      : 3);
      RendererHelper.renderBakedModel(
          mc.getBlockRendererDispatcher().getBlockModelShapes().getModelForState(state), -1, null);

      GlStateManager.translate(-0.5D, -0.5D, -0.5D);

      HatInfoClient info = stand.info;

      if (tempInfo == null
          || info == null
          || !(tempInfo.hatName.equalsIgnoreCase(stand.hatName)
              && tempInfo.colourR == stand.colourR
              && tempInfo.colourG == stand.colourG
              && tempInfo.colourB == stand.colourB
              && tempInfo.alpha == stand.alpha)) {
        tempInfo =
            new HatInfoClient(
                stand.hatName, stand.colourR, stand.colourG, stand.colourB, stand.alpha);
      }

      stand.info = tempInfo;

      TileRendererHatStand.renderer.renderHatStand(stand, 0, 0, 0, 1.0F, -1, stand.gameProfile);

      stand.info = info;

      //	        GlStateManager.enableAlpha();

      GlStateManager.popMatrix();
      GlStateManager.disableRescaleNormal();
      OpenGlHelper.setActiveTexture(OpenGlHelper.lightmapTexUnit);
      GlStateManager.disableTexture2D();
      OpenGlHelper.setActiveTexture(OpenGlHelper.defaultTexUnit);

      RenderHelper.disableStandardItemLighting();
    }
  }