Revision: 18322 http://sourceforge.net/p/jmol/code/18322 Author: hansonr Date: 2013-06-12 03:17:30 +0000 (Wed, 12 Jun 2013) Log Message: ----------- ___version=13.0.17_dev_2013.06.11
bug fix: draw LINEDATA not operative (undocumented, for state; from draw xxx INTERSECT yyy) Modified Paths: -------------- trunk/Jmol/src/org/jmol/render/MeshRenderer.java trunk/Jmol/src/org/jmol/rendersurface/IsosurfaceRenderer.java trunk/Jmol/src/org/jmol/shape/Mesh.java trunk/Jmol/src/org/jmol/shape/MeshCollection.java trunk/Jmol/src/org/jmol/shapespecial/Draw.java trunk/Jmol/src/org/jmol/util/MeshSurface.java trunk/Jmol/src/org/jmol/util/P4.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/render/MeshRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/render/MeshRenderer.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/render/MeshRenderer.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -57,8 +57,8 @@ protected boolean frontOnly; protected boolean antialias; protected boolean haveBsDisplay; - protected boolean haveBsSlabDisplay; - protected boolean haveBsSlabGhost; + protected boolean selectedPolyOnly; + protected boolean isGhostPass; protected P4 thePlane; protected P3 latticeOffset = new P3(); @@ -133,7 +133,7 @@ private boolean doRender; protected boolean volumeRender; - protected BS bsSlab; + protected BS bsPolygons; private boolean setVariables() { @@ -141,19 +141,20 @@ return false; if (mesh.bsSlabGhost != null) g3d.setColix(mesh.slabColix); // forces a second pass - haveBsSlabGhost = (mesh.bsSlabGhost != null && (isExport ? exportPass == 2 + isGhostPass = (mesh.bsSlabGhost != null && (isExport ? exportPass == 2 : g3d.isPass2())); - isTranslucent = haveBsSlabGhost + isTranslucent = isGhostPass || C.isColixTranslucent(mesh.colix); if (isTranslucent || volumeRender || mesh.bsSlabGhost != null) needTranslucent = true; doRender = (setColix(mesh.colix) || mesh.showContourLines); - if (!doRender || haveBsSlabGhost && !(doRender = g3d.setColix(mesh.slabColix))) { + if (!doRender || isGhostPass && !(doRender = g3d.setColix(mesh.slabColix))) { vertices = mesh.vertices; return true; } vertices = (mesh.scale3d == 0 && mesh.mat4 == null ? mesh.vertices : mesh.getOffsetVertices(thePlane)); if (mesh.lineData == null) { + // not a draw if ((vertexCount = mesh.vertexCount) == 0) return false; normixes = mesh.normixes; @@ -161,13 +162,15 @@ return false; // this can happen when user switches windows // during a surface calculation - haveBsDisplay = (mesh.bsDisplay != null); - haveBsSlabDisplay = (haveBsSlabGhost || mesh.bsSlabDisplay != null); - bsSlab = (haveBsSlabGhost ? mesh.bsSlabGhost - : haveBsSlabDisplay ? mesh.bsSlabDisplay : null); + // mesh.bsSlabDisplay is a temporary slab effect + // that is reversible; these are the polygons to display + selectedPolyOnly = (isGhostPass || mesh.bsSlabDisplay != null); + bsPolygons = (isGhostPass ? mesh.bsSlabGhost + : selectedPolyOnly ? mesh.bsSlabDisplay : null); + frontOnly = !viewer.getSlabEnabled() && mesh.frontOnly - && !mesh.isTwoSided && !haveBsSlabDisplay; + && !mesh.isTwoSided && !selectedPolyOnly; screens = viewer.allocTempScreens(vertexCount); if (frontOnly) transformedVectors = g3d.getTransformedVertexVectors(); @@ -178,7 +181,7 @@ } protected boolean setColix(short colix) { - if (haveBsSlabGhost) + if (isGhostPass) return true; if (volumeRender && !isTranslucent) colix = C.getColixTranslucent3(colix, true, 0.8f); @@ -207,13 +210,13 @@ } protected void render2b(boolean generateSet) { - if (!g3d.setColix(haveBsSlabGhost ? mesh.slabColix : colix)) + if (!g3d.setColix(isGhostPass ? mesh.slabColix : colix)) return; if (mesh.showPoints || mesh.polygonCount == 0) renderPoints(); - if (haveBsSlabGhost ? mesh.slabMeshType == T.mesh : mesh.drawTriangles) + if (isGhostPass ? mesh.slabMeshType == T.mesh : mesh.drawTriangles) renderTriangles(false, mesh.showTriangles, false); - if (haveBsSlabGhost ? mesh.slabMeshType == T.fill : mesh.fillTriangles) + if (isGhostPass ? mesh.slabMeshType == T.fill : mesh.fillTriangles) renderTriangles(true, mesh.showTriangles, generateSet); } @@ -246,18 +249,18 @@ g3d.fillSphereI(4, screens[i]); } - protected BS bsPolygons = new BS(); + protected BS bsPolygonsToExport = new BS(); protected void renderTriangles(boolean fill, boolean iShowTriangles, boolean generateSet) { int[][] polygonIndexes = mesh.polygonIndexes; - colix = (haveBsSlabGhost ? mesh.slabColix : mesh.colix); + colix = (isGhostPass ? mesh.slabColix : mesh.colix); // vertexColixes are only isosurface properties of IsosurfaceMesh, not Mesh g3d.setColix(colix); if (generateSet) { if (frontOnly && fill) frontOnly = false; - bsPolygons.clearAll(); + bsPolygonsToExport.clearAll(); } for (int i = mesh.polygonCount; --i >= 0;) { if (!isPolygonDisplayable(i)) @@ -318,7 +321,7 @@ case 3: if (fill) { if (generateSet) { - bsPolygons.set(i); + bsPolygonsToExport.set(i); continue; } if (iShowTriangles) { @@ -339,7 +342,7 @@ continue; if (fill) { if (generateSet) { - bsPolygons.set(i); + bsPolygonsToExport.set(i); continue; } g3d.fillQuadrilateral3i(screens[iA], colix, nA, screens[iB], colix, nB, @@ -426,7 +429,7 @@ protected void exportSurface(short colix) { mesh.normals = mesh.getNormals(vertices, null); - mesh.bsPolygons = bsPolygons; + mesh.bsPolygons = bsPolygonsToExport; mesh.offset = latticeOffset; g3d.drawSurface(mesh, colix); mesh.normals = null; Modified: trunk/Jmol/src/org/jmol/rendersurface/IsosurfaceRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/rendersurface/IsosurfaceRenderer.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/rendersurface/IsosurfaceRenderer.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -23,9 +23,6 @@ */ package org.jmol.rendersurface; - - - import org.jmol.jvxl.data.JvxlCoder; import org.jmol.jvxl.readers.Parameters; import org.jmol.render.MeshRenderer; @@ -67,7 +64,9 @@ iShowNormals = viewer.getTestFlag(4); showNumbers = viewer.getTestFlag(3); isosurface = (Isosurface) shape; - exportPass = (isExport ? 2 : 0); + // exporters will do two passes here if there is translucency + // first pass is #2 (translucent), then #1 (opaque). + exportPass = (isExport ? 2 : 0); isNavigationMode = viewer.getBoolean(T.navigationmode); int mySlabValue = Integer.MAX_VALUE; int slabValue = g3d.getSlab(); @@ -84,7 +83,7 @@ if (renderMeshSlab(mySlabValue, slabValue)) { if (!isExport) renderInfo(); - if (isExport && haveBsSlabGhost) { + if (isExport && isGhostPass) { exportPass = 1; renderMeshSlab(mySlabValue, slabValue); exportPass = 2; @@ -274,7 +273,7 @@ try { if (volumeRender) g3d.volumeRender(true); - boolean slabPoints = ((volumeRender || imesh.polygonCount == 0) && haveBsSlabDisplay); + boolean slabPoints = ((volumeRender || imesh.polygonCount == 0) && selectedPolyOnly); int incr = imesh.vertexIncrement; int diam; if (imesh.diameter <= 0) { @@ -297,7 +296,7 @@ && imesh.vertexSets[i] != imesh.jvxlData.thisSet || !imesh.isColorSolid && imesh.vertexColixes != null && !setColix(imesh.vertexColixes[i]) || haveBsDisplay && !imesh.bsDisplay.get(i) - || slabPoints && !bsSlab.get(i)) + || slabPoints && !bsPolygons.get(i)) continue; hasColorRange = true; // maybe if (showNumbers && screens[i].z > 10 @@ -346,7 +345,7 @@ protected void renderTriangles(boolean fill, boolean iShowTriangles, boolean isExport) { int[][] polygonIndexes = imesh.polygonIndexes; - colix = (haveBsSlabGhost ? imesh.slabColix + colix = (isGhostPass ? imesh.slabColix : !fill && imesh.meshColix != 0 ? imesh.meshColix : imesh.colix); short[] vertexColixes = (!fill && imesh.meshColix != 0 ? null : imesh.vertexColixes); @@ -356,14 +355,14 @@ if (generateSet) { if (frontOnly && fill) frontOnly = false; - bsPolygons.clearAll(); + bsPolygonsToExport.clearAll(); } if (exportType == GData.EXPORT_CARTESIAN) { frontOnly = false; } - boolean colorSolid = (haveBsSlabGhost && (!isBicolorMap) + boolean colorSolid = (isGhostPass && (!isBicolorMap) || vertexColixes == null || imesh.isColorSolid); - boolean noColor = (haveBsSlabGhost && !isBicolorMap + boolean noColor = (isGhostPass && !isBicolorMap || vertexColixes == null || !fill && imesh.meshColix != 0); boolean isPlane = (imesh.jvxlData.jvxlPlane != null); short colix = this.colix; @@ -386,7 +385,7 @@ hasColorRange = !colorSolid && !isBicolorMap; for (int i = imesh.polygonCount; --i >= 0;) { int[] polygon = polygonIndexes[i]; - if (polygon == null || haveBsSlabDisplay && !bsSlab.get(i)) + if (polygon == null || selectedPolyOnly && !bsPolygons.get(i)) continue; int iA = polygon[0]; int iB = polygon[1]; @@ -420,7 +419,7 @@ if (isBicolorMap) { if (colixA != colixB || colixB != colixC) continue; - if (haveBsSlabGhost) + if (isGhostPass) colixA = colixB = colixC = C.copyColixTranslucency( imesh.slabColix, colixA); } @@ -438,7 +437,7 @@ } if (fill) { if (generateSet) { - bsPolygons.set(i); + bsPolygonsToExport.set(i); continue; } if (iB == iC) { Modified: trunk/Jmol/src/org/jmol/shape/Mesh.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/Mesh.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/shape/Mesh.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -129,9 +129,9 @@ bsDisplay = null; bsSlabDisplay = null; bsSlabGhost = null; + bsTransPolygons = null; cappingObject = null; colix = C.GOLD; - useColix = true; colorDensity = false; connections = null; diameter = 0; @@ -145,9 +145,10 @@ lattice = null; mat4 = null; normixes = null; - scale3d = 0; polygonIndexes = null; + polygonTranslucencies = null; scale = 1; + scale3d = 0; showContourLines = false; showPoints = false; showTriangles = false; //as distinct entities @@ -156,6 +157,7 @@ spanningVectors = null; title = null; unitCell = null; + useColix = true; vertexCount0 = polygonCount0 = vertexCount = polygonCount = 0; vertices = null; volumeRenderPointSize = 0.15f; @@ -413,24 +415,24 @@ } return bs; } +// +// BS getVisibleGhostBitSet() { +// BS bs = new BS(); +// if (polygonCount == 0 && bsSlabGhost != null) +// BSUtil.copy2(bsSlabGhost, bs); +// else +// for (int i = polygonCount; --i >= 0;) +// if (bsSlabGhost == null || bsSlabGhost.get(i)) { +// int[] vertexIndexes = polygonIndexes[i]; +// if (vertexIndexes == null) +// continue; +// bs.set(vertexIndexes[0]); +// bs.set(vertexIndexes[1]); +// bs.set(vertexIndexes[2]); +// } +// return bs; +// } - BS getVisibleGhostBitSet() { - BS bs = new BS(); - if (polygonCount == 0 && bsSlabGhost != null) - BSUtil.copy2(bsSlabGhost, bs); - else - for (int i = polygonCount; --i >= 0;) - if (bsSlabGhost == null || bsSlabGhost.get(i)) { - int[] vertexIndexes = polygonIndexes[i]; - if (vertexIndexes == null) - continue; - bs.set(vertexIndexes[0]); - bs.set(vertexIndexes[1]); - bs.set(vertexIndexes[2]); - } - return bs; - } - public void setTokenProperty(int tokProp, boolean bProp) { switch (tokProp) { case T.notfrontonly: Modified: trunk/Jmol/src/org/jmol/shape/MeshCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/shape/MeshCollection.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -354,8 +354,12 @@ return; case T.translucent: m.setTranslucent(bProp, translucentLevel); + // color isosurface translucent clears the slab if (bProp && m.bsSlabGhost != null) m.resetSlab(); + // color isosurface translucent or opaque clears all special translucent polygons + if (m.bsTransPolygons != null) + m.resetTransPolygons(); return; default: m.setTokenProperty(tokProp, bProp); Modified: trunk/Jmol/src/org/jmol/shapespecial/Draw.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/shapespecial/Draw.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -435,27 +435,28 @@ } private void initDraw() { + boundBox = null; + bsAllModels = null; colix = C.ORANGE; color = 0xFFFFFFFF; - newScale = 0; + diameter = 0; + explicitID = false; + indicatedModelIndex = -1; + intersectID = null; + isCurve = isArc = isArrow = isPlane = isCircle = isCylinder = isLine = false; isFixed = isReversed = isRotated45 = isCrossed = noHead = isBarb = false; - isCurve = isArc = isArrow = isPlane = isCircle = isCylinder = isLine = false; - isVertices = isPerpendicular = isVector = false; + isPerpendicular = isVertices = isVector = false; isValid = true; length = Float.MAX_VALUE; - diameter = 0; - width = 0; - indicatedModelIndex = -1; + lineData = null; + newScale = 0; + nidentifiers = nbitsets = 0; offset = null; plane = null; polygon = null; - nidentifiers = nbitsets = 0; + slabData = null; vData = new JmolList<Object[]>(); - bsAllModels = null; - intersectID = null; - slabData = null; - boundBox = null; - explicitID = false; + width = 0; setPropertySuper("thisID", MeshCollection.PREVIOUS_MESH_ID, null); } @@ -638,7 +639,8 @@ @Override protected void clean() { for (int i = meshCount; --i >= 0;) - if (meshes[i] == null || meshes[i].vertexCount == 0 && meshes[i].connections == null) + if (meshes[i] == null || meshes[i].vertexCount == 0 + && meshes[i].connections == null && meshes[i].lineData == null) deleteMeshI(i); } @@ -1356,9 +1358,11 @@ int n = dmesh.lineData.size(); for (int j = 0; j < n;) { P3[] pts = dmesh.lineData.get(j); - str.append(Escape.eP(pts[0])); - str.append(" "); - str.append(Escape.eP(pts[1])); + String s = Escape.eP(pts[0]); + str.append(s.substring(1, s.length() - 1)); + str.append(","); + s = Escape.eP(pts[1]); + str.append(s.substring(1, s.length() - 1)); if (++j < n) str.append(", "); } Modified: trunk/Jmol/src/org/jmol/util/MeshSurface.java =================================================================== --- trunk/Jmol/src/org/jmol/util/MeshSurface.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/util/MeshSurface.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -20,6 +20,7 @@ public int polygonCount; public int[][] polygonIndexes; + public float[] polygonTranslucencies; public boolean isTriangleSet; // just a set of flat polygons public boolean haveQuads; @@ -215,8 +216,20 @@ public BS bsSlabDisplay; public BS bsSlabGhost; + public BS bsTransPolygons; public int slabMeshType; public short slabColix; + + /** + * Must create bsTransPolygons, polygonTranslucencies, + * and new triangle set for partially translucent polygons + * + * @param bsVertices + */ + public void setTranslucentVertices(BS bsVertices) { + //TODO + + } public void setSlab(BS bsDisplay, BS bsGhost, String type, String color, float translucency) { @@ -249,6 +262,21 @@ new Float[] {Float.valueOf(min), Float.valueOf(max)}, Boolean.FALSE, null }; } + public void resetTransPolygons() { + boolean isTranslucent = C.isColixTranslucent(colix); + float translucentLevel = C.getColixTranslucencyFractional(colix); + for (int i = 0; i < polygonCount; i++) + if (bsTransPolygons.get(i)) { + if (!setABC(i)) + continue; + vertexColixes[iA] = C.getColixTranslucent3(vertexColixes[iA], isTranslucent, translucentLevel); + vertexColixes[iB] = C.getColixTranslucent3(vertexColixes[iB], isTranslucent, translucentLevel); + vertexColixes[iC] = C.getColixTranslucent3(vertexColixes[iC], isTranslucent, translucentLevel); + } + bsTransPolygons = null; + polygonTranslucencies = null; + } + public void resetSlab() { slabPolygons(getSlabObject(T.none, null, false, null), false); } Modified: trunk/Jmol/src/org/jmol/util/P4.java =================================================================== --- trunk/Jmol/src/org/jmol/util/P4.java 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/util/P4.java 2013-06-12 03:17:30 UTC (rev 18322) @@ -46,7 +46,7 @@ public static P4 newPt(P4 value) { P4 pt = new P4(); - pt.set(value.x, value.y, value.z, value.w); + pt.set(value.x, value.y, value.z, value.w); return pt; } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-12 03:17:05 UTC (rev 18321) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-06-12 03:17:30 UTC (rev 18322) @@ -11,9 +11,14 @@ ___JmolVersion="13.1.17_dev_2013.06.08" +bug fix: draw LINEDATA not operative (undocumented, for state; from draw xxx INTERSECT yyy) + -- needs revision to create DATA option; can be huge and very long to process state file + + TODO: PyMOL uniqueAtomSettings for transparency -- will require by-vertex translucent option + code: color/translucent/opaque clean up in ScriptEvaluator bug fix: load :2-butanone fails bug fix: PyMOL volume map data saved from PyMOL 1.6 has slightly different data structure This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ This SF.net email is sponsored by Windows: Build for Windows Store. http://p.sf.net/sfu/windows-dev2dev _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits