QvisRenderingWindow.C 37.7 KB
Newer Older
hrchilds's avatar
hrchilds committed
1 2
#include <QvisRenderingWindow.h>
#include <float.h>
hrchilds's avatar
hrchilds committed
3
#include <limits.h>
hrchilds's avatar
hrchilds committed
4 5 6 7 8 9 10 11

#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qradiobutton.h>
#include <qslider.h>
hrchilds's avatar
hrchilds committed
12
#include <qspinbox.h>
hrchilds's avatar
hrchilds committed
13 14 15 16

#include <RenderingAttributes.h>
#include <ViewerProxy.h>
#include <WindowInformation.h>
hrchilds's avatar
hrchilds committed
17
#include <QvisOpacitySlider.h>
hrchilds's avatar
hrchilds committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33

// ****************************************************************************
// Method: QvisRenderingWindow::QvisRenderingWindow
//
// Purpose: 
//   Constructor for the QvisRenderingWindow class.
//
// Arguments:
//   caption : The window caption.
//   shortName : The name shown in the notepad.
//   n         : The notepad area.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:46:40 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
34 35 36
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
37
//   
hrchilds's avatar
hrchilds committed
38 39 40
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Initialize dlMode.
//
hrchilds's avatar
hrchilds committed
41 42 43 44
// ****************************************************************************

QvisRenderingWindow::QvisRenderingWindow(const char *caption,
    const char *shortName, QvisNotepadArea *n) :
hrchilds's avatar
hrchilds committed
45
    QvisPostableWindowSimpleObserver(caption, shortName, n, ApplyButton)
hrchilds's avatar
hrchilds committed
46 47 48 49 50
{
    renderAtts = 0;
    windowInfo = 0;

    objectRepresentation = 0;
hrchilds's avatar
hrchilds committed
51
    dlMode = 0;
hrchilds's avatar
hrchilds committed
52
    stereoType = 0;
hrchilds's avatar
hrchilds committed
53
    scalrenActivationMode = 0;
hrchilds's avatar
hrchilds committed
54 55 56 57 58 59 60 61 62 63 64 65 66
}

// ****************************************************************************
// Method: QvisRenderingWindow::~QvisRenderingWindow
//
// Purpose: 
//   This is the destructor for the QvisRenderingWindow class.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:29 PST 2002
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
67 68
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshold to scalrenActivationMode
hrchilds's avatar
hrchilds committed
69 70 71 72
//
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Delete dlMode.
//
hrchilds's avatar
hrchilds committed
73 74 75 76 77
// ****************************************************************************

QvisRenderingWindow::~QvisRenderingWindow()
{
    delete objectRepresentation;
hrchilds's avatar
hrchilds committed
78
    delete dlMode;
hrchilds's avatar
hrchilds committed
79
    delete stereoType;
hrchilds's avatar
hrchilds committed
80
    delete scalrenActivationMode;
hrchilds's avatar
hrchilds committed
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104

    if(renderAtts)
        renderAtts->Detach(this);

    if(windowInfo)
        windowInfo->Detach(this);
}

// ****************************************************************************
// Method: QvisRenderingWindow::CreateWindowContents
//
// Purpose: 
//   This method creates all of the window's widgets.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:47:57 PST 2002
//
// Modifications:
//   Brad Whitlock, Thu Oct 24 13:33:31 PST 2002
//   I made the stereo radio buttons class members.
//   
//   Kathleen Bonnell, Wed Dec  4 18:42:48 PST 2002 
//   Removed antialiasingQuality slider, no longer needed. 
//   
hrchilds's avatar
hrchilds committed
105 106 107
//   Jeremy Meredith, Fri Nov 14 17:47:19 PST 2003
//   Added specular options.
//
hrchilds's avatar
hrchilds committed
108 109 110
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Added scalable threshold spinbox
//
hrchilds's avatar
hrchilds committed
111 112 113
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Add support for multiple display list modes.
//
hrchilds's avatar
hrchilds committed
114 115 116 117
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
118 119 120
//   Hank Childs, Sun Oct 24 07:36:18 PDT 2004
//   Added shadow options.
//
hrchilds's avatar
hrchilds committed
121 122 123 124 125 126 127 128 129 130 131 132 133 134
// ****************************************************************************

