示例#1
0
  private void makeSectionOutlineIndices(
      int subdivisions,
      int vertexPos,
      int indexPos,
      int[] indices,
      boolean beginEdgeFlag,
      boolean endEdgeFlag) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = gb.getSubdivisionPointsVertexCount(subdivisions);

    int index = indexPos;
    int pos, nextPos;

    if (beginEdgeFlag) {
      pos = vertexPos;
      indices[index++] = pos;
      indices[index++] = pos + 1;
    }

    for (int i = 0; i < count - 1; i++) {
      pos = vertexPos + 2 * i;
      nextPos = vertexPos + 2 * (i + 1);
      indices[index++] = pos;
      indices[index++] = nextPos;
      indices[index++] = pos + 1;
      indices[index++] = nextPos + 1;
    }

    if (endEdgeFlag) {
      pos = vertexPos + 2 * (count - 1);
      indices[index++] = pos;
      indices[index] = pos + 1;
    }
  }
示例#2
0
  private int getSectionOutlineIndexCount(
      int subdivisions, boolean beginEdgeFlag, boolean endEdgeFlag) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = 4 * (gb.getSubdivisionPointsVertexCount(subdivisions) - 1);
    if (beginEdgeFlag) count += 2;
    if (endEdgeFlag) count += 2;

    return count;
  }
示例#3
0
  private void makeSectionVertices(
      DrawContext dc,
      int locationPos,
      float[] locations,
      double[] altitude,
      boolean[] terrainConformant,
      int subdivisions,
      Matrix locationTransform,
      Vec4 referenceCenter,
      int vertexPos,
      float[] vertices) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int numPoints = gb.getSubdivisionPointsVertexCount(subdivisions);

    Globe globe = dc.getGlobe();
    int index1 = 3 * locationPos;
    int index2 = 3 * (locationPos + 1);

    float[] locationVerts = new float[3 * numPoints];
    gb.makeSubdivisionPoints(
        locations[index1],
        locations[index1 + 1],
        locations[index1 + 2],
        locations[index2],
        locations[index2 + 1],
        locations[index2 + 2],
        subdivisions,
        locationVerts);

    for (int i = 0; i < numPoints; i++) {
      int index = 3 * i;
      Vec4 vec = new Vec4(locationVerts[index], locationVerts[index + 1], locationVerts[index + 2]);
      vec = vec.transformBy4(locationTransform);
      Position pos = globe.computePositionFromPoint(vec);

      for (int j = 0; j < 2; j++) {
        vec =
            this.computePointFromPosition(
                dc, pos.getLatitude(), pos.getLongitude(), altitude[j], terrainConformant[j]);

        index = 2 * i + j;
        index = 3 * (vertexPos + index);
        vertices[index] = (float) (vec.x - referenceCenter.x);
        vertices[index + 1] = (float) (vec.y - referenceCenter.y);
        vertices[index + 2] = (float) (vec.z - referenceCenter.z);
      }
    }
  }
示例#4
0
  private void makeSectionFillIndices(
      int subdivisions, int vertexPos, int indexPos, int[] indices) {
    GeometryBuilder gb = this.getGeometryBuilder();
    int count = gb.getSubdivisionPointsVertexCount(subdivisions);

    int index = indexPos;
    int pos, nextPos;
    for (int i = 0; i < count - 1; i++) {
      pos = vertexPos + 2 * i;
      nextPos = vertexPos + 2 * (i + 1);
      indices[index++] = pos + 1;
      indices[index++] = pos;
      indices[index++] = nextPos + 1;
      indices[index++] = nextPos + 1;
      indices[index++] = pos;
      indices[index++] = nextPos;
    }
  }
示例#5
0
 private int getSectionVertexCount(int subdivisions) {
   GeometryBuilder gb = this.getGeometryBuilder();
   return 2 * gb.getSubdivisionPointsVertexCount(subdivisions);
 }
示例#6
0
 private int getSectionFillIndexCount(int subdivisions) {
   GeometryBuilder gb = this.getGeometryBuilder();
   return 6 * (gb.getSubdivisionPointsVertexCount(subdivisions) - 1);
 }