本文整理汇总了Java中javax.media.j3d.PolygonAttributes.CULL_NONE属性的典型用法代码示例。如果您正苦于以下问题:Java PolygonAttributes.CULL_NONE属性的具体用法?Java PolygonAttributes.CULL_NONE怎么用?Java PolygonAttributes.CULL_NONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类javax.media.j3d.PolygonAttributes
的用法示例。
在下文中一共展示了PolygonAttributes.CULL_NONE属性的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: writeNormal
/**
* Applies to <code>normal</code> the given transformation, and appends to
* <code>normalsBuffer</code> its values in a line vn at OBJ format, if the
* normal wasn't written yet.
*
* @return <code>true</code> if the written normal doens't contain any NaN
* value
*/
private boolean writeNormal(StringBuilder normalsBuffer, Transform3D transformationToParent, Vector3f normal, int index, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes, List<Vector3f> addedNormals, int cullFace, boolean backFaceNormalFlip) throws IOException {
if (Float.isNaN(normal.x) || Float.isNaN(normal.y) || Float.isNaN(normal.z)) {
return false;
}
if (backFaceNormalFlip) {
normal.negate();
}
if (normal.x != 0 || normal.y != 0 || normal.z != 0) {
transformationToParent.transform(normal);
normal.normalize();
}
Integer normalIndex = this.normalIndices.get(normal);
if (normalIndex == null) {
normalIndexSubstitutes[index] = this.normalIndices.size() + 1;
this.normalIndices.put(normal, normalIndexSubstitutes[index]);
addedNormals.add(normal);
// Write only once unique normals
normalsBuffer.append("vn " + format(normal.x) + " " + format(normal.y) + " " + format(normal.z) + "\n");
} else {
normalIndexSubstitutes[index] = normalIndex;
}
if (cullFace == PolygonAttributes.CULL_NONE) {
Vector3f oppositeNormal = new Vector3f();
oppositeNormal.negate(normal);
// Fill opposite side normal index substitutes array
return writeNormal(normalsBuffer, transformationToParent, oppositeNormal, index, oppositeSideNormalIndexSubstitutes, null, addedNormals, PolygonAttributes.CULL_FRONT, false);
} else {
return true;
}
}
示例4: 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);
}
}
示例5: 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);
}
}
示例6: setCullFace
/**
* Sets the cull face of all <code>Shape3D</code> children nodes of <code>node</code>.
* @param cullFace <code>PolygonAttributes.CULL_FRONT</code> or <code>PolygonAttributes.CULL_BACK</code>
*/
private void setCullFace(Node node, boolean mirrored, boolean backFaceShown)
{
if (node instanceof Group)
{
// Set cull face of all children
Enumeration<?> enumeration = ((Group) node).getAllChildren();
while (enumeration.hasMoreElements())
{
setCullFace((Node) enumeration.nextElement(), mirrored, backFaceShown);
}
}
else if (node instanceof Link)
{
setCullFace(((Link) node).getSharedGroup(), mirrored, backFaceShown);
}
else if (node instanceof Shape3D)
{
Appearance appearance = ((Shape3D) node).getAppearance();
if (appearance == null)
{
appearance = createAppearanceWithChangeCapabilities();
((Shape3D) node).setAppearance(appearance);
}
PolygonAttributes polygonAttributes = appearance.getPolygonAttributes();
if (polygonAttributes == null)
{
polygonAttributes = createPolygonAttributesWithChangeCapabilities();
appearance.setPolygonAttributes(polygonAttributes);
}
// Change cull face
try
{
int cullFace = polygonAttributes.getCullFace();
if (cullFace != PolygonAttributes.CULL_NONE)
{
Integer defaultCullFace = (Integer) polygonAttributes.getUserData();
if (defaultCullFace == null)
{
polygonAttributes.setUserData(defaultCullFace = cullFace);
}
polygonAttributes
.setCullFace((mirrored ^ backFaceShown ^ defaultCullFace == PolygonAttributes.CULL_FRONT)
? PolygonAttributes.CULL_FRONT : PolygonAttributes.CULL_BACK);
}
}
catch (CapabilityNotSetException ex)
{
// Shouldn't happen since capability is set but happens though with Java 3D 1.3
ex.printStackTrace();
}
}
}
示例7: writeNormal
/**
* Applies to <code>normal</code> the given transformation, and appends to <code>normalsBuffer</code>
* its values in a line vn at OBJ format, if the normal wasn't written yet.
* @return <code>true</code> if the written normal doens't contain any NaN value
*/
private boolean writeNormal(StringBuilder normalsBuffer, Transform3D transformationToParent, Vector3f normal,
int index, int[] normalIndexSubstitutes, int[] oppositeSideNormalIndexSubstitutes,
List<Vector3f> addedNormals, int cullFace, boolean backFaceNormalFlip) throws IOException
{
if (Float.isNaN(normal.x) || Float.isNaN(normal.y) || Float.isNaN(normal.z))
{
return false;
}
if (backFaceNormalFlip)
{
normal.negate();
}
if (normal.x != 0 || normal.y != 0 || normal.z != 0)
{
transformationToParent.transform(normal);
normal.normalize();
}
Integer normalIndex = this.normalIndices.get(normal);
if (normalIndex == null)
{
normalIndexSubstitutes[index] = this.normalIndices.size() + 1;
this.normalIndices.put(normal, normalIndexSubstitutes[index]);
addedNormals.add(normal);
// Write only once unique normals
normalsBuffer.append("vn " + format(normal.x) + " " + format(normal.y) + " " + format(normal.z) + "\n");
}
else
{
normalIndexSubstitutes[index] = normalIndex;
}
if (cullFace == PolygonAttributes.CULL_NONE)
{
Vector3f oppositeNormal = new Vector3f();
oppositeNormal.negate(normal);
// Fill opposite side normal index substitutes array
return writeNormal(normalsBuffer, transformationToParent, oppositeNormal, index,
oppositeSideNormalIndexSubstitutes, null, addedNormals, PolygonAttributes.CULL_FRONT, false);
}
else
{
return true;
}
}
示例8: 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);
}
}
示例9: 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);
}
}