Changeset 4818
- Timestamp:
- Dec 6, 2014 5:16:37 PM (9 years ago)
- Location:
- nanovis/branches/1.1
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
nanovis/branches/1.1
- Property svn:mergeinfo changed
/trunk/packages/vizservers/nanovis merged: 3883-3884,4098
- Property svn:mergeinfo changed
-
nanovis/branches/1.1/Command.cpp
r4816 r4818 48 48 #include "CmdProc.h" 49 49 #include "FlowCmd.h" 50 #include "Trace.h"51 50 #ifdef USE_POINTSET_RENDERER 52 51 #include "PointSet.h" … … 61 60 #include "Volume.h" 62 61 #include "VolumeRenderer.h" 62 #include "Trace.h" 63 63 64 64 using namespace nv::graphics; … … 266 266 } 267 267 268 269 268 /** 270 269 * Used internally to decode a series of volume index values and … … 672 671 } 673 672 674 /*675 * cutplane state $bool $axis vol,,,676 */677 673 static int 678 674 CutplaneStateOp(ClientData clientData, Tcl_Interp *interp, int objc, … … 707 703 } 708 704 705 static int 706 CutplaneVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 707 Tcl_Obj *const *objv) 708 { 709 bool state; 710 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 711 return TCL_ERROR; 712 } 713 714 std::vector<Volume *> ivol; 715 if (GetVolumes(interp, objc - 3, objv + 3, &ivol) != TCL_OK) { 716 return TCL_ERROR; 717 } 718 std::vector<Volume *>::iterator iter; 719 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 720 (*iter)->cutplanesVisible(state); 721 } 722 return TCL_OK; 723 } 724 709 725 static Rappture::CmdSpec cutplaneOps[] = { 710 726 {"position", 1, CutplanePositionOp, 4, 0, "relval axis ?indices?",}, 711 727 {"state", 1, CutplaneStateOp, 4, 0, "bool axis ?indices?",}, 728 {"visible", 1, CutplaneVisibleOp, 3, 0, "bool ?indices?",}, 712 729 }; 713 730 static int nCutplaneOps = NumCmdSpecs(cutplaneOps); … … 858 875 } 859 876 860 const char *name; 861 name = Tcl_GetString(objv[1]); 862 TransferFunction *tf = NanoVis::getTransferFunction(name); 877 const char *tfName = Tcl_GetString(objv[1]); 878 TransferFunction *tf = NanoVis::getTransferFunction(tfName); 863 879 if (tf == NULL) { 864 Tcl_AppendResult(interp, "unknown transfer function \"", name, "\"",880 Tcl_AppendResult(interp, "unknown transfer function \"", tfName, "\"", 865 881 (char*)NULL); 866 882 return TCL_ERROR; … … 874 890 NanoVis::setVolumeRanges(); 875 891 } 876 NanoVis::renderLegend(tf, Volume::valueMin, Volume::valueMax, w, h, name);892 NanoVis::renderLegend(tf, Volume::valueMin, Volume::valueMax, w, h, tfName); 877 893 return TCL_OK; 878 894 } … … 965 981 966 982 // decode the data and store in a series of fields 967 Rappture::Field1D rFunc, gFunc, bFunc, wFunc;968 int cmapc, wmapc, i;983 Rappture::Field1D rFunc, gFunc, bFunc, aFunc; 984 int cmapc, amapc, i; 969 985 Tcl_Obj **cmapv; 970 Tcl_Obj ** wmapv;971 972 wmapv = cmapv = NULL;986 Tcl_Obj **amapv; 987 988 amapv = cmapv = NULL; 973 989 if (Tcl_ListObjGetElements(interp, objv[3], &cmapc, &cmapv) != TCL_OK) { 974 990 return TCL_ERROR; … … 979 995 return TCL_ERROR; 980 996 } 981 if (Tcl_ListObjGetElements(interp, objv[4], & wmapc, &wmapv) != TCL_OK) {997 if (Tcl_ListObjGetElements(interp, objv[4], &amapc, &amapv) != TCL_OK) { 982 998 return TCL_ERROR; 983 999 } 984 if (( wmapc % 2) != 0) {1000 if ((amapc % 2) != 0) { 985 1001 Tcl_AppendResult(interp, "wrong # elements in alphamap: should be ", 986 1002 " { v w ... }", (char*)NULL); … … 1006 1022 bFunc.define(q[0], q[3]); 1007 1023 } 1008 for (i=0; i < wmapc; i += 2) {1024 for (i=0; i < amapc; i += 2) { 1009 1025 double q[2]; 1010 1026 int j; 1011 1027 1012 1028 for (j=0; j < 2; j++) { 1013 if (Tcl_GetDoubleFromObj(interp, wmapv[i+j], &q[j]) != TCL_OK) {1029 if (Tcl_GetDoubleFromObj(interp, amapv[i+j], &q[j]) != TCL_OK) { 1014 1030 return TCL_ERROR; 1015 1031 } 1016 1032 if ((q[j] < 0.0) || (q[j] > 1.0)) { 1017 1033 Tcl_AppendResult(interp, "bad alphamap value \"", 1018 Tcl_GetString( wmapv[i+j]),1034 Tcl_GetString(amapv[i+j]), 1019 1035 "\": should be in the range 0-1", (char*)NULL); 1020 1036 return TCL_ERROR; 1021 1037 } 1022 1038 } 1023 wFunc.define(q[0], q[1]);1039 aFunc.define(q[0], q[1]); 1024 1040 } 1025 1041 // sample the given function into discrete slots … … 1031 1047 data[4*i+1] = gFunc.value(x); 1032 1048 data[4*i+2] = bFunc.value(x); 1033 data[4*i+3] = wFunc.value(x);1049 data[4*i+3] = aFunc.value(x); 1034 1050 } 1035 1051 // find or create this transfer function … … 1078 1094 return TCL_ERROR; 1079 1095 } 1080 VolumeInterpolator * interpolator;1081 interpolator =NanoVis::volRenderer->getVolumeInterpolator();1096 VolumeInterpolator *interpolator = 1097 NanoVis::volRenderer->getVolumeInterpolator(); 1082 1098 interpolator->start(); 1083 1099 if (interpolator->isStarted()) { 1084 const char * fileName = (objc < 5) ? NULL : Tcl_GetString(objv[4]);1085 for (int frame _num = 0; frame_num < total; ++frame_num) {1100 const char *dirName = (objc < 5) ? NULL : Tcl_GetString(objv[4]); 1101 for (int frameNum = 0; frameNum < total; ++frameNum) { 1086 1102 float fraction; 1087 1103 1088 fraction = ((float)frame _num) / (total - 1);1104 fraction = ((float)frameNum) / (total - 1); 1089 1105 TRACE("fraction : %f", fraction); 1090 //interpolator->update(((float)frame_num) / (total - 1));1091 1106 interpolator->update(fraction); 1092 1107 … … 1101 1116 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, fboOrig); 1102 1117 1103 NanoVis::bmpWriteToFile(frame _num, fileName);1118 NanoVis::bmpWriteToFile(frameNum, dirName); 1104 1119 } 1105 1120 } … … 1242 1257 bytes += 5; 1243 1258 nBytes -= 5; 1259 } else if ((nBytes > 4) && (strncmp(bytes, "<DX>", 4) == 0)) { 1260 bytes += 4; 1261 nBytes -= 4; 1244 1262 } 1245 1263 TRACE("DX loading..."); … … 1302 1320 1303 1321 static Rappture::CmdSpec volumeDataOps[] = { 1304 {"follows", 1, VolumeDataFollowsOp, 5, 5, " sizetag",},1322 {"follows", 1, VolumeDataFollowsOp, 5, 5, "nbytes tag",}, 1305 1323 {"state", 1, VolumeDataStateOp, 4, 0, "bool ?indices?",}, 1306 1324 }; … … 1404 1422 return TCL_OK; 1405 1423 } 1406 1407 1424 1408 1425 static Rappture::CmdSpec volumeOutlineOps[] = { … … 1654 1671 {"delete", 2, VolumeDeleteOp, 3, 0, "?name...?",}, 1655 1672 {"exists", 1, VolumeExistsOp, 3, 3, "name",}, 1656 {"names", 1, VolumeNamesOp, 2, 3, "?pattern?",},1673 {"names", 1, VolumeNamesOp, 2, 2, "",}, 1657 1674 {"outline", 1, VolumeOutlineOp, 3, 0, "oper ?args?",}, 1658 1675 {"shading", 2, VolumeShadingOp, 3, 0, "oper ?args?",}, … … 1661 1678 static int nVolumeOps = NumCmdSpecs(volumeOps); 1662 1679 1663 /*1664 * ----------------------------------------------------------------------1665 * CLIENT COMMAND:1666 * volume data state on|off ?<volumeId> ...?1667 * volume outline state on|off ?<volumeId> ...?1668 * volume outline color on|off ?<volumeId> ...?1669 * volume shading transfunc <name> ?<volumeId> ...?1670 * volume shading diffuse <value> ?<volumeId> ...?1671 * volume shading specular <value> ?<volumeId> ...?1672 * volume shading opacity <value> ?<volumeId> ...?1673 * volume state on|off ?<volumeId> ...?1674 *1675 * Clients send these commands to manipulate the volumes.1676 * ----------------------------------------------------------------------1677 */1678 1680 static int 1679 1681 VolumeCmd(ClientData clientData, Tcl_Interp *interp, int objc, … … 1759 1761 1760 1762 static Rappture::CmdSpec heightMapDataOps[] = { 1761 {"follows", 1, HeightMapDataFollowsOp, 5, 5, "size tag",},1762 {"visible", 1, HeightMapDataVisibleOp, 4, 0, "bool ? indices?",},1763 {"follows", 1, HeightMapDataFollowsOp, 5, 5, "size heightmapName",}, 1764 {"visible", 1, HeightMapDataVisibleOp, 4, 0, "bool ?heightmapNames...?",}, 1763 1765 }; 1764 1766 static int nHeightMapDataOps = NumCmdSpecs(heightMapDataOps); … … 1778 1780 } 1779 1781 1780 1781 1782 static int 1782 1783 HeightMapLineContourColorOp(ClientData clientData, Tcl_Interp *interp, int objc, … … 1820 1821 1821 1822 static Rappture::CmdSpec heightMapLineContourOps[] = { 1822 {"color", 1, HeightMapLineContourColorOp, 4, 4, "length",},1823 {"visible", 1, HeightMapLineContourVisibleOp, 4, 0, "bool ? indices?",},1823 {"color", 1, HeightMapLineContourColorOp, 6, 0, "r g b ?heightmapNames...?",}, 1824 {"visible", 1, HeightMapLineContourVisibleOp, 4, 0, "bool ?heightmapNames...?",}, 1824 1825 }; 1825 1826 static int nHeightMapLineContourOps = NumCmdSpecs(heightMapLineContourOps); … … 1954 1955 } 1955 1956 1956 1957 1957 static int 1958 1958 HeightMapOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, … … 1976 1976 1977 1977 static Rappture::CmdSpec heightMapOps[] = { 1978 {"create", 2, HeightMapCreateOp, 10, 10, " tagxmin ymin xmax ymax xnum ynum values",},1978 {"create", 2, HeightMapCreateOp, 10, 10, "heightmapName xmin ymin xmax ymax xnum ynum values",}, 1979 1979 {"cull", 2, HeightMapCullOp, 3, 3, "mode",}, 1980 1980 {"data", 1, HeightMapDataOp, 3, 0, "oper ?args?",}, 1981 {"legend", 2, HeightMapLegendOp, 5, 5, " indexwidth height",},1981 {"legend", 2, HeightMapLegendOp, 5, 5, "heightmapName width height",}, 1982 1982 {"linecontour", 2, HeightMapLineContourOp, 2, 0, "oper ?args?",}, 1983 {"opacity", 1, HeightMapOpacityOp, 3, 0, "value ?heightmap ...? ",},1983 {"opacity", 1, HeightMapOpacityOp, 3, 0, "value ?heightmapNames...? ",}, 1984 1984 {"polygon", 1, HeightMapPolygonOp, 3, 3, "mode",}, 1985 1985 {"shading", 1, HeightMapShadingOp, 3, 3, "model",}, 1986 {"transfunc", 2, HeightMapTransFuncOp, 3, 0, "name ?heightmap ...?",},1986 {"transfunc", 2, HeightMapTransFuncOp, 3, 0, "name ?heightmapNames...?",}, 1987 1987 }; 1988 1988 static int nHeightMapOps = NumCmdSpecs(heightMapOps); -
nanovis/branches/1.1/Volume.cpp
r4612 r4818 48 48 _numComponents(n), 49 49 _nonZeroMin(nonZeroMin), 50 _cutplanesVisible(true), 50 51 _tex(NULL), 51 52 _location(x, y, z), -
nanovis/branches/1.1/Volume.h
r4612 r4818 167 167 void disableCutplane(int index); 168 168 169 void cutplanesVisible(bool state) 170 { 171 _cutplanesVisible = state; 172 } 173 174 bool cutplanesVisible() const 175 { 176 return _cutplanesVisible; 177 } 178 169 179 void moveCutplane(int index, float location); 170 180 … … 389 399 double _nonZeroMin; 390 400 401 bool _cutplanesVisible; 391 402 std::vector<CutPlane> _plane; ///< cut planes 392 403 -
nanovis/branches/1.1/VolumeRenderer.cpp
r4612 r4818 245 245 246 246 for (int j = 0; j < volume->getCutplaneCount(); j++) { 247 if (!volume-> isCutplaneEnabled(j)) {247 if (!volume->cutplanesVisible() || !volume->isCutplaneEnabled(j)) { 248 248 continue; 249 249 } -
nanovis/branches/1.1/protocol-nanovis.txt
r3568 r4818 6 6 Protocol for nanovis render server. 7 7 8 Commands take the general form of command and arguments using Tcl syntax and are 8 Commands take the general form of command and arguments using Tcl syntax and are 9 9 terminated by a newline. Some command arguments expect a Tcl list which can be 10 10 sent by enclosing the list in curly braces to prevent the interpreter from … … 38 38 Requests: 39 39 ================================================================================ 40 axis visible <false|true> 41 42 grid axiscolor <red> <green> <blue> <?alpha?> 43 grid axisname <x|y|z> <name> 44 grid linecolor <red> <green> <blue> <?alpha?> 45 grid visible <false|true> 40 axis visible <bool> 46 41 47 42 camera angle <xAngle> <yAngle> <zAngle> … … 53 48 camera zoom <factor> 54 49 55 screen bgcolor <r> <g> <b> 56 Set screen background color 57 screen size <width> <height> 58 Set size of rendered images 59 60 snapshot 61 Render a 2k x 2k image (offscreen buffer) 62 63 transfunc define <name> {colors} {alpha} 64 colors => 1 line each of "value r g b" 65 alpha => 1 line each of "value alpha" 66 value => [0,1] 67 68 legend <transferfunc name> <width> <height> 69 Request render of transfer function 70 71 heightmap data visible <true|false> <volume IDs> 72 heightmap data follows <nbytes> <data> 73 heightmap linecontour visible <true|false> <volume IDs> 74 heightmap linecontour color <red> <green> <blue> <volume IDs> 75 heightmap tranfunc <transfer function name> <volume IDs> 76 heightmap cull <no/back/front> 77 heightmap polygon <wireframe/fill> 50 clientinfo <list> 51 52 cutplane position <relval> <x|y|z> <?names?> 53 Set the position of a volume cutplane. Names is 54 an optional list of volume names. 55 relval = [0,1] 56 cutplane state <bool> <x|y|z> <?names?> 57 Set the axis (normal) of a volume cutplane. Names is 58 an optional list of volume names. 59 cutplane visible <bool> <?names?> 60 Set visibility of all (x,y, and z) cutplanes for 61 named volume(s) 78 62 79 63 flow add <name> <?option value...?> … … 84 68 flow delete <names> 85 69 flow exists <name> 70 This doesn't currently produce a response, it only returns a boolean 71 within the server's interpreter 86 72 flow goto <nSteps> 87 73 flow names 74 This doesn't currently produce a response, it only returns a Tcl list 75 within the server's interpreter 88 76 flow next 89 77 flow reset … … 106 94 <flowObj> box delete <names> 107 95 <flowObj> box names 96 This doesn't currently produce a response, it only returns a Tcl list 97 within the server's interpreter 108 98 109 99 <flowObj> configure <?option value...?> … … 113 103 -diffuse <val> 114 104 -hide <bool> 105 -light2side <bool> 115 106 -opacity <val> 116 107 -outline <bool> 117 -position <val| %val>118 val = [0,1 00], or %val = [0,1]108 -position <val|val%> 109 val = [0,1], or val% = [0,100] 119 110 -slice <bool> 120 111 -specularExp <val> … … 134 125 -color <{r g b a}> 135 126 -hide <bool> 136 -position <val| %val>137 val = [0,1 00], or %val = [0,1]127 -position <val|val%> 128 val = [0,1], or val% = [0,100] 138 129 -size <val> 139 130 <flowObj> particles delete <names> 140 131 <flowObj> particles names 141 142 volume data state <on|off> <?names?> 143 volume data follows <size> <tag> 144 volume delete <?names?> 132 This doesn't currently produce a response, it only returns a Tcl list 133 within the server's interpreter 134 135 grid axiscolor <red> <green> <blue> <?alpha?> 136 grid axisname <x|y|z> <name> <units> 137 grid linecolor <red> <green> <blue> <?alpha?> 138 grid visible <bool> 139 140 heightmap create <heightmapName> <xMin> <yMin> <xMax> <yMax> <xNum> <yNum> <valueList> 141 heightmap cull <none|back|front> 142 heightmap data follows <nBytes> <heightmapName> 143 After newline following command, nBytes of data are sent 144 heightmap data visible <bool> <?heightmapNames?> 145 heightmap legend <heightmapName> <width> <height> 146 heightmap linecontour color <red> <green> <blue> <?heightmapNames?> 147 heightmap linecontour visible <bool> <?heightmapNames?> 148 heightmap opacity <value> <?heightmapNames?> 149 heightmap polygon <wireframe|fill> 150 **Warning: This is a global setting** 151 heightmap shading <flat|smooth> 152 **Warning: This is a global setting** 153 heightmap transfunc <transferFunctionName> <?heightmapNames?> 154 155 legend <transferfunc name> <width> <height> 156 Request render of transfer function 157 158 screen bgcolor <r> <g> <b> 159 Set screen background color 160 screen size <width> <height> 161 Set size of rendered images 162 163 snapshot 164 Render a 2k x 2k image (offscreen buffer). Response image data is 165 tagged as '-type print' 166 167 transfunc define <name> {colors} {alpha} 168 colors => 1 line each of "value r g b" 169 alpha => 1 line each of "value alpha" 170 value => [0,1] 171 172 up <x|y|z|-x|-y|-z> 173 Set orientation of volumes 174 175 volume animation capture <numframes> <?filename?> 176 This is not fully implemented. Rendered frames are not returned 177 to the client. 178 volume animation clear 179 volume animation start 180 volume animation stop 181 volume animation volumes <?names?> 182 183 volume data follows <nbytes> <name> 184 volume data state <bool> <?names?> 185 volume delete <names> 145 186 volume exists <name> 146 volume names <?pattern?> 187 This doesn't currently produce a response, it only returns a boolean 188 within the server's interpreter 189 volume names 190 This doesn't currently produce a response, it only returns a Tcl list 191 within the server's interpreter 147 192 volume outline color <r> <g> <b> <?names?> 148 volume outline state|visible <bool> <?names?> 193 volume outline state <bool> <?names?> 194 volume outline visible <bool> <?names?> 149 195 volume shading ambient <value> <?names?> 150 196 volume shading diffuse <value> <?names?> 151 197 volume shading isosurface <bool> <?names?> 198 volume shading light2side <bool> <?names?> 152 199 volume shading opacity <value> <?names?> 153 200 volume shading specularExp <value> <?names?> … … 156 203 volume state <bool> <?names?> 157 204 158 volume animation volumes <volume IDs>159 volume animation start160 volume animation stop161 volume animation clear162 volume animation capture numframes <filename>163 164 cutplane position <relval> <x|y|z> <?names?>165 Set the position of a volume cutplane. Names is166 an optional list of volume names.167 relval = [0,1]168 cutplane state <bool> <x|y|z> <?names?>169 Set the axis (normal) of a volume cutplane. Names is170 an optional list of volume names.171 172 up <x|y|z|-x|-y|-z>173 Set orientation of volumes174 175 205 ================================================================================ 176 206 Replies: … … 192 222 min,max over all volumes 193 223 224 nv>data tag <flow-tag> min <val> max <val> 225 Sent after a "<flowObj> data follows...". Min,max values are for the 226 magnitude of the vector field. 227 194 228 ================================================================================ 195 229 Error Replies:
Note: See TracChangeset
for help on using the changeset viewer.