示例#1
0
  private void makeEdge(
      DrawContext dc,
      int count,
      float[] locations,
      Boolean[] edgeFlags,
      double[] altitudes,
      boolean[] terrainConformant,
      int subdivisions,
      int orientation,
      Matrix locationTransform,
      Vec4 referenceCenter,
      int fillIndexPos,
      int[] fillIndices,
      int outlineIndexPos,
      int[] outlineIndices,
      int vertexPos,
      float[] vertices,
      float[] normals) {
    GeometryBuilder gb = this.getGeometryBuilder();
    gb.setOrientation(orientation);

    int sectionFillIndexCount = this.getSectionFillIndexCount(subdivisions);
    int sectionVertexCount = this.getSectionVertexCount(subdivisions);

    for (int i = 0; i < count - 1; i++) {
      boolean beginEdgeFlag = edgeFlags[i];
      boolean endEdgeFlag = edgeFlags[i + 1];

      this.makeSectionFillIndices(subdivisions, vertexPos, fillIndexPos, fillIndices);
      this.makeSectionOutlineIndices(
          subdivisions, vertexPos, outlineIndexPos, outlineIndices, beginEdgeFlag, endEdgeFlag);
      this.makeSectionVertices(
          dc,
          i,
          locations,
          altitudes,
          terrainConformant,
          subdivisions,
          locationTransform,
          referenceCenter,
          vertexPos,
          vertices);
      gb.makeIndexedTriangleArrayNormals(
          fillIndexPos,
          sectionFillIndexCount,
          fillIndices,
          vertexPos,
          sectionVertexCount,
          vertices,
          normals);

      fillIndexPos += sectionFillIndexCount;
      outlineIndexPos += this.getSectionOutlineIndexCount(subdivisions, beginEdgeFlag, endEdgeFlag);
      vertexPos += sectionVertexCount;
    }
  }
示例#2
0
  private void makeCap(
      DrawContext dc,
      GeometryBuilder.IndexedTriangleArray ita,
      double altitude,
      boolean terrainConformant,
      int orientation,
      Matrix locationTransform,
      Vec4 referenceCenter,
      int indexPos,
      int[] indices,
      int vertexPos,
      float[] vertices,
      float[] normals) {
    GeometryBuilder gb = this.getGeometryBuilder();
    Globe globe = dc.getGlobe();

    int indexCount = ita.getIndexCount();
    int vertexCount = ita.getVertexCount();
    int[] locationIndices = ita.getIndices();
    float[] locationVerts = ita.getVertices();

    this.copyIndexArray(
        indexCount,
        (orientation == GeometryBuilder.INSIDE),
        locationIndices,
        vertexPos,
        indexPos,
        indices);

    for (int i = 0; i < vertexCount; 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);
      vec =
          this.computePointFromPosition(
              dc, pos.getLatitude(), pos.getLongitude(), altitude, terrainConformant);

      index = 3 * (vertexPos + i);
      vertices[index] = (float) (vec.x - referenceCenter.x);
      vertices[index + 1] = (float) (vec.y - referenceCenter.y);
      vertices[index + 2] = (float) (vec.z - referenceCenter.z);
    }

    gb.makeIndexedTriangleArrayNormals(
        indexPos, indexCount, indices, vertexPos, vertexCount, vertices, normals);
  }