void
QvisRenderingWindow::CreateWindowContents()
{
    //
    // Create the renderer options group.
    //
    QGroupBox *options = new QGroupBox(central, "options");
    options->setTitle("Options");
    topLayout->addWidget(options);

    QVBoxLayout *spacer = new QVBoxLayout(options);
    spacer->addSpacing(10);
hrchilds's avatar
hrchilds committed
135
    QGridLayout *oLayout = new QGridLayout(spacer, 16, 4);
hrchilds's avatar
hrchilds committed
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
    oLayout->setSpacing(5);
    oLayout->setMargin(10);

    // Create the antialiasing widgets.
    antialiasingToggle = new QCheckBox("Antialiasing", options,
        "antialiasingToggle");
    connect(antialiasingToggle, SIGNAL(toggled(bool)),
            this, SLOT(antialiasingToggled(bool)));
    oLayout->addMultiCellWidget(antialiasingToggle, 0, 0, 0, 1);

    // Create the surface rep widgets.
    QLabel *drawObjLabel = new QLabel("Draw objects as", options, "drawObjLabel");
    oLayout->addMultiCellWidget(drawObjLabel, 2, 2, 0, 3);
    objectRepresentation = new QButtonGroup(0, "objectRepresentation");
    connect(objectRepresentation, SIGNAL(clicked(int)),
            this, SLOT(objectRepresentationChanged(int)));
    QRadioButton *surfaces = new QRadioButton("Surfaces", options, "surfaces");
    objectRepresentation->insert(surfaces);
    oLayout->addWidget(surfaces, 3, 1);
    QRadioButton *wires = new QRadioButton("Wireframe", options,
        "wires");
    objectRepresentation->insert(wires);
    oLayout->addWidget(wires, 3, 2);
    QRadioButton *points = new QRadioButton("Points", options,
        "points");
    objectRepresentation->insert(points);
    oLayout->addWidget(points, 3, 3);

hrchilds's avatar
hrchilds committed
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180
    // Create the display list widgets.
    QLabel *displayListLabel = new QLabel("Use display lists", options, "displayListLabel");
    oLayout->addMultiCellWidget(displayListLabel, 4, 4, 0, 3);
    dlMode = new QButtonGroup(0, "displayList");
    connect(dlMode, SIGNAL(clicked(int)),
            this, SLOT(displayListModeChanged(int)));
    QRadioButton *dl_auto = new QRadioButton("Auto", options, "dl_auto");
    dlMode->insert(dl_auto);
    oLayout->addWidget(dl_auto, 5, 1);
    QRadioButton *dl_always = new QRadioButton("Always", options,
        "dl_always");
    dlMode->insert(dl_always);
    oLayout->addWidget(dl_always, 5, 2);
    QRadioButton *dl_never = new QRadioButton("Never", options,
        "dl_never");
    dlMode->insert(dl_never);
    oLayout->addWidget(dl_never, 5, 3);
hrchilds's avatar
hrchilds committed
181 182 183 184 185 186

    // Create the stereo widgets.
    stereoToggle = new QCheckBox("Stereo", options,
        "stereoToggle");
    connect(stereoToggle, SIGNAL(toggled(bool)),
            this, SLOT(stereoToggled(bool)));
hrchilds's avatar
hrchilds committed
187
    oLayout->addMultiCellWidget(stereoToggle, 6, 6, 0, 3);
hrchilds's avatar
hrchilds committed
188 189 190 191 192
    stereoType = new QButtonGroup(0, "stereoType");
    connect(stereoType, SIGNAL(clicked(int)),
            this, SLOT(stereoTypeChanged(int)));
    redblue = new QRadioButton("Red/Blue", options, "redblue");
    stereoType->insert(redblue);
hrchilds's avatar
hrchilds committed
193
    oLayout->addWidget(redblue, 7, 1);
hrchilds's avatar
hrchilds committed
194 195 196
    interlace = new QRadioButton("Interlace", options,
        "interlace");
    stereoType->insert(interlace);
hrchilds's avatar
hrchilds committed
197
    oLayout->addWidget(interlace, 7, 2);
hrchilds's avatar
hrchilds committed
198 199 200
    crystalEyes = new QRadioButton("Crystal Eyes", options,
        "crystalEyes");
    stereoType->insert(crystalEyes);
hrchilds's avatar
hrchilds committed
201
    oLayout->addWidget(crystalEyes, 7, 3);
hrchilds's avatar
hrchilds committed
202 203

    // Create the scalable rendering widgets.
hrchilds's avatar
hrchilds committed
204
    QLabel *scalrenLabel = new QLabel("Use scalable rendering", options,"scalrenLabel");
hrchilds's avatar
hrchilds committed
205
    oLayout->addMultiCellWidget(scalrenLabel, 8, 8, 0, 3);
hrchilds's avatar
hrchilds committed
206 207 208
    scalrenActivationMode = new QButtonGroup(0, "scalrenActivationMode");
    connect(scalrenActivationMode, SIGNAL(clicked(int)),
            this, SLOT(scalrenActivationModeChanged(int)));
hrchilds's avatar
hrchilds committed
209
    scalrenAuto = new QRadioButton("Auto", options, "auto");
hrchilds's avatar
hrchilds committed
210
    scalrenActivationMode->insert(scalrenAuto);
hrchilds's avatar
hrchilds committed
211
    oLayout->addWidget(scalrenAuto, 9, 1);
hrchilds's avatar
hrchilds committed
212
    scalrenAlways = new QRadioButton("Always", options, "always");
hrchilds's avatar
hrchilds committed
213
    scalrenActivationMode->insert(scalrenAlways);
hrchilds's avatar
hrchilds committed
214
    oLayout->addWidget(scalrenAlways, 9, 2);
hrchilds's avatar
hrchilds committed
215
    scalrenNever = new QRadioButton("Never", options, "never");
hrchilds's avatar
hrchilds committed
216
    scalrenActivationMode->insert(scalrenNever);
hrchilds's avatar
hrchilds committed
217
    oLayout->addWidget(scalrenNever, 9, 3);
hrchilds's avatar
hrchilds committed
218

hrchilds's avatar
hrchilds committed
219 220
    // Create the polygon count spin box for scalable rendering threshold
    scalrenGeometryLabel =  new QLabel("When polygon count exceeds", options, "scalrenGeometryLabel");
hrchilds's avatar
hrchilds committed
221
    oLayout->addMultiCellWidget(scalrenGeometryLabel, 10, 10, 1, 2);
hrchilds's avatar
hrchilds committed
222
    scalrenAutoThreshold = new QSpinBox(0, 10000, 500, options, "scalrenAutoThreshold");
hrchilds's avatar
hrchilds committed
223 224
    scalrenAutoThreshold->setValue(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
    scalrenAutoThresholdChanged(RenderingAttributes::DEFAULT_SCALABLE_AUTO_THRESHOLD);
hrchilds's avatar
hrchilds committed
225 226
    connect(scalrenAutoThreshold, SIGNAL(valueChanged(int)),
            this, SLOT(scalrenAutoThresholdChanged(int)));
hrchilds's avatar
hrchilds committed
227
    oLayout->addWidget(scalrenAutoThreshold, 10, 3);
hrchilds's avatar
hrchilds committed
228 229

    // Create the specular lighting options
hrchilds's avatar
hrchilds committed
230 231 232 233
    specularToggle = new QCheckBox("Specular lighting", options,
                                   "specularToggle");
    connect(specularToggle, SIGNAL(toggled(bool)),
            this, SLOT(specularToggled(bool)));
hrchilds's avatar
hrchilds committed
234
    oLayout->addMultiCellWidget(specularToggle, 11, 11, 0,3);
hrchilds's avatar
hrchilds committed
235 236 237 238 239 240 241 242

    specularStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, options,
                                             "specularStrengthSlider", NULL);
    specularStrengthSlider->setTickInterval(25);
    connect(specularStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularStrengthChanged(int, const void*)));
    specularStrengthLabel = new QLabel(specularStrengthSlider, "Strength",
                                       options, "specularStrengthLabel");
