Changeset 3004


Ignore:
Timestamp:
May 10, 2012, 8:46:29 AM (12 years ago)
Author:
ldelgass
Message:

Add arcball camera to nanovis clients

Location:
branches/nanovis2/gui/scripts
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/nanovis2/gui/scripts/flowvisviewer.tcl

    r2965 r3004  
    124124    private method arrows { tag name }
    125125
     126    private variable _arcball ""
     127    private variable _useArcball 1
    126128    private variable _outbuf       ;# buffer for outgoing commands
    127129
     
    222224    # Initialize the view to some default parameters.
    223225    array set _view {
     226        qw      0.853553
     227        qx      -0.353553
     228        qy      0.353553
     229        qz      0.146447
    224230        theta   45
    225231        phi     45
     
    229235        pan-y   0
    230236    }
     237    set _arcball [blt::arcball create 100 100]
     238    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     239    $_arcball quaternion $q
     240
    231241    set _limits(vmin) 0.0
    232242    set _limits(vmax) 1.0
    233243
    234244    array set _settings [subst {
     245        $this-qw                $_view(qw)
     246        $this-qx                $_view(qx)
     247        $this-qy                $_view(qy)
     248        $this-qz                $_view(qz)
     249        $this-theta             $_view(theta)
     250        $this-phi               $_view(phi)
     251        $this-psi               $_view(psi)
     252        $this-zoom              $_view(zoom)   
     253        $this-pan-x             $_view(pan-x)
     254        $this-pan-y             $_view(pan-y)
    235255        $this-arrows            0
    236256        $this-currenttime       0
    237257        $this-duration          1:00
    238258        $this-loop              0
    239         $this-pan-x             $_view(pan-x)
    240         $this-pan-y             $_view(pan-y)
    241         $this-phi               $_view(phi)
    242259        $this-play              0
    243         $this-psi               $_view(psi)
    244260        $this-speed             500
    245261        $this-step              0
    246262        $this-streams           0
    247         $this-theta             $_view(theta)
    248263        $this-volume            1
    249264        $this-xcutplane         0
     
    253268        $this-zcutplane         0
    254269        $this-zcutposition      0
    255         $this-zoom              $_view(zoom)
    256270    }]
    257271
     
    553567    image delete $_image(legend)
    554568    image delete $_image(download)
     569    catch { blt::arcball destroy $_arcball }
    555570    array unset _settings $this-*
    556571}
     
    10061021    }
    10071022
    1008     # Insure that the global opacity and thickness settings (in the slider
     1023    # Ensure that the global opacity and thickness settings (in the slider
    10091024    # settings widgets) are used for the active transfer-function.  Update the
    10101025    # values in the _settings varible.
     
    11801195    set w [winfo width $itk_component(3dview)]
    11811196    set h [winfo height $itk_component(3dview)]
     1197    $_arcball resize $w $h
    11821198    EventuallyResize $w $h
    11831199
     
    12291245        }
    12301246    }
     1247    set _settings($this-qw)    $_view(qw)
     1248    set _settings($this-qx)    $_view(qx)
     1249    set _settings($this-qy)    $_view(qy)
     1250    set _settings($this-qz)    $_view(qz)
    12311251    set _settings($this-theta) $_view(theta)
    12321252    set _settings($this-phi)   $_view(phi)
     
    12361256    set _settings($this-zoom)  $_view(zoom)
    12371257
    1238     set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    1239     SendCmd "camera angle $xyz"
     1258    if {$_useArcball} {
     1259        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1260        $_arcball quaternion $q
     1261        SendCmd "camera orient $q"
     1262    } else {
     1263        set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     1264        SendCmd "camera angle $xyz"
     1265    }
    12401266    PanCamera
    12411267    SendCmd "camera zoom $_view(zoom)"
     
    13291355        "reset" {
    13301356            array set _view {
     1357                qw      0.853553
     1358                qx      -0.353553
     1359                qy      0.353553
     1360                qz      0.146447
    13311361                theta   45
    13321362                phi     45
     
    13421372                }
    13431373            }
    1344             set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    1345             SendCmd "camera angle $xyz"
     1374            if {$_useArcball} {
     1375                set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1376                $_arcball quaternion $q
     1377                SendCmd "camera orient $q"
     1378            } else {
     1379                set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     1380                SendCmd "camera angle $xyz"
     1381            }
    13461382            PanCamera
     1383            set _settings($this-qw)    $_view(qw)
     1384            set _settings($this-qx)    $_view(qx)
     1385            set _settings($this-qy)    $_view(qy)
     1386            set _settings($this-qz)    $_view(qz)
    13471387            set _settings($this-theta) $_view(theta)
    13481388            set _settings($this-phi)   $_view(phi)
     
    13991439                }
    14001440
    1401                 #
    1402                 # Rotate the camera in 3D
    1403                 #
    1404                 if {$_view(psi) > 90 || $_view(psi) < -90} {
    1405                     # when psi is flipped around, theta moves backwards
    1406                     set dy [expr {-$dy}]
     1441                if {$_useArcball} {
     1442                    set q [$_arcball rotate $x $y $_click(x) $_click(y)]
     1443                    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     1444                    SendCmd "camera orient $q"
     1445                } else {
     1446                    #
     1447                    # Rotate the camera in 3D
     1448                    #
     1449                    if {$_view(psi) > 90 || $_view(psi) < -90} {
     1450                        # when psi is flipped around, theta moves backwards
     1451                        set dy [expr {-$dy}]
     1452                    }
     1453                    set theta [expr {$_view(theta) - $dy*180}]
     1454                    while {$theta < 0} { set theta [expr {$theta+180}] }
     1455                    while {$theta > 180} { set theta [expr {$theta-180}] }
     1456
     1457                    if {abs($theta) >= 30 && abs($theta) <= 160} {
     1458                        set phi [expr {$_view(phi) - $dx*360}]
     1459                        while {$phi < 0} { set phi [expr {$phi+360}] }
     1460                        while {$phi > 360} { set phi [expr {$phi-360}] }
     1461                        set psi $_view(psi)
     1462                    } else {
     1463                        set phi $_view(phi)
     1464                        set psi [expr {$_view(psi) - $dx*360}]
     1465                        while {$psi < -180} { set psi [expr {$psi+360}] }
     1466                        while {$psi > 180} { set psi [expr {$psi-360}] }
     1467                    }
     1468
     1469                    set _view(theta)        $theta
     1470                    set _view(phi)          $phi
     1471                    set _view(psi)          $psi
     1472                    set xyz [Euler2XYZ $theta $phi $psi]
     1473                    set _settings($this-theta) $_view(theta)
     1474                    set _settings($this-phi)   $_view(phi)
     1475                    set _settings($this-psi)   $_view(psi)
     1476                    SendCmd "camera angle $xyz"
    14071477                }
    1408                 set theta [expr {$_view(theta) - $dy*180}]
    1409                 while {$theta < 0} { set theta [expr {$theta+180}] }
    1410                 while {$theta > 180} { set theta [expr {$theta-180}] }
    1411 
    1412                 if {abs($theta) >= 30 && abs($theta) <= 160} {
    1413                     set phi [expr {$_view(phi) - $dx*360}]
    1414                     while {$phi < 0} { set phi [expr {$phi+360}] }
    1415                     while {$phi > 360} { set phi [expr {$phi-360}] }
    1416                     set psi $_view(psi)
    1417                 } else {
    1418                     set phi $_view(phi)
    1419                     set psi [expr {$_view(psi) - $dx*360}]
    1420                     while {$psi < -180} { set psi [expr {$psi+360}] }
    1421                     while {$psi > 180} { set psi [expr {$psi-360}] }
    1422                 }
    1423 
    1424                 set _view(theta)        $theta
    1425                 set _view(phi)          $phi
    1426                 set _view(psi)          $psi
    1427                 set xyz [Euler2XYZ $theta $phi $psi]
    1428                 set _settings($this-theta) $_view(theta)
    1429                 set _settings($this-phi)   $_view(phi)
    1430                 set _settings($this-psi)   $_view(psi)
    1431                 SendCmd "camera angle $xyz"
     1478
    14321479                set _click(x) $x
    14331480                set _click(y) $y
     
    16021649                set tag $_first-$comp
    16031650                set diffuse [expr {0.01*$_settings($this-light)}]
    1604                 set specular [expr {sqrt($_settings($this-light)+1.0)}]
    1605                 SendCmd "$tag configure -diffuse $diffuse -specular $specular"
     1651                set ambient [expr {1.0 - $diffuse}]
     1652                set specularLevel 0.3
     1653                set specularExp 90.0
     1654                SendCmd "$tag configure -ambient $ambient -diffuse $diffuse -specular {$specularLevel $specularExp}"
    16061655            }
    16071656        }
     
    20722121}
    20732122
    2074 
    2075 
    20762123itcl::body Rappture::FlowvisViewer::BuildViewTab {} {
    20772124    foreach { key value } {
     
    23542401    $inner configure -borderwidth 4
    23552402
    2356     set labels { phi theta psi pan-x pan-y zoom }
     2403    if {$_useArcball} {
     2404        set labels { qw qx qy qz pan-x pan-y zoom }
     2405    } else {
     2406        set labels { phi theta psi pan-x pan-y zoom }
     2407    }
    23572408    set row 0
    23582409    foreach tag $labels {
     
    25362587    set _width $w
    25372588    set _height $h
     2589    $_arcball resize $w $h
    25382590    if { !$_resizePending } {
    25392591        $_dispatcher event -after 200 !resize
     
    25802632                    set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    25812633                    SendCmd "camera angle $xyz"
     2634                    if {$_useArcball} {
     2635                        $_arcball euler [list [expr {-[lindex $xyz 2]}] [expr {-[lindex $xyz 1]}] [expr {-[lindex $xyz 0]}]]
     2636                        set q [$_arcball quaternion]
     2637                        foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     2638                        set _settings($this-qw) $_view(qw)
     2639                        set _settings($this-qx) $_view(qx)
     2640                        set _settings($this-qy) $_view(qy)
     2641                        set _settings($this-qz) $_view(qz)
     2642                    }
     2643                }
     2644                "qx" - "qy" - "qz" - "qw" {
     2645                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2646                    $_arcball quaternion $q
     2647                    SendCmd "camera orient $q"
    25822648                }
    25832649                "zoom" {
  • branches/nanovis2/gui/scripts/isomarker.tcl

    r2744 r3004  
    115115        array set limits [$_nvobj limits $_tf]
    116116        if { $limits(vmax) == $limits(vmin) } {
    117             set limits(min) 0.0
    118             set limits(max) 1.0
     117            set limits(vmin) 0.0
     118            set limits(vmax) 1.0
    119119        }
    120120        if { [catch {expr $limits(vmax) - $limits(vmin)} r] != 0 } {
  • branches/nanovis2/gui/scripts/nanovisviewer.tcl

    r2876 r3004  
    118118    private method GetVolumeInfo { w }
    119119
     120    private variable _arcball ""
     121    private variable _useArcball 1
    120122    private variable _outbuf       ;# buffer for outgoing commands
    121123
     
    195197    # Initialize the view to some default parameters.
    196198    array set _view {
     199        qw      0.853553
     200        qx      -0.353553
     201        qy      0.353553
     202        qz      0.146447
    197203        theta   45
    198204        phi     45
     
    202208        pan-y   0
    203209    }
     210    set _arcball [blt::arcball create 100 100]
     211    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     212    $_arcball quaternion $q
     213
    204214    set _limits(vmin) 0.0
    205215    set _limits(vmax) 1.0
    206216
    207217    array set _settings [subst {
     218        $this-qw                $_view(qw)
     219        $this-qx                $_view(qx)
     220        $this-qy                $_view(qy)
     221        $this-qz                $_view(qz)
     222        $this-theta             $_view(theta)
     223        $this-phi               $_view(phi)
     224        $this-psi               $_view(psi)
     225        $this-zoom              $_view(zoom)   
    208226        $this-pan-x             $_view(pan-x)
    209227        $this-pan-y             $_view(pan-y)
    210         $this-phi               $_view(phi)
    211         $this-psi               $_view(psi)
    212         $this-theta             $_view(theta)
    213228        $this-volume            1
    214229        $this-xcutplane         0
     
    218233        $this-zcutplane         0
    219234        $this-zcutposition      0
    220         $this-zoom              $_view(zoom)
    221235    }]
    222236
     
    373387    image delete $_image(legend)
    374388    image delete $_image(download)
     389    catch { blt::arcball destroy $_arcball }
    375390    array unset _settings $this-*
    376391}
     
    658673        return
    659674    }
    660     # Insure that the global opacity and thickness settings (in the slider
     675    # Ensure that the global opacity and thickness settings (in the slider
    661676    # settings widgets) are used for the active transfer-function.  Update
    662677    # the values in the _settings varible.
     
    669684            # The volume hasn't reached the server yet.  How did we get
    670685            # here?
     686            puts stderr "Don't have $vol in _serverVols"
    671687            continue
    672688        }
    673689        if { ![info exists _vol2style($vol)] } {
    674             puts stderr "unknown volume $vol"
     690            puts stderr "Don't have style for volume $vol"
    675691            continue;                        # How does this happen?
    676692        }
     
    812828        return
    813829    }
     830
     831    puts stderr "Received volume info: '$args'"
     832
    814833    # Arguments from server are name value pairs. Stuff them in an array.
    815834    array set info $args
     
    865884    set w [winfo width $itk_component(3dview)]
    866885    set h [winfo height $itk_component(3dview)]
     886    $_arcball resize $w $h
    867887    EventuallyResize $w $h
    868888
     
    885905    # Reset the camera and other view parameters
    886906    #
    887 
     907    set _settings($this-qw)    $_view(qw)
     908    set _settings($this-qx)    $_view(qx)
     909    set _settings($this-qy)    $_view(qy)
     910    set _settings($this-qz)    $_view(qz)
    888911    set _settings($this-theta) $_view(theta)
    889912    set _settings($this-phi)   $_view(phi)
     
    893916    set _settings($this-zoom)  $_view(zoom)
    894917
    895     set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    896     SendCmd "camera angle $xyz"
     918    if {$_useArcball} {
     919        set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     920        $_arcball quaternion $q
     921        SendCmd "camera orient $q"
     922    } else {
     923        set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     924        SendCmd "camera angle $xyz"
     925    }
     926
    897927    PanCamera
    898928    SendCmd "camera zoom $_view(zoom)"
     
    9871017        "reset" {
    9881018            array set _view {
     1019                qw      0.853553
     1020                qx      -0.353553
     1021                qy      0.353553
     1022                qz      0.146447
    9891023                theta   45
    9901024                phi     45
     
    10001034                }
    10011035            }
    1002             set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    1003             SendCmd "camera angle $xyz"
     1036            if {$_useArcball} {
     1037                set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     1038                $_arcball quaternion $q
     1039                SendCmd "camera orient $q"
     1040            } else {
     1041                set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
     1042                SendCmd "camera angle $xyz"
     1043            }
     1044
    10041045            PanCamera
     1046            set _settings($this-qw)    $_view(qw)
     1047            set _settings($this-qx)    $_view(qx)
     1048            set _settings($this-qy)    $_view(qy)
     1049            set _settings($this-qz)    $_view(qz)
    10051050            set _settings($this-theta) $_view(theta)
    10061051            set _settings($this-phi)   $_view(phi)
     
    10581103                }
    10591104
    1060                 #
    1061                 # Rotate the camera in 3D
    1062                 #
    1063                 if {$_view(psi) > 90 || $_view(psi) < -90} {
    1064                     # when psi is flipped around, theta moves backwards
    1065                     set dy [expr {-$dy}]
     1105                if {$_useArcball} {
     1106                    set q [$_arcball rotate $x $y $_click(x) $_click(y)]
     1107                    foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     1108                    SendCmd "camera orient $q"
     1109                } else {
     1110                    #
     1111                    # Rotate the camera in 3D
     1112                    #
     1113                    if {$_view(psi) > 90 || $_view(psi) < -90} {
     1114                        # when psi is flipped around, theta moves backwards
     1115                        set dy [expr {-$dy}]
     1116                    }
     1117                    set theta [expr {$_view(theta) - $dy*180}]
     1118                    while {$theta < 0} { set theta [expr {$theta+180}] }
     1119                    while {$theta > 180} { set theta [expr {$theta-180}] }
     1120
     1121                    if {abs($theta) >= 30 && abs($theta) <= 160} {
     1122                        set phi [expr {$_view(phi) - $dx*360}]
     1123                        while {$phi < 0} { set phi [expr {$phi+360}] }
     1124                        while {$phi > 360} { set phi [expr {$phi-360}] }
     1125                        set psi $_view(psi)
     1126                    } else {
     1127                        set phi $_view(phi)
     1128                        set psi [expr {$_view(psi) - $dx*360}]
     1129                        while {$psi < -180} { set psi [expr {$psi+360}] }
     1130                        while {$psi > 180} { set psi [expr {$psi-360}] }
     1131                    }
     1132
     1133                    set _view(theta)        $theta
     1134                    set _view(phi)          $phi
     1135                    set _view(psi)          $psi
     1136                    set xyz [Euler2XYZ $theta $phi $psi]
     1137                    set _settings($this-theta) $_view(theta)
     1138                    set _settings($this-phi)   $_view(phi)
     1139                    set _settings($this-psi)   $_view(psi)
     1140                    SendCmd "camera angle $xyz"
    10661141                }
    1067                 set theta [expr {$_view(theta) - $dy*180}]
    1068                 while {$theta < 0} { set theta [expr {$theta+180}] }
    1069                 while {$theta > 180} { set theta [expr {$theta-180}] }
    1070 
    1071                 if {abs($theta) >= 30 && abs($theta) <= 160} {
    1072                     set phi [expr {$_view(phi) - $dx*360}]
    1073                     while {$phi < 0} { set phi [expr {$phi+360}] }
    1074                     while {$phi > 360} { set phi [expr {$phi-360}] }
    1075                     set psi $_view(psi)
    1076                 } else {
    1077                     set phi $_view(phi)
    1078                     set psi [expr {$_view(psi) - $dx*360}]
    1079                     while {$psi < -180} { set psi [expr {$psi+360}] }
    1080                     while {$psi > 180} { set psi [expr {$psi-360}] }
    1081                 }
    1082 
    1083                 set _view(theta)        $theta
    1084                 set _view(phi)          $phi
    1085                 set _view(psi)          $psi
    1086                 set xyz [Euler2XYZ $theta $phi $psi]
    1087                 set _settings($this-theta) $_view(theta)
    1088                 set _settings($this-phi)   $_view(phi)
    1089                 set _settings($this-psi)   $_view(psi)
    1090                 SendCmd "camera angle $xyz"
     1142
    10911143                set _click(x) $x
    10921144                set _click(y) $y
     
    11591211            if {[isconnected]} {
    11601212                set val $_settings($this-light)
    1161                 set sval [expr {0.01*$val}]
    1162                 SendCmd "volume shading diffuse $sval"
    1163                 set sval [expr {sqrt($val+1.0)}]
    1164                 SendCmd "volume shading specular $sval"
     1213                set diffuse [expr {0.01*$val}]
     1214                set ambient [expr {1.0-$diffuse}]
     1215                set specularLevel 0.3
     1216                set specularExp 90.0
     1217                SendCmd "volume shading ambient $ambient"
     1218                SendCmd "volume shading diffuse $diffuse"
     1219                SendCmd "volume shading specular {$specularLevel $specularExp}"
    11651220            }
    11661221        }
     
    11831238            }
    11841239        }
    1185 
    11861240        thickness {
    11871241            if {[isconnected] && [array names _activeTfs] > 0 } {
     
    12991353        -levels 6
    13001354        -opacity 1.0
     1355        -markers ""
    13011356    }
    13021357    array set style [lindex [$dataobj components -style $comp] 0]
     
    13211376        -levels 6
    13221377        -opacity 1.0
     1378        -markers ""
    13231379    }
    13241380    foreach {dataobj comp} [split [lindex $_style2vols($tf) 0] -] break
    13251381    array set style [lindex [$dataobj components -style $comp] 0]
    13261382
     1383    puts stderr "$tf: $style(-color), $style(-levels), $style(-opacity), $style(-markers)"
    13271384
    13281385    # We have to parse the style attributes for a volume using this
     
    13411398    if { ![info exists _isomarkers($tf)] } {
    13421399        # Have to defer creation of isomarkers until we have data limits
    1343         if { [info exists style(-markers)] } {
     1400        if { [info exists style(-markers)] &&
     1401             [llength $style(-markers)] > 0 } {
    13441402            ParseMarkersOption $tf $style(-markers)
     1403            puts stderr "Found markers option"
    13451404        } else {
    13461405            ParseLevelsOption $tf $style(-levels)
     
    13511410    }
    13521411    set clist [split $style(-color) :]
    1353     set cmap "0.0 [Color2RGB white] "
     1412    if {[llength $clist] == 1} {
     1413        lappend clist [lindex $clist 0]
     1414    }
    13541415    for {set i 0} {$i < [llength $clist]} {incr i} {
    1355         set x [expr {double($i+1)/([llength $clist]+1)}]
     1416        set x [expr {double($i)/([llength $clist]-1)}]
    13561417        set color [lindex $clist $i]
    13571418        append cmap "$x [Color2RGB $color] "
    13581419    }
    1359     append cmap "1.0 [Color2RGB $color]"
    13601420
    13611421    set tag $this-$tf
     
    13631423        set _settings($tag-opacity) $style(-opacity)
    13641424    }
    1365     set max $_settings($tag-opacity)
     1425    set max 1.0 ;#$_settings($tag-opacity)
    13661426
    13671427    set isovalues {}
     
    13731433
    13741434    if { ![info exists _settings($tag-thickness)]} {
    1375         set _settings($tag-thickness) 0.05
     1435        set _settings($tag-thickness) 0.005
    13761436    }
    13771437    set delta $_settings($tag-thickness)
     
    17041764    label $inner.shading -text "Shading:" -font $fg
    17051765
    1706     label $inner.dim -text "Dim" -font $fg
     1766    label $inner.dim -text "Glow" -font $fg
    17071767    ::scale $inner.light -from 0 -to 100 -orient horizontal \
    17081768        -variable [itcl::scope _settings($this-light)] \
    17091769        -width 10 \
    17101770        -showvalue off -command [itcl::code $this FixSettings light]
    1711     label $inner.bright -text "Bright" -font $fg
    1712 
    1713     label $inner.fog -text "Fog" -font $fg
     1771    label $inner.bright -text "Surface" -font $fg
     1772
     1773    label $inner.fog -text "Clear" -font $fg
    17141774    ::scale $inner.transp -from 0 -to 100 -orient horizontal \
    17151775        -variable [itcl::scope _settings($this-transp)] \
    17161776        -width 10 \
    17171777        -showvalue off -command [itcl::code $this FixSettings transp]
    1718     label $inner.plastic -text "Plastic" -font $fg
     1778    label $inner.plastic -text "Opaque" -font $fg
    17191779
    17201780    label $inner.clear -text "Clear" -font $fg
     
    17411801        3,1 $inner.transp -columnspan 2 -pady 2 -fill x \
    17421802        3,3 $inner.plastic -anchor w -pady 2 \
    1743         4,0 $inner.clear -anchor e -pady 2 \
    1744         4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
    1745         4,3 $inner.opaque -anchor w -pady 2 \
    1746         5,0 $inner.thin -anchor e -pady 2 \
    1747         5,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
    1748         5,3 $inner.thick -anchor w -pady 2
     1803        4,0 $inner.thin -anchor e -pady 2 \
     1804        4,1 $inner.thickness -columnspan 2 -pady 2 -fill x\
     1805        4,3 $inner.thick -anchor w -pady 2
     1806
     1807#        4,0 $inner.clear -anchor e -pady 2 \
     1808#        4,1 $inner.opacity -columnspan 2 -pady 2 -fill x\
     1809#        4,3 $inner.opaque -anchor w -pady 2 \
     1810
    17491811
    17501812    blt::table configure $inner c0 c1 c3 r* -resize none
    1751     blt::table configure $inner r6 -resize expand
     1813    blt::table configure $inner r5 -resize expand
    17521814}
    17531815
     
    18591921    $inner configure -borderwidth 4
    18601922
    1861     set labels { phi theta psi pan-x pan-y zoom }
     1923    if {$_useArcball} {
     1924        set labels { qw qx qy qz pan-x pan-y zoom }
     1925    } else {
     1926        set labels { phi theta psi pan-x pan-y zoom }
     1927    }
    18621928    set row 0
    18631929    foreach tag $labels {
     
    19301996    set _width $w
    19311997    set _height $h
     1998    $_arcball resize $w $h
    19321999    if { !$_resizePending } {
    19332000        $_dispatcher event -idle !resize
     
    19682035                    set xyz [Euler2XYZ $_view(theta) $_view(phi) $_view(psi)]
    19692036                    SendCmd "camera angle $xyz"
     2037                    if {$_useArcball} {
     2038                        $_arcball euler [list [expr {-[lindex $xyz 2]}] [expr {-[lindex $xyz 1]}] [expr {-[lindex $xyz 0]}]]
     2039                        set q [$_arcball quaternion]
     2040                        foreach { _view(qw) _view(qx) _view(qy) _view(qz) } $q break
     2041                        set _settings($this-qw) $_view(qw)
     2042                        set _settings($this-qx) $_view(qx)
     2043                        set _settings($this-qy) $_view(qy)
     2044                        set _settings($this-qz) $_view(qz)
     2045                    }
     2046                }
     2047                "qx" - "qy" - "qz" - "qw" {
     2048                    set q [list $_view(qw) $_view(qx) $_view(qy) $_view(qz)]
     2049                    $_arcball quaternion $q
     2050                    SendCmd "camera orient $q"
    19702051                }
    19712052                "zoom" {
Note: See TracChangeset for help on using the changeset viewer.