Ejemplo n.º 1
0
    @Override
    public void renderTo(Target<?> target) {

      float height = parseHeight(node.getTags(), 1f);

      /* draw main pole */
      target.drawColumn(FIREHYDRANT, null, getBase(), height, 0.15, 0.15, false, true);

      /* draw two small and one large valve */
      VectorXYZ valveBaseVector = getBase().addY(height - 0.3);
      VectorXZ smallValveVector = VectorXZ.X_UNIT;
      VectorXZ largeValveVector = VectorXZ.Z_UNIT;

      target.drawBox(FIREHYDRANT, valveBaseVector, smallValveVector, 0.1f, 0.5f, 0.1f);
      target.drawBox(
          FIREHYDRANT, valveBaseVector.add(0.2f, -0.1f, 0f), largeValveVector, 0.15f, 0.15f, 0.15f);
    }
Ejemplo n.º 2
0
    private void drawContainer(Target<?> target, String trash, VectorXYZ pos) {

      if ("clothes".equals(trash)) {
        target.drawBox(
            new ImmutableMaterial(Lighting.FLAT, new Color(0.82f, 0.784f, 0.75f)),
            pos,
            faceVector,
            2,
            1,
            1);
      } else { // "paper" || "white_glass" || "coloured_glass"
        float width = 1.5f;
        float height = 1.6f;

        Material colourFront = null;
        Material colourBack = null;

        if ("paper".equals(trash)) {
          colourFront = new ImmutableMaterial(Lighting.FLAT, Color.BLUE);
          colourBack = new ImmutableMaterial(Lighting.FLAT, Color.BLUE);
        } else if ("white_glass".equals(trash)) {
          colourFront = new ImmutableMaterial(Lighting.FLAT, Color.WHITE);
          colourBack = new ImmutableMaterial(Lighting.FLAT, Color.WHITE);
        } else { // "coloured_glass"
          colourFront = new ImmutableMaterial(Lighting.FLAT, new Color(0.18f, 0.32f, 0.14f));
          colourBack = new ImmutableMaterial(Lighting.FLAT, new Color(0.39f, 0.15f, 0.11f));
        }

        target.drawBox(STEEL, pos, faceVector, height, width, width);
        target.drawBox(
            colourFront,
            pos.add(
                new VectorXYZ((width / 2 - 0.10), 0.1f, (width / 2 - 0.1)).rotateY(directionAngle)),
            faceVector,
            height - 0.2,
            0.202,
            0.202);
        target.drawBox(
            colourBack,
            pos.add(
                new VectorXYZ(-(width / 2 - 0.10), 0.1f, (width / 2 - 0.1))
                    .rotateY(directionAngle)),
            faceVector,
            height - 0.2,
            0.202,
            0.202);
        target.drawBox(
            colourFront,
            pos.add(
                new VectorXYZ((width / 2 - 0.10), 0.1f, -(width / 2 - 0.1))
                    .rotateY(directionAngle)),
            faceVector,
            height - 0.2,
            0.202,
            0.202);
        target.drawBox(
            colourBack,
            pos.add(
                new VectorXYZ(-(width / 2 - 0.10), 0.1f, -(width / 2 - 0.1))
                    .rotateY(directionAngle)),
            faceVector,
            height - 0.2,
            0.202,
            0.202);
      }
    }