hrchilds's avatar
hrchilds committed
243 244
    oLayout->addWidget(specularStrengthLabel, 12,1);
    oLayout->addMultiCellWidget(specularStrengthSlider, 12,12, 2,3);
hrchilds's avatar
hrchilds committed
245 246 247 248 249 250 251 252

    specularPowerSlider = new QvisOpacitySlider(0, 1000, 100, 100, options,
                                                "specularPowerSlider", NULL);
    specularPowerSlider->setTickInterval(100);
    connect(specularPowerSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(specularPowerChanged(int, const void*)));
    specularPowerLabel = new QLabel(specularPowerSlider, "Sharpness",
                                    options, "specularPowerLabel");
hrchilds's avatar
hrchilds committed
253 254
    oLayout->addWidget(specularPowerLabel, 13,1);
    oLayout->addMultiCellWidget(specularPowerSlider, 13,13, 2,3);
hrchilds's avatar
hrchilds committed
255

hrchilds's avatar
hrchilds committed
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272
    // Create the shadow lighting options
    shadowToggle = new QCheckBox("Shadows", options,
                                   "shadowToggle");
    connect(shadowToggle, SIGNAL(toggled(bool)),
            this, SLOT(shadowToggled(bool)));
    oLayout->addMultiCellWidget(shadowToggle, 14, 14, 0,3);

    shadowStrengthSlider = new QvisOpacitySlider(0, 100, 10, 60, options,
                                             "shadowStrengthSlider", NULL);
    shadowStrengthSlider->setTickInterval(25);
    connect(shadowStrengthSlider, SIGNAL(valueChanged(int, const void*)),
            this, SLOT(shadowStrengthChanged(int, const void*)));
    shadowStrengthLabel = new QLabel(shadowStrengthSlider, "Strength",
                                       options, "shadowStrengthLabel");
    oLayout->addWidget(shadowStrengthLabel, 15,1);
    oLayout->addMultiCellWidget(shadowStrengthSlider, 15,15, 2,3);

hrchilds's avatar
hrchilds committed
273

hrchilds's avatar
hrchilds committed
274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291
    //
    // Create the renderer information group.
    //
    QGroupBox *info = new QGroupBox(central, "info");
    info->setTitle("Information");
    topLayout->addWidget(info);

    QVBoxLayout *vLayout = new QVBoxLayout(info);
    vLayout->addSpacing(10);
    vLayout->setMargin(10);

    renderNotifyToggle = new QCheckBox("Query after each render", info,
        "renderNotifyToggle");
    connect(renderNotifyToggle, SIGNAL(toggled(bool)),
            this, SLOT(renderNotifyToggled(bool)));
    vLayout->addWidget(renderNotifyToggle);
    vLayout->addSpacing(5);

hrchilds's avatar
hrchilds committed
292 293 294 295 296 297 298 299
    QGridLayout *scalrenLayout = new QGridLayout(vLayout, 2, 4);
    scalrenLayout->setSpacing(5);
    QLabel *scalrenLabel2 = new QLabel("Using Scalable Rendering: ", info, "scalrenLabel2");
    scalrenLayout->addWidget(scalrenLabel2, 0, 0);
    scalrenUsingLabel = new QLabel("N/A", info, "scalrenUsingLabel");
    scalrenLayout->addWidget(scalrenUsingLabel, 0, 1);
    vLayout->addSpacing(5);

