From: <ha...@us...> - 2011-06-16 15:22:42
|
Revision: 15602 http://jmol.svn.sourceforge.net/jmol/?rev=15602&view=rev Author: hansonr Date: 2011-06-16 15:22:33 +0000 (Thu, 16 Jun 2011) Log Message: ----------- version=12.1.50_dev # code: Renderers made entirely independent # new feature: super-fast isosurface MAP PROPERTY when isosurfacePropertySmoothing = false Modified Paths: -------------- trunk/Jmol/src/org/jmol/shape/BallsRenderer.java trunk/Jmol/src/org/jmol/viewer/ShapeManager.java trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/shape/BallsRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/shape/BallsRenderer.java 2011-06-16 15:03:02 UTC (rev 15601) +++ trunk/Jmol/src/org/jmol/shape/BallsRenderer.java 2011-06-16 15:22:33 UTC (rev 15602) @@ -33,22 +33,14 @@ import javax.vecmath.*; public class BallsRenderer extends ShapeRenderer { - private int minX, minY, maxX, maxY; - @Override protected void render() { + + // also crosshairs for navigation mode + boolean renderBalls = !viewer.getWireframeRotation() || !viewer.getInMotion(); - boolean renderCrosshairs = (modelSet.getAtomCount() > 0 - && viewer.getShowNavigationPoint() - && exportType == Graphics3D.EXPORT_NOT && g3d - .setColix(Graphics3D.BLACK)); - if (renderCrosshairs) { - minX = Integer.MAX_VALUE; - maxX = Integer.MIN_VALUE; - minY = Integer.MAX_VALUE; - maxY = Integer.MIN_VALUE; - } + int[] minMax = viewer.getCrossHairMinMax(); if (renderBalls) { Atom[] atoms = modelSet.atoms; BitSet bsOK = viewer.getRenderableBitSet(); @@ -56,24 +48,14 @@ Atom atom = atoms[i]; if (atom.screenDiameter > 0 && (atom.getShapeVisibilityFlags() & myVisibilityFlag) != 0 - && g3d.setColix(atom.getColix())) { - if (renderCrosshairs) { - if (atom.screenX < minX) - minX = atom.screenX; - if (atom.screenX > maxX) - maxX = atom.screenX; - if (atom.screenY < minY) - minY = atom.screenY; - if (atom.screenY > maxY) - maxY = atom.screenY; - } + && g3d.setColix(atom.getColix())) { g3d.drawAtom(atom); } } } // this is the square and crosshairs for the navigator - if (renderCrosshairs) { + if (minMax[0] != Integer.MAX_VALUE) { Point3f navOffset = new Point3f(viewer.getNavigationOffset()); boolean antialiased = g3d.isAntialiased(); float navDepth = viewer.getNavigationDepthPercent(); @@ -92,13 +74,13 @@ g3d.drawRect(x - off, y - off, z, 0, h, h); off = h; h = h >> 1; - g3d.setColix(maxX < navOffset.x ? Graphics3D.YELLOW : Graphics3D.GREEN); + g3d.setColix(minMax[1] < navOffset.x ? Graphics3D.YELLOW : Graphics3D.GREEN); g3d.drawRect(x - off, y, z, 0, h, w); - g3d.setColix(minX > navOffset.x ? Graphics3D.YELLOW : Graphics3D.GREEN); + g3d.setColix(minMax[0] > navOffset.x ? Graphics3D.YELLOW : Graphics3D.GREEN); g3d.drawRect(x + h, y, z, 0, h, w); - g3d.setColix(maxY < navOffset.y ? Graphics3D.YELLOW : Graphics3D.GREEN); + g3d.setColix(minMax[3] < navOffset.y ? Graphics3D.YELLOW : Graphics3D.GREEN); g3d.drawRect(x, y - off, z, 0, w, h); - g3d.setColix(minY > navOffset.y ? Graphics3D.YELLOW : Graphics3D.GREEN); + g3d.setColix(minMax[2] > navOffset.y ? Graphics3D.YELLOW : Graphics3D.GREEN); g3d.drawRect(x, y + h, z, 0, w, h); } } Modified: trunk/Jmol/src/org/jmol/viewer/ShapeManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/ShapeManager.java 2011-06-16 15:03:02 UTC (rev 15601) +++ trunk/Jmol/src/org/jmol/viewer/ShapeManager.java 2011-06-16 15:22:33 UTC (rev 15602) @@ -385,6 +385,11 @@ return bsRenderable; } + private final int[] minMax = new int[4]; + public int[] getCrossHairMinMax() { + return minMax; + } + public void transformAtoms() { bsRenderable.clear(); Atom[] atoms = modelSet.atoms; @@ -408,48 +413,77 @@ .abs(atom.madAtom)); // System.out.println("shapeman " + atom + " scaleToScreen(" + screen.z + "," + atom.madAtom + ")=" + atom.screenDiameter); } - if (!viewer.getSlabEnabled()) - return; - boolean slabByMolecule = viewer.getSlabByMolecule(); - boolean slabByAtom = viewer.getSlabByAtom(); - int minZ = g3d.getSlab(); - int maxZ = g3d.getDepth(); - if (slabByMolecule) { - JmolMolecule[] molecules = modelSet.getMolecules(); - int moleculeCount = modelSet.getMoleculeCountInModel(-1); - for (int i = 0; i < moleculeCount; i++) { - JmolMolecule m = molecules[i]; - int j = 0; - int pt = m.firstAtomIndex; - if (!bsRenderable.get(pt)) - continue; - for (; j < m.atomCount; j++, pt++) - if (g3d.isClippedZ(atoms[pt].screenZ - - (atoms[pt].screenDiameter >> 1))) - break; - if (j != m.atomCount) { - pt = m.firstAtomIndex; - for (int k = 0; k < m.atomCount; k++) { - bsRenderable.clear(pt); - atoms[pt++].screenZ = 0; + + if (viewer.getSlabEnabled()) { + boolean slabByMolecule = viewer.getSlabByMolecule(); + boolean slabByAtom = viewer.getSlabByAtom(); + int minZ = g3d.getSlab(); + int maxZ = g3d.getDepth(); + if (slabByMolecule) { + JmolMolecule[] molecules = modelSet.getMolecules(); + int moleculeCount = modelSet.getMoleculeCountInModel(-1); + for (int i = 0; i < moleculeCount; i++) { + JmolMolecule m = molecules[i]; + int j = 0; + int pt = m.firstAtomIndex; + if (!bsRenderable.get(pt)) + continue; + for (; j < m.atomCount; j++, pt++) + if (g3d.isClippedZ(atoms[pt].screenZ + - (atoms[pt].screenDiameter >> 1))) + break; + if (j != m.atomCount) { + pt = m.firstAtomIndex; + for (int k = 0; k < m.atomCount; k++) { + bsRenderable.clear(pt); + atoms[pt++].screenZ = 0; + } } } } + for (int i = bsRenderable.nextSetBit(0); i >= 0; i = bsRenderable + .nextSetBit(i + 1)) { + Atom atom = atoms[i]; + if (g3d.isClippedZ(atom.screenZ + - (slabByAtom ? atoms[i].screenDiameter >> 1 : 0))) { + atom.setClickable(0); + // note that in the case of navigation, + // maxZ is set to Integer.MAX_VALUE. + int r = (slabByAtom ? -1 : 1) * atom.screenDiameter / 2; + if (atom.screenZ + r < minZ || atom.screenZ - r > maxZ + || !g3d.isInDisplayRange(atom.screenX, atom.screenY)) { + bsRenderable.clear(i); + } + } + } } + + boolean renderCrosshairs = (modelSet.getAtomCount() > 0 + && viewer.getShowNavigationPoint() + && g3d.getExportType() == Graphics3D.EXPORT_NOT && g3d + .setColix(Graphics3D.BLACK)); + minMax[0] = Integer.MAX_VALUE; + if (!renderCrosshairs) + return; + int minX = Integer.MAX_VALUE; + int maxX = Integer.MIN_VALUE; + int minY = Integer.MAX_VALUE; + int maxY = Integer.MIN_VALUE; for (int i = bsRenderable.nextSetBit(0); i >= 0; i = bsRenderable .nextSetBit(i + 1)) { Atom atom = atoms[i]; - if (g3d.isClippedZ(atom.screenZ - - (slabByAtom ? atoms[i].screenDiameter >> 1 : 0))) { - atom.setClickable(0); - // note that in the case of navigation, - // maxZ is set to Integer.MAX_VALUE. - int r = (slabByAtom ? -1 : 1) * atom.screenDiameter / 2; - if (atom.screenZ + r < minZ || atom.screenZ - r > maxZ - || !g3d.isInDisplayRange(atom.screenX, atom.screenY)) { - bsRenderable.clear(i); - } - } + if (atom.screenX < minX) + minX = atom.screenX; + if (atom.screenX > maxX) + maxX = atom.screenX; + if (atom.screenY < minY) + minY = atom.screenY; + if (atom.screenY > maxY) + maxY = atom.screenY; } + minMax[0] = minX; + minMax[1] = maxX; + minMax[2] = minY; + minMax[3] = maxY; } } Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-06-16 15:03:02 UTC (rev 15601) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-06-16 15:22:33 UTC (rev 15602) @@ -9787,4 +9787,8 @@ transformManager.setZslabPoint(pt); } + public int[] getCrossHairMinMax() { + return shapeManager.getCrossHairMinMax(); + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |