Ignore:
Timestamp:
Mar 13, 2013 9:57:03 AM (11 years ago)
Author:
ldelgass
Message:

Fix camera reset for nanovis. Includes refactoring of vector/matrix classes
in nanovis to consolidate into vrmath library. Also add preliminary canonical
view control to clients for testing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gui/scripts/flowvisviewer.tcl

    r3485 r3492  
    123123    private method streams { tag name }
    124124    private method arrows { tag name }
     125    private method SetOrientation {}
    125126
    126127    private variable _arcball ""
     
    318319    pack $itk_component(volume) -padx 2 -pady 2
    319320
    320     BuildViewTab
    321     BuildVolumeTab
    322     BuildCutplanesTab
    323     BuildCameraTab
     321    if { [catch {
     322        BuildViewTab
     323        BuildVolumeTab
     324        BuildCutplanesTab
     325        BuildCameraTab
     326    } errs] != 0 } {
     327        global errorInfo
     328        puts stderr "errs=$errs errorInfo=$errorInfo"
     329    }
    324330
    325331    bind $itk_component(3dview) <Configure> \
     
    959965        $_arcball quaternion $q
    960966        SendCmd "camera orient $q"
    961         #SendCmd "camera reset"
     967        SendCmd "camera reset"
    962968        PanCamera
    963969        SendCmd "camera zoom $_view(zoom)"
     
    12571263    $_arcball quaternion $q
    12581264    SendCmd "camera orient $q"
    1259     #SendCmd "camera reset"
     1265    SendCmd "camera reset"
    12601266    PanCamera
    12611267    SendCmd "camera zoom $_view(zoom)"
     
    13671373            $_arcball quaternion $q
    13681374            SendCmd "camera orient $q"
    1369             #SendCmd "camera reset"
    1370             SendCmd "camera zoom $_view(zoom)"
     1375            SendCmd "camera reset"
    13711376            set _settings($this-qw)    $_view(qw)
    13721377            set _settings($this-qx)    $_view(qx)
     
    13761381            set _settings($this-pan-y) $_view(pan-y)
    13771382            set _settings($this-zoom)  $_view(zoom)
     1383            $itk_component(orientation) value "default"
    13781384        }
    13791385    }
     
    23872393    $inner configure -borderwidth 4
    23882394
     2395    set row 0
     2396    label $inner.orientation_l -text "View" -font "Arial 9"
     2397    itk_component add orientation {
     2398        Rappture::Combobox $inner.orientation -width 10 -editable no
     2399    }
     2400    $inner.orientation choices insert end \
     2401        "1 0 0 0" "front" \
     2402        "0 0 1 0" "back" \
     2403        "0.707107 -0.707107 0 0" "top" \
     2404        "0.707107 0.707107 0 0" "bottom" \
     2405        "0.707107 0 -0.707107 0" "left" \
     2406        "0.707107 0 0.707107 0" "right" \
     2407        "0.853553 -0.353553 0.353553 0.146447" "default"
     2408    $itk_component(orientation) value "default"
     2409    bind $inner.orientation <<Value>> [itcl::code $this SetOrientation]
     2410    if 1 {
     2411    blt::table $inner \
     2412            $row,0 $inner.orientation_l -anchor e -pady 2 \
     2413            $row,1 $inner.orientation -anchor w -pady 2 -fill x
     2414    blt::table configure $inner r$row -resize none
     2415    incr row
     2416    }
     2417
    23892418    set labels { qw qx qy qz pan-x pan-y zoom }
    2390     set row 0
    23912419    foreach tag $labels {
    23922420        label $inner.${tag}label -text $tag -font "Arial 9"
     
    26112639                }
    26122640                "qx" - "qy" - "qz" - "qw" {
     2641                    set _view($who) $_settings($this-$who)
    26132642                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
    26142643                    $_arcball quaternion $q
     
    29863015}
    29873016
     3017itcl::body Rappture::FlowvisViewer::SetOrientation {} {
     3018    set quat [$itk_component(orientation) value]
     3019    set quat [$itk_component(orientation) translate $quat]
     3020    foreach name { qw qx qy qz } comp $quat {
     3021        set _view($name) $comp
     3022        set _settings($this-$name) $comp
     3023    }
     3024    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     3025    $_arcball quaternion $q
     3026    SendCmd "camera orient $q"
     3027    SendCmd "camera reset"
     3028    set $_view(pan-x) 0.0
     3029    set $_view(pan-y) 0.0
     3030    set $_view(zoom) 1.0
     3031    set _settings($this-pan-x) $_view(pan-x)
     3032    set _settings($this-pan-y) $_view(pan-y)
     3033    set _settings($this-zoom)  $_view(zoom)
     3034}
Note: See TracChangeset for help on using the changeset viewer.