hrchilds's avatar
hrchilds committed
300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353
    QGridLayout *iLayout = new QGridLayout(vLayout, 2, 4);
    iLayout->setSpacing(5);
    QLabel *fpsLabel2 = new QLabel("Frames per second:", info, "fpsLabel2");
    iLayout->addWidget(fpsLabel2, 0, 0);
    fpsMinLabel = new QLabel("0.", info, "fpsMinLabel");
    iLayout->addWidget(fpsMinLabel, 0, 1);
    fpsAvgLabel = new QLabel("0.", info, "fpsAvgLabel");
    iLayout->addWidget(fpsAvgLabel, 0, 2);
    fpsMaxLabel = new QLabel("0.", info, "fpsMaxLabel");
    iLayout->addWidget(fpsMaxLabel, 0, 3);

    QLabel *ntri = new QLabel("Approximate triangle count:", info, "ntri");
    iLayout->addWidget(ntri, 1, 0);
    approxNumTriangles = new QLabel("0.", info, "approxNumTriangles");
    iLayout->addWidget(approxNumTriangles, 1, 1);
    vLayout->addSpacing(5);

    QGridLayout *eLayout = new QGridLayout(vLayout, 3, 3);
    eLayout->setSpacing(5);
    QLabel *xExtentsLabel = new QLabel("X Extents:", info, "xExtentsLabel");
    eLayout->addWidget(xExtentsLabel, 3, 0);
    extents[0] = new QLabel("0.", info, "extents_0");
    eLayout->addWidget(extents[0], 3, 1);
    extents[1] = new QLabel("0.", info, "extents_1");
    eLayout->addWidget(extents[1], 3, 2);

    QLabel *yExtentsLabel = new QLabel("Y Extents:", info, "yExtentsLabel");
    eLayout->addWidget(yExtentsLabel, 4, 0);
    extents[2] = new QLabel("0.", info, "extents_2");
    eLayout->addWidget(extents[2], 4, 1);
    extents[3] = new QLabel("0.", info, "extents_3");
    eLayout->addWidget(extents[3], 4, 2);

    QLabel *zExtentsLabel = new QLabel("Z Extents:", info, "zExtentsLabel");
    eLayout->addWidget(zExtentsLabel, 5, 0);
    extents[4] = new QLabel("0.", info, "extents_4");
    eLayout->addWidget(extents[4], 5, 1);
    extents[5] = new QLabel("0.", info, "extents_5");
    eLayout->addWidget(extents[5], 5, 2);
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateWindow
//
// Purpose: 
//   This method updates the window's widgets when its subjects update.
//
// Arguments:
//   doAll : Whether or not to ignore field selection.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:48:24 PST 2002
//
// Modifications:
hrchilds's avatar
hrchilds committed
354
//
hrchilds's avatar
hrchilds committed
355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384
// ****************************************************************************

