Skip to content

Commit

Permalink
Bug 1339 - Support for Vertex Attributes in GeometryInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
phil committed Nov 2, 2016
1 parent 15b36a6 commit 5c91b50
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions src/main/java/org/jogamp/java3d/utils/geometry/GeometryInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ public class GeometryInfo {

private boolean coordOnly = false;

private int vertexAttrCount = 0;

private int[] vertexAttrSizes = null;


/**
Expand Down Expand Up @@ -1513,6 +1516,11 @@ public void setContourCounts(int contourCounts[])
this.contourCounts = contourCounts;
} // End of setContourCounts

public void setVertexAttributes(int vertexAttrCount, int[] vertexAttrSizes)
{
this.vertexAttrCount = vertexAttrCount;
this.vertexAttrSizes = vertexAttrSizes;
}


/**
Expand Down Expand Up @@ -2169,6 +2177,9 @@ else if (texCoordDim == 3)
vertexFormat |= GeometryArray.TEXTURE_COORDINATE_3;
else if (texCoordDim == 4)
vertexFormat |= GeometryArray.TEXTURE_COORDINATE_4;

if (vertexAttrCount > 0)
vertexFormat |= GeometryArray.VERTEX_ATTRIBUTES;

return vertexFormat;
} // End of getVertexFormat
Expand Down Expand Up @@ -2566,26 +2577,26 @@ public GeometryArray getGeometryArray(boolean byRef, boolean interleaved,
switch (prim) {
case TRIANGLE_ARRAY:
TriangleArray ta = new TriangleArray(vertexCount, vertexFormat,
texCoordSetCount, texCoordSetMap);
texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes);
ga = (GeometryArray)ta;
break;

case QUAD_ARRAY:
QuadArray qa = new QuadArray(vertexCount, vertexFormat,
texCoordSetCount, texCoordSetMap);
texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes);
ga = (GeometryArray)qa;
break;

case TRIANGLE_STRIP_ARRAY:
TriangleStripArray tsa = new TriangleStripArray(vertexCount,
vertexFormat, texCoordSetCount, texCoordSetMap,
vertexFormat, texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes,
stripCounts);
ga = (GeometryArray)tsa;
break;

case TRIANGLE_FAN_ARRAY:
TriangleFanArray tfa = new TriangleFanArray(vertexCount,
vertexFormat, texCoordSetCount, texCoordSetMap,
vertexFormat, texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes,
stripCounts);
ga = (GeometryArray)tfa;
break;
Expand Down Expand Up @@ -2745,28 +2756,28 @@ public IndexedGeometryArray getIndexedGeometryArray(boolean compact,
switch (prim) {
case TRIANGLE_ARRAY:
IndexedTriangleArray ta = new IndexedTriangleArray(vertexCount,
vertexFormat, texCoordSetCount, texCoordSetMap,
vertexFormat, texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes,
coordinateIndices.length);
ga = (IndexedGeometryArray)ta;
break;

case QUAD_ARRAY:
IndexedQuadArray qa = new IndexedQuadArray(vertexCount,
vertexFormat, texCoordSetCount, texCoordSetMap,
vertexFormat, texCoordSetCount, texCoordSetMap, vertexAttrCount, vertexAttrSizes,
coordinateIndices.length);
ga = (IndexedGeometryArray)qa;
break;
case TRIANGLE_STRIP_ARRAY:
IndexedTriangleStripArray tsa = new IndexedTriangleStripArray(
vertexCount, vertexFormat, texCoordSetCount,
texCoordSetMap, coordinateIndices.length, stripCounts);
texCoordSetMap, vertexAttrCount, vertexAttrSizes, coordinateIndices.length, stripCounts);
ga = (IndexedGeometryArray)tsa;
break;

case TRIANGLE_FAN_ARRAY:
IndexedTriangleFanArray tfa = new IndexedTriangleFanArray(
vertexCount, vertexFormat, texCoordSetCount,
texCoordSetMap, coordinateIndices.length, stripCounts);
texCoordSetMap, vertexAttrCount, vertexAttrSizes, coordinateIndices.length, stripCounts);
ga = (IndexedGeometryArray)tfa;
break;
}
Expand Down

0 comments on commit 5c91b50

Please sign in to comment.