Ignore:
Timestamp:
Mar 23, 2012 1:31:05 AM (12 years ago)
Author:
ldelgass
Message:

Some minor refactoring, also add some more fine grained config.h defines
(e.g. replace NV40 define with feature defines). Add tests for some required
OpenGL extensions (should always check for extensions or base version before
calling entry points from the extension). Also, clamp diffuse and specular
values on input and warn when they are out of range.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/nanovis/FlowCmd.cpp

    r2875 r2877  
    3434#include "Unirect.h"
    3535#include "VelocityArrowsSlice.h"
     36#include "Volume.h"
    3637
    3738#define RELPOS 0
     
    294295    memset(&_sv, 0, sizeof(FlowValues));
    295296    _sv.sliceVisible = 1;
    296     _sv.tfPtr = NanoVis::get_transfunc("default");
     297    _sv.tfPtr = NanoVis::getTransfunc("default");
    297298
    298299    Tcl_InitHashTable(&_particlesTable, TCL_STRING_KEYS);
     
    317318    }
    318319    if (_volPtr != NULL) {
    319         NanoVis::remove_volume(_volPtr);
     320        NanoVis::removeVolume(_volPtr);
    320321        _volPtr = NULL;
    321322    }
     
    530531    if (_volPtr != NULL) {
    531532        TRACE("from ScaleVectorField volId=%s\n", _volPtr->name());
    532         NanoVis::remove_volume(_volPtr);
     533        NanoVis::removeVolume(_volPtr);
    533534        _volPtr = NULL;
    534535    }
     
    575576        NanoVis::licRenderer->
    576577            setVectorField(_volPtr->id, loc,
    577                            1.0f / _volPtr->aspect_ratio_width,
    578                            1.0f / _volPtr->aspect_ratio_height,
    579                            1.0f / _volPtr->aspect_ratio_depth,
     578                           1.0f / _volPtr->aspectRatioWidth,
     579                           1.0f / _volPtr->aspectRatioHeight,
     580                           1.0f / _volPtr->aspectRatioDepth,
    580581                           _volPtr->wAxis.max());
    581582        SetCurrentPosition();
     
    589590                        //*(volPtr->get_location()),
    590591                        1.0f,
    591                         _volPtr->aspect_ratio_height / _volPtr->aspect_ratio_width,
    592                         _volPtr->aspect_ratio_depth / _volPtr->aspect_ratio_width
     592                        _volPtr->aspectRatioHeight / _volPtr->aspectRatioWidth,
     593                        _volPtr->aspectRatioDepth / _volPtr->aspectRatioWidth
    593594                        //,volPtr->wAxis.max()
    594595                        );
     
    657658    Volume *volPtr;
    658659
    659     volPtr = NanoVis::load_volume(_name, _dataPtr->xNum(), _dataPtr->yNum(),
    660                                   _dataPtr->zNum(), 4, data,
    661                                   NanoVis::magMin, NanoVis::magMax, 0);
     660    volPtr = NanoVis::loadVolume(_name, _dataPtr->xNum(), _dataPtr->yNum(),
     661                                 _dataPtr->zNum(), 4, data,
     662                                 NanoVis::magMin, NanoVis::magMax, 0);
    662663    volPtr->xAxis.SetRange(_dataPtr->xMin(), _dataPtr->xMax());
    663664    volPtr->yAxis.SetRange(_dataPtr->yMin(), _dataPtr->yMax());
     
    672673          NanoVis::magMin, NanoVis::magMax);
    673674    volPtr->setPhysicalBBox(physicalMin, physicalMax);
    674     //volPtr->set_n_slice(256 - _volIndex);
    675     // volPtr->set_n_slice(512- _volIndex);
    676     //volPtr->n_slices(256-n);
     675    //volPtr->numSlices(256 - _volIndex);
     676    //volPtr->numSlices(512 - _volIndex);
     677    //volPtr->numSlices(256 - n);
    677678    // TBD..
    678679    /* Don't set the slice number until we're are about to render the
    679680       volume. */
    680     volPtr->disable_cutplane(0);
    681     volPtr->disable_cutplane(1);
    682     volPtr->disable_cutplane(2);
     681    volPtr->disableCutplane(0);
     682    volPtr->disableCutplane(1);
     683    volPtr->disableCutplane(2);
    683684
    684685    /* Initialize the volume with the previously configured values. */
    685686    volPtr->transferFunction(_sv.tfPtr);
    686     volPtr->data_enabled(_sv.showVolume);
     687    volPtr->dataEnabled(_sv.showVolume);
    687688    volPtr->outline(_sv.showOutline);
    688     volPtr->opacity_scale(_sv.opacity);
     689    volPtr->opacityScale(_sv.opacity);
    689690    volPtr->specular(_sv.specular);
    690691    volPtr->diffuse(_sv.diffuse);
     
    695696    float dz0 = -0.5*volPtr->depth/volPtr->width;
    696697    volPtr->location(Vector3(dx0, dy0, dz0));
    697     Volume::update_pending = true;
     698    Volume::updatePending = true;
    698699    return volPtr;
    699700}
     
    765766    }
    766767    flowPtr->data(dataPtr);
    767     NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     768    NanoVis::eventuallyRedraw(NanoVis::MAP_FLOWS);
    768769    return TCL_OK;
    769770}
     
    857858        assert(nWritten == (ssize_t)strlen(info));
    858859    }
    859     NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     860    NanoVis::eventuallyRedraw(NanoVis::MAP_FLOWS);
    860861    return TCL_OK;
    861862}
     
    13311332    TransferFunction **funcPtrPtr = (TransferFunction **)(record + offset);
    13321333    TransferFunction *funcPtr;
    1333     funcPtr = NanoVis::get_transfunc(Tcl_GetString(objPtr));
     1334    funcPtr = NanoVis::getTransfunc(Tcl_GetString(objPtr));
    13341335    if (funcPtr == NULL) {
    13351336        Tcl_AppendResult(interp, "transfer function \"", Tcl_GetString(objPtr),
     
    13501351        return TCL_ERROR;
    13511352    }
    1352     NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     1353    NanoVis::eventuallyRedraw(NanoVis::MAP_FLOWS);
    13531354    return TCL_OK;
    13541355}
     
    13721373    }
    13731374    particlesPtr->Configure();
    1374     NanoVis::EventuallyRedraw();
     1375    NanoVis::eventuallyRedraw();
    13751376    Tcl_SetObjResult(interp, objv[3]);
    13761377    return TCL_OK;
     
    13911392    }
    13921393    particlesPtr->Configure();
    1393     NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     1394    NanoVis::eventuallyRedraw(NanoVis::MAP_FLOWS);
    13941395    return TCL_OK;
    13951396}
     
    14081409        }
    14091410    }
    1410     NanoVis::EventuallyRedraw();
     1411    NanoVis::eventuallyRedraw();
    14111412    return TCL_OK;
    14121413}
     
    14861487        return TCL_ERROR;
    14871488    }
    1488     NanoVis::EventuallyRedraw();
     1489    NanoVis::eventuallyRedraw();
    14891490    Tcl_SetObjResult(interp, objv[3]);
    14901491    return TCL_OK;
     
    15041505        }
    15051506    }
    1506     NanoVis::EventuallyRedraw();
     1507    NanoVis::eventuallyRedraw();
    15071508    return TCL_OK;
    15081509}
     
    15411542        return TCL_ERROR;
    15421543    }
    1543     NanoVis::EventuallyRedraw();
     1544    NanoVis::eventuallyRedraw();
    15441545    return TCL_OK;
    15451546}
     
    16131614        NanoVis::MapFlows();
    16141615    }
    1615     NanoVis::render_legend(tf, NanoVis::magMin, NanoVis::magMax, w, h, label);
     1616    NanoVis::renderLegend(tf, NanoVis::magMin, NanoVis::magMax, w, h, label);
    16161617    return TCL_OK;
    16171618}
     
    16811682    }
    16821683    Tcl_SetObjResult(interp, objv[2]);
    1683     NanoVis::EventuallyRedraw();
     1684    NanoVis::eventuallyRedraw();
    16841685    return TCL_OK;
    16851686}
     
    16991700        Tcl_DeleteCommand(interp, flowPtr->name());
    17001701    }
    1701     NanoVis::EventuallyRedraw(NanoVis::MAP_FLOWS);
     1702    NanoVis::eventuallyRedraw(NanoVis::MAP_FLOWS);
    17021703    return TCL_OK;
    17031704}
     
    17461747        NanoVis::AdvectFlows();
    17471748    }
    1748     NanoVis::EventuallyRedraw();
     1749    NanoVis::eventuallyRedraw();
    17491750    return TCL_OK;
    17501751}
     
    17771778        NanoVis::MapFlows();
    17781779    }
    1779     NanoVis::EventuallyRedraw();
     1780    NanoVis::eventuallyRedraw();
    17801781    NanoVis::licRenderer->convolve();
    17811782    NanoVis::AdvectFlows();
     
    18801881    values.frameRate = 25.0f;                // Default frame rate 25 fps
    18811882    values.bitRate = 6000000;                // Default video bit rate.
    1882     values.width = NanoVis::win_width;
    1883     values.height = NanoVis::win_height;
     1883    values.width = NanoVis::winWidth;
     1884    values.height = NanoVis::winHeight;
    18841885    values.nFrames = 100;
    18851886    values.format = Rappture::AVTranslate::MPEG1;
     
    19071908    // Save the old dimensions of the offscreen buffer.
    19081909    int oldWidth, oldHeight;
    1909     oldWidth = NanoVis::win_width;
    1910     oldHeight = NanoVis::win_height;
     1910    oldWidth = NanoVis::winWidth;
     1911    oldHeight = NanoVis::winHeight;
    19111912
    19121913    TRACE("FLOW started\n");
     
    19261927    if ((values.width != oldWidth) || (values.height != oldHeight)) {
    19271928        // Resize to the requested size.
    1928         NanoVis::resize_offscreen_buffer(values.width, values.height);
     1929        NanoVis::resizeOffscreenBuffer(values.width, values.height);
    19291930    }
    19301931    // Now compute the line padding for the offscreen buffer.
     
    19461947        }
    19471948        NanoVis::AdvectFlows();
    1948         NanoVis::offscreen_buffer_capture();
     1949        NanoVis::offscreenBufferCapture();
    19491950        NanoVis::display();
    1950         NanoVis::read_screen();
     1951        NanoVis::readScreen();
    19511952        glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    1952         movie.append(context, NanoVis::screen_buffer, pad);
     1953        movie.append(context, NanoVis::screenBuffer, pad);
    19531954    }
    19541955    movie.done(context);
     
    19711972    }
    19721973    if ((values.width != oldWidth) || (values.height != oldHeight)) {
    1973         NanoVis::resize_offscreen_buffer(oldWidth, oldHeight);
     1974        NanoVis::resizeOffscreenBuffer(oldWidth, oldHeight);
    19741975    }
    19751976    NanoVis::ResetFlows();
Note: See TracChangeset for help on using the changeset viewer.