void
QvisRenderingWindow::UpdateWindow(bool doAll)
{
    if(SelectedSubject() == renderAtts || doAll)
        UpdateOptions(doAll);
    if(SelectedSubject() == windowInfo || doAll)
        UpdateInformation(doAll);
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateOptions
//
// Purpose: 
//   Updates the widgets that control the rendering options.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:28:53 PDT 2002
//
// Modifications:
//   Brad Whitlock, Thu Oct 24 13:35:22 PST 2002
//   I added code to enable/disable the stereo rendering buttons.
//
//   Kathleen Bonnell, Wed Dec  4 18:42:48 PST 2002 
//   Renumber switch cases, to reflect antialisingFrames removed from atts. 
//
hrchilds's avatar
hrchilds committed
385 386 387
//   Jeremy Meredith, Fri Nov 14 17:44:35 PST 2003
//   Added specular options.
//
hrchilds's avatar
hrchilds committed
388 389 390
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Changed name of scalableThreshld to scalrenActivationMode
//
hrchilds's avatar
hrchilds committed
391 392 393
//   Hank Childs, Sun May  9 15:54:29 PDT 2004
//   Add support for multiple display list modes.
//
hrchilds's avatar
hrchilds committed
394 395 396 397
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
398 399 400
//   Hank Childs, Sun Oct 24 07:36:18 PDT 2004
//   Added shadow options.
//
hrchilds's avatar
hrchilds committed
401 402 403 404 405 406
// ****************************************************************************

void
QvisRenderingWindow::UpdateOptions(bool doAll)
{
    QString tmp;
hrchilds's avatar
hrchilds committed
407
    int itmp, itmp2;
hrchilds's avatar
hrchilds committed
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < renderAtts->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!renderAtts->IsSelected(i))
            continue;
        }

        switch(i)
        {
        case 0: //antialiasing
            antialiasingToggle->blockSignals(true);
            antialiasingToggle->setChecked(renderAtts->GetAntialiasing());
            antialiasingToggle->blockSignals(false);
            break;
        case 1: //geometryRepresentation
            itmp = (int)renderAtts->GetGeometryRepresentation();
            objectRepresentation->blockSignals(true);
            objectRepresentation->setButton(itmp);
            objectRepresentation->blockSignals(false);
            break;
        case 2: //displayLists
hrchilds's avatar
hrchilds committed
434 435 436 437 438 439 440 441 442 443
            itmp = (int) renderAtts->GetDisplayListMode();
            if (itmp == 2) // Auto for atts's enum type order
                itmp2 = 0; // Order of Auto in window
            else if (itmp == 1) // Always for atts' enum type order
                itmp2 = 1; // Order of Always in window.
            else           // Never for atts' enum type order
                itmp2 = 2; // Order of Never in window.
            dlMode->blockSignals(true);
            dlMode->setButton(itmp2);
            dlMode->blockSignals(false);
hrchilds's avatar
hrchilds committed
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465
            break;
        case 3: //stereoRendering
            stereoToggle->blockSignals(true);
            stereoToggle->setChecked(renderAtts->GetStereoRendering());
            stereoToggle->blockSignals(false);
            stereoType->setEnabled(renderAtts->GetStereoRendering());
            redblue->setEnabled(renderAtts->GetStereoRendering());
            interlace->setEnabled(renderAtts->GetStereoRendering());
            crystalEyes->setEnabled(renderAtts->GetStereoRendering());
            break;
        case 4: //stereoType
            stereoType->blockSignals(true);
            stereoType->setButton((int)renderAtts->GetStereoType());
            stereoType->blockSignals(false);
            break;
        case 5: //notifyForEachRender
            renderNotifyToggle->blockSignals(true);
            renderNotifyToggle->setChecked(renderAtts->GetNotifyForEachRender());
            renderNotifyToggle->blockSignals(false);
            break;
        case 6: //scalableRendering
            break;
hrchilds's avatar
hrchilds committed
466
        case 7: //scalrenActivationMode
hrchilds's avatar
hrchilds committed
467 468
            RenderingAttributes::TriStateMode itmp;
            itmp = renderAtts->GetScalableActivationMode();
hrchilds's avatar
hrchilds committed
469
            scalrenActivationMode->blockSignals(true);
hrchilds's avatar
hrchilds committed
470
            if (itmp == RenderingAttributes::Always)
hrchilds's avatar
hrchilds committed
471
               scalrenActivationMode->setButton(1);
hrchilds's avatar
hrchilds committed
472
            else if (itmp == RenderingAttributes::Never)
hrchilds's avatar
hrchilds committed
473
               scalrenActivationMode->setButton(2);
hrchilds's avatar
hrchilds committed
474
            else
hrchilds's avatar
hrchilds committed
475 476
               scalrenActivationMode->setButton(0);
            scalrenActivationMode->blockSignals(false);
hrchilds's avatar
hrchilds committed
477 478 479
            shadowToggle->setEnabled(itmp == RenderingAttributes::Always);
            if (itmp != RenderingAttributes::Always)
                shadowStrengthSlider->setEnabled(false);
hrchilds's avatar
hrchilds committed
480
            break;
hrchilds's avatar
hrchilds committed
481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502
        case 8: //specularFlag
            specularToggle->blockSignals(true);
            specularToggle->setChecked(renderAtts->GetSpecularFlag());
            specularToggle->blockSignals(false);
            specularStrengthSlider->setEnabled(renderAtts->GetSpecularFlag());
            specularPowerSlider->setEnabled(renderAtts->GetSpecularFlag());
            specularStrengthLabel->setEnabled(renderAtts->GetSpecularFlag());
            specularPowerLabel->setEnabled(renderAtts->GetSpecularFlag());
            break;
        case 9: //specularCoeff
            specularStrengthSlider->blockSignals(true);
            specularStrengthSlider->setValue(int(renderAtts->GetSpecularCoeff()*100.));
            specularStrengthSlider->blockSignals(false);
            break;
        case 10: //specularPower
            specularPowerSlider->blockSignals(true);
            specularPowerSlider->setValue(int(renderAtts->GetSpecularPower()*10.));
            specularPowerSlider->blockSignals(false);
            break;
        case 11: //specularColor
            // Not user-modifiable at this time
            break;
hrchilds's avatar
hrchilds committed
503 504 505 506 507 508 509 510 511 512 513 514
        case 12: //shadowFlag
            shadowToggle->blockSignals(true);
            shadowToggle->setChecked(renderAtts->GetDoShadowing());
            shadowToggle->blockSignals(false);
            shadowStrengthSlider->setEnabled(renderAtts->GetDoShadowing());
            shadowStrengthLabel->setEnabled(renderAtts->GetDoShadowing());
            break;
        case 13: //shadowStrength
            shadowStrengthSlider->blockSignals(true);
            shadowStrengthSlider->setValue(int(renderAtts->GetShadowStrength()*100.));
            shadowStrengthSlider->blockSignals(false);
            break;
hrchilds's avatar
hrchilds committed
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541
        }
    }
}

// ****************************************************************************
// Method: QvisRenderingWindow::UpdateInformation
//
// Purpose: 
//   Updates the information labels with statistics from the viewer.
//
// Arguments:
//   doAll : Whether or not to ignore selection and update all widgets.
//
// Programmer: Brad Whitlock
// Creation:   Tue Sep 24 11:29:35 PDT 2002
//
// Modifications:
//   Eric Brugger, Fri Apr 18 11:52:33 PDT 2003
//   I removed auto center view.
//   
// ****************************************************************************

