Browse Source

Volume Streaming Around Camera - parameter Radius is relative to FOV

Adam Midlik 2 years ago
parent
commit
df9ce6add9

+ 1 - 1
src/mol-plugin-ui/custom/volume.tsx

@@ -288,7 +288,7 @@ export class VolumeStreamingCustomControls extends PluginUIComponent<StateTransf
                     isUnbounded: isUnboundedParam,
                 }, { description: 'Box around focused element.' }),
                 'camera-target': PD.Group({
-                    radius: PD.Numeric(5, { min: 0, max: 50, step: 0.5 }, { description: 'Radius in \u212B within which the volume is shown.' }),
+                    radius: PD.Numeric(0.5, { min: 0, max: 1, step: 0.05 }, { description: 'Radius within which the volume is shown (relative to the field of view).' }),
                     detailLevel: {...detailLevel, isHidden: true},
                     dynamicDetailLevel: dynamicDetailLevel,
                     isRelative: isRelativeParam,

+ 3 - 2
src/mol-plugin/behavior/dynamic/volume-streaming/behavior.ts

@@ -91,7 +91,7 @@ export namespace VolumeStreaming {
                     topRight: PD.Vec3(Vec3.create(0, 0, 0), {}, { isHidden: true }),
                 }, { description: 'Box around focused element.', isFlat: true }),
                 'camera-target': PD.Group({
-                    radius: PD.Numeric(5, { min: 0, max: 50, step: 0.5 }, { description: 'Radius in \u212B within which the volume is shown.' }),
+                    radius: PD.Numeric(0.5, { min: 0, max: 1, step: 0.05 }, { description: 'Radius within which the volume is shown (relative to the field of view).' }),
                     // Minimal detail level for the inside of the zoomed region (real detail can be higher, depending on the region size)
                     dynamicDetailLevel: createDetailParams(info.header.availablePrecisions, 0, { label: 'Dynamic Detail' }),  // TODO Adam choose appropriate default value
                     bottomLeft: PD.Vec3(Vec3.create(0, 0, 0), {}, { isHidden: true }),
@@ -465,7 +465,8 @@ export namespace VolumeStreaming {
             if (viewport && viewport.width > viewport.height) {
                 radius *= viewport.width / viewport.height;
             }
-            radius *= 0.5; // debug? // TODO Adam remove?
+            const relativeRadius = this.params.entry.params.view.name === 'camera-target' ? this.params.entry.params.view.params.radius : 0.5;
+            radius *= relativeRadius;
             let radiusX, radiusY, radiusZ;
             if (boundByBoundarySize) {
                 let bBoxSize = Vec3.zero();