diff --git a/CHANGELOG.md b/CHANGELOG.md index bc744e8e448e3bff130444abb025258638ddad8e..7503f5118ff53d6a686ad832601ad26b0629f2be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ Note that since we don't clearly distinguish between a public and private interf - Make operators in `IndexPairBonds` a directed property - Remove erroneous bounding-box overlap test in `Structure.eachUnitPair` - Fix `EdgeBuilder.addNextEdge` for loop edges +- Optimize inter unit bond compute +- Improve SSAO for thin geometry (e.g. lines) ## [v3.35.0] - 2023-05-14 diff --git a/src/mol-gl/shader/ssao.frag.ts b/src/mol-gl/shader/ssao.frag.ts index ac851e47fa8bf28a56dc78e379c5559c90c07dcb..cdc86f31437bbb0925083e55e441e473034955fc 100644 --- a/src/mol-gl/shader/ssao.frag.ts +++ b/src/mol-gl/shader/ssao.frag.ts @@ -114,7 +114,7 @@ void main(void) { vec2 selfPackedDepth = packUnitIntervalToRG(selfDepth); if (isBackground(selfDepth)) { - gl_FragColor = vec4(packUnitIntervalToRG(0.0), selfPackedDepth); + gl_FragColor = vec4(packUnitIntervalToRG(1.0), selfPackedDepth); return; } diff --git a/src/mol-model/structure/structure/unit/bonds/inter-compute.ts b/src/mol-model/structure/structure/unit/bonds/inter-compute.ts index 1a8603945776d17e39c65d4a4fde46c1a4b8c11e..7186e8efab4a2e3e2084f666a8288da3f767d19e 100644 --- a/src/mol-model/structure/structure/unit/bonds/inter-compute.ts +++ b/src/mol-model/structure/structure/unit/bonds/inter-compute.ts @@ -243,10 +243,8 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo ...p, validUnit: (props && props.validUnit) || (u => Unit.isAtomic(u)), validUnitPair: (props && props.validUnitPair) || ((s, a, b) => { - // In case both units have a struct conn record, ignore other criteria - if (hasCommonStructConnRecord(a, b)) { - return Structure.validUnitPair(s, a, b); - } + const isValidPair = Structure.validUnitPair(s, a, b); + if (!isValidPair) return false; const mtA = a.model.atomicHierarchy.derived.residue.moleculeType; const mtB = b.model.atomicHierarchy.derived.residue.moleculeType; @@ -258,7 +256,13 @@ function computeInterUnitBonds(structure: Structure, props?: Partial<InterBondCo const notIonA = (!Unit.isAtomic(a) || mtA[a.residueIndex[a.elements[0]]] !== MoleculeType.Ion); const notIonB = (!Unit.isAtomic(b) || mtB[b.residueIndex[b.elements[0]]] !== MoleculeType.Ion); const notIon = notIonA && notIonB; - return Structure.validUnitPair(s, a, b) && (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon); + + const check = (notWater || !p.ignoreWater) && (notIon || !p.ignoreIon); + if (!check) { + // In case both units have a struct conn record, ignore other criteria + return hasCommonStructConnRecord(a, b); + } + return true; }), }); }