void
QvisRenderingWindow::UpdateInformation(bool doAll)
{
    QString tmp;
    float fps;
hrchilds's avatar
hrchilds committed
542
    int j;
hrchilds's avatar
hrchilds committed
543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597

    // Loop through all the attributes and do something for
    // each of them that changed. This function is only responsible
    // for displaying the state values and setting widget sensitivity.
    for(int i = 0; i < windowInfo->NumAttributes(); ++i)
    {
        if(!doAll)
        {
            if(!windowInfo->IsSelected(i))
            continue;
        }

        switch(i)
        {
        case 0: //windowMode
        case 1: //boundingBoxNavigate
        case 2: //spin
        case 3: //perspective
        case 4: //lockView
        case 5: //viewExtentsType
        case 6: //viewDimension
            break;
        case 7: //lastRenderMin
            // Determine the fps.
            if(windowInfo->GetLastRenderMin() > 0. &&
               windowInfo->GetLastRenderMin() < 1.e05)
                fps = 1. / windowInfo->GetLastRenderMin();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMaxLabel->setText(tmp);
            break;
        case 8: //lastRenderAvg
            // Determine the fps.
            if(windowInfo->GetLastRenderAvg() > 0.)
                fps = 1. / windowInfo->GetLastRenderAvg();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsAvgLabel->setText(tmp);
            break;
        case 9: //lastRenderMax
            // Determine the fps.
            if(windowInfo->GetLastRenderMax() > 0.)
                fps = 1. / windowInfo->GetLastRenderMax();
            else
                fps = 0.;
            tmp.sprintf("%1.3g", fps);
            fpsMinLabel->setText(tmp);
            break;
        case 10: //numTriangles
            tmp.sprintf("%d", windowInfo->GetNumTriangles());
            approxNumTriangles->setText(tmp);
            break;
        case 11: //extents
hrchilds's avatar
hrchilds committed
598
            for(j = 0; j < 6; ++j)
hrchilds's avatar
hrchilds committed
599 600 601 602 603 604 605 606 607 608 609 610 611 612
            {
                double d = windowInfo->GetExtents()[j];
                if(d == DBL_MAX || d == -DBL_MAX)
                    tmp = "not set";
                else
                    tmp.sprintf("%g", windowInfo->GetExtents()[j]);
                extents[j]->setText(tmp);
            }
            break;
        case 12: // lockTools
        case 13: // lockTime
        case 14: // cameraViewMode
        case 15: // fullFrame
            break;
hrchilds's avatar
hrchilds committed
613 614 615
        case 16: // usingScalableRendering
            scalrenUsingLabel->setText(windowInfo->GetUsingScalableRendering() ? "yes" : "no");
            break;
hrchilds's avatar
hrchilds committed
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
        }            
    }
}

// ****************************************************************************
// Method: QvisRenderingWindow::Apply
//
// Purpose: 
//   Tells the viewer to apply the rendering attributes.
//
// Arguments:
//   ignore : A flag that causes us to unconditionally apply the
//            rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:49:19 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::Apply(bool ignore)
{
    if(AutoUpdate() || ignore)
    {
        renderAtts->Notify();
        viewer->SetRenderingAttributes();
    }
    else
        renderAtts->Notify();
}

