Changeset 4693


Ignore:
Timestamp:
Nov 10, 2014 1:39:31 PM (10 years ago)
Author:
ldelgass
Message:

Fix for volume opacity style. I think this should be a better fix than r4664.
We always normalize transfer functions, we just need to appy the opacity
component style to the volume at creation time.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.3/gui/scripts/nanovisviewer.tcl

    r4680 r4693  
    238238        -thickness              350
    239239        -volume                 1
    240         -volumeopacity          1.0
     240        -volumeopacity          0.5
    241241        -volumevisible          1
    242242        -xcutplaneposition      50
     
    251251    }
    252252    array set _widget {
    253         -volumeopacity          100
     253        -volumeopacity          50
    254254    }
    255255    itk_component add 3dview {
     
    13181318            set _settings($what) [expr $_widget($what) * 0.01]
    13191319            set _settings($_current${what}) $_settings($what)
    1320        
    1321             foreach {cmap wmap} $_cname2transferFunction($_current) break
    1322             set wmap [ComputeAlphamap $_current]
    1323             set _cname2transferFunction($_current) [list $cmap $wmap]
    1324             SendCmd [list transfunc define $_current $cmap $wmap]
     1320            foreach tag [GetDatasetsWithComponent $_current] {
     1321                SendCmd "volume shading opacity $_settings($what) $tag"
     1322            }
    13251323        }
    13261324        "-volumevisible" {
     
    22492247    set isovalues [$_transferFunctionEditors($cname) values]
    22502248
    2251     # Currently using volume shading opacity to scale opacity in
    2252     # the volume shader.
    2253     set max $_settings($cname-volumeopacity)
     2249    # Transfer function should be normalized with [0,1] range
     2250    # The volume shading opacity setting is used to scale opacity
     2251    # in the volume shader.
     2252    set max 1.0
    22542253
    22552254    # Use the component-wise thickness setting from the slider
     
    24712470itcl::body Rappture::NanovisViewer::SetObjectStyle { dataobj cname } {
    24722471    array set styles {
    2473         -opacity  0.6
     2472        -opacity  0.5
    24742473    }
    24752474    array set styles [lindex [$dataobj components -style $cname] 0]
    24762475    set _settings($cname-volumeopacity) $styles(-opacity)
     2476    set tag $dataobj-$cname
     2477    SendCmd "volume shading opacity $_settings($cname-volumeopacity) $tag"
    24772478    NameTransferFunction $dataobj $cname
    24782479}
Note: See TracChangeset for help on using the changeset viewer.