Example #1
0
  /**
   * Sent by the Renderer to start the drawing process, kind of neat in that the LineCell sends
   * commands back to the Renderer on how to draw itself (Remember the Renderer only has a vector of
   * cells).
   */
  public void render(Renderer aren) {
    int cnt, i;

    cnt = mtSet.size();
    // Load the texture first.
    if (imTex != null) {
      aren.loadTexture(0, imTex);
    }
    if (nNormal != null) aren.normal(nNormal);
    else aren.lighting(false);

    aren.beginDraw(aren.POLYGON);
    if (cnt == 1) { // we have only one material set it outside the loop
      aren.setMaterial(mtSet.getMaterial(0));
      for (i = 0; i < intVals.size(); i++) {
        if (tCoords != null) aren.texCoord(tCoords.getTexCoord(i));
        aren.vertex(ptSet.getPoint(getVal(i)));
      }
    } else {
      for (i = 0; i < intVals.size(); i++) {
        aren.setMaterial(mtSet.getMaterial(getVal(i) % cnt));
        if (tCoords != null) aren.texCoord(tCoords.getTexCoord(i));
        aren.vertex(ptSet.getPoint(getVal(i)));
      }
    }
    aren.endDraw();
  }