Beispiel #1
0
  public void drawAll(Camera cam) {
    float[] rotationMatrix = new float[16];
    boolean typeSwitchDirty = false;

    OrderUnit[] renderOrder = buildCompleteDrawOrder(cam.getPos());

    Matrix.setIdentityM(rotationMatrix, 0);
    Matrix.rotateM(rotationMatrix, 0, -angle, 0.0f, 1.0f, 0.0f);

    for (int i = 0; i < renderOrder.length; i++) {
      if (renderOrder[i].getType() == OrderUnit.ORDERUNITTYPE.Node) {
        if (!typeSwitchDirty) {
          mConnectionsBatch.endBatch();
          mDottedBatch.endBatch();
        }

        drawOneNode(renderOrder[i].getId(), rotationMatrix, cam);
        typeSwitchDirty = true;
      } else {
        if (typeSwitchDirty) {
          mConnectionsBatch.beginBatch(cam, modelMatrix);
          mDottedBatch.beginBatch(cam, modelMatrix);
          typeSwitchDirty = false;
        }

        Line3D currentLine = connections[renderOrder[i].getId()].getLine();
        if (currentLine.isDotted()) mDottedBatch.batchElement(currentLine);
        else mConnectionsBatch.batchElement(currentLine);
      }
    }
  }
Beispiel #2
0
  private void drawConnections(Camera cam) {
    NodeConnectionOrderUnit[] renderOrder = buildConnectionDrawOrder(cam.getPos());

    mConnectionsBatch.beginBatch(cam, modelMatrix);
    mDottedBatch.beginBatch(cam, modelMatrix);

    for (int i = 0; i < renderOrder.length; i++) {
      Line3D currentLine = connections[renderOrder[i].getId()].getLine();

      if (currentLine.isDotted()) mDottedBatch.batchElement(currentLine);
      else mConnectionsBatch.batchElement(currentLine);
    }

    mConnectionsBatch.endBatch();
    mDottedBatch.endBatch();
  }