コード例 #1
0
  protected void renderModel(float bladeRotatation, int face, int height) {
    float[] rot = ITorque.forgeDiretctionToRotationMatrix[face];
    if (rot[0] != 0) {
      GL11.glRotatef(rot[0], 1, 0, 0);
    }
    if (rot[1] != 0) {
      GL11.glRotatef(rot[1], 0, 1, 0);
    }
    if (rot[2] != 0) {
      GL11.glRotatef(rot[2], 0, 0, 1);
    }

    float textureWidth = model.textureWidth();
    float textureHeight = model.textureHeight();
    GL11.glRotatef(bladeRotatation, 0, 0, 1);
    windmillShaft.render(model.textureWidth(), model.textureHeight());

    for (int i = 0; i < 4; i++) {
      GL11.glRotatef(90, 0, 0, 1);
      GL11.glPushMatrix();
      bladeShaft.render(textureWidth, textureHeight);
      for (int k = 1; k < height; k++) {
        blade.render(textureWidth, textureHeight);
        if (k == height - 1) {
          bladeJoint.render(textureWidth, textureHeight);
        }
        if (k < height - 1) {
          GL11.glTranslatef(0, 1, 0);
        }
      }
      GL11.glPopMatrix();
    }
  }
コード例 #2
0
  @Override
  public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
    bindTexture(texture);
    GL11.glTranslatef(0.5f, -0.25f, 0.5f);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glScalef(0.35f, 0.35f, 0.35f);
    float[] rot = ITorque.forgeDiretctionToRotationMatrix[2];
    if (rot[0] != 0) {
      GL11.glRotatef(rot[0], 1, 0, 0);
    }
    if (rot[1] != 0) {
      GL11.glRotatef(rot[1], 0, 1, 0);
    }
    if (rot[2] != 0) {
      GL11.glRotatef(rot[2], 0, 0, 1);
    }

    float textureWidth = model.textureWidth();
    float textureHeight = model.textureHeight();
    windmillShaft.setRotation(0, 0, 0);
    windmillShaft.render(textureWidth, textureHeight);
    int height = 5;

    bladeShaft.render(textureWidth, textureHeight);
    for (int k = 1; k < height; k++) {
      blade.render(textureWidth, textureHeight);
      if (k == height - 1) {
        bladeJoint.render(textureWidth, textureHeight);
      }
      if (k < height - 1) {
        GL11.glTranslatef(0, 1, 0);
      }
    }
    GL11.glPopAttrib();
    GL11.glPopMatrix();
  }