// ****************************************************************************
// Method: QvisRenderingWindow::SubjectRemoved
//
// Purpose: 
//   This method makes sure that we don't Detach from the subject if it is
//   destroyed first.
//
// Arguments:
//   TheRemovedSubject : The subject being deleted.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:50:04 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::SubjectRemoved(Subject *TheRemovedSubject)
{
    if(TheRemovedSubject == renderAtts)
        renderAtts = 0;
    else if(TheRemovedSubject == windowInfo)
        windowInfo = 0;
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectRenderingAttributes
//
// Purpose: 
//   Makes this window observe the rendering attributes.
//
// Arguments:
//   w : The rendering attributes.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectRenderingAttributes(RenderingAttributes *w)
{
    renderAtts = w;
    renderAtts->Attach(this);
}

// ****************************************************************************
// Method: QvisRenderingWindow::ConnectWindowInformation
//
// Purpose: 
//   Makes this window observe the window information.
//
// Arguments:
//   w : The window information.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:11 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::ConnectWindowInformation(WindowInformation *w)
{
    windowInfo = w;
    windowInfo->Attach(this);
}

//
// Qt slot functions
//

// ****************************************************************************
// Method: QvisRenderingWindow::apply
//
// Purpose: 
//   This Qt slot function is called by clicking the apply button.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:51:45 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::apply()
{
    Apply(true);
}

// ****************************************************************************
// Method: QvisRenderingWindow::antialiasingToggled
//
// Purpose: 
//   This Qt slot function is called when the antialiasing checkbox is clicked.
//
// Arguments:
//   val : The new AA value.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:52:07 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::antialiasingToggled(bool val)
{
    renderAtts->SetAntialiasing(val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::objectRepresentationChanged
//
// Purpose: 
//   This Qt slot function is called when we change surface representations.
//
// Arguments:
//   val : The new surface representation.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:53:28 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::objectRepresentationChanged(int val)
{
    renderAtts->SetGeometryRepresentation(
        (RenderingAttributes::GeometryRepresentation)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
794
// Method: QvisRenderingWindow::displayListModeChanged
hrchilds's avatar
hrchilds committed
795 796
//
// Purpose: 
hrchilds's avatar
hrchilds committed
797
//   This Qt slot function is called when we change the display list mode.
hrchilds's avatar
hrchilds committed
798 799
//
// Arguments:
hrchilds's avatar
hrchilds committed
800
//   mode : The new display list mode.
hrchilds's avatar
hrchilds committed
801
//
hrchilds's avatar
hrchilds committed
802 803
// Programmer: Hank Childs
// Creation:   May 9, 2004
hrchilds's avatar
hrchilds committed
804 805 806 807 808 809
//
// Modifications:
//   
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
810
QvisRenderingWindow::displayListModeChanged(int mode)
hrchilds's avatar
hrchilds committed
811
{
hrchilds's avatar
hrchilds committed
812 813 814 815 816 817 818 819
    int itmp = 0;
    if (mode == 0)      // Auto in Window
        itmp = 2;       // Auto for atts' enum type
    else if (mode == 1) // Always in window
        itmp = 1;       // Always for atts' enum type
    else                // Never in window.
        itmp = 0;       // Never for atts' enum type

hrchilds's avatar
hrchilds committed
820
    renderAtts->SetDisplayListMode((RenderingAttributes::TriStateMode)itmp);
hrchilds's avatar
hrchilds committed
821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoToggled
//
// Purpose: 
//   This Qt slot function is called when we change turn stereo on/off.
//
// Arguments:
//   val : The new stereo enabled mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:54:52 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoToggled(bool val)
{
    renderAtts->SetStereoRendering(val);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::stereoTypeChanged
//
// Purpose: 
//   This Qt slot function is called when the stereo type changes.
//
// Arguments:
//   val : The new stereo type.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:55:32 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::stereoTypeChanged(int val)
{
    renderAtts->SetStereoType((RenderingAttributes::StereoTypes)val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::renderNotifyToggled
//
// Purpose: 
//   This Qt slot function is called when the "Query after render" toggle
//   button is clicked.
//
// Arguments:
//   val : The new query mode.
//
// Programmer: Brad Whitlock
// Creation:   Mon Sep 23 14:56:12 PST 2002
//
// Modifications:
//   
// ****************************************************************************

void
QvisRenderingWindow::renderNotifyToggled(bool val)
{
    renderAtts->SetNotifyForEachRender(val);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
hrchilds's avatar
hrchilds committed
898
// Method: QvisRenderingWindow::scalrenActivationModeChanged
hrchilds's avatar
hrchilds committed
899 900
//
// Purpose: 
hrchilds's avatar
hrchilds committed
901
//   This Qt slot function is called when the scalable activation mode changes.
hrchilds's avatar
hrchilds committed
902 903
//
// Arguments:
hrchilds's avatar
hrchilds committed
904
//   val : The new scalable activation mode flag.
hrchilds's avatar
hrchilds committed
905
//         0 = Auto, 1 = Always, 2 = Never
hrchilds's avatar
hrchilds committed
906 907 908 909 910
//
// Programmer: Mark C. Miller 
// Creation:   Wed Nov 20 17:09:59 PST 2002 
//
// Modifications:
hrchilds's avatar
hrchilds committed
911 912 913
//
//   Mark C. Miller, Tue Apr 27 14:41:35 PDT 2004
//   Added scalrenAutoThreshold spinbox and geometry label
hrchilds's avatar
hrchilds committed
914
//   
hrchilds's avatar
hrchilds committed
915 916 917 918
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
919 920 921
// ****************************************************************************

void
hrchilds's avatar
hrchilds committed
922
QvisRenderingWindow::scalrenActivationModeChanged(int val)
hrchilds's avatar
hrchilds committed
923
{
hrchilds's avatar
hrchilds committed
924
    if (val == 0)
hrchilds's avatar
hrchilds committed
925 926 927
    {
        scalrenAutoThreshold->setEnabled(1);
        scalrenGeometryLabel->setEnabled(1);
hrchilds's avatar
hrchilds committed
928
        renderAtts->SetScalableActivationMode(RenderingAttributes::Auto);
hrchilds's avatar
hrchilds committed
929 930
        scalrenAutoThresholdChanged(scalrenAutoThreshold->value());
    }
hrchilds's avatar
hrchilds committed
931
    else if (val == 1)
hrchilds's avatar
hrchilds committed
932 933 934
    {
        scalrenAutoThreshold->setEnabled(0);
        scalrenGeometryLabel->setEnabled(0);
hrchilds's avatar
hrchilds committed
935
        renderAtts->SetScalableActivationMode(RenderingAttributes::Always);
hrchilds's avatar
hrchilds committed
936
    }
hrchilds's avatar
hrchilds committed
937
    else
hrchilds's avatar
hrchilds committed
938 939 940
    {
        scalrenAutoThreshold->setEnabled(0);
        scalrenGeometryLabel->setEnabled(0);
hrchilds's avatar
hrchilds committed
941
        renderAtts->SetScalableActivationMode(RenderingAttributes::Never);
hrchilds's avatar
hrchilds committed
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961
    }
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
// Method: QvisRenderingWindow::scalrenAutoThresholdChanged
//
// Purpose: 
//   This Qt slot function is called when the scalable rendering automatic
//   polygon count threshold changes.
//
// Arguments:
//   val : The new polygon count threshold.
//
// Programmer: Mark C. Miller 
// Creation:   Wed Apr 21 22:42:57 PDT 2004 
//
// Modifications:
//   
hrchilds's avatar
hrchilds committed
962 963 964 965
//   Mark C. Miller, Tue May 11 20:21:24 PDT 2004
//   Changed scalable rendering controls to use activation mode and auto
//   threshold
//
hrchilds's avatar
hrchilds committed
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021
// ****************************************************************************
void
QvisRenderingWindow::scalrenAutoThresholdChanged(int val)
{
    // determine the actual value from the given value and the current suffix
    int actualVal;
    if (scalrenAutoThreshold->suffix() == " GPolys")
        actualVal = val * (int) 1e9;
    else if (scalrenAutoThreshold->suffix() == " MPolys")
        actualVal = val * (int) 1e6;
    else if (scalrenAutoThreshold->suffix() == " KPolys")
        actualVal = val * (int) 1e3;
    else if (scalrenAutoThreshold->suffix() == "  Polys")
        actualVal = val;
    else
        actualVal = val;

    // deal with stepping backwards
    int step = scalrenAutoThreshold->lineStep();
    if ((val == 500) && (step == 500) && (scalrenAutoThreshold->suffix() == "  Polys"))
        actualVal = 950;
    else if ((val == 5) && (step == 5) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 9500;
    else if ((val == 50) && (step == 50) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 95000;
    else if ((val == 500) && (step == 500) && (scalrenAutoThreshold->suffix() == " KPolys"))
        actualVal = 950000;
    else if ((val == 5) && (step == 5) && (scalrenAutoThreshold->suffix() == " MPolys"))
        actualVal = 9500000;
    else if ((val == 50) && (step == 50) && (scalrenAutoThreshold->suffix() == " MPolys"))
        actualVal = 95000000;
    else if ((val == 0) && (step == 1) && (scalrenAutoThreshold->suffix() == " GPolys"))
        actualVal = 950000000;

    // compute the step size and suffix for the displayed value in the GUI
    QString suffix;
    if      (actualVal < 1e3) { step = 50;  suffix = "  Polys"; }
    else if (actualVal < 1e4) { step = 500; suffix = "  Polys"; }
    else if (actualVal < 1e5) { step = 5;   suffix = " KPolys"; }
    else if (actualVal < 1e6) { step = 50;  suffix = " KPolys"; }
    else if (actualVal < 1e7) { step = 500; suffix = " KPolys"; }
    else if (actualVal < 1e8) { step = 5;   suffix = " MPolys"; }
    else if (actualVal < 1e9) { step = 50;  suffix = " MPolys"; }
    else                      { step = 1;   suffix = " GPolys"; }

    // compute the divisor for the displayed value in the GUI
    int div;
    if      (suffix == " KPolys") div = (int) 1e3;
    else if (suffix == " MPolys") div = (int) 1e6; 
    else if (suffix == " GPolys") div = (int) 1e9;
    else                          div = 1;

    // set the new GUI value
    scalrenAutoThreshold->setLineStep(step);
    scalrenAutoThreshold->setSuffix(suffix);
    scalrenAutoThreshold->setValue(actualVal / div);
hrchilds's avatar
hrchilds committed
1022
    renderAtts->SetScalableAutoThreshold(actualVal);
hrchilds's avatar
hrchilds committed
1023

hrchilds's avatar
hrchilds committed
1024 1025 1026
    SetUpdate(false);
    Apply();
}
hrchilds's avatar
hrchilds committed
1027

hrchilds's avatar
hrchilds committed
1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073
// ****************************************************************************
//  Method:  QvisRenderingWindow::shadowToggled
//
//  Purpose:
//    Callback for the shadow toggle button
//
//  Arguments:
//    val        true to enable shadow
//
//  Programmer:  Hank Childs
//  Creation:    October 24, 2004
//
// ****************************************************************************

void
QvisRenderingWindow::shadowToggled(bool val)
{
    renderAtts->SetDoShadowing(val);
    shadowStrengthSlider->setEnabled(renderAtts->GetDoShadowing());
    shadowStrengthLabel->setEnabled(renderAtts->GetDoShadowing());
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
//  Method:  QvisRenderingWindow::shadowStrengthChanged
//
//  Purpose:
//    Callback for the shadow coefficient slider
//
//  Arguments:
//    val        the new coefficient
//
//  Programmer:  Hank Childs
//  Creation:    October 24, 2004
//
// ****************************************************************************

void
QvisRenderingWindow::shadowStrengthChanged(int val, const void*)
{
    renderAtts->SetShadowStrength(float(val)/100.);
    SetUpdate(false);
    Apply();
}

hrchilds's avatar
hrchilds committed
1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142
// ****************************************************************************
//  Method:  QvisRenderingWindow::specularToggled
//
//  Purpose:
//    Callback for the specular toggle button
//
//  Arguments:
//    val        true to enable specular
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 14, 2003
//
// ****************************************************************************

void
QvisRenderingWindow::specularToggled(bool val)
{
    renderAtts->SetSpecularFlag(val);
    specularStrengthSlider->setEnabled(renderAtts->GetSpecularFlag());
    specularPowerSlider->setEnabled(renderAtts->GetSpecularFlag());
    specularStrengthLabel->setEnabled(renderAtts->GetSpecularFlag());
    specularPowerLabel->setEnabled(renderAtts->GetSpecularFlag());
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
//  Method:  QvisRenderingWindow::specularStrengthChanged
//
//  Purpose:
//    Callback for the specular coefficient slider
//
//  Arguments:
//    val        the new coefficient
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 14, 2003
//
// ****************************************************************************

void
QvisRenderingWindow::specularStrengthChanged(int val, const void*)
{
    renderAtts->SetSpecularCoeff(float(val)/100.);
    SetUpdate(false);
    Apply();
}

// ****************************************************************************
//  Method:  QvisRenderingWindow::specularPowerChanged
//
//  Purpose:
//    Callback for the specular exponent slider.
//
//  Arguments:
//    val        the new value
//
//  Programmer:  Jeremy Meredith
//  Creation:    November 14, 2003
//
// ****************************************************************************

void
QvisRenderingWindow::specularPowerChanged(int val, const void*)
{
    renderAtts->SetSpecularPower(float(val)/10.);
    SetUpdate(false);
    Apply();
}