Changeset 1295 for trunk/packages/vizservers
- Timestamp:
- Mar 6, 2009, 9:27:24 PM (16 years ago)
- Location:
- trunk/packages/vizservers/nanovis
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/nanovis/Command.cpp
r1291 r1295 1848 1848 } 1849 1849 NanoVis::initParticle(); 1850 1851 // send the movie back to the client 1852 // FIXME: find a way to get the data from the movie object as a char* 1853 Rappture::Buffer data; 1854 data.load(fileName); 1855 char command[512]; 1856 sprintf(command,"nv>file -bytes %lu\n",data.size()); 1857 NanoVis::sendDataToClient(command,data.bytes(),data.size()); 1858 1850 1859 return TCL_OK; 1851 1860 } … … 1936 1945 1937 1946 static int 1947 FlowPlayOp(ClientData cdata, Tcl_Interp *interp, int objc, 1948 Tcl_Obj *const *objv) 1949 { 1950 if (NanoVis::licRenderer && 1951 !NanoVis::licRenderer->isActivated()) { 1952 NanoVis::licRenderer->activate(); 1953 } 1954 if (NanoVis::particleRenderer && 1955 !NanoVis::particleRenderer->isActivated()) { 1956 NanoVis::particleRenderer->activate(); 1957 } 1958 1959 Trace("sending flow playback frame\n"); 1960 1961 // Generate the latest frame and send it back to the client 1962 if (NanoVis::licRenderer && 1963 NanoVis::licRenderer->isActivated()) { 1964 NanoVis::licRenderer->convolve(); 1965 } 1966 if (NanoVis::particleRenderer && 1967 NanoVis::particleRenderer->isActivated()) { 1968 NanoVis::particleRenderer->advect(); 1969 } 1970 NanoVis::offscreen_buffer_capture(); //enable offscreen render 1971 NanoVis::display(); 1972 1973 NanoVis::read_screen(); 1974 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0); 1975 1976 // NanoVis::bmp_write_to_file(frame_count, fileName); 1977 1978 Trace("FLOW end\n"); 1979 return TCL_OK; 1980 } 1981 1982 static int 1938 1983 FlowResetOp(ClientData cdata, Tcl_Interp *interp, int objc, 1939 1984 Tcl_Obj *const *objv) … … 1973 2018 {"data", 1, FlowDataOp, 3, 0, "oper ?args?",}, 1974 2019 {"lic", 1, FlowLicOp, 3, 3, "on|off",}, 1975 {"particle", 1, FlowParticleOp, 3, 0, "oper ?args?",}, 2020 {"particle", 2, FlowParticleOp, 3, 0, "oper ?args?",}, 2021 {"play", 2, FlowPlayOp, 2, 2, "",}, 1976 2022 {"reset", 1, FlowResetOp, 2, 2, "",}, 1977 2023 {"vectorid", 1, FlowVectorIdOp, 3, 3, "index",}, … … 1983 2029 * CLIENT COMMAND: 1984 2030 * flow data follows <value> 1985 * flow capture 2031 * flow capture frames filename 1986 2032 * flow lic on|off 1987 2033 * flow particle visible on|off 1988 2034 * flow particle slice <volumeId> 1989 2035 * flow particle slicepos <value> 2036 * flow play 1990 2037 * flow reset 1991 2038 * flow vectorid <volumeId> -
trunk/packages/vizservers/nanovis/nanovis.cpp
r1282 r1295 1243 1243 stats.nFrames++; 1244 1244 stats.nBytes += (bytesPerRow * win_height); 1245 } 1246 1247 void 1248 NanoVis::sendDataToClient(const char *command, const char *data, size_t dlen) 1249 { 1250 /* 1251 char header[200]; 1252 1253 // Generate the PPM binary file header 1254 sprintf(header, "P6 %d %d %d\n", win_width, win_height, PPM_MAXVAL); 1255 1256 size_t header_length = strlen(header); 1257 size_t data_length = win_width * win_height * 3; 1258 1259 char command[200]; 1260 sprintf(command, "%s %lu\n", prefix, 1261 (unsigned long)header_length + data_length); 1262 */ 1263 1264 // size_t wordsPerRow = (win_width * 24 + 31) / 32; 1265 // size_t bytesPerRow = wordsPerRow * 4; 1266 // size_t rowLength = win_width * 3; 1267 size_t nRecs = 2; 1268 1269 struct iovec *iov; 1270 iov = (struct iovec *)malloc(sizeof(struct iovec) * nRecs); 1271 1272 // Write the nanovisviewer command, then the image header and data. 1273 // Command 1274 // FIXME: shouldn't have to cast this 1275 iov[0].iov_base = (char *)command; 1276 iov[0].iov_len = strlen(command); 1277 // Data 1278 // FIXME: shouldn't have to cast this 1279 iov[1].iov_base = (char *)data; 1280 iov[1].iov_len = dlen; 1281 writev(0, iov, nRecs); 1282 free(iov); 1283 // stats.nFrames++; 1284 // stats.nBytes += (bytesPerRow * win_height); 1245 1285 } 1246 1286 -
trunk/packages/vizservers/nanovis/nanovis.h
r1238 r1295 147 147 static TransferFunction* get_transfunc(const char *name); 148 148 static TransferFunction* DefineTransferFunction(const char *name, 149 149 size_t n, float *data); 150 150 static void SetVolumeRanges(void); 151 151 static void SetHeightmapRanges(void); … … 157 157 static void resize_offscreen_buffer(int w, int h); 158 158 static void ppm_write(const char *prefix); 159 static void sendDataToClient(const char *command, const char *data, 160 size_t dlen); 159 161 static void bmp_write(const char *prefix); 160 162 static void bmp_write_to_file(int frame_number, const char* directory_name); … … 164 166 static void display_offscreen_buffer(); 165 167 static int render_legend(TransferFunction *tf, double min, double max, 166 168 int width, int height, const char* volArg); 167 169 static Volume *load_volume(int index, int width, int height, int depth, 168 170 int n, float* data, double vmin, double vmax, double nzero_min); 169 171 static void xinetd_listen(void); 170 172 static int render_2d_contour(HeightMap* heightmap, int width, int height); … … 182 184 183 185 static void read_screen(void) { 184 185 186 glReadPixels(0, 0, win_width, win_height, GL_RGB, GL_UNSIGNED_BYTE, 187 screen_buffer); 186 188 } 187 189 static void offscreen_buffer_capture(void) { 188 190 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, final_fbo); 189 191 } 190 192 };
Note: See TracChangeset
for help on using the changeset viewer.