private void renderShapes() { BioShapeCollection mps = (BioShapeCollection) shape; for (int c = mps.bioShapes.length; --c >= 0; ) { BioShape bioShape = mps.getBioShape(c); if ((bioShape.modelVisibilityFlags & myVisibilityFlag) == 0) continue; if (bioShape.monomerCount >= 2 && initializePolymer(bioShape)) { bsRenderMesh.clearAll(); renderBioShape(bioShape); renderMeshes(); freeTempArrays(); } } }
private boolean initializePolymer(BioShape bioShape) { BS bsDeleted = vwr.getDeletedAtoms(); if (vwr.ms.isJmolDataFrameForModel(bioShape.modelIndex)) { controlPoints = bioShape.bioPolymer.getControlPoints(true, 0, false); } else { controlPoints = bioShape.bioPolymer.getControlPoints(isTraceAlpha, sheetSmoothing, invalidateSheets); } monomerCount = bioShape.monomerCount; bsRenderMesh = BS.newN(monomerCount); monomers = bioShape.monomers; reversed = bioShape.bioPolymer.reversed; leadAtomIndices = bioShape.bioPolymer.getLeadAtomIndices(); bsVisible.clearAll(); boolean haveVisible = false; if (invalidateMesh) bioShape.falsifyMesh(); for (int i = monomerCount; --i >= 0; ) { if ((monomers[i].shapeVisibilityFlags & myVisibilityFlag) == 0 || ms.isAtomHidden(leadAtomIndices[i]) || bsDeleted != null && bsDeleted.get(leadAtomIndices[i])) continue; Atom lead = ms.at[leadAtomIndices[i]]; if (!g3d.isInDisplayRange(lead.sX, lead.sY)) continue; bsVisible.set(i); haveVisible = true; } if (!haveVisible) return false; ribbonBorder = vwr.getBoolean(T.ribbonborder); // note that we are not treating a PhosphorusPolymer // as nucleic because we are not calculating the wing // vector correctly. // if/when we do that then this test will become // isNucleic = bioShape.bioPolymer.isNucleic(); isNucleic = bioShape.bioPolymer instanceof NucleicPolymer; isCarbohydrate = bioShape.bioPolymer instanceof CarbohydratePolymer; haveControlPointScreens = false; wingVectors = bioShape.wingVectors; meshReady = bioShape.meshReady; meshes = bioShape.meshes; mads = bioShape.mads; colixes = bioShape.colixes; colixesBack = bioShape.colixesBack; setStructureTypes(); return true; }