Esempio n. 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);
      }
    }
  }
  @Override
  public void batchElement(Line3D line) {
    TextureRegion texRgn = new TextureRegion();
    texRgn.v2 = line.getRay().getLength() / mUnitSize;
    line.setTexRgn(texRgn);
    super.batchElement(line);

    line.checkOcclusion();
  }
Esempio n. 3
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();
  }