Ignore:
Timestamp:
Aug 8, 2011 9:34:06 AM (13 years ago)
Author:
ldelgass
Message:
  • Add protocol for setting glyph scaling and color modes
  • Finish adding protocol for setting scale, position, orientation of all graphics object types
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/RpVtkRendererCmd.cpp

    r2332 r2335  
    757757
    758758static int
     759Contour2DOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     760                  Tcl_Obj *const *objv)
     761{
     762    double quat[4];
     763    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     764        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     765        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     766        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     767        return TCL_ERROR;
     768    }
     769    if (objc == 7) {
     770        const char *name = Tcl_GetString(objv[6]);
     771        g_renderer->setContour2DOrientation(name, quat);
     772    } else {
     773        g_renderer->setContour2DOrientation("all", quat);
     774    }
     775    return TCL_OK;
     776}
     777
     778static int
     779Contour2DPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     780                    Tcl_Obj *const *objv)
     781{
     782    double pos[3];
     783    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     784        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     785        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     786        return TCL_ERROR;
     787    }
     788    if (objc == 6) {
     789        const char *name = Tcl_GetString(objv[5]);
     790        g_renderer->setContour2DPosition(name, pos);
     791    } else {
     792        g_renderer->setContour2DPosition("all", pos);
     793    }
     794    return TCL_OK;
     795}
     796
     797static int
     798Contour2DScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     799                 Tcl_Obj *const *objv)
     800{
     801    double scale[3];
     802    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     803        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     804        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     805        return TCL_ERROR;
     806    }
     807    if (objc == 6) {
     808        const char *name = Tcl_GetString(objv[5]);
     809        g_renderer->setContour2DScale(name, scale);
     810    } else {
     811        g_renderer->setContour2DScale("all", scale);
     812    }
     813    return TCL_OK;
     814}
     815
     816static int
    759817Contour2DVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    760818                   Tcl_Obj *const *objv)
     
    779837    {"linecolor", 5, Contour2DLineColorOp, 5, 6, "r g b ?dataSetName?"},
    780838    {"linewidth", 5, Contour2DLineWidthOp, 3, 4, "width ?dataSetName?"},
    781     {"opacity",   1, Contour2DOpacityOp, 3, 4, "value ?dataSetName?"},
     839    {"opacity",   2, Contour2DOpacityOp, 3, 4, "value ?dataSetName?"},
     840    {"orient",    2, Contour2DOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     841    {"pos",       1, Contour2DPositionOp, 5, 6, "x y z ?dataSetName?"},
     842    {"scale",     1, Contour2DScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    782843    {"visible",   1, Contour2DVisibleOp, 3, 4, "bool ?dataSetName?"}
    783844};
     
    9981059    } else {
    9991060        g_renderer->setContour3DOpacity("all", opacity);
     1061    }
     1062    return TCL_OK;
     1063}
     1064
     1065static int
     1066Contour3DOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1067                  Tcl_Obj *const *objv)
     1068{
     1069    double quat[4];
     1070    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     1071        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     1072        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     1073        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     1074        return TCL_ERROR;
     1075    }
     1076    if (objc == 7) {
     1077        const char *name = Tcl_GetString(objv[6]);
     1078        g_renderer->setContour3DOrientation(name, quat);
     1079    } else {
     1080        g_renderer->setContour3DOrientation("all", quat);
     1081    }
     1082    return TCL_OK;
     1083}
     1084
     1085static int
     1086Contour3DPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1087                    Tcl_Obj *const *objv)
     1088{
     1089    double pos[3];
     1090    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     1091        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     1092        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     1093        return TCL_ERROR;
     1094    }
     1095    if (objc == 6) {
     1096        const char *name = Tcl_GetString(objv[5]);
     1097        g_renderer->setContour3DPosition(name, pos);
     1098    } else {
     1099        g_renderer->setContour3DPosition("all", pos);
     1100    }
     1101    return TCL_OK;
     1102}
     1103
     1104static int
     1105Contour3DScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1106                 Tcl_Obj *const *objv)
     1107{
     1108    double scale[3];
     1109    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     1110        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     1111        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     1112        return TCL_ERROR;
     1113    }
     1114    if (objc == 6) {
     1115        const char *name = Tcl_GetString(objv[5]);
     1116        g_renderer->setContour3DScale(name, scale);
     1117    } else {
     1118        g_renderer->setContour3DScale("all", scale);
    10001119    }
    10011120    return TCL_OK;
     
    10451164    {"linecolor", 5, Contour3DLineColorOp, 5, 6, "r g b ?dataSetName?"},
    10461165    {"linewidth", 5, Contour3DLineWidthOp, 3, 4, "width ?dataSetName?"},
    1047     {"opacity",   1, Contour3DOpacityOp, 3, 4, "value ?dataSetName?"},
     1166    {"opacity",   2, Contour3DOpacityOp, 3, 4, "value ?dataSetName?"},
     1167    {"orient",    2, Contour3DOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     1168    {"pos",       1, Contour3DPositionOp, 5, 6, "x y z ?dataSetName?"},
     1169    {"scale",     1, Contour3DScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    10481170    {"visible",   1, Contour3DVisibleOp, 3, 4, "bool ?dataSetName?"},
    10491171    {"wireframe", 1, Contour3DWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    13381460
    13391461static int
     1462GlyphsColorModeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1463                  Tcl_Obj *const *objv)
     1464{
     1465    Glyphs::ColorMode mode;
     1466    const char *str = Tcl_GetString(objv[2]);
     1467    if (str[0] == 's' && strcmp(str, "scale") == 0) {
     1468        mode = Glyphs::COLOR_BY_SCALE;
     1469    } else if (str[0] == 's' && strcmp(str, "scalar") == 0) {
     1470        mode = Glyphs::COLOR_BY_SCALAR;
     1471    } else if (str[0] == 'v' && strcmp(str, "vector") == 0) {
     1472        mode = Glyphs::COLOR_BY_VECTOR;
     1473    } else {
     1474        Tcl_AppendResult(interp, "bad color mode option \"", str,
     1475                         "\": should be one of: 'scale', 'scalar', 'vector'", (char*)NULL);
     1476        return TCL_ERROR;
     1477    }
     1478    if (objc == 4) {
     1479        const char *name = Tcl_GetString(objv[3]);
     1480        g_renderer->setGlyphsColorMode(name, mode);
     1481    } else {
     1482        g_renderer->setGlyphsColorMode("all", mode);
     1483    }
     1484    return TCL_OK;
     1485}
     1486
     1487static int
    13401488GlyphsDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc,
    13411489               Tcl_Obj *const *objv)
     
    14381586
    14391587static int
     1588GlyphsOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1589               Tcl_Obj *const *objv)
     1590{
     1591    double quat[4];
     1592    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     1593        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     1594        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     1595        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     1596        return TCL_ERROR;
     1597    }
     1598    if (objc == 7) {
     1599        const char *name = Tcl_GetString(objv[6]);
     1600        g_renderer->setGlyphsOrientation(name, quat);
     1601    } else {
     1602        g_renderer->setGlyphsOrientation("all", quat);
     1603    }
     1604    return TCL_OK;
     1605}
     1606
     1607static int
     1608GlyphsPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1609                 Tcl_Obj *const *objv)
     1610{
     1611    double pos[3];
     1612    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     1613        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     1614        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     1615        return TCL_ERROR;
     1616    }
     1617    if (objc == 6) {
     1618        const char *name = Tcl_GetString(objv[5]);
     1619        g_renderer->setGlyphsPosition(name, pos);
     1620    } else {
     1621        g_renderer->setGlyphsPosition("all", pos);
     1622    }
     1623    return TCL_OK;
     1624}
     1625
     1626static int
    14401627GlyphsScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    14411628              Tcl_Obj *const *objv)
    14421629{
     1630    double scale[3];
     1631    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     1632        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     1633        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     1634        return TCL_ERROR;
     1635    }
     1636    if (objc == 6) {
     1637        const char *name = Tcl_GetString(objv[5]);
     1638        g_renderer->setGlyphsScale(name, scale);
     1639    } else {
     1640        g_renderer->setGlyphsScale("all", scale);
     1641    }
     1642    return TCL_OK;
     1643}
     1644
     1645static int
     1646GlyphsScaleFactorOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1647                    Tcl_Obj *const *objv)
     1648{
    14431649    double scale;
    14441650    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale) != TCL_OK) {
     
    14501656    } else {
    14511657        g_renderer->setGlyphsScaleFactor("all", scale);
     1658    }
     1659    return TCL_OK;
     1660}
     1661
     1662static int
     1663GlyphsScalingModeOp(ClientData clientData, Tcl_Interp *interp, int objc,
     1664                    Tcl_Obj *const *objv)
     1665{
     1666    Glyphs::ScalingMode mode;
     1667    const char *str = Tcl_GetString(objv[2]);
     1668    if (str[0] == 's' && strcmp(str, "scalar") == 0) {
     1669        mode = Glyphs::SCALE_BY_SCALAR;
     1670    } else if (str[0] == 'v' && strcmp(str, "vector") == 0) {
     1671        mode = Glyphs::SCALE_BY_VECTOR;
     1672    } else if (str[0] == 'v' && strcmp(str, "vector_comp") == 0) {
     1673        mode = Glyphs::SCALE_BY_VECTOR_COMPONENTS;
     1674    } else if (str[0] == 'o' && strcmp(str, "off") == 0) {
     1675        mode = Glyphs::SCALING_OFF;
     1676    } else {
     1677        Tcl_AppendResult(interp, "bad scaling mode option \"", str,
     1678                         "\": should be one of: 'scalar', 'vector', 'vector_comp', 'off'", (char*)NULL);
     1679        return TCL_ERROR;
     1680    }
     1681    if (objc == 4) {
     1682        const char *name = Tcl_GetString(objv[3]);
     1683        g_renderer->setGlyphsScalingMode(name, mode);
     1684    } else {
     1685        g_renderer->setGlyphsScalingMode("all", mode);
    14521686    }
    14531687    return TCL_OK;
     
    15301764static Rappture::CmdSpec glyphsOps[] = {
    15311765    {"add",       1, GlyphsAddOp, 3, 4, "shape ?dataSetNme?"},
    1532     {"colormap",  1, GlyphsColorMapOp, 3, 4, "colorMapName ?dataSetNme?"},
     1766    {"colormap",  7, GlyphsColorMapOp, 3, 4, "colorMapName ?dataSetNme?"},
     1767    {"colormode", 7, GlyphsColorModeOp, 3, 4, "mode ?dataSetNme?"},
    15331768    {"delete",    1, GlyphsDeleteOp, 2, 3, "?dataSetName?"},
    15341769    {"edges",     1, GlyphsEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"},
     1770    {"gscale",    1, GlyphsScaleFactorOp, 3, 4, "scaleFactor ?dataSetName?"},
    15351771    {"lighting",  3, GlyphsLightingOp, 3, 4, "bool ?dataSetName?"},
    15361772    {"linecolor", 5, GlyphsLineColorOp, 5, 6, "r g b ?dataSetName?"},
    15371773    {"linewidth", 5, GlyphsLineWidthOp, 3, 4, "width ?dataSetName?"},
    1538     {"opacity",   1, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"},
    1539     {"scale",     2, GlyphsScaleOp, 3, 4, "scaleFactor ?dataSetName?"},
     1774    {"opacity",   2, GlyphsOpacityOp, 3, 4, "value ?dataSetName?"},
     1775    {"orient",    2, GlyphsOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     1776    {"pos",       1, GlyphsPositionOp, 5, 6, "x y z ?dataSetName?"},
     1777    {"scale",     2, GlyphsScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    15401778    {"shape",     2, GlyphsShapeOp, 3, 4, "shapeVal ?dataSetName?"},
     1779    {"smode",     2, GlyphsScalingModeOp, 3, 4, "mode ?dataSetNme?"},
    15411780    {"visible",   1, GlyphsVisibleOp, 3, 4, "bool ?dataSetName?"},
    15421781    {"wireframe", 1, GlyphsWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    19342173    {"orient",       2, HeightMapOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
    19352174    {"pos",          1, HeightMapPositionOp, 5, 6, "x y z ?dataSetName?"},
    1936     {"scale",        1, HeightMapScaleOp, 5, 6, "sx sy sz  ?dataSetName?"},
     2175    {"scale",        1, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    19372176    {"visible",      2, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"},
    19382177    {"volumeslice",  2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}
     
    21352374
    21362375static int
     2376LICOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     2377            Tcl_Obj *const *objv)
     2378{
     2379    double quat[4];
     2380    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     2381        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     2382        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     2383        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     2384        return TCL_ERROR;
     2385    }
     2386    if (objc == 7) {
     2387        const char *name = Tcl_GetString(objv[6]);
     2388        g_renderer->setLICOrientation(name, quat);
     2389    } else {
     2390        g_renderer->setLICOrientation("all", quat);
     2391    }
     2392    return TCL_OK;
     2393}
     2394
     2395static int
     2396LICPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     2397              Tcl_Obj *const *objv)
     2398{
     2399    double pos[3];
     2400    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     2401        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     2402        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     2403        return TCL_ERROR;
     2404    }
     2405    if (objc == 6) {
     2406        const char *name = Tcl_GetString(objv[5]);
     2407        g_renderer->setLICPosition(name, pos);
     2408    } else {
     2409        g_renderer->setLICPosition("all", pos);
     2410    }
     2411    return TCL_OK;
     2412}
     2413
     2414static int
     2415LICScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     2416           Tcl_Obj *const *objv)
     2417{
     2418    double scale[3];
     2419    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     2420        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     2421        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     2422        return TCL_ERROR;
     2423    }
     2424    if (objc == 6) {
     2425        const char *name = Tcl_GetString(objv[5]);
     2426        g_renderer->setLICScale(name, scale);
     2427    } else {
     2428        g_renderer->setLICScale("all", scale);
     2429    }
     2430    return TCL_OK;
     2431}
     2432
     2433static int
    21372434LICVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    21382435             Tcl_Obj *const *objv)
     
    21902487    {"linecolor",   5, LICLineColorOp, 5, 6, "r g b ?dataSetName?"},
    21912488    {"linewidth",   5, LICLineWidthOp, 3, 4, "width ?dataSetName?"},
    2192     {"opacity",     1, LICOpacityOp, 3, 4, "value ?dataSetName?"},
     2489    {"opacity",     2, LICOpacityOp, 3, 4, "value ?dataSetName?"},
     2490    {"orient",      2, LICOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     2491    {"pos",         1, LICPositionOp, 5, 6, "x y z ?dataSetName?"},
     2492    {"scale",       1, LICScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    21932493    {"visible",     2, LICVisibleOp, 3, 4, "bool ?dataSetName?"},
    21942494    {"volumeslice", 2, LICVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}
     
    25052805    {"pos",        1, MoleculePositionOp, 5, 6, "x y z ?dataSetName?"},
    25062806    {"rscale",     1, MoleculeAtomScalingOp, 3, 4, "scaling ?dataSetName?"},
    2507     {"scale",      1, MoleculeScaleOp, 5, 6, "sx sy sz  ?dataSetName?"},
     2807    {"scale",      1, MoleculeScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    25082808    {"visible",    1, MoleculeVisibleOp, 3, 4, "bool ?dataSetName?"},
    25092809    {"wireframe",  1, MoleculeWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    26592959static int
    26602960PolyDataOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
    2661                   Tcl_Obj *const *objv)
     2961                 Tcl_Obj *const *objv)
    26622962{
    26632963    double quat[4];
     
    26792979static int
    26802980PolyDataPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
    2681                     Tcl_Obj *const *objv)
     2981                   Tcl_Obj *const *objv)
    26822982{
    26832983    double pos[3];
     
    26982998static int
    26992999PolyDataScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
    2700                  Tcl_Obj *const *objv)
     3000                Tcl_Obj *const *objv)
    27013001{
    27023002    double scale[3];
     
    27143014    return TCL_OK;
    27153015}
    2716 
    27173016
    27183017static int
     
    27613060    {"orient",    2, PolyDataOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
    27623061    {"pos",       1, PolyDataPositionOp, 5, 6, "x y z ?dataSetName?"},
    2763     {"scale",     1, PolyDataScaleOp, 5, 6, "sx sy sz  ?dataSetName?"},
     3062    {"scale",     1, PolyDataScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    27643063    {"visible",   1, PolyDataVisibleOp, 3, 4, "bool ?dataSetName?"},
    27653064    {"wireframe", 1, PolyDataWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    29043203    } else {
    29053204        g_renderer->setPseudoColorOpacity("all", opacity);
     3205    }
     3206    return TCL_OK;
     3207}
     3208
     3209static int
     3210PseudoColorOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3211                    Tcl_Obj *const *objv)
     3212{
     3213    double quat[4];
     3214    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     3215        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     3216        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     3217        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     3218        return TCL_ERROR;
     3219    }
     3220    if (objc == 7) {
     3221        const char *name = Tcl_GetString(objv[6]);
     3222        g_renderer->setPseudoColorOrientation(name, quat);
     3223    } else {
     3224        g_renderer->setPseudoColorOrientation("all", quat);
     3225    }
     3226    return TCL_OK;
     3227}
     3228
     3229static int
     3230PseudoColorPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3231                      Tcl_Obj *const *objv)
     3232{
     3233    double pos[3];
     3234    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     3235        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     3236        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     3237        return TCL_ERROR;
     3238    }
     3239    if (objc == 6) {
     3240        const char *name = Tcl_GetString(objv[5]);
     3241        g_renderer->setPseudoColorPosition(name, pos);
     3242    } else {
     3243        g_renderer->setPseudoColorPosition("all", pos);
     3244    }
     3245    return TCL_OK;
     3246}
     3247
     3248static int
     3249PseudoColorScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3250                   Tcl_Obj *const *objv)
     3251{
     3252    double scale[3];
     3253    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     3254        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     3255        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     3256        return TCL_ERROR;
     3257    }
     3258    if (objc == 6) {
     3259        const char *name = Tcl_GetString(objv[5]);
     3260        g_renderer->setPseudoColorScale(name, scale);
     3261    } else {
     3262        g_renderer->setPseudoColorScale("all", scale);
    29063263    }
    29073264    return TCL_OK;
     
    29503307    {"linecolor", 5, PseudoColorLineColorOp, 5, 6, "r g b ?dataSetName?"},
    29513308    {"linewidth", 5, PseudoColorLineWidthOp, 3, 4, "width ?dataSetName?"},
    2952     {"opacity",   1, PseudoColorOpacityOp, 3, 4, "value ?dataSetName?"},
     3309    {"opacity",   2, PseudoColorOpacityOp, 3, 4, "value ?dataSetName?"},
     3310    {"orient",    2, PseudoColorOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     3311    {"pos",       1, PseudoColorPositionOp, 5, 6, "x y z ?dataSetName?"},
     3312    {"scale",     1, PseudoColorScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
    29533313    {"visible",   1, PseudoColorVisibleOp, 3, 4, "bool ?dataSetName?"},
    29543314    {"wireframe", 1, PseudoColorWireframeOp, 3, 4, "bool ?dataSetName?"}
     
    32583618    } else {
    32593619        g_renderer->setStreamlinesOpacity("all", opacity);
     3620    }
     3621    return TCL_OK;
     3622}
     3623
     3624static int
     3625StreamlinesOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3626                    Tcl_Obj *const *objv)
     3627{
     3628    double quat[4];
     3629    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     3630        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     3631        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     3632        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     3633        return TCL_ERROR;
     3634    }
     3635    if (objc == 7) {
     3636        const char *name = Tcl_GetString(objv[6]);
     3637        g_renderer->setStreamlinesOrientation(name, quat);
     3638    } else {
     3639        g_renderer->setStreamlinesOrientation("all", quat);
     3640    }
     3641    return TCL_OK;
     3642}
     3643
     3644static int
     3645StreamlinesPositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3646                      Tcl_Obj *const *objv)
     3647{
     3648    double pos[3];
     3649    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     3650        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     3651        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     3652        return TCL_ERROR;
     3653    }
     3654    if (objc == 6) {
     3655        const char *name = Tcl_GetString(objv[5]);
     3656        g_renderer->setStreamlinesPosition(name, pos);
     3657    } else {
     3658        g_renderer->setStreamlinesPosition("all", pos);
     3659    }
     3660    return TCL_OK;
     3661}
     3662
     3663static int
     3664StreamlinesScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3665                   Tcl_Obj *const *objv)
     3666{
     3667    double scale[3];
     3668    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     3669        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     3670        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     3671        return TCL_ERROR;
     3672    }
     3673    if (objc == 6) {
     3674        const char *name = Tcl_GetString(objv[5]);
     3675        g_renderer->setStreamlinesScale(name, scale);
     3676    } else {
     3677        g_renderer->setStreamlinesScale("all", scale);
    32603678    }
    32613679    return TCL_OK;
     
    34613879    {"lines",     5, StreamlinesLinesOp, 2, 3, "?dataSetName?"},
    34623880    {"linewidth", 5, StreamlinesLineWidthOp, 3, 4, "width ?dataSetName?"},
    3463     {"opacity",   1, StreamlinesOpacityOp, 3, 4, "val ?dataSetName?"},
     3881    {"opacity",   2, StreamlinesOpacityOp, 3, 4, "val ?dataSetName?"},
     3882    {"orient",    2, StreamlinesOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     3883    {"pos",       1, StreamlinesPositionOp, 5, 6, "x y z ?dataSetName?"},
    34643884    {"ribbons",   1, StreamlinesRibbonsOp, 4, 5, "width angle ?dataSetName?"},
    3465     {"seed",      1, StreamlinesSeedOp, 4, 11, "op params... ?dataSetName?"},
     3885    {"scale",     2, StreamlinesScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     3886    {"seed",      2, StreamlinesSeedOp, 4, 11, "op params... ?dataSetName?"},
    34663887    {"tubes",     1, StreamlinesTubesOp, 4, 5, "numSides radius ?dataSetName?"},
    34673888    {"visible",   1, StreamlinesVisibleOp, 3, 4, "bool ?dataSetName?"}
     
    35533974    } else {
    35543975        g_renderer->setVolumeOpacity("all", opacity);
     3976    }
     3977    return TCL_OK;
     3978}
     3979
     3980static int
     3981VolumeOrientOp(ClientData clientData, Tcl_Interp *interp, int objc,
     3982               Tcl_Obj *const *objv)
     3983{
     3984    double quat[4];
     3985    if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK ||
     3986        Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK ||
     3987        Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK ||
     3988        Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) {
     3989        return TCL_ERROR;
     3990    }
     3991    if (objc == 7) {
     3992        const char *name = Tcl_GetString(objv[6]);
     3993        g_renderer->setVolumeOrientation(name, quat);
     3994    } else {
     3995        g_renderer->setVolumeOrientation("all", quat);
     3996    }
     3997    return TCL_OK;
     3998}
     3999
     4000static int
     4001VolumePositionOp(ClientData clientData, Tcl_Interp *interp, int objc,
     4002                 Tcl_Obj *const *objv)
     4003{
     4004    double pos[3];
     4005    if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK ||
     4006        Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK ||
     4007        Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) {
     4008        return TCL_ERROR;
     4009    }
     4010    if (objc == 6) {
     4011        const char *name = Tcl_GetString(objv[5]);
     4012        g_renderer->setVolumePosition(name, pos);
     4013    } else {
     4014        g_renderer->setVolumePosition("all", pos);
     4015    }
     4016    return TCL_OK;
     4017}
     4018
     4019static int
     4020VolumeScaleOp(ClientData clientData, Tcl_Interp *interp, int objc,
     4021              Tcl_Obj *const *objv)
     4022{
     4023    double scale[3];
     4024    if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK ||
     4025        Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK ||
     4026        Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) {
     4027        return TCL_ERROR;
     4028    }
     4029    if (objc == 6) {
     4030        const char *name = Tcl_GetString(objv[5]);
     4031        g_renderer->setVolumeScale(name, scale);
     4032    } else {
     4033        g_renderer->setVolumeScale("all", scale);
    35554034    }
    35564035    return TCL_OK;
     
    36554134    {"delete",   1, VolumeDeleteOp, 2, 3, "?dataSetName?"},
    36564135    {"lighting", 1, VolumeLightingOp, 3, 4, "bool ?dataSetName?"},
    3657     {"opacity",  1, VolumeOpacityOp, 3, 4, "val ?dataSetName?"},
    3658     {"shading",  1, VolumeShadingOp, 4, 6, "oper val ?dataSetName?"},
     4136    {"opacity",  2, VolumeOpacityOp, 3, 4, "val ?dataSetName?"},
     4137    {"orient",   2, VolumeOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"},
     4138    {"pos",      1, VolumePositionOp, 5, 6, "x y z ?dataSetName?"},
     4139    {"scale",    2, VolumeScaleOp, 5, 6, "sx sy sz ?dataSetName?"},
     4140    {"shading",  2, VolumeShadingOp, 4, 6, "oper val ?dataSetName?"},
    36594141    {"visible",  1, VolumeVisibleOp, 3, 4, "bool ?dataSetName?"}
    36604142};
Note: See TracChangeset for help on using the changeset viewer.