Changeset 923 for trunk/vizservers


Ignore:
Timestamp:
Mar 6, 2008 10:59:02 AM (16 years ago)
Author:
gah
Message:
 
Location:
trunk/vizservers/nanovis
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/vizservers/nanovis/Command.cpp

    r917 r923  
    3434 *          an id field that's a number that gets incremented each new volume.
    3535 *        x Create R2, matrix, etc. libraries. (done)
    36  *        o Add bookkeeping for volumes, heightmaps, flows, etc. to track
    37  *          1) id #  2) simulation # 3) include/exclude.  The include/exclude
    38  *          is to indicate whether the item should contribute to the overall
    39  *          limits of the axes.
     36 *        o Add bookkeeping for volumes, heightmaps, flows, etc. to track
     37 *          1) id #  2) simulation # 3) include/exclude.  The include/exclude
     38 *          is to indicate whether the item should contribute to the overall
     39 *          limits of the axes.
    4040 */
    4141
    42 #define ISO_TEST                1
    43 #define PLANE_CMD               0
    44 #define __TEST_CODE__           0
     42#define ISO_TEST                1
     43#define PLANE_CMD               0
     44#define __TEST_CODE__           0
    4545// FOR testing new functions
    46 #define _LOCAL_ZINC_TEST_       0
     46#define _LOCAL_ZINC_TEST_       0
    4747
    4848#include <tcl.h>
     
    165165static int
    166166GetCullMode(Tcl_Interp *interp, Tcl_Obj *objPtr,
    167         graphics::RenderContext::CullMode *modePtr)
     167        graphics::RenderContext::CullMode *modePtr)
    168168{
    169169    char *string = Tcl_GetString(objPtr);
     
    272272static HeightMap *
    273273CreateHeightMap(ClientData clientData, Tcl_Interp *interp, int objc,
    274                 Tcl_Obj *CONST *objv)
     274                Tcl_Obj *CONST *objv)
    275275{
    276276    float xMin, yMin, xMax, yMax;
     
    353353        (NanoVis::heightMap[mapIndex] == NULL)) {
    354354        Tcl_AppendResult(interp, "invalid heightmap index \"",
    355                 Tcl_GetString(objPtr), "\"", (char *)NULL);
     355                Tcl_GetString(objPtr), "\"", (char *)NULL);
    356356        return TCL_ERROR;
    357357    }
     
    382382    if (index < 0) {
    383383        Tcl_AppendResult(interp, "can't have negative index \"",
    384                 Tcl_GetString(objPtr), "\"", (char*)NULL);
     384                Tcl_GetString(objPtr), "\"", (char*)NULL);
    385385        return TCL_ERROR;
    386386    }
     
    418418    if (vol == NULL) {
    419419        Tcl_AppendResult(interp, "no volume defined for index \"",
    420                 Tcl_GetString(objPtr), "\"", (char*)NULL);
     420                Tcl_GetString(objPtr), "\"", (char*)NULL);
    421421        return TCL_ERROR;
    422422    }
     
    475475        if (index < 0) {
    476476            Tcl_AppendResult(interp, "can't have negative index \"",
    477                 Tcl_GetString(objv[n]), "\"", (char *)NULL);
     477                Tcl_GetString(objv[n]), "\"", (char *)NULL);
    478478            return TCL_ERROR;
    479479        }
     
    594594    }
    595595    if (GetAxis(interp, string, indexPtr) != TCL_OK) {
    596         return TCL_ERROR;
     596        return TCL_ERROR;
    597597    }
    598598    if (dirPtr != NULL) {
    599         *dirPtr = sign;
     599        *dirPtr = sign;
    600600    }
    601601    return TCL_OK;
     
    617617    if (objc < 3) {
    618618        Tcl_AppendResult(interp, "missing color values\": ",
    619                 "should list of R G B values 0.0 - 1.0", (char*)NULL);
     619                "should list of R G B values 0.0 - 1.0", (char*)NULL);
    620620        return TCL_ERROR;
    621621    }
     
    684684    double x0, y0, z0;
    685685    if ((Tcl_GetDoubleFromObj(interp, objv[2], &x0) != TCL_OK) ||
    686         (Tcl_GetDoubleFromObj(interp, objv[3], &y0) != TCL_OK) ||
    687         (Tcl_GetDoubleFromObj(interp, objv[4], &z0) != TCL_OK)) {
    688         return TCL_ERROR;
     686        (Tcl_GetDoubleFromObj(interp, objv[3], &y0) != TCL_OK) ||
     687        (Tcl_GetDoubleFromObj(interp, objv[4], &z0) != TCL_OK)) {
     688        return TCL_ERROR;
    689689    }
    690690    NanoVis::cam->aim(x0, y0, z0);
     
    697697    double xangle, yangle, zangle;
    698698    if ((Tcl_GetDoubleFromObj(interp, objv[2], &xangle) != TCL_OK) ||
    699         (Tcl_GetDoubleFromObj(interp, objv[3], &yangle) != TCL_OK) ||
    700         (Tcl_GetDoubleFromObj(interp, objv[4], &zangle) != TCL_OK)) {
    701         return TCL_ERROR;
     699        (Tcl_GetDoubleFromObj(interp, objv[3], &yangle) != TCL_OK) ||
     700        (Tcl_GetDoubleFromObj(interp, objv[4], &zangle) != TCL_OK)) {
     701        return TCL_ERROR;
    702702    }
    703703    NanoVis::cam->rotate(xangle, yangle, zangle);
     
    710710    double zoom;
    711711    if (Tcl_GetDoubleFromObj(interp, objv[2], &zoom) != TCL_OK) {
    712         return TCL_ERROR;
     712        return TCL_ERROR;
    713713    }
    714714    NanoVis::zoom(zoom);
     
    718718static Rappture::CmdSpec cameraOps[] =
    719719{
    720     {"aim",     2, CameraAimOp,      5, 5, "x y z",},
    721     {"angle",   2, CameraAngleOp,    5, 5, "xAngle yAngle zAngle",},
    722     {"zoom",    1, CameraZoomOp,     3, 3, "factor",},
     720    {"aim",     2, CameraAimOp,      5, 5, "x y z",},
     721    {"angle",   2, CameraAngleOp,    5, 5, "xAngle yAngle zAngle",},
     722    {"zoom",    1, CameraZoomOp,     3, 3, "factor",},
    723723};
    724724static int nCameraOps = NumCmdSpecs(cameraOps);
     
    743743
    744744    proc = Rappture::GetOpFromObj(interp, nCameraOps, cameraOps,
    745                 Rappture::CMDSPEC_ARG1, objc, objv, 0);
     745                Rappture::CMDSPEC_ARG1, objc, objv, 0);
    746746    if (proc == NULL) {
    747         return TCL_ERROR;
     747        return TCL_ERROR;
    748748    }
    749749    return (*proc) (cdata, interp, objc, objv);
     
    787787static int
    788788CutplanePositionOp(ClientData cdata, Tcl_Interp *interp, int objc,
    789                    Tcl_Obj *CONST *objv)
     789                   Tcl_Obj *CONST *objv)
    790790{
    791791    float relval;
    792792    if (GetFloatFromObj(interp, objv[2], &relval) != TCL_OK) {
    793         return TCL_ERROR;
     793        return TCL_ERROR;
    794794    }
    795795   
    796796    // keep this just inside the volume so it doesn't disappear
    797797    if (relval < 0.01f) {
    798         relval = 0.01f;
     798        relval = 0.01f;
    799799    } else if (relval > 0.99f) {
    800         relval = 0.99f;
     800        relval = 0.99f;
    801801    }
    802802   
    803803    int axis;
    804804    if (GetAxisFromObj(interp, objv[3], &axis) != TCL_OK) {
    805         return TCL_ERROR;
     805        return TCL_ERROR;
    806806    }
    807807   
    808808    vector<Volume *> ivol;
    809     if (GetVolumes(interp, objc-4, objv+4, &ivol) != TCL_OK) {
    810         return TCL_ERROR;
     809    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
     810        return TCL_ERROR;
    811811    }
    812812    vector<Volume *>::iterator iter;
    813813    for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    814         (*iter)->move_cutplane(axis, relval);
     814        (*iter)->move_cutplane(axis, relval);
    815815    }
    816816    return TCL_OK;
     
    819819static int
    820820CutplaneStateOp(ClientData cdata, Tcl_Interp *interp, int objc,
    821                 Tcl_Obj *CONST *objv)
     821                Tcl_Obj *CONST *objv)
    822822{
    823823    int state;
    824824    if (Tcl_GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) {
    825         return TCL_ERROR;
     825        return TCL_ERROR;
    826826    }
    827827   
    828828    int axis;
    829829    if (GetAxisFromObj(interp, objv[3], &axis) != TCL_OK) {
    830         return TCL_ERROR;
     830        return TCL_ERROR;
    831831    }
    832832   
    833833    vector<Volume *> ivol;
    834834    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
    835         return TCL_ERROR;
     835        return TCL_ERROR;
    836836    }
    837837    if (state) {
    838         vector<Volume *>::iterator iter;
    839         for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    840             (*iter)->enable_cutplane(axis);
    841         }
     838        vector<Volume *>::iterator iter;
     839        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
     840            (*iter)->enable_cutplane(axis);
     841        }
    842842    } else {
    843         vector<Volume *>::iterator iter;
    844         for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    845             (*iter)->disable_cutplane(axis);
    846         }
     843        vector<Volume *>::iterator iter;
     844        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
     845            (*iter)->disable_cutplane(axis);
     846        }
    847847    }
    848848    return TCL_OK;
     
    851851static Rappture::CmdSpec cutplaneOps[] =
    852852{
    853     {"position", 1, CutplanePositionOp, 4, 4, "bool axis ?indices?",},
    854     {"state",    1, CutplaneStateOp,    4, 0, "relval axis ?indices?",},
     853    {"position", 1, CutplanePositionOp, 4, 0, "bool axis ?indices?",},
     854    {"state",    1, CutplaneStateOp,    4, 0, "relval axis ?indices?",},
    855855};
    856856static int nCutplaneOps = NumCmdSpecs(cutplaneOps);
     
    877877
    878878    proc = Rappture::GetOpFromObj(interp, nCutplaneOps, cutplaneOps,
    879                 Rappture::CMDSPEC_ARG1, objc, objv, 0);
     879                Rappture::CMDSPEC_ARG1, objc, objv, 0);
    880880    if (proc == NULL) {
    881         return TCL_ERROR;
     881        return TCL_ERROR;
    882882    }
    883883    return (*proc) (cdata, interp, objc, objv);
     
    900900    if (objc != 4) {
    901901        Tcl_AppendResult(interp, "wrong # args: should be \"",
    902                 Tcl_GetString(objv[0]), " volIndex width height\"", (char*)NULL);
     902                Tcl_GetString(objv[0]), " volIndex width height\"", (char*)NULL);
    903903        return TCL_ERROR;
    904904    }
     
    912912    if (tf == NULL) {
    913913        Tcl_AppendResult(interp, "no transfer function defined for volume \"",
    914                 Tcl_GetString(objv[1]), "\"", (char*)NULL);
     914                Tcl_GetString(objv[1]), "\"", (char*)NULL);
    915915        return TCL_ERROR;
    916916    }
     
    945945    if (objc != 3) {
    946946        Tcl_AppendResult(interp, "wrong # args: should be \"",
    947                 Tcl_GetString(objv[0]), " width height\"", (char*)NULL);
     947                Tcl_GetString(objv[0]), " width height\"", (char*)NULL);
    948948        return TCL_ERROR;
    949949    }
     
    951951    int w, h;
    952952    if ((Tcl_GetIntFromObj(interp, objv[1], &w) != TCL_OK) ||
    953         (Tcl_GetIntFromObj(interp, objv[2], &h) != TCL_OK)) {
     953        (Tcl_GetIntFromObj(interp, objv[2], &h) != TCL_OK)) {
    954954        return TCL_ERROR;
    955955    }
     
    973973    if (objc < 2) {
    974974        Tcl_AppendResult(interp, "wrong # args: should be \"",
    975                 Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
     975                Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
    976976        return TCL_ERROR;
    977977    }
     
    982982        if (objc != 5) {
    983983            Tcl_AppendResult(interp, "wrong # args: should be \"",
    984                 Tcl_GetString(objv[0]), " define name colormap alphamap\"",
    985                 (char*)NULL);
     984                Tcl_GetString(objv[0]), " define name colormap alphamap\"",
     985                (char*)NULL);
    986986            return TCL_ERROR;
    987987        }
     
    10851085    if (objc != 2) {
    10861086        Tcl_AppendResult(interp, "wrong # args: should be \"",
    1087                 Tcl_GetString(objv[0]), " x|y|z|-x|-y|-z\"", (char*)NULL);
     1087                Tcl_GetString(objv[0]), " x|y|z|-x|-y|-z\"", (char*)NULL);
    10881088        return TCL_ERROR;
    10891089    }
     
    10971097    return TCL_OK;
    10981098}
     1099
     1100#ifdef notdef
     1101static Rappture::CmdSpec volumeAnimationOps[] =
     1102{
     1103    {"capture",   2, VolumeAnimationCaptureOp,  4, 0, "value ?indices?",},
     1104    {"clear",     2, VolumeAnimationClearOp,    4, 0, "value ?indices?",},
     1105    {"start",     3, VolumeAnimationStartOp,    4, 0, "value ?indices?",},
     1106    {"stop",      3, VolumeAnimationStopOp,     4, 0, "bool ?indices?",},
     1107    {"volumes",   1, VolumeAnimationVolumesOp,  4, 0, "funcName ?indices?",},
     1108};
     1109static int nVolumeAnimationOps = NumCmdSpecs(volumeAnimationOps);
     1110
     1111static int
     1112VolumeDataFollowsOp(ClientData cdata, Tcl_Interp *interp, int objc,
     1113                    Tcl_Obj *CONST *objv)
     1114{
     1115    printf("Data Loading\n");
     1116    fflush(stdout);
     1117   
     1118    int nbytes;
     1119    if (Tcl_GetIntFromObj(interp, objv[3], &nbytes) != TCL_OK) {
     1120        return TCL_ERROR;
     1121    }
     1122   
     1123    Rappture::Buffer buf;
     1124    if (GetDataStream(interp, buf, nbytes) != TCL_OK) {
     1125        return TCL_ERROR;
     1126    }
     1127    int n = NanoVis::n_volumes;
     1128    char header[6];
     1129    memcpy(header, buf.bytes(), sizeof(char) * 5);
     1130    header[5] = '\0';
     1131   
     1132#if _LOCAL_ZINC_TEST_
     1133    //FILE* fp = fopen("/home/nanohub/vrinside/nv/data/HOON/QDWL_100_100_50_strain_8000i.nd_zatom_12_1", "rb");
     1134    FILE* fp;
     1135   
     1136    fp = fopen("/home/nanohub/vrinside/nv/data/HOON/GaAs_AlGaAs_2QD_B4.nd_zc_1_wf", "rb");
     1137    if (fp == NULL) {
     1138        printf("cannot open the file\n");
     1139        fflush(stdout);
     1140        return TCL_ERROR;
     1141    }
     1142    unsigned char* b = (unsigned char*)malloc(buf.size());
     1143    fread(b, buf.size(), 1, fp);
     1144    fclose(fp);
     1145#endif  /*_LOCAL_ZINC_TEST_*/
     1146    printf("Checking header[%s]\n", header);
     1147    fflush(stdout);
     1148    if (strcmp(header, "<HDR>") == 0) {
     1149        Volume* vol = NULL;
     1150       
     1151        printf("ZincBlende stream is in\n");
     1152        fflush(stdout);
     1153        //std::stringstream fdata(std::ios_base::out|std::ios_base::in|std::ios_base::binary);
     1154        //fdata.write(buf.bytes(),buf.size());
     1155        //vol = NvZincBlendeReconstructor::getInstance()->loadFromStream(fdata);
     1156       
     1157#if _LOCAL_ZINC_TEST_
     1158        vol = NvZincBlendeReconstructor::getInstance()->loadFromMemory(b);
     1159#else
     1160        vol = NvZincBlendeReconstructor::getInstance()->loadFromMemory((void*) buf.bytes());
     1161#endif  /*_LOCAL_ZINC_TEST_*/
     1162        if (vol == NULL) {
     1163            Tcl_AppendResult(interp, "can't get volume instance", (char *)NULL);
     1164            return TCL_OK;
     1165        }
     1166        printf("finish loading\n");
     1167        fflush(stdout);
     1168        while (NanoVis::n_volumes <= n) {
     1169            NanoVis::volume.push_back((Volume*) NULL);
     1170            NanoVis::n_volumes++;
     1171        }
     1172       
     1173        if (NanoVis::volume[n] != NULL) {
     1174            delete NanoVis::volume[n];
     1175            NanoVis::volume[n] = NULL;
     1176        }
     1177       
     1178        float dx0 = -0.5;
     1179        float dy0 = -0.5*vol->height/vol->width;
     1180        float dz0 = -0.5*vol->depth/vol->width;
     1181        vol->move(Vector3(dx0, dy0, dz0));
     1182       
     1183        NanoVis::volume[n] = vol;
     1184#if __TEST_CODE__
     1185    } else if (strcmp(header, "<FET>") == 0) {
     1186        printf("FET loading...\n");
     1187        fflush(stdout);
     1188        std::stringstream fdata;
     1189        fdata.write(buf.bytes(),buf.size());
     1190        err = load_volume_stream3(n, fdata);
     1191        if (err) {
     1192            Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL);
     1193            return TCL_ERROR;
     1194        }
     1195#endif  /*__TEST_CODE__*/
     1196    } else if (strcmp(header, "<ODX>") == 0) {
     1197        Rappture::Outcome err;
     1198       
     1199        printf("Loading DX using OpenDX library...\n");
     1200        fflush(stdout);
     1201        //err = load_volume_stream_odx(n, buf.bytes()+5, buf.size()-5);
     1202        //err = load_volume_stream2(n, fdata);
     1203        if (err) {
     1204            Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL);
     1205            return TCL_ERROR;
     1206        }
     1207    } else {
     1208        Rappture::Outcome err;
     1209       
     1210        printf("OpenDX loading...\n");
     1211        fflush(stdout);
     1212        std::stringstream fdata;
     1213        fdata.write(buf.bytes(),buf.size());
     1214       
     1215#if ISO_TEST
     1216        err = load_volume_stream2(n, fdata);
     1217#else
     1218        err = load_volume_stream(n, fdata);
     1219#endif
     1220        if (err) {
     1221            Tcl_AppendResult(interp, err.remark().c_str(), (char*)NULL);
     1222            return TCL_ERROR;
     1223        }
     1224    }
     1225   
     1226    //
     1227    // BE CAREFUL: Set the number of slices to something slightly different
     1228    // for each volume.  If we have identical volumes at exactly the same
     1229    // position with exactly the same number of slices, the second volume will
     1230    // overwrite the first, so the first won't appear at all.
     1231    //
     1232    if (NanoVis::volume[n] != NULL) {
     1233        NanoVis::volume[n]->set_n_slice(256-n);
     1234        NanoVis::volume[n]->disable_cutplane(0);
     1235        NanoVis::volume[n]->disable_cutplane(1);
     1236        NanoVis::volume[n]->disable_cutplane(2);
     1237       
     1238        NanoVis::vol_renderer->add_volume(NanoVis::volume[n],
     1239                                          NanoVis::get_transfunc("default"));
     1240    }
     1241   
     1242    {
     1243        Volume *volPtr;
     1244        char info[1024];
     1245        float vmin, vmax;
     1246       
     1247        if (GetVolumeLimits(interp, &vmin, &vmax) != TCL_OK) {
     1248            return TCL_ERROR;
     1249        }
     1250        volPtr = NanoVis::volume[n];
     1251        sprintf(info, "nv>data id %d min %g max %g vmin %g vmax %g\n",
     1252                n, volPtr->range_min(), volPtr->range_max(),vmin, vmax);
     1253        write(0, info, strlen(info));
     1254    }
     1255    return TCL_OK;
     1256}
     1257
     1258static int
     1259VolumeDataStateOp(ClientData cdata, Tcl_Interp *interp, int objc,
     1260                  Tcl_Obj *CONST *objv)
     1261{
     1262    int state;
     1263    if (Tcl_GetBooleanFromObj(interp, objv[3], &state) != TCL_OK) {
     1264        return TCL_ERROR;
     1265    }
     1266    vector<Volume *> ivol;
     1267    if (GetVolumes(interp, objc - 4, objv + 4, &ivol) != TCL_OK) {
     1268        return TCL_ERROR;
     1269    }
     1270    if (state) {
     1271        vector<Volume *>::iterator iter;
     1272        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
     1273            (*iter)->enable_data();
     1274        }
     1275    } else {
     1276        vector<Volume *>::iterator iter;
     1277        for (iter = ivol.begin(); iter != ivol.end(); iter++) {
     1278            (*iter)->disable_data();
     1279        }
     1280    }
     1281    return TCL_OK;
     1282}
     1283
     1284static Rappture::CmdSpec volumeDataOps[] =
     1285{
     1286    {"follows",   1, VolumeDataFollowsOp, 4, 4, "size",},
     1287    {"state",     1, VolumeDataStateOp,   4, 0, "bool ?indices?",},
     1288};
     1289static int nVolumeDataOps = NumCmdSpecs(volumeDataOps);
     1290
     1291static int
     1292VolumeOutlineStateOp(ClientData cdata, Tcl_Interp *interp, int objc,
     1293                  Tcl_Obj *CONST *objv)
     1294{
     1295    return TCL_OK;
     1296}
     1297static Rappture::CmdSpec volumeOutlineOps[] =
     1298{
     1299    {"color",     1, VolumeOutlineColorOp,    6, 0, "r g b ?indices?",},
     1300    {"state",     1, VolumeOutlineStateOp,    4, 0, "bool ?indices?",},
     1301    {"visible",   1, VolumeOutlineVisibleOp,  4, 0, "bool ?indices?",},
     1302};
     1303static int nVolumeOutlineOps = NumCmdSpecs(volumeOutlineOps);
     1304
     1305static Rappture::CmdSpec volumeShadingOps[] =
     1306{
     1307    {"diffuse",     1, VolumeShadingDiffuseOp,    4, 0, "value ?indices?",},
     1308    {"isosurface",  1, VolumeShadingIsosurfaceOp, 4, 0, "bool ?indices?",},
     1309    {"opacity",     1, VolumeShadingOpacityOp,    4, 0, "value ?indices?",},
     1310    {"specular",    1, VolumeShadingSpecularOp,   4, 0, "value ?indices?",},
     1311    {"transfunc",   1, VolumeShadingTransFuncOp,  4, 0, "funcName ?indices?",},
     1312};
     1313static int nVolumeShadingOps = NumCmdSpecs(volumeShadingOps);
     1314
     1315static Rappture::CmdSpec volumeOps[] =
     1316{
     1317    {"animation", 2, VolumeAnimationOp,   3, 3, "oper ?args?",},
     1318    {"axis",      2, VolumeAxisOp,        3, 3, "label axis value ?indices?",},
     1319    {"data",      1, VolumeDataOp,        3, 3, "oper ?args?",},
     1320    {"outline",   1, VolumeOutlineOp,     3, 0, "oper ?args?",},
     1321    {"shading",   2, VolumeShadingOp,     3, 0, "oper ?args?",},
     1322    {"state",     2, VolumeStateOp,       3, 0, "bool ?indices?",},
     1323    {"test2",     1, VolumeTestOp,        2, 2, "",},
     1324};
     1325static int nVolumeOps = NumCmdSpecs(volumeOps);
     1326#endif
    10991327
    11001328/*
     
    11191347    if (objc < 2) {
    11201348        Tcl_AppendResult(interp, "wrong # args: should be \"",
    1121                 Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
     1349                Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
    11221350        return TCL_ERROR;
    11231351    }
     
    11281356        if (objc < 3) {
    11291357            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1130                 Tcl_GetString(objv[0]), " axis option ?arg arg...?\"",
    1131                 (char*)NULL);
    1132             return TCL_ERROR;
    1133         }
    1134         char *string = Tcl_GetString(objv[2]);
     1358                Tcl_GetString(objv[0]), " axis option ?arg arg...?\"",
     1359                (char*)NULL);
     1360            return TCL_ERROR;
     1361        }
     1362        char *string = Tcl_GetString(objv[2]);
    11351363        c = string[0];
    11361364        if ((c == 'l') && (strcmp(string, "label") == 0)) {
    11371365            if (objc < 5) {
    11381366                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1139                         Tcl_GetString(objv[0]),
    1140                         " axis label x|y|z string ?volume ...?\"", (char*)NULL);
     1367                        Tcl_GetString(objv[0]),
     1368                        " axis label x|y|z string ?volume ...?\"", (char*)NULL);
    11411369                return TCL_ERROR;
    11421370            }
     
    11501378            }
    11511379            vector<Volume *>::iterator iter;
    1152             char *label;
    1153             label = Tcl_GetString(objv[4]);
     1380            char *label;
     1381            label = Tcl_GetString(objv[4]);
    11541382            for (iter = ivol.begin(); iter != ivol.end(); iter++) {
    11551383                (*iter)->set_label(axis, label);
     
    11571385        } else {
    11581386            Tcl_AppendResult(interp, "bad option \"", string,
    1159                 "\": should be label", (char*)NULL);
     1387                "\": should be label", (char*)NULL);
    11601388            return TCL_ERROR;
    11611389        }
     
    11631391        if (objc < 3) {
    11641392            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1165                 Tcl_GetString(objv[0]), " data option ?arg arg...?\"",
    1166                 (char*)NULL);
    1167             return TCL_ERROR;
    1168         }
    1169         char *string = Tcl_GetString(objv[2]);
     1393                Tcl_GetString(objv[0]), " data option ?arg arg...?\"",
     1394                (char*)NULL);
     1395            return TCL_ERROR;
     1396        }
     1397        char *string = Tcl_GetString(objv[2]);
    11701398        c = string[0];
    11711399        if ((c == 's') && (strcmp(string, "state") == 0)) {
    11721400            if (objc < 4) {
    11731401                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1174                         Tcl_GetString(objv[0])," data state on|off ?volume...?\"",
    1175                         (char*)NULL);
     1402                        Tcl_GetString(objv[0])," data state on|off ?volume...?\"",
     1403                        (char*)NULL);
    11761404                return TCL_ERROR;
    11771405            }
     
    11981426            if (objc < 4) {
    11991427                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1200                         Tcl_GetString(objv[0]), " data follows size", (char*)NULL);
     1428                        Tcl_GetString(objv[0]), " data follows size", (char*)NULL);
    12011429                return TCL_ERROR;
    12021430            }
     
    13001528                std::stringstream fdata;
    13011529                fdata.write(buf.bytes(),buf.size());
    1302                
     1530               
    13031531#if ISO_TEST
    13041532                err = load_volume_stream2(n, fdata);
     
    13501578        if (objc < 3) {
    13511579            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1352                 Tcl_GetString(objv[0]), " outline option ?arg arg...?\"",
    1353                 (char*)NULL);
    1354             return TCL_ERROR;
    1355         }
    1356         char *string = Tcl_GetString(objv[2]);
     1580                Tcl_GetString(objv[0]), " outline option ?arg arg...?\"",
     1581                (char*)NULL);
     1582            return TCL_ERROR;
     1583        }
     1584        char *string = Tcl_GetString(objv[2]);
    13571585        c = string[0];
    13581586        if ((c == 's') && (strcmp(string, "state") == 0)) {
    13591587            if (objc < 3) {
    13601588                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1361                         Tcl_GetString(objv[0]),
    1362                         " outline state on|off ?volume ...? \"", (char*)NULL);
     1589                        Tcl_GetString(objv[0]),
     1590                        " outline state on|off ?volume ...? \"", (char*)NULL);
    13631591                return TCL_ERROR;
    13641592            }
     
    14051633            if (objc < 6) {
    14061634                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1407                         Tcl_GetString(objv[0]),
    1408                         " outline color R G B ?volume ...? \"", (char*)NULL);
     1635                        Tcl_GetString(objv[0]),
     1636                        " outline color R G B ?volume ...? \"", (char*)NULL);
    14091637                return TCL_ERROR;
    14101638            }
     
    14301658        if (objc < 3) {
    14311659            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1432                 Tcl_GetString(objv[0]), " shading option ?arg arg...?\"",
    1433                 (char*)NULL);
    1434             return TCL_ERROR;
    1435         }
    1436         char *string = Tcl_GetString(objv[2]);
     1660                Tcl_GetString(objv[0]), " shading option ?arg arg...?\"",
     1661                (char*)NULL);
     1662            return TCL_ERROR;
     1663        }
     1664        char *string = Tcl_GetString(objv[2]);
    14371665        c = string[0];
    14381666        if ((c == 't') && (strcmp(string, "transfunc") == 0)) {
    14391667            if (objc < 4) {
    14401668                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1441                         Tcl_GetString(objv[0]),
    1442                         " shading transfunc name ?volume ...?\"", (char*)NULL);
     1669                        Tcl_GetString(objv[0]),
     1670                        " shading transfunc name ?volume ...?\"", (char*)NULL);
    14431671                return TCL_ERROR;
    14441672            }
    14451673            TransferFunction *tf;
    1446             char *name = Tcl_GetString(objv[3]);
     1674            char *name = Tcl_GetString(objv[3]);
    14471675            tf = NanoVis::get_transfunc(name);
    14481676            if (tf == NULL) {
     
    14701698            if (objc < 4) {
    14711699                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1472                         Tcl_GetString(objv[0]),
    1473                         " shading diffuse value ?volume ...?\"", (char*)NULL);
     1700                        Tcl_GetString(objv[0]),
     1701                        " shading diffuse value ?volume ...?\"", (char*)NULL);
    14741702                return TCL_ERROR;
    14751703            }
     
    14901718            if (objc < 4) {
    14911719                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1492                         Tcl_GetString(objv[0]),
    1493                         " shading opacity value ?volume ...?\"", (char*)NULL);
     1720                        Tcl_GetString(objv[0]),
     1721                        " shading opacity value ?volume ...?\"", (char*)NULL);
    14941722                return TCL_ERROR;
    14951723            }
     
    15091737            if (objc < 4) {
    15101738                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1511                         Tcl_GetString(objv[0]),
    1512                         " shading specular value ?volume ...?\"", (char*)NULL);
     1739                        Tcl_GetString(objv[0]),
     1740                        " shading specular value ?volume ...?\"", (char*)NULL);
    15131741                return TCL_ERROR;
    15141742            }
     
    15281756            if (objc < 4) {
    15291757                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1530                         Tcl_GetString(objv[0]),
    1531                         " shading isosurface on|off ?volume ...?\"", (char*)NULL);
     1758                        Tcl_GetString(objv[0]),
     1759                        " shading isosurface on|off ?volume ...?\"", (char*)NULL);
    15321760                return TCL_ERROR;
    15331761            }
     
    15531781        if (objc < 3) {
    15541782            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1555                 Tcl_GetString(objv[0]), " state on|off ?volume...?\"",
    1556                 (char*)NULL);
     1783                Tcl_GetString(objv[0]), " state on|off ?volume...?\"",
     1784                (char*)NULL);
    15571785            return TCL_ERROR;
    15581786        }
     
    15791807        if (objc < 3) {
    15801808            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1581                 Tcl_GetString(objv[0]), " animation option ?args...?\"",
    1582                 (char*)NULL);
    1583             return TCL_ERROR;
    1584         }
    1585         char *string = Tcl_GetString(objv[2]);
    1586         char c = string[0];
     1809                Tcl_GetString(objv[0]), " animation option ?args...?\"",
     1810                (char*)NULL);
     1811            return TCL_ERROR;
     1812        }
     1813        char *string = Tcl_GetString(objv[2]);
     1814        char c = string[0];
    15871815        if ((c == 'v') && (strcmp(string,"volumes") == 0)) {
    15881816            vector<unsigned int> ivol;
     
    15951823                Trace("index: %d\n", *iter);
    15961824                NanoVis::vol_renderer->addAnimatedVolume(NanoVis::volume[*iter],
    1597                         *iter);
     1825                        *iter);
    15981826            }
    15991827        } else if ((c == 'c') && (strcmp(string,"capture") == 0)) {
     
    16041832            }
    16051833            VolumeInterpolator* interpolator;
    1606             interpolator = NanoVis::vol_renderer->getVolumeInterpolator();
     1834            interpolator = NanoVis::vol_renderer->getVolumeInterpolator();
    16071835            interpolator->start();
    16081836            if (interpolator->is_started()) {
    1609                 char *fileName = (objc < 5) ? NULL : Tcl_GetString(objv[4]);
     1837                char *fileName = (objc < 5) ? NULL : Tcl_GetString(objv[4]);
    16101838                for (int frame_num = 0; frame_num < total; ++frame_num) {
    1611                     float fraction;
     1839                    float fraction;
    16121840
    16131841                    fraction = ((float)frame_num) / (total - 1);
     
    16231851                    glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    16241852           
    1625                     NanoVis::bmp_write_to_file(frame_num, fileName);
     1853                    NanoVis::bmp_write_to_file(frame_num, fileName);
    16261854                }
    16271855            }
    16281856        } else if ((c == 's') && (strcmp(string, "start") == 0)) {
    1629             NanoVis::vol_renderer->startVolumeAnimation();
     1857            NanoVis::vol_renderer->startVolumeAnimation();
    16301858        } else if ((c == 's') && (strcmp(string, "stop") == 0)) {
    1631             NanoVis::vol_renderer->stopVolumeAnimation();
     1859            NanoVis::vol_renderer->stopVolumeAnimation();
    16321860        } else if ((c == 'c') && (strcmp(string, "clear") == 0)) {
    1633             NanoVis::vol_renderer->clearAnimatedVolumeInfo();
     1861            NanoVis::vol_renderer->clearAnimatedVolumeInfo();
    16341862        } else {
    16351863            Tcl_AppendResult(interp, "bad animation option \"", string,
    16361864                "\": should be volumes, start, stop,  or clear", (char*)NULL);
    16371865            return TCL_ERROR;
    1638         }
     1866        }
    16391867    } else if ((c == 't') && (strcmp(string, "test2") == 0)) {
    16401868        NanoVis::volume[1]->disable_data();
     
    16551883    if (objc < 2) {
    16561884        Tcl_AppendResult(interp, "wrong # args: should be \"",
    1657                 Tcl_GetString(objv[0]), " option ?arg arg?", (char *)NULL);
     1885                Tcl_GetString(objv[0]), " option ?arg arg?", (char *)NULL);
    16581886        return TCL_ERROR;
    16591887    }
     
    16631891        if (objc != 3) {
    16641892            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1665                 Tcl_GetString(objv[0]), " vectorid volume", (char *)NULL);
     1893                Tcl_GetString(objv[0]), " vectorid volume", (char *)NULL);
    16661894            return TCL_ERROR;
    16671895        }
     
    16891917        if (objc != 3) {
    16901918            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1691                 Tcl_GetString(objv[0]), " lic on|off\"", (char*)NULL);
     1919                Tcl_GetString(objv[0]), " lic on|off\"", (char*)NULL);
    16921920            return TCL_ERROR;
    16931921        }
     
    17001928        if (objc < 3) {
    17011929            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1702                 Tcl_GetString(objv[0]), " particle visible|slice|slicepos arg \"",
    1703                 (char*)NULL);
    1704             return TCL_ERROR;
    1705         }
    1706         char *string = Tcl_GetString(objv[2]);
     1930                Tcl_GetString(objv[0]), " particle visible|slice|slicepos arg \"",
     1931                (char*)NULL);
     1932            return TCL_ERROR;
     1933        }
     1934        char *string = Tcl_GetString(objv[2]);
    17071935        c = string[0];
    17081936        if ((c == 'v') && (strcmp(string, "visible") == 0)) {
    17091937            if (objc != 4) {
    17101938                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1711                         Tcl_GetString(objv[0]), " particle visible on|off\"",
    1712                         (char*)NULL);
     1939                        Tcl_GetString(objv[0]), " particle visible on|off\"",
     1940                        (char*)NULL);
    17131941                return TCL_ERROR;
    17141942            }
     
    17211949            if (objc != 4) {
    17221950                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1723                         Tcl_GetString(objv[0]),
     1951                        Tcl_GetString(objv[0]),
    17241952                        " particle slice volume\"", (char*)NULL);
    17251953                return TCL_ERROR;
     
    17331961            if (objc != 4) {
    17341962                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1735                         Tcl_GetString(objv[0]), " particle slicepos value\"",
    1736                         (char*)NULL);
     1963                        Tcl_GetString(objv[0]), " particle slicepos value\"",
     1964                        (char*)NULL);
    17371965                return TCL_ERROR;
    17381966            }
     
    17591987        } else {
    17601988            Tcl_AppendResult(interp, "unknown option \"",string,"\": should be \"",
    1761                 Tcl_GetString(objv[0]), " visible, slice, or slicepos\"",
     1989                Tcl_GetString(objv[0]), " visible, slice, or slicepos\"",
    17621990                (char *)NULL);
    17631991            return TCL_ERROR;
     
    17681996        if (objc > 4 || objc < 3) {
    17691997            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1770                 Tcl_GetString(objv[0]), " capture numframes [directory]\"",
    1771                 (char*)NULL);
     1998                Tcl_GetString(objv[0]), " capture numframes [directory]\"",
     1999                (char*)NULL);
    17722000            return TCL_ERROR;
    17732001        }
     
    17842012        }
    17852013        // Karl
    1786         //
    1787         Trace("FLOW started\n");
    1788         char *fileName;
    1789         fileName = (objc < 4) ? NULL : Tcl_GetString(objv[3]);
     2014        //
     2015        Trace("FLOW started\n");
     2016        char *fileName;
     2017        fileName = (objc < 4) ? NULL : Tcl_GetString(objv[3]);
    17902018        for (int frame_count = 0; frame_count < total_frame_count;
    17912019             frame_count++) {
     
    18082036            glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
    18092037
    1810             NanoVis::bmp_write_to_file(frame_count, fileName);
    1811         }
    1812         Trace("FLOW end\n");
     2038            NanoVis::bmp_write_to_file(frame_count, fileName);
     2039        }
     2040        Trace("FLOW end\n");
    18132041        // put your code...
    18142042        if (NanoVis::licRenderer) {
     
    18222050        if (objc < 3) {
    18232051            Tcl_AppendResult(interp, "wrong # args: should be \"",
    1824                 Tcl_GetString(objv[0]), " data follows ?args?", (char *)NULL);
    1825             return TCL_ERROR;
    1826         }
    1827         char *string = Tcl_GetString(objv[2]);;
     2052                Tcl_GetString(objv[0]), " data follows ?args?", (char *)NULL);
     2053            return TCL_ERROR;
     2054        }
     2055        char *string = Tcl_GetString(objv[2]);;
    18282056        c = string[0];
    18292057        if ((c == 'f') && (strcmp(string,"follows") == 0)) {
    18302058            if (objc != 4) {
    18312059                Tcl_AppendResult(interp, "wrong # args: should be \"",
    1832                         Tcl_GetString(objv[0]), " data follows length",
    1833                         (char *)NULL);
     2060                        Tcl_GetString(objv[0]), " data follows length",
     2061                        (char *)NULL);
    18342062                return TCL_ERROR;
    18352063            }
     
    18752103static int
    18762104HeightMapDataFollowsOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1877                        Tcl_Obj *CONST *objv)
     2105                       Tcl_Obj *CONST *objv)
    18782106{
    18792107    Rappture::Buffer buf;
     
    18812109   
    18822110    if (Tcl_GetIntFromObj(interp, objv[3], &nBytes) != TCL_OK) {
    1883         return TCL_ERROR;
     2111        return TCL_ERROR;
    18842112    }
    18852113    if (GetDataStream(interp, buf, nBytes) != TCL_OK) {
    1886         return TCL_ERROR;
     2114        return TCL_ERROR;
    18872115    }
    18882116    buf.append("\0", 1);
     
    18902118    result = Tcl_Eval(interp, buf.bytes());
    18912119    if (result != TCL_OK) {
    1892         fprintf(stderr, "error in command: %s\n",
    1893                 Tcl_GetStringResult(interp));
    1894         fflush(stderr);
     2120        fprintf(stderr, "error in command: %s\n",
     2121                Tcl_GetStringResult(interp));
     2122        fflush(stderr);
    18952123    }
    18962124    return result;
     
    18992127static int
    19002128HeightMapDataVisibleOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1901                        Tcl_Obj *CONST *objv)
     2129                       Tcl_Obj *CONST *objv)
    19022130{
    19032131    int ivisible;
    19042132    if (Tcl_GetBooleanFromObj(interp, objv[3], &ivisible) != TCL_OK) {
    1905         return TCL_ERROR;
     2133        return TCL_ERROR;
    19062134    }
    19072135    vector<unsigned int> indices;
    19082136    if (GetIndices(interp, objc - 4, objv + 4, &indices) != TCL_OK) {
    1909         return TCL_ERROR;
     2137        return TCL_ERROR;
    19102138    }
    19112139    bool visible;
    19122140    visible = (bool)ivisible;
    19132141    for (unsigned int i = 0; i < indices.size(); ++i) {
    1914         if ((indices[i] < NanoVis::heightMap.size()) &&
    1915             (NanoVis::heightMap[indices[i]] != NULL)) {
    1916             NanoVis::heightMap[indices[i]]->setVisible(visible);
    1917         }
     2142        if ((indices[i] < NanoVis::heightMap.size()) &&
     2143            (NanoVis::heightMap[indices[i]] != NULL)) {
     2144            NanoVis::heightMap[indices[i]]->setVisible(visible);
     2145        }
    19182146    }
    19192147    return TCL_OK;
     
    19292157static int
    19302158HeightMapDataOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1931                 Tcl_Obj *CONST *objv)
     2159                Tcl_Obj *CONST *objv)
    19322160{
    19332161    Tcl_ObjCmdProc *proc;
    19342162
    19352163    proc = Rappture::GetOpFromObj(interp, nHeightMapDataOps, heightMapDataOps,
    1936                 Rappture::CMDSPEC_ARG2, objc, objv, 0);
     2164                Rappture::CMDSPEC_ARG2, objc, objv, 0);
    19372165    if (proc == NULL) {
    1938         return TCL_ERROR;
     2166        return TCL_ERROR;
    19392167    }
    19402168    return (*proc) (cdata, interp, objc, objv);
     
    19442172static int
    19452173HeightMapLineContourColorOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1946                               Tcl_Obj *CONST *objv)
     2174                              Tcl_Obj *CONST *objv)
    19472175{
    19482176    float rgb[3];
    19492177    if (GetColor(interp, objc - 3, objv + 3, rgb) != TCL_OK) {
    1950         return TCL_ERROR;
     2178        return TCL_ERROR;
    19512179    }           
    19522180    vector<unsigned int> indices;
    19532181    if (GetIndices(interp, objc-6, objv + 6, &indices) != TCL_OK) {
    1954         return TCL_ERROR;
     2182        return TCL_ERROR;
    19552183    }
    19562184    for (unsigned int i = 0; i < indices.size(); ++i) {
    1957         if ((indices[i] < NanoVis::heightMap.size()) &&
    1958             (NanoVis::heightMap[indices[i]] != NULL)) {
    1959             NanoVis::heightMap[indices[i]]->setLineContourColor(rgb);
    1960         }
     2185        if ((indices[i] < NanoVis::heightMap.size()) &&
     2186            (NanoVis::heightMap[indices[i]] != NULL)) {
     2187            NanoVis::heightMap[indices[i]]->setLineContourColor(rgb);
     2188        }
    19612189    }
    19622190    return TCL_OK;
     
    19652193static int
    19662194HeightMapLineContourVisibleOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1967                               Tcl_Obj *CONST *objv)
     2195                              Tcl_Obj *CONST *objv)
    19682196{
    19692197    int ivisible;
    19702198    bool visible;
    19712199    if (Tcl_GetBooleanFromObj(interp, objv[3], &ivisible) != TCL_OK) {
    1972         return TCL_ERROR;
     2200        return TCL_ERROR;
    19732201    }
    19742202    visible = (bool)ivisible;
    19752203    vector<unsigned int> indices;
    19762204    if (GetIndices(interp, objc-4, objv+4, &indices) != TCL_OK) {
    1977         return TCL_ERROR;
     2205        return TCL_ERROR;
    19782206    }
    19792207    for (unsigned int i = 0; i < indices.size(); ++i) {
    1980         if ((indices[i] < NanoVis::heightMap.size()) &&
    1981             (NanoVis::heightMap[indices[i]] != NULL)) {
    1982             NanoVis::heightMap[indices[i]]->setLineContourVisible(visible);
    1983         }
     2208        if ((indices[i] < NanoVis::heightMap.size()) &&
     2209            (NanoVis::heightMap[indices[i]] != NULL)) {
     2210            NanoVis::heightMap[indices[i]]->setLineContourVisible(visible);
     2211        }
    19842212    }
    19852213    return TCL_OK;
     
    19952223static int
    19962224HeightMapLineContourOp(ClientData cdata, Tcl_Interp *interp, int objc,
    1997                         Tcl_Obj *CONST *objv)
     2225                        Tcl_Obj *CONST *objv)
    19982226{
    19992227    Tcl_ObjCmdProc *proc;
    20002228
    20012229    proc = Rappture::GetOpFromObj(interp, nHeightMapLineContourOps,
    2002         heightMapLineContourOps, Rappture::CMDSPEC_ARG2, objc, objv, 0);
     2230        heightMapLineContourOps, Rappture::CMDSPEC_ARG2, objc, objv, 0);
    20032231    if (proc == NULL) {
    2004         return TCL_ERROR;
     2232        return TCL_ERROR;
    20052233    }
    20062234    return (*proc) (cdata, interp, objc, objv);
     
    20092237static int
    20102238HeightMapCullOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2011                    Tcl_Obj *CONST *objv)
     2239                   Tcl_Obj *CONST *objv)
    20122240{
    20132241    graphics::RenderContext::CullMode mode;
    20142242    if (GetCullMode(interp, objv[2], &mode) != TCL_OK) {
    2015         return TCL_ERROR;
     2243        return TCL_ERROR;
    20162244    }
    20172245    NanoVis::renderContext->setCullMode(mode);
     
    20212249static int
    20222250HeightMapCreateOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2023                   Tcl_Obj *CONST *objv)
     2251                  Tcl_Obj *CONST *objv)
    20242252{
    20252253    HeightMap *hMap;
     
    20282256    hMap = CreateHeightMap(cdata, interp, objc - 2, objv + 2);
    20292257    if (hMap == NULL) {
    2030         return TCL_ERROR;
     2258        return TCL_ERROR;
    20312259    }
    20322260    NanoVis::heightMap.push_back(hMap);
     
    20372265static int
    20382266HeightMapLegendOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2039                   Tcl_Obj *CONST *objv)
     2267                  Tcl_Obj *CONST *objv)
    20402268{
    20412269    HeightMap *hMap;
    20422270    if (GetHeightMap(interp, objv[2], &hMap) != TCL_OK) {
    2043         return TCL_ERROR;
     2271        return TCL_ERROR;
    20442272    }
    20452273    TransferFunction *tf;
    20462274    tf = hMap->getColorMap();
    20472275    if (tf == NULL) {
    2048         Tcl_AppendResult(interp, "no transfer function defined for heightmap \"",
    2049                 Tcl_GetString(objv[2]), "\"", (char*)NULL);
    2050         return TCL_ERROR;
     2276        Tcl_AppendResult(interp, "no transfer function defined for heightmap \"",
     2277                Tcl_GetString(objv[2]), "\"", (char*)NULL);
     2278        return TCL_ERROR;
    20512279    }
    20522280    int w, h;
    20532281    if ((Tcl_GetIntFromObj(interp, objv[3], &w) != TCL_OK) ||
    2054         (Tcl_GetIntFromObj(interp, objv[4], &h) != TCL_OK)) {
    2055         return TCL_ERROR;
     2282        (Tcl_GetIntFromObj(interp, objv[4], &h) != TCL_OK)) {
     2283        return TCL_ERROR;
    20562284    }
    20572285    NanoVis::render_legend(tf, hMap->range_min(), hMap->range_max(),
    2058                            w, h, "label");
     2286                           w, h, "label");
    20592287    return TCL_OK;
    20602288}
     
    20622290static int
    20632291HeightMapPolygonOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2064                    Tcl_Obj *CONST *objv)
     2292                   Tcl_Obj *CONST *objv)
    20652293{
    20662294    graphics::RenderContext::PolygonMode mode;
    20672295    if (GetPolygonMode(interp, objv[2], &mode) != TCL_OK) {
    2068         return TCL_ERROR;
     2296        return TCL_ERROR;
    20692297    }
    20702298    NanoVis::renderContext->setPolygonMode(mode);
     
    20742302static int
    20752303HeightMapShadeOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2076                    Tcl_Obj *CONST *objv)
     2304                   Tcl_Obj *CONST *objv)
    20772305{
    20782306    graphics::RenderContext::ShadingModel model;
    20792307    if (GetShadingModel(interp, objv[2], &model) != TCL_OK) {
    2080         return TCL_ERROR;
     2308        return TCL_ERROR;
    20812309    }
    20822310    NanoVis::renderContext->setShadingModel(model);
     
    20862314static int
    20872315HeightMapTestOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2088         Tcl_Obj *CONST *objv)
     2316        Tcl_Obj *CONST *objv)
    20892317{
    20902318    srand((unsigned)time(NULL));
     
    20972325    float x;
    20982326    for (int i = 0; i < size; ++i) {
    2099         x = - 10 + i%20;
    2100         data[i] = exp(- (x * x)/(2 * sigma * sigma)) /
    2101             (sigma * sqrt(2.0)) / mean * 2 + 1000;
     2327        x = - 10 + i%20;
     2328        data[i] = exp(- (x * x)/(2 * sigma * sigma)) /
     2329            (sigma * sqrt(2.0)) / mean * 2 + 1000;
    21022330    }
    21032331   
     
    21252353static int
    21262354HeightMapTransFuncOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2127                      Tcl_Obj *CONST *objv)
     2355                     Tcl_Obj *CONST *objv)
    21282356{
    21292357    char *name;
     
    21322360    tf = NanoVis::get_transfunc(name);
    21332361    if (tf == NULL) {
    2134         Tcl_AppendResult(interp, "transfer function \"", name,
    2135                         "\" is not defined", (char*)NULL);
    2136         return TCL_ERROR;
     2362        Tcl_AppendResult(interp, "transfer function \"", name,
     2363                        "\" is not defined", (char*)NULL);
     2364        return TCL_ERROR;
    21372365    }
    21382366    vector<unsigned int> indices;
    21392367    if (GetIndices(interp, objc - 3, objv + 3, &indices) != TCL_OK) {
    2140         return TCL_ERROR;
     2368        return TCL_ERROR;
    21412369    }
    21422370    for (unsigned int i = 0; i < indices.size(); ++i) {
    2143         if ((indices[i] < NanoVis::heightMap.size()) &&
    2144             (NanoVis::heightMap[indices[i]] != NULL)) {
    2145             NanoVis::heightMap[indices[i]]->setColorMap(tf);
    2146         }
     2371        if ((indices[i] < NanoVis::heightMap.size()) &&
     2372            (NanoVis::heightMap[indices[i]] != NULL)) {
     2373            NanoVis::heightMap[indices[i]]->setColorMap(tf);
     2374        }
    21472375    }
    21482376    return TCL_OK;
     
    21522380{
    21532381    {"create",       2, HeightMapCreateOp,      9, 9,
    2154         "xmin ymin xmax ymax xnum ynum values",},
     2382        "xmin ymin xmax ymax xnum ynum values",},
    21552383    {"cull",         2, HeightMapCullOp,        3, 3, "mode",},
    21562384    {"data",         1, HeightMapDataOp,        3, 0, "oper ?args?",},
     
    21702398
    21712399    proc = Rappture::GetOpFromObj(interp, nHeightMapOps, heightMapOps,
    2172         Rappture::CMDSPEC_ARG1, objc, objv, 0);
     2400        Rappture::CMDSPEC_ARG1, objc, objv, 0);
    21732401    if (proc == NULL) {
    2174         return TCL_ERROR;
     2402        return TCL_ERROR;
    21752403    }
    21762404    return (*proc) (cdata, interp, objc, objv);
     
    21792407static int
    21802408GridAxisColorOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2181                 Tcl_Obj *CONST *objv)
     2409                Tcl_Obj *CONST *objv)
    21822410{
    21832411    float r, g, b, a;
    21842412    if ((GetFloatFromObj(interp, objv[2], &r) != TCL_OK) ||
    2185         (GetFloatFromObj(interp, objv[3], &g) != TCL_OK) ||
    2186         (GetFloatFromObj(interp, objv[4], &b) != TCL_OK)) {
    2187         return TCL_ERROR;
     2413        (GetFloatFromObj(interp, objv[3], &g) != TCL_OK) ||
     2414        (GetFloatFromObj(interp, objv[4], &b) != TCL_OK)) {
     2415        return TCL_ERROR;
    21882416    }
    21892417    a = 1.0f;
    21902418    if ((objc == 6) && (GetFloatFromObj(interp, objv[5], &a) != TCL_OK)) {
    2191         return TCL_ERROR;
     2419        return TCL_ERROR;
    21922420    }           
    21932421    if (NanoVis::grid) {
    2194         NanoVis::grid->setAxisColor(r, g, b, a);
     2422        NanoVis::grid->setAxisColor(r, g, b, a);
    21952423    }
    21962424    return TCL_OK;
     
    21992427static int
    22002428GridAxisNameOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2201                 Tcl_Obj *CONST *objv)
     2429                Tcl_Obj *CONST *objv)
    22022430{
    22032431    int axisId;
    22042432    if (GetAxisFromObj(interp, objv[2], &axisId) != TCL_OK) {
    2205         return TCL_ERROR;
     2433        return TCL_ERROR;
    22062434    }
    22072435    if (NanoVis::grid) {
    2208         NanoVis::grid->setAxisName(axisId, Tcl_GetString(objv[3]));
     2436        NanoVis::grid->setAxisName(axisId, Tcl_GetString(objv[3]));
    22092437    }
    22102438    return TCL_OK;
     
    22132441static int
    22142442GridLineColorOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2215                 Tcl_Obj *CONST *objv)
     2443                Tcl_Obj *CONST *objv)
    22162444{
    22172445    float r, g, b, a;
    22182446    if ((GetFloatFromObj(interp, objv[2], &r) != TCL_OK) ||
    2219         (GetFloatFromObj(interp, objv[3], &g) != TCL_OK) ||
    2220         (GetFloatFromObj(interp, objv[4], &b) != TCL_OK)) {
    2221         return TCL_ERROR;
     2447        (GetFloatFromObj(interp, objv[3], &g) != TCL_OK) ||
     2448        (GetFloatFromObj(interp, objv[4], &b) != TCL_OK)) {
     2449        return TCL_ERROR;
    22222450    }
    22232451    a = 1.0f;
    22242452    if ((objc == 6) && (GetFloatFromObj(interp, objv[5], &a) != TCL_OK)) {
    2225         return TCL_ERROR;
     2453        return TCL_ERROR;
    22262454    }           
    22272455    if (NanoVis::grid) {
    2228         NanoVis::grid->setGridLineColor(r, g, b, a);
     2456        NanoVis::grid->setGridLineColor(r, g, b, a);
    22292457    }
    22302458    return TCL_OK;
     
    22332461static int
    22342462GridLineCountOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2235                 Tcl_Obj *CONST *objv)
     2463                Tcl_Obj *CONST *objv)
    22362464{
    22372465    int x, y, z;
    22382466   
    22392467    if ((Tcl_GetIntFromObj(interp, objv[2], &x) != TCL_OK) ||
    2240         (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) ||
    2241         (Tcl_GetIntFromObj(interp, objv[4], &z) != TCL_OK)) {
    2242         return TCL_ERROR;
     2468        (Tcl_GetIntFromObj(interp, objv[3], &y) != TCL_OK) ||
     2469        (Tcl_GetIntFromObj(interp, objv[4], &z) != TCL_OK)) {
     2470        return TCL_ERROR;
    22432471    }
    22442472    if (NanoVis::grid) {
    2245         NanoVis::grid->setGridLineCount(x, y, z);
     2473        NanoVis::grid->setGridLineCount(x, y, z);
    22462474    }
    22472475    return TCL_OK;
     
    22502478static int
    22512479GridMinMaxOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2252              Tcl_Obj *CONST *objv)
     2480             Tcl_Obj *CONST *objv)
    22532481{
    22542482    double x1, y1, z1, x2, y2, z2;
    22552483    if ((Tcl_GetDoubleFromObj(interp, objv[2], &x1) != TCL_OK) ||
    2256         (Tcl_GetDoubleFromObj(interp, objv[3], &y1) != TCL_OK) ||
    2257         (Tcl_GetDoubleFromObj(interp, objv[4], &z1) != TCL_OK) ||
    2258         (Tcl_GetDoubleFromObj(interp, objv[5], &x2) != TCL_OK) ||
    2259         (Tcl_GetDoubleFromObj(interp, objv[6], &y2) != TCL_OK) ||
    2260         (Tcl_GetDoubleFromObj(interp, objv[7], &z2) != TCL_OK)) {
    2261         return TCL_ERROR;
     2484        (Tcl_GetDoubleFromObj(interp, objv[3], &y1) != TCL_OK) ||
     2485        (Tcl_GetDoubleFromObj(interp, objv[4], &z1) != TCL_OK) ||
     2486        (Tcl_GetDoubleFromObj(interp, objv[5], &x2) != TCL_OK) ||
     2487        (Tcl_GetDoubleFromObj(interp, objv[6], &y2) != TCL_OK) ||
     2488        (Tcl_GetDoubleFromObj(interp, objv[7], &z2) != TCL_OK)) {
     2489        return TCL_ERROR;
    22622490    }
    22632491    if (NanoVis::grid) {
    2264         NanoVis::grid->setMinMax(Vector3(x1, y1, z1), Vector3(x2, y2, z2));
     2492        NanoVis::grid->setMinMax(Vector3(x1, y1, z1), Vector3(x2, y2, z2));
    22652493    }
    22662494    return TCL_OK;
     
    22692497static int
    22702498GridVisibleOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2271              Tcl_Obj *CONST *objv)
     2499             Tcl_Obj *CONST *objv)
    22722500{
    22732501    int ivisible;
    22742502   
    22752503    if (Tcl_GetBooleanFromObj(interp, objv[2], &ivisible) != TCL_OK) {
    2276         return TCL_ERROR;
     2504        return TCL_ERROR;
    22772505    }
    22782506    NanoVis::grid->setVisible((bool)ivisible);
     
    22822510static Rappture::CmdSpec gridOps[] =
    22832511{
    2284     {"axiscolor",  5, GridAxisColorOp,  5, 6, "r g b ?a?",},
    2285     {"axisname",   5, GridAxisNameOp,   5, 5, "index width height",},
    2286     {"linecolor",  7, GridLineColorOp,  5, 6, "r g b ?a?",},
    2287     {"linecount",  7, GridLineCountOp,  5, 5, "xCount yCount zCount",},
    2288     {"minmax",     1, GridMinMaxOp,     8, 8, "xMin yMin zMin xMax yMax zMax",},
    2289     {"visible",    1, GridVisibleOp,    3, 3, "bool",},
     2512    {"axiscolor",  5, GridAxisColorOp,  5, 6, "r g b ?a?",},
     2513    {"axisname",   5, GridAxisNameOp,   5, 5, "index width height",},
     2514    {"linecolor",  7, GridLineColorOp,  5, 6, "r g b ?a?",},
     2515    {"linecount",  7, GridLineCountOp,  5, 5, "xCount yCount zCount",},
     2516    {"minmax",     1, GridMinMaxOp,     8, 8, "xMin yMin zMin xMax yMax zMax",},
     2517    {"visible",    1, GridVisibleOp,    3, 3, "bool",},
    22902518};
    22912519static int nGridOps = NumCmdSpecs(gridOps);
     
    22972525
    22982526    proc = Rappture::GetOpFromObj(interp, nGridOps, gridOps,
    2299         Rappture::CMDSPEC_ARG1, objc, objv, 0);
     2527        Rappture::CMDSPEC_ARG1, objc, objv, 0);
    23002528    if (proc == NULL) {
    2301         return TCL_ERROR;
     2529        return TCL_ERROR;
    23022530    }
    23032531    return (*proc) (cdata, interp, objc, objv);
     
    23092537    if (objc < 2) {
    23102538        Tcl_AppendResult(interp, "wrong # args: should be \"",
    2311                 Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
     2539                Tcl_GetString(objv[0]), " option arg arg...\"", (char*)NULL);
    23122540        return TCL_ERROR;
    23132541    }
     
    23382566    if (objc != 4) {
    23392567        Tcl_AppendResult(interp, "wrong # args: should be \"",
    2340                 Tcl_GetString(objv[0]), " plane_index w h \"", (char*)NULL);
     2568                Tcl_GetString(objv[0]), " plane_index w h \"", (char*)NULL);
    23412569        return TCL_ERROR;
    23422570    }
     
    23792607    if (objc != 3) {
    23802608        Tcl_AppendResult(interp, "wrong # args: should be \"",
    2381                 Tcl_GetString(objv[0]), " plane_index tf_index \"", (char*)NULL);
     2609                Tcl_GetString(objv[0]), " plane_index tf_index \"", (char*)NULL);
    23822610        return TCL_ERROR;
    23832611    }
     
    23962624static int
    23972625PlaneEnableOp(ClientData cdata, Tcl_Interp *interp, int objc,
    2398                Tcl_Obj *CONST *objv)
     2626               Tcl_Obj *CONST *objv)
    23992627{
    24002628    fprintf(stderr,"enable a plane so the 2D renderer can render it command\n");
     
    24022630    if (objc != 3) {
    24032631        Tcl_AppendResult(interp, "wrong # args: should be \"",
    2404                 Tcl_GetString(objv[0]), " plane_index mode \"", (char*)NULL);
     2632                Tcl_GetString(objv[0]), " plane_index mode \"", (char*)NULL);
    24052633        return TCL_ERROR;
    24062634    }
     
    24222650static Rappture::CmdSpec planeOps[] =
    24232651{
    2424     {"enable",     1, PlaneEnableOp,    4, 4, "planeIdx mode",},
    2425     {"link",       1, PlaneLinkOp,      4, 4, "planeIdx transfuncIdx",},
    2426     {"new",        1, PlaneNewOp,       5, 5, "planeIdx width height",},
     2652    {"enable",     1, PlaneEnableOp,    4, 4, "planeIdx mode",},
     2653    {"link",       1, PlaneLinkOp,      4, 4, "planeIdx transfuncIdx",},
     2654    {"new",        1, PlaneNewOp,       5, 5, "planeIdx width height",},
    24272655};
    24282656static int nPlaneOps = NumCmdSpecs(planeOps);
     
    24342662
    24352663    proc = Rappture::GetOpFromObj(interp, nPlaneOps, planeOps,
    2436         Rappture::CMDSPEC_ARG1, objc, objv, 0);
     2664        Rappture::CMDSPEC_ARG1, objc, objv, 0);
    24372665    if (proc == NULL) {
    2438         return TCL_ERROR;
     2666        return TCL_ERROR;
    24392667    }
    24402668    return (*proc) (cdata, interp, objc, objv);
    24412669}
    24422670
    2443 #endif  /*PLANE_CMD*/
     2671#endif  /*PLANE_CMD*/
    24442672
    24452673/*
     
    24722700    int i;
    24732701    for (i = 1; i < objc; i += 2) {
    2474         char *string;
    2475 
    2476         string = Tcl_GetString(objv[i]);
     2702        char *string;
     2703
     2704        string = Tcl_GetString(objv[i]);
    24772705        if (strcmp(string, "xmin") == 0) {
    24782706            if (GetFloatFromObj(interp, objv[i+1], &xMin) != TCL_OK) {
     
    25102738            }
    25112739        } else if (strcmp(string, "zvalues") == 0) {
    2512             Tcl_Obj **zObj;
     2740            Tcl_Obj **zObj;
    25132741
    25142742            if (Tcl_ListObjGetElements(interp, objv[i+1], &zNum, &zObj)!= TCL_OK) {
     
    25652793    Tcl_DStringInit(&cmdbuffer);
    25662794
    2567     Tcl_CreateObjCommand(interp, "axis",        AxisCmd,        NULL, NULL);
    2568     Tcl_CreateObjCommand(interp, "camera",      CameraCmd,      NULL, NULL);
    2569     Tcl_CreateObjCommand(interp, "cutplane",    CutplaneCmd,    NULL, NULL);
    2570     Tcl_CreateObjCommand(interp, "flow",        FlowCmd,        NULL, NULL);
    2571     Tcl_CreateObjCommand(interp, "grid",        GridCmd,        NULL, NULL);
    2572     Tcl_CreateObjCommand(interp, "heightmap",   HeightMapCmd,   NULL, NULL);
    2573     Tcl_CreateObjCommand(interp, "legend",      LegendCmd,      NULL, NULL);
    2574     Tcl_CreateObjCommand(interp, "screen",      ScreenCmd,      NULL, NULL);
    2575     Tcl_CreateObjCommand(interp, "screenshot",  ScreenShotCmd,  NULL, NULL);
    2576     Tcl_CreateObjCommand(interp, "transfunc",   TransfuncCmd,   NULL, NULL);
    2577     Tcl_CreateObjCommand(interp, "unirect2d",   UniRect2dCmd,   NULL, NULL);
    2578     Tcl_CreateObjCommand(interp, "up",          UpCmd,          NULL, NULL);
    2579     Tcl_CreateObjCommand(interp, "volume",      VolumeCmd,      NULL, NULL);
     2795    Tcl_CreateObjCommand(interp, "axis",        AxisCmd,        NULL, NULL);
     2796    Tcl_CreateObjCommand(interp, "camera",      CameraCmd,      NULL, NULL);
     2797    Tcl_CreateObjCommand(interp, "cutplane",    CutplaneCmd,    NULL, NULL);
     2798    Tcl_CreateObjCommand(interp, "flow",        FlowCmd,        NULL, NULL);
     2799    Tcl_CreateObjCommand(interp, "grid",        GridCmd,        NULL, NULL);
     2800    Tcl_CreateObjCommand(interp, "heightmap",   HeightMapCmd,   NULL, NULL);
     2801    Tcl_CreateObjCommand(interp, "legend",      LegendCmd,      NULL, NULL);
     2802    Tcl_CreateObjCommand(interp, "screen",      ScreenCmd,      NULL, NULL);
     2803    Tcl_CreateObjCommand(interp, "screenshot",  ScreenShotCmd,  NULL, NULL);
     2804    Tcl_CreateObjCommand(interp, "transfunc",   TransfuncCmd,   NULL, NULL);
     2805    Tcl_CreateObjCommand(interp, "unirect2d",   UniRect2dCmd,   NULL, NULL);
     2806    Tcl_CreateObjCommand(interp, "up",          UpCmd,          NULL, NULL);
     2807    Tcl_CreateObjCommand(interp, "volume",      VolumeCmd,      NULL, NULL);
    25802808#if __TEST_CODE__
    25812809    Tcl_CreateObjCommand(interp, "test", TestCmd, NULL, NULL);
  • trunk/vizservers/nanovis/VolumeRenderer.cpp

    r900 r923  
    119119void VolumeRenderer::render_all_points()
    120120{
    121 /*
     121#ifdef notdef
    122122    double x0 = 0;
    123123    double y0 = 0;
    124124    double z0 = 0;
    125 
    126   for(int i=0; i<n_volumes; i++){
    127     int volume_index = i;
    128     if(!volume[i]->is_enabled())
    129       continue; //skip this volume
    130 
    131     Vector3* location = volume[volume_index]->get_location();
    132     Vector4 shift_4d(location->x, location->y, location->z, 0);
    133 
    134     glPushMatrix();
    135     glTranslatef(shift_4d.x, shift_4d.y, shift_4d.z);
    136 
    137     if (volume[volume_index]->outline_is_enabled()) {
    138         float olcolor[3];
    139         volume[volume_index]->get_outline_color(olcolor);
    140         draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1,
    141             (double)olcolor[0], (double)olcolor[1], (double)olcolor[2],
    142             1.5);
    143     }
    144 
    145     glPopMatrix();
    146   }
    147 */
     125   
     126    for(int i=0; i<n_volumes; i++){
     127        int volume_index = i;
     128        if(!volume[i]->is_enabled())
     129            continue; //skip this volume
     130       
     131        Vector3* location = volume[volume_index]->get_location();
     132        Vector4 shift_4d(location->x, location->y, location->z, 0);
     133       
     134        glPushMatrix();
     135        glTranslatef(shift_4d.x, shift_4d.y, shift_4d.z);
     136       
     137        if (volume[volume_index]->outline_is_enabled()) {
     138            float olcolor[3];
     139            volume[volume_index]->get_outline_color(olcolor);
     140            draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1,
     141                (double)olcolor[0], (double)olcolor[1], (double)olcolor[2], 1.5);
     142        }
     143       
     144        glPopMatrix();
     145    }
     146#endif
    148147}
    149148
     
    534533
    535534  //draw volume bounding box
    536   draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1, 0.8, 0.1, 0.1, 1.5);
     535  if (volume[volume_index]->outline_is_enabled()) {
     536      draw_bounding_box(x0, y0, z0, x0+1, y0+1, z0+1, 0.8, 0.1, 0.1, 1.5);
     537  }
    537538  glPopMatrix();
    538539
  • trunk/vizservers/nanovis/nanovis.cpp

    r915 r923  
    10281028}
    10291029
     1030#ifdef notdef
    10301031/*
    10311032 * Is this routine being used? --gah
     
    10801081    glEnable(GL_TEXTURE_2D);
    10811082}
     1083#endif
    10821084
    10831085
Note: See TracChangeset for help on using the changeset viewer.