Changeset 1474 for trunk/packages/vizservers/nanovis/FlowCmd.cpp
- Timestamp:
- May 29, 2009 6:09:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/FlowCmd.cpp
r1473 r1474 67 67 {Rappture::SWITCH_BOOLEAN, "-outline", "boolean", 68 68 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}, 69 75 {Rappture::SWITCH_END} 70 76 }; … … 269 275 * been allocated for this vector. */ 270 276 _sv.sliceVisible = 1; 277 _sv.tfPtr = NanoVis::get_transfunc("default"); 271 278 _volPtr = NULL; 272 279 _cmdToken = Tcl_CreateObjCommand(interp, (char *)_name, … … 649 656 volPtr->disable_cutplane(2); 650 657 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 667 665 float dx0 = -0.5; 668 666 float dy0 = -0.5*volPtr->height/volPtr->width; 669 667 float dz0 = -0.5*volPtr->depth/volPtr->width; 670 668 volPtr->move(Vector3(dx0, dy0, dz0)); 669 Volume::update_pending = true; 671 670 return volPtr; 672 671 } … … 1596 1595 1597 1596 /* 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 */ 1607 static int 1608 FlowLegendOp(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 /* 1598 1636 *--------------------------------------------------------------------------- 1599 1637 * … … 1615 1653 {"configure", 1, FlowConfigureOp, 2, 0, "?switches?"}, 1616 1654 {"data", 1, FlowDataOp, 2, 0, "oper ?args?"}, 1655 {"legend", 1, FlowLegendOp, 4, 4, "w h"}, 1617 1656 {"particles", 1, FlowParticlesOp, 2, 0, "oper ?args?"} 1618 1657 }; … … 1934 1973 return TCL_OK; 1935 1974 } 1975 1936 1976 1937 1977 /*
Note: See TracChangeset
for help on using the changeset viewer.