From 8c13f7b8ba86472e7023fb0b005785d36ca35554 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alex.rose@rcsb.org>
Date: Fri, 30 Nov 2018 16:44:17 -0800
Subject: [PATCH] direct volume rendering tweaks and fixes

---
 .../geometry/direct-volume/direct-volume.ts   |  4 ++--
 src/mol-gl/shader/direct-volume.frag          |  2 +-
 src/mol-model/structure/structure/unit.ts     | 24 +++++++++++--------
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/src/mol-geo/geometry/direct-volume/direct-volume.ts b/src/mol-geo/geometry/direct-volume/direct-volume.ts
index 6f25a2e39..c26c7d9c0 100644
--- a/src/mol-geo/geometry/direct-volume/direct-volume.ts
+++ b/src/mol-geo/geometry/direct-volume/direct-volume.ts
@@ -74,8 +74,8 @@ export namespace DirectVolume {
         isoValue: PD.Numeric(0.22, { min: -1, max: 1, step: 0.01 }),
         renderMode: PD.Select('volume', RenderModeOptions),
         controlPoints: PD.LineGraph([
-            Vec2.create(0.19, 0.0), Vec2.create(0.2, 0.15), Vec2.create(0.21, 0.0),
-            Vec2.create(0.79, 0.0), Vec2.create(0.8, 0.15), Vec2.create(0.81, 0.0),
+            Vec2.create(0.19, 0.0), Vec2.create(0.2, 0.05), Vec2.create(0.25, 0.05), Vec2.create(0.26, 0.0),
+            Vec2.create(0.79, 0.0), Vec2.create(0.8, 0.05), Vec2.create(0.85, 0.05), Vec2.create(0.86, 0.0),
         ]),
         list: PD.ColorScale<ColorListName>('RedYellowBlue', ColorListOptions),
     }
diff --git a/src/mol-gl/shader/direct-volume.frag b/src/mol-gl/shader/direct-volume.frag
index 7eabed7ff..de8f74643 100644
--- a/src/mol-gl/shader/direct-volume.frag
+++ b/src/mol-gl/shader/direct-volume.frag
@@ -91,7 +91,7 @@ const float gradOffset = 0.5;
 
 vec4 raymarch(vec3 startLoc, vec3 step, vec3 viewDir) {
     vec3 scaleVol = vec3(1.0) / uGridDim;
-    vec3 pos = startLoc + scaleVol * 0.5;
+    vec3 pos = startLoc;
     float prevValue = -1.0;
     float value = 0.0;
     vec4 src = vec4(0.0);
diff --git a/src/mol-model/structure/structure/unit.ts b/src/mol-model/structure/structure/unit.ts
index 933cd583a..cbdf58718 100644
--- a/src/mol-model/structure/structure/unit.ts
+++ b/src/mol-model/structure/structure/unit.ts
@@ -22,8 +22,10 @@ import { GaussianDensityProps, computeUnitGaussianDensityCached } from './unit/g
 import { RuntimeContext } from 'mol-task';
 import { WebGLContext } from 'mol-gl/webgl/context';
 
-// A building block of a structure that corresponds to an atomic or a coarse grained representation
-// 'conveniently grouped together'.
+/**
+ * A building block of a structure that corresponds to an atomic or
+ * a coarse grained representation 'conveniently grouped together'.
+ */
 type Unit = Unit.Atomic | Unit.Spheres | Unit.Gaussians
 
 namespace Unit {
@@ -114,13 +116,15 @@ namespace Unit {
         return (i: number) => 0;
     }
 
-    // A bulding block of a structure that corresponds
-    // to a "natural group of atoms" (most often a "chain")
-    // together with a tranformation (rotation and translation)
-    // that is dynamically applied to the underlying atom set.
-    //
-    // An atom set can be referenced by multiple diffrent units which
-    // makes construction of assemblies and spacegroups very efficient.
+    /**
+     * A bulding block of a structure that corresponds
+     * to a "natural group of atoms" (most often a "chain")
+     * together with a tranformation (rotation and translation)
+     * that is dynamically applied to the underlying atom set.
+     *
+     * An atom set can be referenced by multiple diffrent units which
+     * makes construction of assemblies and spacegroups very efficient.
+     */
     export class Atomic implements Base {
         readonly kind = Kind.Atomic;
 
@@ -130,7 +134,7 @@ namespace Unit {
         readonly model: Model;
         readonly conformation: SymmetryOperator.ArrayMapping<ElementIndex>;
 
-        // Reference some commonly accessed things for faster access.
+        /** Reference some commonly accessed things for faster access. */
         readonly residueIndex: ArrayLike<ResidueIndex>;
         readonly chainIndex: ArrayLike<ChainIndex>;
 
-- 
GitLab