I am using the QuadMeshFactory to generate the geometry shown in the following pictures.
The problem is that I would like to display the mesh lines (similar to wireframe, but with the faces still showing), but when I use the methods factory.setGenerateEdgesFromFaces(true); and factory.setEdgeFromQuadMesh(true); I get the following result:
[attachment=0]aircraft.jpeg[/attachment]
How can I get the mesh lines to show correctly?? And why are they so crazy?
Here is a summary of my code:
Code: Select all
ArrayList<double[][][]> l;
int t = 0;
for(int i=0; i<liftingSurfaces.size(); i++){
l = liftingSurfaces.get(i).getPanelCoords(); // get vertex coordinates
for(int j=0; j<l.size(); j++){
factory[t] = new QuadMeshFactory();
factory[t].setVLineCount(l.get(j).length);
factory[t].setULineCount(l.get(j)[0].length);
factory[t].setClosedInUDirection(false);
factory[t].setClosedInVDirection(false);
factory[t].setVertexCoordinates(l.get(j));
factory[t].setGenerateFaceNormals(true);
factory[t].setGenerateTextureCoordinates(true);
factory[t].setGenerateEdgesFromFaces(false);
factory[t].setEdgeFromQuadMesh(true); // generate "long" edges: one for each u-, v- parameter curve
factory[t].update();
faceSets[t]=factory[t].getIndexedFaceSet();
t++;
}
}
GeometryMergeFactory mergeFact = new GeometryMergeFactory();
mergeFact.setRespectFaces(true);
mergeFact.setRespectEdges(true);
mergeFact.setGenerateVertexNormals(true);
mergeFact.setGenerateFaceNormals(true);
IndexedFaceSet result = mergeFact.mergeIndexedFaceSets(faceSets);
geometryNode.setGeometry(result);
Code: Select all
Appearance ap = geometryNode.getAppearance();
ap.setAttribute(LINE_SHADER+"."+DIFFUSE_COLOR, Color.red);
ap.setAttribute(POINT_SHADER+"."+DIFFUSE_COLOR, Color.black);
ap.setAttribute(POINT_SHADER+"."+POINT_RADIUS, .1);
ap.setAttribute(CommonAttributes.LINE_WIDTH, 0.1);
ap.setAttribute(CommonAttributes.TUBE_RADIUS, 0.1);
ap.setAttribute(POLYGON_SHADER+"."+SMOOTH_SHADING, false);
// turn on transparency for faces but keep tubes and spheres opaque
ap.setAttribute(TRANSPARENCY_ENABLED, true);
ap.setAttribute(OPAQUE_TUBES_AND_SPHERES, true);
ap.setAttribute(POLYGON_SHADER+"."+TRANSPARENCY, .4);