本文整理汇总了Java中javax.media.j3d.IndexedGeometryArray类的典型用法代码示例。如果您正苦于以下问题:Java IndexedGeometryArray类的具体用法?Java IndexedGeometryArray怎么用?Java IndexedGeometryArray使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IndexedGeometryArray类属于javax.media.j3d包,在下文中一共展示了IndexedGeometryArray类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeIndexedLine
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Writes the line indices given at vertexIndex1, vertexIndex2,
* in a line l at OBJ format.
*/
private void writeIndexedLine(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2,
int[] vertexIndexSubstitutes, int[] textureCoordinatesIndexSubstitutes) throws IOException
{
if ((geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0)
{
this.out.write("l " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/"
+ (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/"
+ (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)])
+ "\n");
}
else
{
this.out.write("l " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + " "
+ (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "\n");
}
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:22,代码来源:OBJWriter.java
示例2: writeIndexedTriangle
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:nerdouille,项目名称:silvie,代码行数:30,代码来源:OBJWriter.java
示例3: copyCoordinateIndices
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Copies the coordinate indices out of an IndexedGeometryArray, whether they're stored by reference or not.
*
* @param array
* @return
*/
public static int[ ] copyCoordinateIndices( IndexedGeometryArray array )
{
int[ ] coordinateIndices = null;
final int format = array.getVertexFormat( );
if( ( format & GeometryArray.BY_REFERENCE_INDICES ) > 0 )
{
coordinateIndices = array.getCoordIndicesRef( ).clone( );
}
else
{
coordinateIndices = new int[ array.getIndexCount( ) ];
array.getCoordinateIndices( 0 , coordinateIndices );
}
return coordinateIndices;
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:24,代码来源:J3DUtils.java
示例4: copyNormalIndices
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Copies the normal indices out of an IndexedGeometryArray, whether they're stored by reference or not.
*
* @param array
* @return
*/
public static int[ ] copyNormalIndices( IndexedGeometryArray array )
{
int[ ] normalIndices = null;
final int format = array.getVertexFormat( );
if( ( format & GeometryArray.BY_REFERENCE_INDICES ) > 0 && ( format & GeometryArray.USE_COORD_INDEX_ONLY ) > 0 )
{
normalIndices = array.getCoordIndicesRef( ).clone( );
}
else
{
normalIndices = new int[ array.getIndexCount( ) ];
array.getNormalIndices( 0 , normalIndices );
}
return normalIndices;
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:24,代码来源:J3DUtils.java
示例5: visualizeNormals
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
public static Shape3D visualizeNormals( Shape3D shape , float scale , boolean local , Appearance app )
{
final GeometryArray geomArray = ( GeometryArray ) shape.getGeometry( );
LineArray rendered;
if( geomArray instanceof IndexedGeometryArray )
{
final IndexedGeometryArray indexedGeomArray = ( IndexedGeometryArray ) geomArray;
rendered = renderNormals( indexedGeomArray , scale );
}
else
{
rendered = renderNormals( geomArray , scale );
}
if( !local )
{
final Transform3D localToVworld = new Transform3D( );
shape.getLocalToVworld( localToVworld );
transformCoordinates( rendered , localToVworld );
}
return new Shape3D( rendered , app );
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:26,代码来源:J3DUtils.java
示例6: writeIndexedLine
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Writes the line indices given at vertexIndex1, vertexIndex2,
* in a line l at OBJ format.
*/
private void writeIndexedLine(IndexedGeometryArray geometryArray,
int vertexIndex1, int vertexIndex2,
int [] vertexIndexSubstitutes,
int [] textureCoordinatesIndexSubstitutes) throws IOException {
if ((geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
this.out.write("l " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)])
+ "/" + (textureCoordinatesIndexSubstitutes [geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + "\n");
} else {
this.out.write("l " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex1)])
+ " " + (vertexIndexSubstitutes [geometryArray.getCoordinateIndex(vertexIndex2)]) + "\n");
}
}
开发者ID:IGNF,项目名称:geoxygene,代码行数:19,代码来源:OBJWriter.java
示例7: addIndexedTriangleToPath
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Adds to <code>nodePath</code> the triangle joining vertices at
* vertexIndex1, vertexIndex2, vertexIndex3 indices.
*/
private void addIndexedTriangleToPath(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2,
int vertexIndex3, float[] vertices, GeneralPath geometryPath, int triangleIndex, Area nodeArea)
{
addTriangleToPath(geometryArray, geometryArray.getCoordinateIndex(vertexIndex1),
geometryArray.getCoordinateIndex(vertexIndex2), geometryArray.getCoordinateIndex(vertexIndex3),
vertices, geometryPath, triangleIndex, nodeArea);
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:12,代码来源:ModelManager.java
示例8: addIndexedQuadrilateralToPath
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Adds to <code>nodePath</code> the quadrilateral joining vertices at
* vertexIndex1, vertexIndex2, vertexIndex3, vertexIndex4 indices.
*/
private void addIndexedQuadrilateralToPath(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2,
int vertexIndex3, int vertexIndex4, float[] vertices, GeneralPath geometryPath, int quadrilateralIndex,
Area nodeArea)
{
addQuadrilateralToPath(geometryArray, geometryArray.getCoordinateIndex(vertexIndex1),
geometryArray.getCoordinateIndex(vertexIndex2), geometryArray.getCoordinateIndex(vertexIndex3),
geometryArray.getCoordinateIndex(vertexIndex4), vertices, geometryPath, quadrilateralIndex, nodeArea);
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:13,代码来源:ModelManager.java
示例9: exportIndexedLine
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Stores in <code>verticesIndices</code> the indices given at vertexIndex1, vertexIndex2.
*/
private void exportIndexedLine(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2,
int[] verticesIndices, int index)
{
verticesIndices[index++] = geometryArray.getCoordinateIndex(vertexIndex1);
verticesIndices[index] = geometryArray.getCoordinateIndex(vertexIndex2);
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:10,代码来源:PhotoRenderer.java
示例10: exportIndexedTriangle
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* 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;
}
开发者ID:valsr,项目名称:SweetHome3D,代码行数:42,代码来源:PhotoRenderer.java
示例11: writeIndexedLine
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* Writes the line indices given at vertexIndex1, vertexIndex2, in a line l
* at OBJ format.
*/
private void writeIndexedLine(IndexedGeometryArray geometryArray, int vertexIndex1, int vertexIndex2, int[] vertexIndexSubstitutes, int[] textureCoordinatesIndexSubstitutes) throws IOException {
if ((geometryArray.getVertexFormat() & GeometryArray.TEXTURE_COORDINATE_2) != 0) {
this.out.write("l " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "/" + (textureCoordinatesIndexSubstitutes[geometryArray.getTextureCoordinateIndex(0, vertexIndex2)]) + "\n");
} else {
this.out.write("l " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex1)]) + " " + (vertexIndexSubstitutes[geometryArray.getCoordinateIndex(vertexIndex2)]) + "\n");
}
}
开发者ID:nerdouille,项目名称:silvie,代码行数:12,代码来源:OBJWriter.java
示例12: writeIndexedQuadrilateral
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* 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);
}
}
开发者ID:nerdouille,项目名称:silvie,代码行数:33,代码来源:OBJWriter.java
示例13: renderNormals
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
public static LineArray renderNormals( IndexedGeometryArray array , float scale )
{
final Point3f[ ] coordinates = copyCoordinates3f( array );
final Vector3f[ ] normals = copyNormals3f( array );
final int[ ] coordinateIndices = copyCoordinateIndices( array );
final int[ ] normalIndices = copyNormalIndices( array );
if( coordinates == null || normals == null || coordinateIndices == null || normalIndices == null )
{
throw new IllegalArgumentException( "Unable to get necessary information from the geometry" );
}
final int vertexCount = coordinateIndices.length * 2;
final Point3f temp = new Point3f( );
final LineArray result = new LineArray( vertexCount , GeometryArray.COORDINATES );
int k = 0;
for( int i = 0 ; i < coordinateIndices.length ; i++ )
{
final Point3f coordinate = coordinates[ coordinateIndices[ i ] ];
final Vector3f normal = normals[ normalIndices[ i ] ];
result.setCoordinate( k++ , coordinate );
temp.scaleAdd( scale , normal , coordinate );
result.setCoordinate( k++ , temp );
}
return result;
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:30,代码来源:J3DUtils.java
示例14: renderFronts
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
public static LineArray renderFronts( Shape3D shape , float scale )
{
Geometry geom = shape.getGeometry( );
if( geom instanceof IndexedGeometryArray )
{
return renderFronts( ( IndexedGeometryArray ) geom , scale );
}
else if( geom instanceof GeometryArray )
{
return renderFronts( ( GeometryArray ) geom , scale );
}
return null;
}
开发者ID:jedwards1211,项目名称:breakout,代码行数:15,代码来源:J3DUtils.java
示例15: writeIndexedTriangle
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* 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);
// }
}
开发者ID:IGNF,项目名称:geoxygene,代码行数:62,代码来源:OBJWriter.java
示例16: writeIndexedQuadrilateral
import javax.media.j3d.IndexedGeometryArray; //导入依赖的package包/类
/**
* 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);
// }
}
开发者ID:IGNF,项目名称:geoxygene,代码行数:73,代码来源:OBJWriter.java
注:本文中的javax.media.j3d.IndexedGeometryArray类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论