Ignore:
Timestamp:
May 29, 2009 6:09:42 AM (15 years ago)
Author:
gah
Message:
 
File:
1 edited

Legend:

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

    r1473 r1474  
    6767    {Rappture::SWITCH_BOOLEAN, "-outline", "boolean",
    6868        offsetof(FlowValues, showOutline), 0},
     69    {Rappture::SWITCH_FLOAT, "-diffuse", "value",
     70        offsetof(FlowValues, diffuse), 0},
     71    {Rappture::SWITCH_FLOAT, "-opacity", "value",
     72        offsetof(FlowValues, opacity), 0},
     73    {Rappture::SWITCH_FLOAT, "-specular", "value",
     74        offsetof(FlowValues, specular), 0},
    6975    {Rappture::SWITCH_END}
    7076};
     
    269275                                         * been allocated for this vector. */
    270276    _sv.sliceVisible = 1;
     277    _sv.tfPtr = NanoVis::get_transfunc("default");
    271278    _volPtr = NULL;
    272279    _cmdToken = Tcl_CreateObjCommand(interp, (char *)_name,
     
    649656    volPtr->disable_cutplane(2);
    650657
    651     TransferFunction *tfPtr;
    652     tfPtr = _sv.tfPtr;
    653     if (tfPtr == NULL) {
    654         tfPtr = NanoVis::get_transfunc("default");
    655     }
    656     NanoVis::vol_renderer->add_volume(volPtr, tfPtr);
    657     if (_sv.showVolume) {
    658         volPtr->enable_data();
    659     } else {
    660         volPtr->disable_data();
    661     }
    662     if (_sv.showOutline) {
    663         volPtr->enable_outline();
    664     } else {
    665         volPtr->disable_outline();
    666     }
     658    NanoVis::vol_renderer->add_volume(volPtr, _sv.tfPtr);
     659    volPtr->data(_sv.showVolume);
     660    volPtr->outline(_sv.showOutline);
     661    volPtr->opacity_scale(_sv.opacity);
     662    volPtr->specular(_sv.specular);
     663    volPtr->diffuse(_sv.diffuse);
     664
    667665    float dx0 = -0.5;
    668666    float dy0 = -0.5*volPtr->height/volPtr->width;
    669667    float dz0 = -0.5*volPtr->depth/volPtr->width;
    670668    volPtr->move(Vector3(dx0, dy0, dz0));
     669    Volume::update_pending = true;
    671670    return volPtr;
    672671}
     
    15961595
    15971596/*
     1597 * ----------------------------------------------------------------------
     1598 * CLIENT COMMAND:
     1599 *   $flow legend <width> <height>
     1600 *
     1601 * Clients use this to generate a legend image for the specified
     1602 * transfer function.  The legend image is a color gradient from 0
     1603 * to one, drawn in the given transfer function.  The resulting image
     1604 * is returned in the size <width> x <height>.
     1605 * ----------------------------------------------------------------------
     1606 */
     1607static int
     1608FlowLegendOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1609          Tcl_Obj *const *objv)
     1610{
     1611    FlowCmd *flowPtr = (FlowCmd *)clientData;
     1612   
     1613    const char *string = Tcl_GetString(objv[1]);
     1614    TransferFunction *tf;
     1615    tf = flowPtr->GetTransferFunction();
     1616    if (tf == NULL) {
     1617        Tcl_AppendResult(interp, "unknown transfer function \"", string, "\"",
     1618                             (char*)NULL);
     1619        return TCL_ERROR;
     1620    }
     1621    const char *label;
     1622    label = Tcl_GetString(objv[0]);
     1623    int w, h;
     1624    if ((Tcl_GetIntFromObj(interp, objv[2], &w) != TCL_OK) ||
     1625        (Tcl_GetIntFromObj(interp, objv[3], &h) != TCL_OK)) {
     1626        return TCL_ERROR;
     1627    }
     1628    if (NanoVis::MAP_FLOWS) {
     1629        NanoVis::MapFlows();
     1630    }
     1631    NanoVis::render_legend(tf, NanoVis::magMin, NanoVis::magMax, w, h, label);
     1632    return TCL_OK;
     1633}
     1634
     1635/*
    15981636 *---------------------------------------------------------------------------
    15991637 *
     
    16151653    {"configure",   1, FlowConfigureOp,  2, 0, "?switches?"},
    16161654    {"data",        1, FlowDataOp,       2, 0, "oper ?args?"},
     1655    {"legend",      1, FlowLegendOp,     4, 4, "w h"},
    16171656    {"particles",   1, FlowParticlesOp,  2, 0, "oper ?args?"}
    16181657};
     
    19341973    return TCL_OK;
    19351974}
     1975
    19361976
    19371977/*
Note: See TracChangeset for help on using the changeset viewer.