Hi Bob, whoa, that great. I think this deserves an option (set cartoonsElliptical true/false) and not be limited to such high hermiteLevels. I would need some time to figure out how to add such an option, though I would tackle it. Let me now. Attached is a patch that enable the seam adjusting for nucleic cartoons. Also I think renderMesh is unnecessarily called twice. The seam adjusting does not work when exporting to e.g. .obj or .pov, but I did not figure out why :-( Alexander |
### Eclipse Workspace Patch 1.0 #P Jmol3 Index: src/org/jmol/renderbio/BioShapeRenderer.java =================================================================== --- src/org/jmol/renderbio/BioShapeRenderer.java (revision 17642) +++ src/org/jmol/renderbio/BioShapeRenderer.java (working copy) @@ -62,7 +62,7 @@ private Mesh[] meshes; private boolean[] meshReady; - private BitSet bsRenderMesh; + protected BitSet bsRenderMesh; protected int monomerCount; @@ -106,7 +106,7 @@ val = (val <= 0 ? -val : viewer.getInMotion() ? 0 : val); if (val != hermiteLevel && val != 0) invalidateMesh = true; - hermiteLevel = Math.min(val, 8); + hermiteLevel = Math.min(val, 12); // increased max value - probably only reasonable for export. AR if (hermiteLevel == 0) aspectRatio = 0; @@ -131,7 +131,7 @@ if (bioShape.monomerCount >= 2 && initializePolymer(bioShape)) { bsRenderMesh.clearAll(); renderBioShape(bioShape); - renderMeshes(); + //renderMeshes(); // that's not necessary, or is it? AR freeTempArrays(); } } @@ -627,8 +627,9 @@ void adjustCartoonSeamNormals(int i, int nPer) { if (bsTemp == null) bsTemp = Normix.newVertexBitSet(); + // non nucleic, rendering direction from monomerCount-1 to 0 if (i == iNext - 1 && iNext < monomerCount - && monomers[i].getStrucNo() == monomers[iNext].getStrucNo() + && monomers[i].getStrucNo() == monomers[iNext].getStrucNo() && meshReady[i] && meshReady[iNext]) { try { Vector3f[] normals2 = meshes[iNext].getNormalsTemp(); @@ -642,10 +643,26 @@ } } catch (Exception e) { } + // nucleic, reversed rendering direction + }else if(i == iPrev + 1 && iPrev < monomerCount + && monomers[i].isNucleic() && monomers[iPrev].isNucleic() + && meshReady[i] && meshReady[iPrev]) { + try { + Vector3f[] normals2 = meshes[iPrev].getNormalsTemp(); + Vector3f[] normals = meshes[i].getNormalsTemp(); + int normixCount = normals.length; + for (int j = 1; j <= nPer; ++j) { + norml.add2(normals[nPer - j], normals2[normixCount - j]); + norml.normalize(); + meshes[i].normalsTemp[nPer - j].setT(norml); + meshes[iPrev].normalsTemp[normixCount - j].setT(norml); + } + } catch (Exception e) { + } } } - private void renderMeshes() { + protected void renderMeshes() { for (int i = bsRenderMesh.nextSetBit(0); i >= 0; i = bsRenderMesh .nextSetBit(i + 1)) { if (meshes[i].normalsTemp != null) { Index: src/org/jmol/renderbio/CartoonRenderer.java =================================================================== --- src/org/jmol/renderbio/CartoonRenderer.java (revision 17637) +++ src/org/jmol/renderbio/CartoonRenderer.java (working copy) @@ -85,6 +85,7 @@ colixHoogsteenEdge = Colix.getColixTranslucent(Colix.BLUE, isTranslucent, tl); } boolean isTraceAlpha = viewer.getTraceAlpha(); + bsRenderMesh.clearAll(); for (int i = bsVisible.nextSetBit(0); i >= 0; i = bsVisible .nextSetBit(i + 1)) { if (isTraceAlpha) { @@ -100,6 +101,7 @@ if (g3d.setColix(colix)) renderNucleicBaseStep((NucleicMonomer) monomers[i], mads[i], ptConnect); } + renderMeshes(); } @Override
Am 08.10.2012 um 14:19 schrieb Robert Hanson: Alexander, |
------------------------------------------------------------------------------ Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev
_______________________________________________ Jmol-developers mailing list Jmol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-developers