本文整理汇总了Java中javax.media.j3d.PolygonAttributes.CULL_FRONT属性的典型用法代码示例。如果您正苦于以下问题:Java PolygonAttributes.CULL_FRONT属性的具体用法?Java PolygonAttributes.CULL_FRONT怎么用?Java PolygonAttributes.CULL_FRONT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.j3d.PolygonAttributes
的用法示例。
在下文中一共展示了PolygonAttributes.CULL_FRONT属性的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportTriangle
/**
* Stores in <code>verticesIndices</code> the indices vertexIndex1, vertexIndex2, vertexIndex3.
*/
private int exportTriangle(GeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3,
int[] verticesIndices, int index, float[] vertices, Set<Triangle> exportedTriangles, int cullFace)
{
if (cullFace == PolygonAttributes.CULL_FRONT)
{
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
Triangle exportedTriangle = new Triangle(vertices, vertexIndex1, vertexIndex2, vertexIndex3);
if (!exportedTriangles.contains(exportedTriangle))
{
exportedTriangles.add(exportedTriangle);
verticesIndices[index++] = vertexIndex1;
verticesIndices[index++] = vertexIndex2;
verticesIndices[index++] = vertexIndex3;
}
return index;
}
示例2: writeIndexedTriangle
/**
* Writes the triangle indices given at vertexIndex1, vertexIndex2,
* vertexIndex3, in a line f at OBJ format.
*/
private void writeIndexedTriangle(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3, int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes, boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes, boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex3)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex3)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex3)]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex3)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
writeIndexedTriangle(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null, normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}
示例3: writeTriangle
/**
* Writes the triangle indices given at vertexIndex1, vertexIndex2,
* vertexIndex3, in a line f at OBJ format.
*/
private void writeTriangle(GeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3, int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes, boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes, boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex1]) + "/" + (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex2]) + "/" + (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "/" + (normalIndexSubstitutes[vertexIndex3]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "//" + (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "//" + (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "//" + (normalIndexSubstitutes[vertexIndex3]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
writeTriangle(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null, normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}
示例4: exportIndexedTriangle
/**
* Stores in <code>verticesIndices</code> the indices given at vertexIndex1, vertexIndex2, vertexIndex3.
*/
private int exportIndexedTriangle(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2,
int vertexIndex3, int[] verticesIndices, int[] normalsIndices, int[] textureCoordinatesIndices, int index,
float[] vertices, Set<Triangle> exportedTriangles, int cullFace)
{
if (cullFace == PolygonAttributes.CULL_FRONT)
{
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
int coordinateIndex1 = geometryArray.getCoordinateIndex(vertexIndex1);
int coordinateIndex2 = geometryArray.getCoordinateIndex(vertexIndex2);
int coordinateIndex3 = geometryArray.getCoordinateIndex(vertexIndex3);
Triangle exportedTriangle = new Triangle(vertices, coordinateIndex1, coordinateIndex2, coordinateIndex3);
if (!exportedTriangles.contains(exportedTriangle))
{
exportedTriangles.add(exportedTriangle);
verticesIndices[index] = coordinateIndex1;
verticesIndices[index + 1] = coordinateIndex2;
verticesIndices[index + 2] = coordinateIndex3;
if (normalsIndices != null)
{
normalsIndices[index] = geometryArray.getNormalIndex(vertexIndex1);
normalsIndices[index + 1] = geometryArray.getNormalIndex(vertexIndex2);
normalsIndices[index + 2] = geometryArray.getNormalIndex(vertexIndex3);
}
if (textureCoordinatesIndices != null)
{
textureCoordinatesIndices[index] = geometryArray.getTextureCoordinateIndex(0, vertexIndex1);
textureCoordinatesIndices[index + 1] = geometryArray.getTextureCoordinateIndex(0, vertexIndex2);
textureCoordinatesIndices[index + 2] = geometryArray.getTextureCoordinateIndex(0, vertexIndex3);
}
return index + 3;
}
return index;
}
示例5: writeIndexedQuadrilateral
/**
* Writes the quadrilateral indices given at vertexIndex1, vertexIndex2,
* vertexIndex3, vertexIndex4, in a line f at OBJ format.
*/
private void writeIndexedQuadrilateral(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3, int vertexIndex4, int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes, boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes, boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex2;
vertexIndex2 = vertexIndex3;
vertexIndex3 = tmp;
tmp = vertexIndex1;
vertexIndex1 = vertexIndex4;
vertexIndex4 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex3)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex3)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex4)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex4)]) + "/" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex4)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex3)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex4)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex4)]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex3)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex4)]) + "//" + (normalIndexSubstitutes[geometryArray.getNormalIndex(vertexIndex4)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex3)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex4)]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
writeIndexedQuadrilateral(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4, vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null, normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}
示例6: writeQuadrilateral
/**
* Writes the quadrilateral indices given at vertexIndex1, vertexIndex2,
* vertexIndex3, vertexIndex4, in a line f at OBJ format.
*/
private void writeQuadrilateral(GeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3, int vertexIndex4, int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes, boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes, boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex2;
vertexIndex2 = vertexIndex3;
vertexIndex3 = tmp;
tmp = vertexIndex1;
vertexIndex1 = vertexIndex4;
vertexIndex4 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex1]) + "/" + (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex2]) + "/" + (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "/" + (normalIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex4]) + "/" + (normalIndexSubstitutes[vertexIndex4]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "/" + (textureCoordinatesIndexSubstitutes[vertexIndex4]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "//" + (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "//" + (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "//" + (normalIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "//" + (normalIndexSubstitutes[vertexIndex4]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
writeQuadrilateral(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4, vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null, normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}
示例7: writeIndexedTriangle
/**
* Writes the triangle indices given at vertexIndex1, vertexIndex2, vertexIndex3,
* in a line f at OBJ format.
*/
private void writeIndexedTriangle(IndexedGeometryArray geometryArray,
int vertexIndex1, int vertexIndex2, int vertexIndex3,
int [] vertexIndexSubstitutes,
int [] normalIndexSubstitutes,
int [] oppositeSideNormalIndexSubstitutes,
boolean normalsDefined,
int [] textureCoordinatesIndexSubstitutes,
boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
if (textureCoordinatesGenerated
|| (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex2)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex3)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex3)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex3)]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex3)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)]) + "\n");
}
}
// if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
// writeIndexedTriangle(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3,
// vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null,
// normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
// }
}
示例8: writeIndexedQuadrilateral
/**
* Writes the quadrilateral indices given at vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
* in a line f at OBJ format.
*/
private void writeIndexedQuadrilateral(IndexedGeometryArray geometryArray,
int vertexIndex1, int vertexIndex2, int vertexIndex3, int vertexIndex4,
int [] vertexIndexSubstitutes,
int [] normalIndexSubstitutes,
int [] oppositeSideNormalIndexSubstitutes,
boolean normalsDefined,
int [] textureCoordinatesIndexSubstitutes,
boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex2;
vertexIndex2 = vertexIndex3;
vertexIndex3 = tmp;
tmp = vertexIndex1;
vertexIndex1 = vertexIndex4;
vertexIndex4 = tmp;
}
if (textureCoordinatesGenerated
|| (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex2)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex3)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex3)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex4)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex4)])
+ "/" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex4)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex3)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex4)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex4)]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex3)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex4)])
+ "//" + (normalIndexSubstitutes [geometryArray.getNormalIndex(vertexIndex4)]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex3)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex4)]) + "\n");
}
}
// if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
// writeIndexedQuadrilateral(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
// vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null,
// normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
// }
}
示例9: writeTriangle
/**
* Writes the triangle indices given at vertexIndex1, vertexIndex2, vertexIndex3,
* in a line f at OBJ format.
*/
private void writeTriangle(GeometryArray geometryArray,
int vertexIndex1, int vertexIndex2, int vertexIndex3,
int [] vertexIndexSubstitutes,
int [] normalIndexSubstitutes,
int [] oppositeSideNormalIndexSubstitutes,
boolean normalsDefined,
int [] textureCoordinatesIndexSubstitutes,
boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
if (textureCoordinatesGenerated
|| (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex1])
+ "/" + (normalIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex2])
+ "/" + (normalIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex3])
+ "/" + (normalIndexSubstitutes [vertexIndex3]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex3]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "//" + (normalIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "//" + (normalIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "//" + (normalIndexSubstitutes [vertexIndex3]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3]) + "\n");
}
}
// if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
// writeTriangle(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3,
// vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null,
// normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
//}
}
示例10: writeQuadrilateral
/**
* Writes the quadrilateral indices given at vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
* in a line f at OBJ format.
*/
private void writeQuadrilateral(GeometryArray geometryArray,
int vertexIndex1, int vertexIndex2, int vertexIndex3, int vertexIndex4,
int [] vertexIndexSubstitutes,
int [] normalIndexSubstitutes,
int [] oppositeSideNormalIndexSubstitutes,
boolean normalsDefined,
int [] textureCoordinatesIndexSubstitutes,
boolean textureCoordinatesGenerated, int cullFace) throws IOException {
if (cullFace == PolygonAttributes.CULL_FRONT) {
// Reverse vertex order
int tmp = vertexIndex2;
vertexIndex2 = vertexIndex3;
vertexIndex3 = tmp;
tmp = vertexIndex1;
vertexIndex1 = vertexIndex4;
vertexIndex4 = tmp;
}
if (textureCoordinatesGenerated
|| (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex1])
+ "/" + (normalIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex2])
+ "/" + (normalIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex3])
+ "/" + (normalIndexSubstitutes [vertexIndex3])
+ " " + (vertexIndexSubstitutes [vertexIndex4])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex4])
+ "/" + (normalIndexSubstitutes [vertexIndex4]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex3])
+ " " + (vertexIndexSubstitutes [vertexIndex4])
+ "/" + (textureCoordinatesIndexSubstitutes [vertexIndex4]) + "\n");
}
} else {
if (normalsDefined) {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ "//" + (normalIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ "//" + (normalIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ "//" + (normalIndexSubstitutes [vertexIndex3])
+ " " + (vertexIndexSubstitutes [vertexIndex4])
+ "//" + (normalIndexSubstitutes [vertexIndex4]) + "\n");
} else {
this.out.write("f " + (vertexIndexSubstitutes [vertexIndex1])
+ " " + (vertexIndexSubstitutes [vertexIndex2])
+ " " + (vertexIndexSubstitutes [vertexIndex3])
+ " " + (vertexIndexSubstitutes [vertexIndex4]) + "\n");
}
}
// if (cullFace == PolygonAttributes.CULL_NONE) {
// Use opposite side normal index substitutes array
// writeQuadrilateral(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
// vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null,
// normalsDefined, textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
// }
}
示例11: writeTriangle
/**
* Writes the triangle indices given at vertexIndex1, vertexIndex2, vertexIndex3,
* in a line f at OBJ format.
*/
private void writeTriangle(GeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3,
int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes,
boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes, boolean textureCoordinatesGenerated,
int cullFace) throws IOException
{
if (cullFace == PolygonAttributes.CULL_FRONT)
{
// Reverse vertex order
int tmp = vertexIndex1;
vertexIndex1 = vertexIndex3;
vertexIndex3 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0)
{
if (normalsDefined)
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex1]) + "/"
+ (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex2]) + "/"
+ (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "/"
+ (normalIndexSubstitutes[vertexIndex3]) + "\n");
}
else
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex1]) + " "
+ (vertexIndexSubstitutes[vertexIndex2]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex2]) + " "
+ (vertexIndexSubstitutes[vertexIndex3]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "\n");
}
}
else
{
if (normalsDefined)
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "//"
+ (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "//"
+ (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "//"
+ (normalIndexSubstitutes[vertexIndex3]) + "\n");
}
else
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + " "
+ (vertexIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE)
{
// Use opposite side normal index substitutes array
writeTriangle(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndexSubstitutes,
oppositeSideNormalIndexSubstitutes, null, normalsDefined, textureCoordinatesIndexSubstitutes,
textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}
示例12: writeQuadrilateral
/**
* Writes the quadrilateral indices given at vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
* in a line f at OBJ format.
*/
private void writeQuadrilateral(GeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int vertexIndex3,
int vertexIndex4, int[] vertexIndexSubstitutes, int[] normalIndexSubstitutes,
int[] oppositeSideNormalIndexSubstitutes, boolean normalsDefined, int[] textureCoordinatesIndexSubstitutes,
boolean textureCoordinatesGenerated, int cullFace) throws IOException
{
if (cullFace == PolygonAttributes.CULL_FRONT)
{
// Reverse vertex order
int tmp = vertexIndex2;
vertexIndex2 = vertexIndex3;
vertexIndex3 = tmp;
tmp = vertexIndex1;
vertexIndex1 = vertexIndex4;
vertexIndex4 = tmp;
}
if (textureCoordinatesGenerated || (geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0)
{
if (normalsDefined)
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex1]) + "/"
+ (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex2]) + "/"
+ (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex3]) + "/"
+ (normalIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex4]) + "/"
+ (normalIndexSubstitutes[vertexIndex4]) + "\n");
}
else
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex1]) + " "
+ (vertexIndexSubstitutes[vertexIndex2]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex2]) + " "
+ (vertexIndexSubstitutes[vertexIndex3]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex3]) + " "
+ (vertexIndexSubstitutes[vertexIndex4]) + "/"
+ (textureCoordinatesIndexSubstitutes[vertexIndex4]) + "\n");
}
}
else
{
if (normalsDefined)
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + "//"
+ (normalIndexSubstitutes[vertexIndex1]) + " " + (vertexIndexSubstitutes[vertexIndex2]) + "//"
+ (normalIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + "//"
+ (normalIndexSubstitutes[vertexIndex3]) + " " + (vertexIndexSubstitutes[vertexIndex4]) + "//"
+ (normalIndexSubstitutes[vertexIndex4]) + "\n");
}
else
{
this.out.write("f " + (vertexIndexSubstitutes[vertexIndex1]) + " "
+ (vertexIndexSubstitutes[vertexIndex2]) + " " + (vertexIndexSubstitutes[vertexIndex3]) + " "
+ (vertexIndexSubstitutes[vertexIndex4]) + "\n");
}
}
if (cullFace == PolygonAttributes.CULL_NONE)
{
// Use opposite side normal index substitutes array
writeQuadrilateral(geometryArray, vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4,
vertexIndexSubstitutes, oppositeSideNormalIndexSubstitutes, null, normalsDefined,
textureCoordinatesIndexSubstitutes, textureCoordinatesGenerated, PolygonAttributes.CULL_FRONT);
}
}