Changeset 3958
- Timestamp:
- Sep 24, 2013, 4:41:59 PM (11 years ago)
- Location:
- branches/blt4/packages
- Files:
-
- 6 added
- 59 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/blt4/packages/Makefile.in
r1018 r3958 15 15 VPATH = $(srcdir) 16 16 17 .PHONY: optimizer17 .PHONY: all install clean distclean optimizer 18 18 19 19 all: -
branches/blt4/packages/optimizer/examples/app-qdot.tcl
r1166 r3958 10 10 # AUTHOR: Ganesh Hegde, Purdue University 11 11 # Adapted from: simple.tcl 12 # Copyright (c) 200 8 Purdue Research Foundation12 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 13 13 # 14 14 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/examples/rosenbrock.tcl
r899 r3958 11 11 # ====================================================================== 12 12 # AUTHOR: Michael McLennan, Purdue University 13 # Copyright (c) 2004-20 07 Purdue Research Foundation13 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 14 14 # 15 15 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/examples/simple.tcl
r1201 r3958 11 11 # ====================================================================== 12 12 # AUTHOR: Michael McLennan, Purdue University 13 # Copyright (c) 200 8 Purdue Research Foundation13 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 14 14 # 15 15 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/examples/simplesingle.tcl
r1201 r3958 11 11 # ====================================================================== 12 12 # AUTHOR: Michael McLennan, Purdue University 13 # Copyright (c) 200 8 Purdue Research Foundation13 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 14 14 # 15 15 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/examples/visualize.tcl
r899 r3958 10 10 # ====================================================================== 11 11 # AUTHOR: Michael McLennan, Purdue University 12 # Copyright (c) 200 8 Purdue Research Foundation12 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 13 13 # 14 14 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/pgapack/Makefile.in
r1052 r3958 12 12 PGAPACK = @PGAPACK@ 13 13 14 .PHONY: pgapack14 .PHONY: all install test clean distclean pgapack 15 15 16 16 all: pgapack -
branches/blt4/packages/optimizer/src/plugin_pgapack.c
r1271 r3958 8 8 * ====================================================================== 9 9 * AUTHOR: Michael McLennan, Purdue University 10 * Copyright (c) 200 8 Purdue Research Foundation10 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 11 11 * 12 12 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/rp_optimizer.c
r1166 r3958 9 9 * ====================================================================== 10 10 * AUTHOR: Michael McLennan, Purdue University 11 * Copyright (c) 200 8 Purdue Research Foundation11 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 12 12 * 13 13 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/rp_optimizer.h
r1166 r3958 9 9 * ====================================================================== 10 10 * AUTHOR: Michael McLennan, Purdue University 11 * Copyright (c) 200 8 Purdue Research Foundation11 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 12 12 * 13 13 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/rp_optimizer_tcl.c
r1166 r3958 8 8 * ====================================================================== 9 9 * AUTHOR: Michael McLennan, Purdue University 10 * Copyright (c) 200 8 Purdue Research Foundation10 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 11 11 * 12 12 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/rp_tcloptions.c
r898 r3958 10 10 * ====================================================================== 11 11 * AUTHOR: Michael McLennan, Purdue University 12 * Copyright (c) 200 8 Purdue Research Foundation12 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 13 13 * 14 14 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/rp_tcloptions.h
r898 r3958 10 10 * ====================================================================== 11 11 * AUTHOR: Michael McLennan, Purdue University 12 * Copyright (c) 200 8 Purdue Research Foundation12 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 13 13 * 14 14 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/tclconfig/mkindex.tcl
r897 r3958 7 7 # ====================================================================== 8 8 # AUTHOR: Michael McLennan, Purdue University 9 # Copyright (c) 2004-20 05 Purdue Research Foundation9 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 10 10 # 11 11 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/tclconfig/patchlevel.tcl
r897 r3958 6 6 # ====================================================================== 7 7 # AUTHOR: Michael McLennan, Purdue University 8 # Copyright (c) 2004-20 05 Purdue Research Foundation8 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 9 9 # 10 10 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/src/test.c
r809 r3958 8 8 * ====================================================================== 9 9 * AUTHOR: Michael McLennan, Purdue University 10 * Copyright (c) 2004-20 07 Purdue Research Foundation10 * Copyright (c) 2004-2012 HUBzero Foundation, LLC 11 11 * 12 12 * See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/tests/aaa.test
r903 r3958 7 7 # ====================================================================== 8 8 # AUTHOR: Michael McLennan, Purdue University 9 # Copyright (c) 200 8 Purdue Research Foundation9 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 10 10 # 11 11 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/tests/all.tcl
r897 r3958 7 7 # ====================================================================== 8 8 # AUTHOR: Michael McLennan, Purdue University 9 # Copyright (c) 200 8 Purdue Research Foundation9 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 10 10 # 11 11 # See the file "license.terms" for information on usage and -
branches/blt4/packages/optimizer/tests/pgapack.test
r898 r3958 8 8 # ====================================================================== 9 9 # AUTHOR: Michael McLennan, Purdue University 10 # Copyright (c) 200 8 Purdue Research Foundation10 # Copyright (c) 2004-2012 HUBzero Foundation, LLC 11 11 # 12 12 # See the file "license.terms" for information on usage and -
branches/blt4/packages/vizservers/nanovis/BMPWriter.cpp
r3892 r3958 9 9 */ 10 10 11 #ifndef USE_THREADS 12 #include <unistd.h> 13 #endif 11 14 #include <cstdlib> 12 15 #include <cstring> -
branches/blt4/packages/vizservers/nanovis/Camera.cpp
r3892 r3958 286 286 } 287 287 288 TRACE("near: %g far: %g", _near, _far); 289 288 290 // Extend the bounds a bit 289 291 _near = 0.99 * _near - (_far - _near) * 0.5; 290 292 _far = 1.01 * _far + (_far - _near) * 0.5; 293 294 TRACE("after extend: near: %g far: %g", _near, _far); 291 295 292 296 // Ensure near is closer than far -
branches/blt4/packages/vizservers/nanovis/Camera.h
r3892 r3958 55 55 } 56 56 57 floatgetDistance() const57 double getDistance() const 58 58 { 59 59 return vrmath::Vector3f(_focalPoint - _position).length(); -
branches/blt4/packages/vizservers/nanovis/Command.cpp
r3892 r3958 55 55 #include "FlowCmd.h" 56 56 #include "dxReader.h" 57 #ifdef USE_VTK 58 #include "VtkDataSetReader.h" 59 #endif 57 60 #include "VtkReader.h" 58 61 #include "BMPWriter.h" … … 763 766 } 764 767 768 static int 769 CutplaneVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 770 Tcl_Obj *const *objv) 771 { 772 bool state; 773 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 774 return TCL_ERROR; 775 } 776 777 std::vector<Volume *> ivol; 778 if (GetVolumes(interp, objc - 3, objv + 3, &ivol) != TCL_OK) { 779 return TCL_ERROR; 780 } 781 std::vector<Volume *>::iterator iter; 782 for (iter = ivol.begin(); iter != ivol.end(); iter++) { 783 (*iter)->cutplanesVisible(state); 784 } 785 return TCL_OK; 786 } 787 765 788 static Rappture::CmdSpec cutplaneOps[] = { 766 789 {"position", 1, CutplanePositionOp, 4, 0, "relval axis ?indices?",}, 767 790 {"state", 1, CutplaneStateOp, 4, 0, "bool axis ?indices?",}, 791 {"visible", 1, CutplaneVisibleOp, 3, 0, "bool ?indices?",}, 768 792 }; 769 793 static int nCutplaneOps = NumCmdSpecs(cutplaneOps); … … 1273 1297 } else if ((nBytes > 14) && (strncmp(bytes, "# vtk DataFile", 14) == 0)) { 1274 1298 TRACE("VTK loading..."); 1275 std::stringstream fdata;1276 fdata.write(bytes, nBytes);1277 1299 if (nBytes <= 0) { 1278 1300 ERROR("data buffer is empty"); … … 1280 1302 } 1281 1303 Rappture::Outcome context; 1304 #ifdef USE_VTK 1305 volume = load_vtk_volume_stream(context, tag, bytes, nBytes); 1306 #else 1307 std::stringstream fdata; 1308 fdata.write(bytes, nBytes); 1282 1309 volume = load_vtk_volume_stream(context, tag, fdata); 1310 #endif 1283 1311 if (volume == NULL) { 1284 1312 Tcl_AppendResult(interp, context.remark(), (char*)NULL); … … 1292 1320 } 1293 1321 TRACE("DX loading..."); 1294 std::stringstream fdata;1295 fdata.write(bytes, nBytes);1296 1322 if (nBytes <= 0) { 1297 1323 ERROR("data buffer is empty"); 1298 1324 abort(); 1299 1325 } 1326 std::stringstream fdata; 1327 fdata.write(bytes, nBytes); 1300 1328 Rappture::Outcome context; 1301 1329 volume = load_dx_volume_stream(context, tag, fdata); -
branches/blt4/packages/vizservers/nanovis/Doxyfile.in
r3892 r3958 599 599 # subdirectory from a directory tree whose root is specified with the INPUT tag. 600 600 601 EXCLUDE = @srcdir@/ newmat11 @srcdir@/CircularQueue.h @srcdir@/ParticleEmitter.h @srcdir@/ParticleEmitter.cpp @srcdir@/ParticleSystem.h @srcdir@/ParticleSystem.cpp @srcdir@/ParticleSystemFactory.h @srcdir@/ParticleSystemFactory.cpp @srcdir@/BucketSort.h @srcdir@/BucketSort.cpp @srcdir@/PCASplit.h @srcdir@/PCASplit.cpp @srcdir@/PointSet.h @srcdir@/PointSet.cpp @srcdir@/PointSetRenderer.h @srcdir@/PointSetRenderer.cpp @srcdir@/PointShader.h @srcdir@/PointShader.cpp601 EXCLUDE = @srcdir@/bak @srcdir@/newmat11 @srcdir@/CircularQueue.h @srcdir@/ParticleEmitter.h @srcdir@/ParticleEmitter.cpp @srcdir@/ParticleSystem.h @srcdir@/ParticleSystem.cpp @srcdir@/ParticleSystemFactory.h @srcdir@/ParticleSystemFactory.cpp @srcdir@/BucketSort.h @srcdir@/BucketSort.cpp @srcdir@/PCASplit.h @srcdir@/PCASplit.cpp @srcdir@/PointSet.h @srcdir@/PointSet.cpp @srcdir@/PointSetRenderer.h @srcdir@/PointSetRenderer.cpp @srcdir@/PointShader.h @srcdir@/PointShader.cpp 602 602 603 603 # The EXCLUDE_SYMLINKS tag can be used select whether or not files or -
branches/blt4/packages/vizservers/nanovis/Flow.cpp
r3892 r3958 41 41 _interp(interp), 42 42 _name(name), 43 _data(NULL),44 43 _volume(NULL) 45 44 { … … 59 58 Rappture::FreeSwitches(_switches, &_sv, 0); 60 59 61 if (_data != NULL) {62 delete _data;63 }64 60 if (_volume != NULL) { 65 61 NanoVis::removeVolume(_volume); … … 91 87 if (isDataLoaded()) { 92 88 BBox bbox; 93 data()->getBounds(bbox.min, bbox.max);89 _volume->getBounds(bbox.min, bbox.max); 94 90 allBounds.extend(bbox); 95 91 } … … 115 111 switch (position->axis) { 116 112 case AXIS_X: 117 return (position->value - _ data->xMin()) /118 (_ data->xMax() - _data->xMin());113 return (position->value - _volume->xAxis.min()) / 114 (_volume->xAxis.max() - _volume->xAxis.min()); 119 115 case AXIS_Y: 120 return (position->value - _ data->yMin()) /121 (_ data->yMax() - _data->yMin());116 return (position->value - _volume->yAxis.min()) / 117 (_volume->yAxis.max() - _volume->yAxis.min()); 122 118 case AXIS_Z: 123 return (position->value - _ data->zMin()) /124 (_ data->zMax() - _data->zMin());119 return (position->value - _volume->zAxis.min()) / 120 (_volume->zAxis.max() - _volume->zAxis.min()); 125 121 } 126 122 return 0.0; … … 303 299 Flow::scaleVectorField() 304 300 { 305 float *vdata = getScaledVector(); 306 if (_volume != NULL) { 307 TRACE("Updating existing volume: %s", _volume->name()); 308 _volume->setData(vdata, magMin, magMax, 0); 309 } else { 310 _volume = makeVolume(vdata); 311 if (_volume == NULL) { 312 return false; 313 } 314 } 315 delete [] vdata; 301 if (_volume == NULL) { 302 ERROR("Called with NULL _volume"); 303 return false; 304 } 305 316 306 // FIXME: LIC and arrows should be per-flow 317 307 if (NanoVis::licRenderer != NULL) { … … 346 336 347 337 float * 348 Flow::getScaledVector( )349 { 350 assert( _data->nComponents() == 3);351 size_t n = _data->nValues() / _data->nComponents() * 4;338 Flow::getScaledVector(Rappture::Unirect3d *unirect) 339 { 340 assert(unirect->nComponents() == 3); 341 size_t n = unirect->nValues() / unirect->nComponents() * 4; 352 342 float *data = new float[n]; 353 343 memset(data, 0, sizeof(float) * n); 354 344 float *dest = data; 355 const float *values = _data->values();356 for (size_t iz = 0; iz < _data->zNum(); iz++) {357 for (size_t iy = 0; iy < _data->yNum(); iy++) {358 for (size_t ix = 0; ix < _data->xNum(); ix++) {345 const float *values = unirect->values(); 346 for (size_t iz = 0; iz < unirect->zNum(); iz++) { 347 for (size_t iy = 0; iy < unirect->yNum(); iy++) { 348 for (size_t ix = 0; ix < unirect->xNum(); ix++) { 359 349 double vx, vy, vz, vm; 360 350 vx = values[0]; … … 362 352 vz = values[2]; 363 353 vm = sqrt(vx*vx + vy*vy + vz*vz); 364 dest[0] = vm / magMax;365 dest[1] = vx /(2.0 * magMax) + 0.5;366 dest[2] = vy /(2.0 * magMax) + 0.5;367 dest[3] = vz /(2.0 * magMax) + 0.5;354 dest[0] = vm / unirect->magMax(); 355 dest[1] = vx /(2.0 * unirect->magMax()) + 0.5; 356 dest[2] = vy /(2.0 * unirect->magMax()) + 0.5; 357 dest[3] = vz /(2.0 * unirect->magMax()) + 0.5; 368 358 values += 3; 369 359 dest += 4; … … 375 365 376 366 Volume * 377 Flow::makeVolume( float *data)367 Flow::makeVolume(Rappture::Unirect3d *unirect, float *data) 378 368 { 379 369 Volume *volume = 380 370 NanoVis::loadVolume(_name.c_str(), 381 _data->xNum(),382 _data->yNum(),383 _data->zNum(),371 unirect->xNum(), 372 unirect->yNum(), 373 unirect->zNum(), 384 374 4, data, 385 magMin, magMax, 0); 386 volume->xAxis.setRange(_data->xMin(), _data->xMax()); 387 volume->yAxis.setRange(_data->yMin(), _data->yMax()); 388 volume->zAxis.setRange(_data->zMin(), _data->zMax()); 389 390 TRACE("mag=%g %g", magMin, magMax); 391 392 volume->disableCutplane(0); 393 volume->disableCutplane(1); 394 volume->disableCutplane(2); 375 unirect->magMin(), 376 unirect->magMax(), 377 0); 378 volume->xAxis.setRange(unirect->xMin(), unirect->xMax()); 379 volume->yAxis.setRange(unirect->yMin(), unirect->yMax()); 380 volume->zAxis.setRange(unirect->zMin(), unirect->zMax()); 381 382 TRACE("mag=%g %g", unirect->magMin(), unirect->magMax()); 383 384 return volume; 385 } 386 387 void 388 Flow::initVolume() 389 { 390 _volume->disableCutplane(0); 391 _volume->disableCutplane(1); 392 _volume->disableCutplane(2); 395 393 396 394 /* Initialize the volume with the previously configured values. */ 397 volume->transferFunction(_sv.transferFunction);398 volume->dataEnabled(_sv.showVolume);399 volume->twoSidedLighting(_sv.twoSidedLighting);400 volume->outline(_sv.showOutline);401 volume->opacityScale(_sv.opacity);402 volume->ambient(_sv.ambient);403 volume->diffuse(_sv.diffuse);404 volume->specularLevel(_sv.specular);405 volume->specularExponent(_sv.specularExp);395 _volume->transferFunction(_sv.transferFunction); 396 _volume->dataEnabled(_sv.showVolume); 397 _volume->twoSidedLighting(_sv.twoSidedLighting); 398 _volume->outline(_sv.showOutline); 399 _volume->opacityScale(_sv.opacity); 400 _volume->ambient(_sv.ambient); 401 _volume->diffuse(_sv.diffuse); 402 _volume->specularLevel(_sv.specular); 403 _volume->specularExponent(_sv.specularExp); 406 404 407 405 Volume::updatePending = true; 408 return volume; 409 } 406 } -
branches/blt4/packages/vizservers/nanovis/Flow.h
r3892 r3958 83 83 void getBoxNames(std::vector<std::string>& names); 84 84 85 bool scaleVectorField();86 87 85 bool visible() 88 86 { … … 97 95 bool isDataLoaded() 98 96 { 99 return (_data != NULL); 100 } 101 102 Rappture::Unirect3d *data() 103 { 104 return _data; 105 } 106 107 void data(Rappture::Unirect3d *data) 108 { 109 if (_data != NULL) { 110 delete _data; 111 } 112 _data = data; 97 return (_volume != NULL); 98 } 99 100 void getVectorRange(double range[]) 101 { 102 range[0] = _volume->wAxis.min(); 103 range[1] = _volume->wAxis.max(); 104 } 105 106 void data(Rappture::Unirect3d *unirect) 107 { 108 float *vdata = getScaledVector(unirect); 109 _volume = makeVolume(unirect, vdata); 110 delete [] vdata; 111 delete unirect; 112 initVolume(); 113 scaleVectorField(); 114 } 115 116 void data(Volume *volume) 117 { 118 _volume = volume; 119 initVolume(); 120 scaleVectorField(); 113 121 } 114 122 … … 198 206 typedef std::tr1::unordered_map<BoxId, FlowBox *> BoxHashmap; 199 207 200 float *getScaledVector(); 201 202 Volume *makeVolume(float *data); 208 void initVolume(); 209 210 bool scaleVectorField(); 211 212 float *getScaledVector(Rappture::Unirect3d *unirect); 213 214 Volume *makeVolume(Rappture::Unirect3d *unirect, float *data); 203 215 204 216 void renderBoxes(); … … 219 231 220 232 /** 221 * Uniform rectangular data222 * representing the mesh and vector223 * field values. These values are224 * kept to regenerate the volume225 * associated with the flow. */226 Rappture::Unirect3d *_data;227 228 /**229 233 * The volume associated with the 230 234 * flow. This isn't the same thing as -
branches/blt4/packages/vizservers/nanovis/FlowCmd.cpp
r3892 r3958 30 30 #include "Command.h" 31 31 #include "PPMWriter.h" 32 #ifdef USE_VTK 33 #include "VtkDataSetReader.h" 34 #endif 35 #include "VtkReader.h" 32 36 #include "FlowCmd.h" 33 37 #include "FlowTypes.h" … … 243 247 size_t length = buf.size(); 244 248 245 Rappture::Unirect3d * dataPtr;246 dataPtr = new Rappture::Unirect3d(nComponents);249 Rappture::Unirect3d *unirect = NULL; 250 Volume *volume = NULL; 247 251 248 252 Flow *flow = (Flow *)clientData; 249 253 if ((length > 4) && (strncmp(bytes, "<DX>", 4) == 0)) { 250 if (!dataPtr->importDx(result, nComponents, length - 4, bytes + 4)) { 254 unirect = new Rappture::Unirect3d(nComponents); 255 if (!unirect->importDx(result, nComponents, length - 4, bytes + 4)) { 251 256 Tcl_AppendResult(interp, result.remark(), (char *)NULL); 252 delete dataPtr;257 delete unirect; 253 258 return TCL_ERROR; 254 259 } 255 260 } else if ((length > 10) && (strncmp(bytes, "unirect3d ", 10) == 0)) { 256 if (dataPtr->parseBuffer(interp, buf) != TCL_OK) { 257 delete dataPtr; 261 unirect = new Rappture::Unirect3d(nComponents); 262 if (unirect->parseBuffer(interp, buf) != TCL_OK) { 263 delete unirect; 258 264 return TCL_ERROR; 259 265 } 260 266 } else if ((length > 10) && (strncmp(bytes, "unirect2d ", 10) == 0)) { 267 unirect = new Rappture::Unirect3d(nComponents); 261 268 Rappture::Unirect2d *u2dPtr; 262 269 u2dPtr = new Rappture::Unirect2d(nComponents); 263 270 if (u2dPtr->parseBuffer(interp, buf) != TCL_OK) { 271 delete unirect; 264 272 delete u2dPtr; 265 273 return TCL_ERROR; 266 274 } 267 dataPtr->convert(u2dPtr);275 unirect->convert(u2dPtr); 268 276 delete u2dPtr; 269 #if 0270 277 } else if ((length > 14) && (strncmp(bytes, "# vtk DataFile", 14) == 0)) { 271 278 TRACE("VTK loading..."); … … 277 284 } 278 285 Rappture::Outcome context; 279 volume = load_vtk_volume_stream(context, tag, fdata); 286 #ifdef USE_VTK 287 volume = load_vtk_volume_stream(context, flow->name(), bytes, length); 288 #else 289 std::stringstream fdata; 290 fdata.write(bytes, nBytes); 291 volume = load_vtk_volume_stream(context, flow->name(), fdata); 292 #endif 280 293 if (volume == NULL) { 281 294 Tcl_AppendResult(interp, context.remark(), (char*)NULL); 282 295 return TCL_ERROR; 283 296 } 284 #endif285 297 } else { 286 298 TRACE("header is %.14s", buf.bytes()); 287 if (!dataPtr->importDx(result, nComponents, length, bytes)) { 299 unirect = new Rappture::Unirect3d(nComponents); 300 if (!unirect->importDx(result, nComponents, length, bytes)) { 288 301 Tcl_AppendResult(interp, result.remark(), (char *)NULL); 289 delete dataPtr;290 return TCL_ERROR; 291 } 292 } 293 if ( dataPtr->nValues() == 0) {294 delete dataPtr;302 delete unirect; 303 return TCL_ERROR; 304 } 305 } 306 if (unirect != NULL && unirect->nValues() == 0) { 307 delete unirect; 295 308 Tcl_AppendResult(interp, "no data found in stream", (char *)NULL); 296 309 return TCL_ERROR; 297 310 } 298 TRACE("nx = %d ny = %d nz = %d", 299 dataPtr->xNum(), dataPtr->yNum(), dataPtr->zNum()); 300 TRACE("x0 = %lg y0 = %lg z0 = %lg", 301 dataPtr->xMin(), dataPtr->yMin(), dataPtr->zMin()); 302 TRACE("lx = %lg ly = %lg lz = %lg", 303 dataPtr->xMax() - dataPtr->xMin(), 304 dataPtr->yMax() - dataPtr->yMin(), 305 dataPtr->zMax() - dataPtr->zMin()); 306 TRACE("dx = %lg dy = %lg dz = %lg", 307 dataPtr->xNum() > 1 ? (dataPtr->xMax() - dataPtr->xMin())/(dataPtr->xNum()-1) : 0, 308 dataPtr->yNum() > 1 ? (dataPtr->yMax() - dataPtr->yMin())/(dataPtr->yNum()-1) : 0, 309 dataPtr->zNum() > 1 ? (dataPtr->zMax() - dataPtr->zMin())/(dataPtr->zNum()-1) : 0); 310 TRACE("magMin = %lg magMax = %lg", 311 dataPtr->magMin(), dataPtr->magMax()); 312 flow->data(dataPtr); 311 if (unirect != NULL) { 312 TRACE("nx = %d ny = %d nz = %d", 313 unirect->xNum(), unirect->yNum(), unirect->zNum()); 314 TRACE("x0 = %lg y0 = %lg z0 = %lg", 315 unirect->xMin(), unirect->yMin(), unirect->zMin()); 316 TRACE("lx = %lg ly = %lg lz = %lg", 317 unirect->xMax() - unirect->xMin(), 318 unirect->yMax() - unirect->yMin(), 319 unirect->zMax() - unirect->zMin()); 320 TRACE("dx = %lg dy = %lg dz = %lg", 321 unirect->xNum() > 1 ? (unirect->xMax() - unirect->xMin())/(unirect->xNum()-1) : 0, 322 unirect->yNum() > 1 ? (unirect->yMax() - unirect->yMin())/(unirect->yNum()-1) : 0, 323 unirect->zNum() > 1 ? (unirect->zMax() - unirect->zMin())/(unirect->zNum()-1) : 0); 324 TRACE("magMin = %lg magMax = %lg", 325 unirect->magMin(), unirect->magMax()); 326 327 flow->data(unirect); 328 } else { 329 flow->data(volume); 330 } 331 double range[2]; 332 flow->getVectorRange(range); 313 333 { 314 334 char info[1024]; 315 335 int length = 316 336 sprintf(info, "nv>data tag %s min %g max %g\n", 317 flow->name(), dataPtr->magMin(), dataPtr->magMax());337 flow->name(), range[0], range[1]); 318 338 #ifdef USE_THREADS 319 339 queueResponse(info, (size_t)length, Response::VOLATILE); … … 840 860 } 841 861 if (Flow::updatePending) { 842 NanoVis:: mapFlows();862 NanoVis::setFlowRanges(); 843 863 } 844 864 NanoVis::renderLegend(tf, Flow::magMin, Flow::magMax, w, h, label); … … 965 985 NanoVis::resetFlows(); 966 986 if (Flow::updatePending) { 967 NanoVis:: mapFlows();987 NanoVis::setFlowRanges(); 968 988 } 969 989 for (int i = 0; i < nSteps; i++) { … … 997 1017 assert(NanoVis::licRenderer != NULL); 998 1018 if (Flow::updatePending) { 999 NanoVis:: mapFlows();1019 NanoVis::setFlowRanges(); 1000 1020 } 1001 1021 NanoVis::licRenderer->convolve(); -
branches/blt4/packages/vizservers/nanovis/Grid.cpp
r3892 r3958 20 20 21 21 #define NUMDIGITS 6 22 #define GRID_TICK 0.05 22 #define TICK_LENGTH 0.05 23 #define LABEL_OFFSET 0.06 24 #define TITLE_OFFSET 0.2 23 25 24 26 Grid::Grid() : … … 55 57 glEnable(GL_DEPTH_TEST); 56 58 glDisable(GL_TEXTURE_2D); 59 #ifdef notdef 57 60 glEnable(GL_BLEND); 58 #ifdef notdef59 61 glEnable(GL_LINE_SMOOTH); 62 #else 63 glDisable(GL_BLEND); 60 64 #endif 61 65 … … 73 77 { 74 78 glVertex3f(0.0f, 0.0f, 0.0f); 75 glVertex3f(1.0f + GRID_TICK, 0.0f, 0.0f);79 glVertex3f(1.0f + TICK_LENGTH/xAxis.range(), 0.0f, 0.0f); 76 80 glVertex3f(0.0f, 0.0f, 0.0f); 77 glVertex3f(0.0f, 1.0f + GRID_TICK, 0.0f);81 glVertex3f(0.0f, 1.0f + TICK_LENGTH/yAxis.range(), 0.0f); 78 82 glVertex3f(0.0f, 0.0f, 0.0f); 79 glVertex3f(0.0f, 0.0f, 1.0f + GRID_TICK);83 glVertex3f(0.0f, 0.0f, 1.0f + TICK_LENGTH/zAxis.range()); 80 84 } 81 85 glEnd(); … … 96 100 glVertex3f(x, 1.0f, 0.0f); 97 101 glVertex3f(x, 0.0f, 0.0f); 98 glVertex3f(x, 0.0f, 1.0f + GRID_TICK);102 glVertex3f(x, 0.0f, 1.0f + TICK_LENGTH/zAxis.range()); 99 103 } 100 104 for (result = yAxis.firstMajor(iter); result; result = iter.next()) { … … 102 106 y = yAxis.map(iter.getValue()); 103 107 glVertex3f(0.0f, y, 0.0f); 104 glVertex3f(1.0f + GRID_TICK, y, 0.0f);108 glVertex3f(1.0f + TICK_LENGTH/xAxis.range(), y, 0.0f); 105 109 glVertex3f(0.0f, y, 0.0f); 106 110 glVertex3f(0.0f, y, 1.0f); … … 112 116 glVertex3f(0.0f, 1.0f, z); 113 117 glVertex3f(0.0f, 0.0f, z); 114 glVertex3f(1.0f + GRID_TICK, 0.0f, z);118 glVertex3f(1.0f + TICK_LENGTH/xAxis.range(), 0.0f, z); 115 119 } 116 120 } … … 163 167 glGetDoublev(GL_PROJECTION_MATRIX, prjm); 164 168 glGetIntegerv(GL_VIEWPORT, viewport); 165 169 166 170 _font->begin(); 167 if (gluProject(1.2, 0.0, 0.0, mv, prjm, viewport, &wx, &wy, &wz)) { 171 if (gluProject(1.0 + TITLE_OFFSET/xAxis.range(), 0.0, 0.0, mv, prjm, viewport, &wx, &wy, &wz) && 172 wz >= 0.0 && wz <= 1.0) { 168 173 glLoadIdentity(); 169 174 glTranslatef((int) wx, viewport[3] - (int) wy, 0); … … 175 180 } 176 181 177 if (gluProject(0.0, 1.2, 0.0, mv, prjm, viewport, &wx, &wy, &wz)) { 182 if (gluProject(0.0, 1.0 + TITLE_OFFSET/yAxis.range(), 0.0, mv, prjm, viewport, &wx, &wy, &wz) && 183 wz >= 0.0 && wz <= 1.0) { 178 184 glLoadIdentity(); 179 185 glTranslatef((int) wx, viewport[3] - (int)wy, 0); … … 185 191 } 186 192 187 if (gluProject(0.0, 0.0, 1.2, mv, prjm, viewport, &wx, &wy, &wz)) { 193 if (gluProject(0.0, 0.0, 1.0 + TITLE_OFFSET/zAxis.range(), mv, prjm, viewport, &wx, &wy, &wz) && 194 wz >= 0.0 && wz <= 1.0) { 188 195 glLoadIdentity(); 189 196 glTranslatef((int) wx, (int) viewport[3] - (int)wy, 0.0f); … … 200 207 float x; 201 208 x = xAxis.map(iter.getValue()); 202 if (gluProject(x, 0.0f, 1.06f, mv, prjm, viewport, &wx, &wy, &wz)) { 209 if (gluProject(x, 0.0f, 1.0 + LABEL_OFFSET/zAxis.range(), mv, prjm, viewport, &wx, &wy, &wz) && 210 wz >= 0.0 && wz <= 1.0) { 203 211 char buff[20]; 204 212 glLoadIdentity(); … … 211 219 float y; 212 220 y = yAxis.map(iter.getValue()); 213 if (gluProject(1.06f, y, 0.0f, mv, prjm, viewport, &wx, &wy, &wz)) { 221 if (gluProject(1.0 + LABEL_OFFSET/xAxis.range(), y, 0.0f, mv, prjm, viewport, &wx, &wy, &wz) && 222 wz >= 0.0 && wz <= 1.0) { 214 223 char buff[20]; 215 224 glLoadIdentity(); … … 219 228 } 220 229 } 221 for (result = zAxis.firstMajor(iter) ; result; result = iter.next()) {230 for (result = zAxis.firstMajor(iter) + LABEL_OFFSET/xAxis.range(); result; result = iter.next()) { 222 231 float z; 223 232 z = zAxis.map(iter.getValue()); 224 if (gluProject(1.06f, 0.0f, z, mv, prjm, viewport, &wx, &wy, &wz)) { 233 if (gluProject(1.0 + LABEL_OFFSET/xAxis.range(), 0.0f, z, mv, prjm, viewport, &wx, &wy, &wz) && 234 wz >= 0.0 && wz <= 1.0) { 225 235 char buff[20]; 226 236 glLoadIdentity(); -
branches/blt4/packages/vizservers/nanovis/Makefile.in
r3892 r3958 3 3 USE_POINTSET_RENDERER = #yes 4 4 USE_PARTICLE_SYSTEM = #yes 5 USE_VTK = yes 5 6 6 7 SHELL = /bin/sh … … 53 54 VRMATH_LIB_SPEC = $(VRMATH_LIB) 54 55 56 VTK_LIB_DIR = @VTK_LIB_DIR@ 57 VTK_INC_SPEC = @VTK_INC_SPEC@ 58 VTK_LIB_SPEC = \ 59 -lvtkIOCore-6.0 \ 60 -lvtkIOLegacy-6.0 \ 61 -lvtkFiltersCore-6.0 \ 62 -lvtkImagingHybrid-6.0 \ 63 -lvtkImagingCore-6.0 \ 64 -lvtkCommonCore-6.0 \ 65 -lvtkCommonDataModel-6.0 \ 66 -lvtkCommonExecutionModel-6.0 \ 67 -lvtkCommonMisc-6.0 \ 68 -lvtkCommonSystem-6.0 \ 69 -lvtkCommonTransforms-6.0 \ 70 -lvtkCommonMath-6.0 71 55 72 EXTRA_LIBS = -lm -lpthread 56 73 RP_DIR = @RP_DIR@ … … 73 90 $(UTIL_LIB_SPEC) \ 74 91 $(VRMATH_LIB_SPEC) \ 92 $(VTK_LIB_SPEC) \ 75 93 $(TCL_LIB_SPEC) \ 76 94 $(CG_LIB_SPEC) \ … … 85 103 $(MAT_INC_SPEC) \ 86 104 $(VRMATH_INC_SPEC) \ 105 $(VTK_INC_SPEC) \ 87 106 $(TCL_INC_SPEC) \ 88 107 $(CG_INC_SPEC) \ … … 103 122 ifdef USE_POINTSET_RENDERER 104 123 DEFINES += -DUSE_POINTSET_RENDERER 124 endif 125 ifdef USE_VTK 126 DEFINES += -DUSE_VTK 105 127 endif 106 128 CXX_SWITCHES = $(CFLAGS) $(EXTRA_CFLAGS) $(DEFINES) $(INCLUDES) … … 204 226 endif 205 227 228 ifdef USE_VTK 229 OBJS += DataSetResample.o \ 230 VtkDataSetReader.o 231 endif 232 206 233 .PHONY: all install install-resources install-shaders install-nanovis docs clean-docs clean distclean graphics imgloaders newmat11 util vrmath 207 234 … … 287 314 ContourLineFilter.o: ContourLineFilter.cpp ContourLineFilter.h 288 315 ConvexPolygon.o: ConvexPolygon.cpp ConvexPolygon.h $(VRMATH_DIR)/include/vrmath/Vector4f.h $(VRMATH_DIR)/include/vrmath/Matrix4x4d.h Plane.h 316 DataSetResample.o: DataSetResample.cpp DataSetResample.h 289 317 Flow.o: Flow.cpp Flow.h FlowCmd.h FlowTypes.h FlowBox.h FlowParticles.h LIC.h VelocityArrowsSlice.h Switch.h Unirect.h Volume.h TransferFunction.h Trace.h 290 318 FlowBox.o: FlowBox.cpp FlowBox.h FlowTypes.h Switch.h Trace.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h $(VRMATH_DIR)/include/vrmath/Vector4f.h $(VRMATH_DIR)/include/vrmath/Matrix4x4d.h … … 293 321 GradientFilter.o: GradientFilter.cpp GradientFilter.h 294 322 Grid.o: Grid.cpp Grid.h Axis.h Chain.h $(UTIL_DIR)/Fonts.h $(VRMATH_DIR)/include/vrmath/Color4f.h $(VRMATH_DIR)/include/vrmath/Vector4f.h 295 HeightMap.o: HeightMap.cpp HeightMap.h 296 LIC.o: LIC.cpp LIC.h 323 HeightMap.o: HeightMap.cpp HeightMap.h Shader.h 324 LIC.o: LIC.cpp LIC.h Shader.h 297 325 OrientationIndicator.o: OrientationIndicator.cpp OrientationIndicator.h 298 326 ParticleAdvectionShader.o: ParticleAdvectionShader.cpp ParticleAdvectionShader.h Shader.h … … 312 340 RegularVolumeShader.o: RegularVolumeShader.cpp RegularVolumeShader.h VolumeShader.h Shader.h 313 341 RenderVertexArray.o: RenderVertexArray.cpp RenderVertexArray.h 314 Shader.o: Shader.cpp Shader.h 342 Shader.o: Shader.cpp Shader.h config.h 315 343 ShaderGL.o: ShaderGL.cpp ShaderGL.h 316 344 StdVertexShader.o: StdVertexShader.cpp StdVertexShader.h Shader.h … … 327 355 VolumeRenderer.o: VolumeRenderer.cpp VolumeRenderer.h ConvexPolygon.h Volume.h nanovis.h Trace.h Plane.h StdVertexShader.h Shader.h 328 356 VolumeShader.o: VolumeShader.cpp VolumeShader.h Shader.h 329 VtkReader.o: VtkReader.h Trace.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h ReaderCommon.h nanovis.h 357 VtkDataSetReader.o: VtkDataSetReader.cpp VtkDataSetReader.h DataSetResample.h $(VRMATH_DIR)/include/vrmath/Vector3f.h ReaderCommon.h Trace.h Volume.h nanovis.h config.h 358 VtkReader.o: VtkReader.h Trace.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h ReaderCommon.h nanovis.h config.h 330 359 ZincBlendeReconstructor.o: ZincBlendeReconstructor.cpp ZincBlendeReconstructor.h ZincBlendeVolume.h Volume.h $(VRMATH_DIR)/include/vrmath/Vector3f.h 331 360 ZincBlendeVolume.o: ZincBlendeVolume.cpp ZincBlendeVolume.h config.h define.h -
branches/blt4/packages/vizservers/nanovis/ReaderCommon.cpp
r3892 r3958 64 64 65 65 /** 66 * \brief Normalize data to [0,1] based on vmin,vmax range 67 * 68 * Data outside of given range is clamped, and NaNs are set to 69 * -1 in the output 70 * 71 * \param data Float array of unnormalized data, will be normalized on return 72 * \param count Number of elts in array 73 * \param stride Stride between values in data array 74 * \param vmin Minimum value in data array 75 * \param vmax Maximum value in data array 76 */ 77 void 78 nv::normalizeVector(float *data, int count, double vmin, double vmax) 79 { 80 for (int p = 0; p < count; p++) { 81 int i = p * 4; 82 data[i ] = data[i]/vmax; 83 data[i+1] = data[i+1]/(2.0 * vmax) + 0.5; 84 data[i+2] = data[i+2]/(2.0 * vmax) + 0.5; 85 data[i+3] = data[i+3]/(2.0 * vmax) + 0.5; 86 } 87 } 88 89 /** 66 90 * \brief Compute Sobel filtered gradients for a 3D volume 67 91 * -
branches/blt4/packages/vizservers/nanovis/ReaderCommon.h
r3892 r3958 15 15 normalizeScalar(float *data, int count, int stride, double min, double max); 16 16 17 extern void 18 normalizeVector(float *data, int count, double min, double max); 19 17 20 extern float * 18 21 computeGradient(float *data, -
branches/blt4/packages/vizservers/nanovis/Shader.cpp
r3892 r3958 12 12 #include <util/FilePath.h> 13 13 14 #include "config.h" 14 15 #include "Shader.h" 15 16 #include "Trace.h" … … 18 19 using namespace nv::util; 19 20 21 /** 22 * These correspond to NV_vertex_program3 and NV_fragment_program2: 23 * CG_PROFILE_VP40 24 * CG_PROFILE_FP40 25 * 26 * These correspond to ARB_vertex_program and ARB_fragment_program: 27 * CG_PROFILE_ARBVP1 28 * CG_PROFILE_ARBFP1 29 * 30 * Generic GLSL targets: 31 * CG_PROFILE_GLSLV 32 * CG_PROFILE_GLSLF 33 */ 34 #ifdef USE_ARB_PROGRAMS 35 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_ARBVP1; 36 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_ARBFP1; 37 #else 20 38 CGprofile Shader::_defaultVertexProfile = CG_PROFILE_VP40; 21 39 CGprofile Shader::_defaultFragmentProfile = CG_PROFILE_FP40; 40 #endif 22 41 CGcontext Shader::_cgContext = NULL; 23 42 -
branches/blt4/packages/vizservers/nanovis/Shader.h
r3892 r3958 49 49 void loadFragmentProgram(const char *fileName); 50 50 51 bool isVertexProgramLoaded() 52 { 53 return (getVP() == NULL); 54 } 55 56 bool isFragmentProgramLoaded() 57 { 58 return (getFP() == NULL); 59 } 60 51 61 void setVPParameter1f(const char *name, float val) 52 62 { … … 284 294 void resetPrograms(); 285 295 286 287 296 CGprogram getVP() 288 297 { -
branches/blt4/packages/vizservers/nanovis/Unirect.cpp
r3892 r3958 8 8 9 9 #include <tcl.h> 10 11 #include <RpField1D.h>12 #include <RpFieldRect3D.h>13 10 14 11 #include "Command.h" … … 634 631 } 635 632 636 bool637 Rappture::Unirect3d::resample(Rappture::Outcome &result, size_t nSamples)638 {639 Rappture::Mesh1D xgrid(_xMin, _xMax, _xNum);640 Rappture::Mesh1D ygrid(_yMin, _yMax, _yNum);641 Rappture::Mesh1D zgrid(_zMin, _zMax, _zNum);642 Rappture::FieldRect3D xfield(xgrid, ygrid, zgrid);643 Rappture::FieldRect3D yfield(xgrid, ygrid, zgrid);644 Rappture::FieldRect3D zfield(xgrid, ygrid, zgrid);645 646 size_t i, j;647 for (i = 0, j = 0; i < _nValues; i += _nComponents, j++) {648 double vx, vy, vz;649 650 vx = _values[i];651 vy = _values[i+1];652 vz = _values[i+2];653 654 xfield.define(j, vx);655 yfield.define(j, vy);656 zfield.define(j, vz);657 }658 // Figure out a good mesh spacing659 double dx, dy, dz;660 double lx, ly, lz;661 lx = xfield.rangeMax(Rappture::xaxis) - xfield.rangeMin(Rappture::xaxis);662 ly = xfield.rangeMax(Rappture::yaxis) - xfield.rangeMin(Rappture::yaxis);663 lz = xfield.rangeMax(Rappture::zaxis) - xfield.rangeMin(Rappture::zaxis);664 665 double dmin;666 dmin = pow((lx*ly*lz)/((nSamples-1)*(nSamples-1)*(nSamples-1)), 0.333);667 668 /* Recompute new number of points for each axis. */669 _xNum = (size_t)ceil(lx/dmin);670 _yNum = (size_t)ceil(ly/dmin);671 _zNum = (size_t)ceil(lz/dmin);672 673 #ifndef HAVE_NPOT_TEXTURES674 // must be an even power of 2 for older cards675 _xNum = (int)pow(2.0, ceil(log10((double)_xNum)/log10(2.0)));676 _yNum = (int)pow(2.0, ceil(log10((double)_yNum)/log10(2.0)));677 _zNum = (int)pow(2.0, ceil(log10((double)_zNum)/log10(2.0)));678 #endif679 680 dx = lx/(double)(_xNum-1);681 dy = ly/(double)(_yNum-1);682 dz = lz/(double)(_zNum-1);683 684 TRACE("lx:%lf ly:%lf lz:%lf dmin:%lf dx:%lf dy:%lf dz:%lf", lx, ly, lz, dmin, dx, dy, dz);685 686 size_t n = _nComponents * _xNum * _yNum * _zNum;687 _values = (float *)realloc(_values, sizeof(float) * n);688 memset(_values, 0, sizeof(float) * n);689 690 // Generate the uniformly sampled rectangle that we need for a volume691 float *destPtr = _values;692 for (size_t i = 0; i < _zNum; i++) {693 double z;694 695 z = _zMin + (i * dx);696 for (size_t j = 0; j < _yNum; j++) {697 double y;698 699 y = _yMin + (j * dy);700 for (size_t k = 0; k < _xNum; k++) {701 double x;702 703 x = _xMin + (k * dz);704 destPtr[0] = xfield.value(x, y, z);705 destPtr[1] = yfield.value(x, y, z);706 destPtr[2] = zfield.value(x, y, z);707 }708 }709 }710 _nValues = _xNum * _yNum * _zNum * _nComponents;711 return true;712 }713 714 633 void 715 634 Rappture::Unirect3d::getVectorRange() -
branches/blt4/packages/vizservers/nanovis/Unirect.h
r3892 r3958 229 229 bool convert(Unirect2d *dataPtr); 230 230 231 bool resample(Rappture::Outcome &context, size_t nSamples = 30);232 233 231 bool isInitialized() 234 232 { … … 247 245 float _zValueMin, _zValueMax; 248 246 double _magMin, _magMax; /* Range of magnitudes of vector 249 * data. */247 * data. */ 250 248 char *_xUnits; 251 249 char *_yUnits; -
branches/blt4/packages/vizservers/nanovis/VelocityArrowsSlice.cpp
r3892 r3958 65 65 _queryVelocityFP.loadFragmentProgram("queryvelocity.cg"); 66 66 67 _particleShader.loadVertexProgram("velocityslicevp.cg"); 68 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 67 // Delay loading of shaders only required for glyph style rendering 68 if (_renderMode == GLYPHS) { 69 _particleShader.loadVertexProgram("velocityslicevp.cg"); 70 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 71 } 69 72 70 73 createRenderTarget(); … … 362 365 continue; 363 366 } 364 if (length > 1.0e-6) {367 if (length > 0.0) { 365 368 Vector3f vnorm = vel.normalize(); 366 369 Vector3f rotationAxis = refVec.cross(vnorm); … … 414 417 glTexEnvf(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_TRUE); 415 418 419 // FIXME: This vertex shader won't compile with ARB_vertex_program, 420 // so it should use GLSL 421 if (!_particleShader.isVertexProgramLoaded()) { 422 _particleShader.loadVertexProgram("velocityslicevp.cg"); 423 } 424 if (!_particleShader.isFragmentProgramLoaded()) { 425 _particleShader.loadFragmentProgram("velocityslicefp.cg"); 426 } 427 416 428 _particleShader.bind(); 417 429 _particleShader.setVPTextureParameter("vfield", _vectorFieldGraphicsID); … … 458 470 Vector3f bmin, bmax; 459 471 volume->getBounds(bmin, bmax); 460 _origin = bmin;472 _origin.set(bmin.x, bmin.y, bmin.z); 461 473 _scale.set(bmax.x-bmin.x, bmax.y-bmin.y, bmax.z-bmin.z); 462 474 -
branches/blt4/packages/vizservers/nanovis/Volume.cpp
r3892 r3958 31 31 double Volume::valueMax = 1.0; 32 32 33 Volume::Volume(int w , int h, int d,34 int n , float *data,35 double v 0, double v1, double nonZeroMin) :33 Volume::Volume(int width, int height, int depth, 34 int numComponents, float *data, 35 double vmin, double vmax, double nonZeroMin) : 36 36 _id(0), 37 _width(w ),38 _height(h ),39 _depth(d ),37 _width(width), 38 _height(height), 39 _depth(depth), 40 40 _transferFunc(NULL), 41 41 _ambient(0.6f), … … 46 46 _opacityScale(0.5f), 47 47 _data(NULL), 48 _numComponents(n ),48 _numComponents(numComponents), 49 49 _nonZeroMin(nonZeroMin), 50 _cutplanesVisible(true), 50 51 _tex(NULL), 51 52 _position(0,0,0), … … 62 63 _outlineColor[0] = _outlineColor[1] = _outlineColor[2] = 1.0f; 63 64 64 _tex = new Texture3D(_width, _height, _depth, GL_FLOAT, GL_LINEAR, n);65 _tex = new Texture3D(_width, _height, _depth, GL_FLOAT, GL_LINEAR, _numComponents); 65 66 int fcount = _width * _height * _depth * _numComponents; 66 67 _data = new float[fcount]; … … 70 71 _id = _tex->id(); 71 72 72 wAxis.setRange(v 0, v1);73 wAxis.setRange(vmin, vmax); 73 74 74 75 //Add cut planes. We create 3 default cut planes facing x, y, z directions. … … 90 91 } 91 92 92 void Volume::setData(float *data, double v 0, double v1, double nonZeroMin)93 void Volume::setData(float *data, double vmin, double vmax, double nonZeroMin) 93 94 { 94 95 int fcount = _width * _height * _depth * _numComponents; 95 96 memcpy(_data, data, fcount * sizeof(float)); 96 97 _tex->update(_data); 97 wAxis.setRange(v 0, v1);98 wAxis.setRange(vmin, vmax); 98 99 _nonZeroMin = nonZeroMin; 99 100 updatePending = true; -
branches/blt4/packages/vizservers/nanovis/Volume.h
r3892 r3958 125 125 } 126 126 127 void setData(float *data, double v 0, double v1, double nonZeroMin);127 void setData(float *data, double vmin, double vmax, double nonZeroMin); 128 128 129 129 const float *data() const … … 154 154 155 155 void disableCutplane(int index); 156 157 void cutplanesVisible(bool state) 158 { 159 _cutplanesVisible = state; 160 } 161 162 bool cutplanesVisible() const 163 { 164 return _cutplanesVisible; 165 } 156 166 157 167 void setCutplanePosition(int index, float location); … … 387 397 double _nonZeroMin; 388 398 399 bool _cutplanesVisible; 389 400 std::vector<CutPlane> _plane; ///< cut planes 390 401 -
branches/blt4/packages/vizservers/nanovis/VolumeRenderer.cpp
r3892 r3958 281 281 282 282 for (int j = 0; j < volume->getCutplaneCount(); j++) { 283 if (!volume-> isCutplaneEnabled(j)) {283 if (!volume->cutplanesVisible() || !volume->isCutplaneEnabled(j)) { 284 284 continue; 285 285 } -
branches/blt4/packages/vizservers/nanovis/VtkReader.cpp
r3892 r3958 16 16 #include "ReaderCommon.h" 17 17 18 #include "config.h" 18 19 #include "nanovis.h" 19 20 #include "VtkReader.h" -
branches/blt4/packages/vizservers/nanovis/ZincBlendeVolume.cpp
r3892 r3958 24 24 using namespace vrmath; 25 25 26 ZincBlendeVolume::ZincBlendeVolume(int w, int h, int d, int n, 26 ZincBlendeVolume::ZincBlendeVolume(int width, int height, int depth, 27 int numComponents, 27 28 float *dataVolumeA, float *dataVolumeB, 28 double v 0, double v1, double non_zeromin,29 double vmin, double vmax, double nonZeroMin, 29 30 const Vector3f& cellSz) : 30 Volume(w , h, d, n, dataVolumeA, v0, v1, non_zeromin),31 Volume(width, height, depth, numComponents, dataVolumeA, vmin, vmax, nonZeroMin), 31 32 cellSize(cellSz) 32 33 { … … 34 35 _volumeType = ZINCBLENDE; 35 36 36 //store member tex initialize in Volume() as zincblende _tex[0]37 //store member tex initialize in Volume() as zincblendeTex[0] 37 38 assert(_tex); 38 39 zincblendeTex[0] = _tex; 39 40 40 41 //now add another tex as zincblende_tex[1] 41 Texture3D *secondTex = new Texture3D(w , h, d, GL_FLOAT, GL_LINEAR, n);42 Texture3D *secondTex = new Texture3D(width, height, depth, GL_FLOAT, GL_LINEAR, numComponents); 42 43 assert(secondTex); 43 44 secondTex->initialize(dataVolumeB); -
branches/blt4/packages/vizservers/nanovis/ZincBlendeVolume.h
r3892 r3958 23 23 ZincBlendeVolume(int width, int height, int depth, int numComponents, 24 24 float *dataVolumeA, float *dataVolumeB, 25 double vmin, double vmax, double non _zeromin,25 double vmin, double vmax, double nonZeroMin, 26 26 const vrmath::Vector3f& cellSize); 27 27 -
branches/blt4/packages/vizservers/nanovis/config.h
r3892 r3958 38 38 39 39 /* 40 * If defined, use ARB_vertex_program and ARB_fragment_program as Cg 41 * profile target, otherwise NV_vertex_program3 and NV_fragment_program2 42 * are required 43 */ 44 //#define USE_ARB_PROGRAMS 45 46 /* 40 47 * Keep statistics 41 48 */ -
branches/blt4/packages/vizservers/nanovis/dxReader.cpp
r3892 r3958 211 211 } 212 212 213 TRACE("found nx=%d ny=%d nxy=%d nz=%d\ndx=% f dy=%f dz=%f\nx0=%f y0=%f z0=%f",213 TRACE("found nx=%d ny=%d nxy=%d nz=%d\ndx=%g dy=%g dz=%g\nx0=%g y0=%g z0=%g", 214 214 nx, ny, nxy, nz, dx, dy, dz, x0, y0, z0); 215 215 -
branches/blt4/packages/vizservers/nanovis/nanovis.cpp
r3892 r3958 504 504 } 505 505 #endif 506 // FIXME: should use ARB programs or (preferably) a GLSL profile for portability 506 // FIXME: should use GLSL for portability 507 #ifdef USE_ARB_PROGRAMS 508 if (!GLEW_ARB_vertex_program || 509 !GLEW_ARB_fragment_program) { 510 ERROR("ARB_vertex_program and ARB_fragment_program extensions are required"); 511 return false; 512 } 513 #else 507 514 if (!GLEW_NV_vertex_program3 || 508 515 !GLEW_NV_fragment_program2) { … … 510 517 return false; 511 518 } 519 #endif 512 520 513 521 if (!FilePath::getInstance()->setPath(path)) { … … 611 619 } 612 620 621 /** 622 * \brief Called when new volumes are added to update ranges 623 */ 613 624 void 614 625 NanoVis::setVolumeRanges() … … 636 647 } 637 648 649 /** 650 * \brief Called when new heightmaps are added to update ranges 651 */ 638 652 void 639 653 NanoVis::setHeightmapRanges() … … 668 682 NanoVis::collectBounds(bool onlyVisible) 669 683 { 670 if (Flow::updatePending) {671 mapFlows();672 }673 674 684 sceneBounds.makeEmpty(); 675 685 … … 698 708 } 699 709 700 { 710 for (FlowHashmap::iterator itr = flowTable.begin(); 711 itr != flowTable.end(); ++itr) { 712 Flow *flow = itr->second; 713 701 714 BBox bbox; 702 getFlowBounds(bbox.min, bbox.max, onlyVisible);715 flow->getBounds(bbox.min, bbox.max, onlyVisible); 703 716 sceneBounds.extend(bbox); 704 717 } … … 714 727 } 715 728 729 #if 0 716 730 if (!onlyVisible || grid->isVisible()) { 717 731 BBox bbox; … … 719 733 sceneBounds.extend(bbox); 720 734 } 735 #endif 721 736 722 737 if (sceneBounds.isEmpty()) { … … 802 817 } 803 818 819 /** 820 * \brief Called when new flows are added to update ranges 821 */ 804 822 bool 805 NanoVis:: mapFlows()823 NanoVis::setFlowRanges() 806 824 { 807 825 TRACE("Enter"); … … 817 835 itr != flowTable.end(); ++itr) { 818 836 Flow *flow = itr->second; 819 double min, max;820 837 if (!flow->isDataLoaded()) { 821 838 continue; 822 839 } 823 Rappture::Unirect3d *data = flow->data(); 824 min = data->magMin(); 825 max = data->magMax(); 826 if (min < Flow::magMin) { 827 Flow::magMin = min; 840 double range[2]; 841 flow->getVectorRange(range); 842 if (range[0] < Flow::magMin) { 843 Flow::magMin = range[0]; 828 844 } 829 if ( max> Flow::magMax) {830 Flow::magMax = max;845 if (range[1] > Flow::magMax) { 846 Flow::magMax = range[1]; 831 847 } 832 848 } … … 846 862 flow->initializeParticles(); 847 863 } 848 if (!flow->scaleVectorField()) {849 return false;850 }851 864 } 852 865 853 866 Flow::updatePending = false; 854 867 return true; 855 }856 857 void858 NanoVis::getFlowBounds(Vector3f& min,859 Vector3f& max,860 bool onlyVisible)861 {862 TRACE("Enter");863 864 BBox allBounds;865 for (FlowHashmap::iterator itr = flowTable.begin();866 itr != flowTable.end(); ++itr) {867 BBox bbox;868 itr->second->getBounds(bbox.min, bbox.max, onlyVisible);869 allBounds.extend(bbox);870 }871 872 min = allBounds.min;873 max = allBounds.max;874 868 } 875 869 … … 918 912 919 913 if (Flow::updatePending) { 920 mapFlows();914 setFlowRanges(); 921 915 } 922 916 if (HeightMap::updatePending) { -
branches/blt4/packages/vizservers/nanovis/nanovis.h
r3892 r3958 123 123 static void setVolumeRanges(); 124 124 static void setHeightmapRanges(); 125 static bool mapFlows();125 static bool setFlowRanges(); 126 126 127 127 static Flow *getFlow(const char *name); … … 129 129 static void deleteFlows(Tcl_Interp *interp); 130 130 static void deleteFlow(const char *name); 131 static void getFlowBounds(vrmath::Vector3f& min, 132 vrmath::Vector3f& max, 133 bool onlyVisible = false); 131 134 132 static void renderFlows(); 135 133 static void resetFlows(); -
branches/blt4/packages/vizservers/nanovis/util/Fonts.cpp
r3892 r3958 93 93 glLoadIdentity(); 94 94 95 #if 0 96 glDisable(GL_BLEND); 97 glEnable(GL_DEPTH_TEST); 98 #else 95 99 glEnable(GL_BLEND); 96 100 glDisable(GL_DEPTH_TEST); 101 #endif 97 102 } 98 103 … … 223 228 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); 224 229 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); 230 glTexEnvi(GL_TEXTURE_2D, GL_TEXTURE_ENV_MODE, GL_MODULATE); 225 231 glBindTexture(GL_TEXTURE_2D, 0); 226 232 -
branches/blt4/packages/vizservers/nanovis/vrmath/include/vrmath/Vector2f.h
r3892 r3958 40 40 void set(const Vector2f& v); 41 41 42 floatdot() const;42 double dot() const; 43 43 44 44 double length() const; … … 67 67 } 68 68 69 inline floatVector2f::dot() const69 inline double Vector2f::dot() const 70 70 { 71 71 return (x * x + y * y); -
branches/blt4/packages/vizservers/nanovis/vrmath/include/vrmath/Vector3f.h
r3892 r3958 58 58 Vector3f scale(const Vector3f& scale) const; 59 59 60 Vector3f scale( floatscale) const;60 Vector3f scale(double scale) const; 61 61 62 62 bool operator==(const Vector3f& v) const; … … 67 67 68 68 // scalar ops 69 Vector3f operator+( floatscalar) const;70 Vector3f operator-( floatscalar) const;71 Vector3f operator*( floatscalar) const;72 Vector3f operator/( floatscalar) const;73 Vector3f& operator*=( floatscalar);69 Vector3f operator+(double scalar) const; 70 Vector3f operator-(double scalar) const; 71 Vector3f operator*(double scalar) const; 72 Vector3f operator/(double scalar) const; 73 Vector3f& operator*=(double scalar); 74 74 75 75 // vector ops … … 113 113 } 114 114 115 inline Vector3f Vector3f::operator+( floatscalar) const115 inline Vector3f Vector3f::operator+(double scalar) const 116 116 { 117 117 return Vector3f(x + scalar, y + scalar, z + scalar); 118 118 } 119 119 120 inline Vector3f Vector3f::operator-( floatscalar) const120 inline Vector3f Vector3f::operator-(double scalar) const 121 121 { 122 122 return Vector3f(x - scalar, y - scalar, z - scalar); 123 123 } 124 124 125 inline Vector3f Vector3f::operator*( floatscalar) const125 inline Vector3f Vector3f::operator*(double scalar) const 126 126 { 127 127 return Vector3f(x * scalar, y * scalar, z * scalar); 128 128 } 129 129 130 inline Vector3f Vector3f::operator/( floatscalar) const130 inline Vector3f Vector3f::operator/(double scalar) const 131 131 { 132 132 return Vector3f(x / scalar, y / scalar, z / scalar); 133 133 } 134 134 135 inline Vector3f& Vector3f::operator*=( floatscalar)135 inline Vector3f& Vector3f::operator*=(double scalar) 136 136 { 137 137 x *= scalar; … … 168 168 169 169 #if 0 170 inline Vector3f operator*( floatscale, const Vector3f& value)170 inline Vector3f operator*(double scale, const Vector3f& value) 171 171 { 172 172 return Vector3f(value.x * scale, value.y * scale, value.z * scale); … … 231 231 inline Vector3f Vector3f::normalize() const 232 232 { 233 floatlen = length();234 if (len > 1.0e-6) {233 double len = length(); 234 if (len > 0.0) { 235 235 return Vector3f(x / len, y / len, z / len); 236 236 } else { … … 239 239 } 240 240 241 inline Vector3f Vector3f::scale( floatscale) const241 inline Vector3f Vector3f::scale(double scale) const 242 242 { 243 243 return Vector3f(x * scale, y * scale, z * scale); -
branches/blt4/packages/vizservers/nanovis/vrmath/include/vrmath/Vector4f.h
r3892 r3958 66 66 } 67 67 68 Vector4f operator*( floatop2) const68 Vector4f operator*(double op2) const 69 69 { 70 70 return Vector4f(x * op2, y * op2, z * op2, w * op2); 71 71 } 72 72 73 Vector4f operator/( floatop2) const73 Vector4f operator/(double op2) const 74 74 { 75 75 return Vector4f(x / op2, y / op2, z / op2, w / op2); … … 78 78 void divideByW(); 79 79 80 floatdot(const Vector4f& vec) const;80 double dot(const Vector4f& vec) const; 81 81 82 82 union { … … 122 122 } 123 123 124 inline floatVector4f::dot(const Vector4f& v) const124 inline double Vector4f::dot(const Vector4f& v) const 125 125 { 126 return ( x * v.x + y * v.y + z * v.z +w * v.w);126 return ((double)x * v.x + (double)y * v.y + (double)z * v.z + (double)w * v.w); 127 127 } 128 128 -
branches/blt4/packages/vizservers/vtkvis/DataSet.cpp
r3892 r3958 164 164 return false; 165 165 166 if (vtkUnstructuredGrid::SafeDownCast(_dataSet) != NULL ) {166 if (vtkUnstructuredGrid::SafeDownCast(_dataSet) != NULL && !isCloud()) { 167 167 vtkSmartPointer<vtkExtractUnstructuredGrid> filter = vtkSmartPointer<vtkExtractUnstructuredGrid>::New(); 168 168 #ifdef USE_VTK6 -
branches/blt4/packages/vizservers/vtkvis/Makefile.in
r3892 r3958 147 147 Molecule.cpp \ 148 148 Outline.cpp \ 149 Parallelepiped.cpp \ 149 150 PolyData.cpp \ 150 151 Polygon.cpp \ … … 230 231 Molecule.o: Molecule.h MoleculeData.h GraphicsObject.h DataSet.h Renderer.h ColorMap.h Trace.h 231 232 Outline.o: Outline.h GraphicsObject.h DataSet.h Trace.h 233 Parallelepiped.o: Parallelepiped.h Shape.h GraphicsObject.h DataSet.h Renderer.h Trace.h 232 234 PolyData.o: PolyData.h GraphicsObject.h DataSet.h Renderer.h Trace.h 233 235 Polygon.o: Polygon.h Shape.h GraphicsObject.h DataSet.h Renderer.h Trace.h … … 235 237 PseudoColor.o: PseudoColor.h GraphicsObject.h DataSet.h Renderer.h ColorMap.h Trace.h 236 238 ReadBuffer.o: ReadBuffer.h Trace.h 237 Renderer.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h Math.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h P olyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h238 RendererCmd.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h P olyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h239 RendererGraphicsObjs.o: Renderer.h RendererGraphicsObjs.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h P olyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h239 Renderer.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h Math.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelepiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h 240 RendererCmd.o: Renderer.h RendererGraphicsObjs.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelepiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h ReadBuffer.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h 241 RendererGraphicsObjs.o: Renderer.h RendererGraphicsObjs.h DataSet.h Arc.h Arrow.h Box.h Cone.h Contour2D.h Contour3D.h Cutplane.h Cylinder.h Disk.h Glyphs.h Group.h HeightMap.h Image.h LIC.h Line.h Molecule.h Outline.h Parallelepiped.h PolyData.h Polygon.h PseudoColor.h Sphere.h Streamlines.h Text3D.h Volume.h Warp.h ColorMap.h Trace.h 240 242 RenderServer.o: RenderServer.h RendererCmd.h Renderer.h vtkRpCubeAxesActor.h vtkRpAxisFollower.h vtkRpAxisActor.h ReadBuffer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h 241 243 ResponseQueue.o: ResponseQueue.h Trace.h -
branches/blt4/packages/vizservers/vtkvis/RenderServer.h
r3892 r3958 16 16 class Renderer; 17 17 18 #define VTKVIS_VERSION_STRING "1. 5"18 #define VTKVIS_VERSION_STRING "1.6" 19 19 20 20 #define MSECS_ELAPSED(t1, t2) \ -
branches/blt4/packages/vizservers/vtkvis/Renderer.cpp
r3892 r3958 197 197 deleteAllGraphicsObjects<Molecule>(); 198 198 deleteAllGraphicsObjects<Outline>(); 199 deleteAllGraphicsObjects<Parallelepiped>(); 199 200 deleteAllGraphicsObjects<PolyData>(); 200 201 deleteAllGraphicsObjects<Polygon>(); … … 382 383 bool needRangeUpdate = false; 383 384 do { 384 if (strcmp(itr->second->getActiveScalarsName(), scalarName) != 0) { 385 const char *name = itr->second->getActiveScalarsName(); 386 if (name == NULL || (strcmp(name, scalarName) != 0)) { 385 387 if (!itr->second->setActiveScalars(scalarName)) { 386 388 ret = false; … … 2436 2438 setGraphicsObjectAspect<Molecule>(aspectRatio); 2437 2439 setGraphicsObjectAspect<Outline>(aspectRatio); 2440 setGraphicsObjectAspect<Parallelepiped>(aspectRatio); 2438 2441 setGraphicsObjectAspect<PolyData>(aspectRatio); 2439 2442 setGraphicsObjectAspect<Polygon>(aspectRatio); … … 3357 3360 mergeGraphicsObjectBounds<Molecule>(bounds, onlyVisible); 3358 3361 mergeGraphicsObjectBounds<Outline>(bounds, onlyVisible); 3362 mergeGraphicsObjectBounds<Parallelepiped>(bounds, onlyVisible); 3359 3363 mergeGraphicsObjectBounds<PolyData>(bounds, onlyVisible); 3360 3364 mergeGraphicsObjectBounds<Polygon>(bounds, onlyVisible); … … 3429 3433 mergeGraphicsObjectUnscaledBounds<Outline>(bounds, onlyVisible); 3430 3434 mergeGraphicsObjectUnscaledBounds<PolyData>(bounds, onlyVisible); 3435 mergeGraphicsObjectUnscaledBounds<Parallelepiped>(bounds, onlyVisible); 3431 3436 mergeGraphicsObjectUnscaledBounds<Polygon>(bounds, onlyVisible); 3432 3437 mergeGraphicsObjectUnscaledBounds<PseudoColor>(bounds, onlyVisible); … … 4577 4582 setGraphicsObjectClippingPlanes<Molecule>(_activeClipPlanes); 4578 4583 setGraphicsObjectClippingPlanes<Outline>(_activeClipPlanes); 4584 setGraphicsObjectClippingPlanes<Parallelepiped>(_activeClipPlanes); 4579 4585 setGraphicsObjectClippingPlanes<PolyData>(_activeClipPlanes); 4580 4586 setGraphicsObjectClippingPlanes<Polygon>(_activeClipPlanes); -
branches/blt4/packages/vizservers/vtkvis/Renderer.h
r3892 r3958 45 45 #include "Molecule.h" 46 46 #include "Outline.h" 47 #include "Parallelepiped.h" 47 48 #include "PolyData.h" 48 49 #include "Polygon.h" … … 809 810 const char *name, double range[2] = NULL); 810 811 811 // N-sided Regular Polygons 812 813 bool addPolygon(const DataSetId& id, int numSides, double center[3], double normal[3], double radius); 812 // Parallelepipeds 813 814 bool addParallelepiped(const DataSetId& id, double vec1[3], double vec2[3], double vec3[3], 815 bool flipNormals = false); 814 816 815 817 // PolyData meshes … … 826 828 DataSet::DataAttributeType type, 827 829 const char *name, double range[2] = NULL); 830 831 // N-sided Regular Polygons 832 833 bool addPolygon(const DataSetId& id, int numSides, double center[3], double normal[3], double radius); 828 834 829 835 // Color-mapped surfaces … … 975 981 typedef std::tr1::unordered_map<DataSetId, Molecule *> MoleculeHashmap; 976 982 typedef std::tr1::unordered_map<DataSetId, Outline *> OutlineHashmap; 983 typedef std::tr1::unordered_map<DataSetId, Parallelepiped *> ParallelepipedHashmap; 977 984 typedef std::tr1::unordered_map<DataSetId, PolyData *> PolyDataHashmap; 978 985 typedef std::tr1::unordered_map<DataSetId, Polygon *> PolygonHashmap; … … 1114 1121 MoleculeHashmap _molecules; 1115 1122 OutlineHashmap _outlines; 1123 ParallelepipedHashmap _parallelepipeds; 1116 1124 PolyDataHashmap _polyDatas; 1117 1125 PolygonHashmap _polygons; -
branches/blt4/packages/vizservers/vtkvis/RendererCmd.cpp
r3892 r3958 1317 1317 { 1318 1318 const char *title = Tcl_GetString(objv[3]); 1319 if (strlen(title) > 30) {1319 if (strlen(title) > 60) { 1320 1320 Tcl_AppendResult(interp, "axis name \"", title, 1321 1321 "\" is too long", (char*)NULL); … … 1601 1601 { 1602 1602 const char *units = Tcl_GetString(objv[3]); 1603 if (strlen(units) > 10) {1603 if (strlen(units) > 20) { 1604 1604 Tcl_AppendResult(interp, "axis units name \"", units, 1605 1605 "\" is too long", (char*)NULL); … … 8559 8559 8560 8560 static int 8561 ParallelepipedAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 8562 Tcl_Obj *const *objv) 8563 { 8564 double vec1[3], vec2[3], vec3[3]; 8565 if (Tcl_GetDoubleFromObj(interp, objv[2], &vec1[0]) != TCL_OK || 8566 Tcl_GetDoubleFromObj(interp, objv[3], &vec1[1]) != TCL_OK || 8567 Tcl_GetDoubleFromObj(interp, objv[4], &vec1[2]) != TCL_OK || 8568 Tcl_GetDoubleFromObj(interp, objv[5], &vec2[0]) != TCL_OK || 8569 Tcl_GetDoubleFromObj(interp, objv[6], &vec2[1]) != TCL_OK || 8570 Tcl_GetDoubleFromObj(interp, objv[7], &vec2[2]) != TCL_OK || 8571 Tcl_GetDoubleFromObj(interp, objv[8], &vec3[0]) != TCL_OK || 8572 Tcl_GetDoubleFromObj(interp, objv[9], &vec3[1]) != TCL_OK || 8573 Tcl_GetDoubleFromObj(interp, objv[10], &vec3[2]) != TCL_OK) { 8574 return TCL_ERROR; 8575 } 8576 const char *name = Tcl_GetString(objv[11]); 8577 if (!g_renderer->addParallelepiped(name, vec1, vec2, vec3)) { 8578 Tcl_AppendResult(interp, "Failed to create parallelepiped", (char*)NULL); 8579 return TCL_ERROR; 8580 } 8581 return TCL_OK; 8582 } 8583 8584 static int 8585 ParallelepipedDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 8586 Tcl_Obj *const *objv) 8587 { 8588 if (objc == 3) { 8589 const char *name = Tcl_GetString(objv[2]); 8590 g_renderer->deleteGraphicsObject<Parallelepiped>(name); 8591 } else { 8592 g_renderer->deleteGraphicsObject<Parallelepiped>("all"); 8593 } 8594 return TCL_OK; 8595 } 8596 8597 static int 8598 ParallelepipedColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 8599 Tcl_Obj *const *objv) 8600 { 8601 float color[3]; 8602 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 8603 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 8604 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 8605 return TCL_ERROR; 8606 } 8607 if (objc == 6) { 8608 const char *name = Tcl_GetString(objv[5]); 8609 g_renderer->setGraphicsObjectColor<Parallelepiped>(name, color); 8610 } else { 8611 g_renderer->setGraphicsObjectColor<Parallelepiped>("all", color); 8612 } 8613 return TCL_OK; 8614 } 8615 8616 static int 8617 ParallelepipedCullingOp(ClientData clientData, Tcl_Interp *interp, int objc, 8618 Tcl_Obj *const *objv) 8619 { 8620 bool state; 8621 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8622 return TCL_ERROR; 8623 } 8624 if (objc == 4) { 8625 const char *name = Tcl_GetString(objv[3]); 8626 g_renderer->setGraphicsObjectCulling<Parallelepiped>(name, state); 8627 } else { 8628 g_renderer->setGraphicsObjectCulling<Parallelepiped>("all", state); 8629 } 8630 return TCL_OK; 8631 } 8632 8633 static int 8634 ParallelepipedEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 8635 Tcl_Obj *const *objv) 8636 { 8637 bool state; 8638 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8639 return TCL_ERROR; 8640 } 8641 if (objc == 4) { 8642 const char *name = Tcl_GetString(objv[3]); 8643 g_renderer->setGraphicsObjectEdgeVisibility<Parallelepiped>(name, state); 8644 } else { 8645 g_renderer->setGraphicsObjectEdgeVisibility<Parallelepiped>("all", state); 8646 } 8647 return TCL_OK; 8648 } 8649 8650 static int 8651 ParallelepipedFlipNormalsOp(ClientData clientData, Tcl_Interp *interp, int objc, 8652 Tcl_Obj *const *objv) 8653 { 8654 bool state; 8655 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8656 return TCL_ERROR; 8657 } 8658 if (objc == 4) { 8659 const char *name = Tcl_GetString(objv[3]); 8660 g_renderer->setGraphicsObjectFlipNormals<Parallelepiped>(name, state); 8661 } else { 8662 g_renderer->setGraphicsObjectFlipNormals<Parallelepiped>("all", state); 8663 } 8664 return TCL_OK; 8665 } 8666 8667 static int 8668 ParallelepipedLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 8669 Tcl_Obj *const *objv) 8670 { 8671 bool state; 8672 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8673 return TCL_ERROR; 8674 } 8675 if (objc == 4) { 8676 const char *name = Tcl_GetString(objv[3]); 8677 g_renderer->setGraphicsObjectLighting<Parallelepiped>(name, state); 8678 } else { 8679 g_renderer->setGraphicsObjectLighting<Parallelepiped>("all", state); 8680 } 8681 return TCL_OK; 8682 } 8683 8684 static int 8685 ParallelepipedLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 8686 Tcl_Obj *const *objv) 8687 { 8688 float color[3]; 8689 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 8690 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 8691 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 8692 return TCL_ERROR; 8693 } 8694 if (objc == 6) { 8695 const char *name = Tcl_GetString(objv[5]); 8696 g_renderer->setGraphicsObjectEdgeColor<Parallelepiped>(name, color); 8697 } else { 8698 g_renderer->setGraphicsObjectEdgeColor<Parallelepiped>("all", color); 8699 } 8700 return TCL_OK; 8701 } 8702 8703 static int 8704 ParallelepipedLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 8705 Tcl_Obj *const *objv) 8706 { 8707 float width; 8708 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 8709 return TCL_ERROR; 8710 } 8711 if (objc == 4) { 8712 const char *name = Tcl_GetString(objv[3]); 8713 g_renderer->setGraphicsObjectEdgeWidth<Parallelepiped>(name, width); 8714 } else { 8715 g_renderer->setGraphicsObjectEdgeWidth<Parallelepiped>("all", width); 8716 } 8717 return TCL_OK; 8718 } 8719 8720 static int 8721 ParallelepipedMaterialOp(ClientData clientData, Tcl_Interp *interp, int objc, 8722 Tcl_Obj *const *objv) 8723 { 8724 double ambient, diffuse, specCoeff, specPower; 8725 if (Tcl_GetDoubleFromObj(interp, objv[2], &ambient) != TCL_OK || 8726 Tcl_GetDoubleFromObj(interp, objv[3], &diffuse) != TCL_OK || 8727 Tcl_GetDoubleFromObj(interp, objv[4], &specCoeff) != TCL_OK || 8728 Tcl_GetDoubleFromObj(interp, objv[5], &specPower) != TCL_OK) { 8729 return TCL_ERROR; 8730 } 8731 8732 if (objc == 7) { 8733 const char *name = Tcl_GetString(objv[6]); 8734 g_renderer->setGraphicsObjectAmbient<Parallelepiped>(name, ambient); 8735 g_renderer->setGraphicsObjectDiffuse<Parallelepiped>(name, diffuse); 8736 g_renderer->setGraphicsObjectSpecular<Parallelepiped>(name, specCoeff, specPower); 8737 } else { 8738 g_renderer->setGraphicsObjectAmbient<Parallelepiped>("all", ambient); 8739 g_renderer->setGraphicsObjectDiffuse<Parallelepiped>("all", diffuse); 8740 g_renderer->setGraphicsObjectSpecular<Parallelepiped>("all", specCoeff, specPower); 8741 } 8742 return TCL_OK; 8743 } 8744 8745 static int 8746 ParallelepipedOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 8747 Tcl_Obj *const *objv) 8748 { 8749 double opacity; 8750 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 8751 return TCL_ERROR; 8752 } 8753 if (objc == 4) { 8754 const char *name = Tcl_GetString(objv[3]); 8755 g_renderer->setGraphicsObjectOpacity<Parallelepiped>(name, opacity); 8756 } else { 8757 g_renderer->setGraphicsObjectOpacity<Parallelepiped>("all", opacity); 8758 } 8759 return TCL_OK; 8760 } 8761 8762 static int 8763 ParallelepipedOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 8764 Tcl_Obj *const *objv) 8765 { 8766 double quat[4]; 8767 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 8768 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 8769 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 8770 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 8771 return TCL_ERROR; 8772 } 8773 if (objc == 7) { 8774 const char *name = Tcl_GetString(objv[6]); 8775 g_renderer->setGraphicsObjectOrientation<Parallelepiped>(name, quat); 8776 } else { 8777 g_renderer->setGraphicsObjectOrientation<Parallelepiped>("all", quat); 8778 } 8779 return TCL_OK; 8780 } 8781 8782 static int 8783 ParallelepipedOriginOp(ClientData clientData, Tcl_Interp *interp, int objc, 8784 Tcl_Obj *const *objv) 8785 { 8786 double origin[3]; 8787 if (Tcl_GetDoubleFromObj(interp, objv[2], &origin[0]) != TCL_OK || 8788 Tcl_GetDoubleFromObj(interp, objv[3], &origin[1]) != TCL_OK || 8789 Tcl_GetDoubleFromObj(interp, objv[4], &origin[2]) != TCL_OK) { 8790 return TCL_ERROR; 8791 } 8792 if (objc == 6) { 8793 const char *name = Tcl_GetString(objv[5]); 8794 g_renderer->setGraphicsObjectOrigin<Parallelepiped>(name, origin); 8795 } else { 8796 g_renderer->setGraphicsObjectOrigin<Parallelepiped>("all", origin); 8797 } 8798 return TCL_OK; 8799 } 8800 8801 static int 8802 ParallelepipedPositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 8803 Tcl_Obj *const *objv) 8804 { 8805 double pos[3]; 8806 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 8807 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 8808 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 8809 return TCL_ERROR; 8810 } 8811 if (objc == 6) { 8812 const char *name = Tcl_GetString(objv[5]); 8813 g_renderer->setGraphicsObjectPosition<Parallelepiped>(name, pos); 8814 } else { 8815 g_renderer->setGraphicsObjectPosition<Parallelepiped>("all", pos); 8816 } 8817 return TCL_OK; 8818 } 8819 8820 static int 8821 ParallelepipedScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 8822 Tcl_Obj *const *objv) 8823 { 8824 double scale[3]; 8825 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 8826 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 8827 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 8828 return TCL_ERROR; 8829 } 8830 if (objc == 6) { 8831 const char *name = Tcl_GetString(objv[5]); 8832 g_renderer->setGraphicsObjectScale<Parallelepiped>(name, scale); 8833 } else { 8834 g_renderer->setGraphicsObjectScale<Parallelepiped>("all", scale); 8835 } 8836 return TCL_OK; 8837 } 8838 8839 static int 8840 ParallelepipedShadingOp(ClientData clientData, Tcl_Interp *interp, int objc, 8841 Tcl_Obj *const *objv) 8842 { 8843 GraphicsObject::ShadingModel shadeModel; 8844 const char *str = Tcl_GetString(objv[2]); 8845 if (str[0] == 'f' && strcmp(str, "flat") == 0) { 8846 shadeModel = GraphicsObject::SHADE_FLAT; 8847 } else if (str[0] == 's' && strcmp(str, "smooth") == 0) { 8848 shadeModel = GraphicsObject::SHADE_GOURAUD; 8849 } else { 8850 Tcl_AppendResult(interp, "bad shading option \"", str, 8851 "\": should be one of: 'flat', 'smooth'", (char*)NULL); 8852 return TCL_ERROR; 8853 } 8854 if (objc == 4) { 8855 const char *name = Tcl_GetString(objv[3]); 8856 g_renderer->setGraphicsObjectShadingModel<Parallelepiped>(name, shadeModel); 8857 } else { 8858 g_renderer->setGraphicsObjectShadingModel<Parallelepiped>("all", shadeModel); 8859 } 8860 return TCL_OK; 8861 } 8862 8863 static int 8864 ParallelepipedVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 8865 Tcl_Obj *const *objv) 8866 { 8867 bool state; 8868 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8869 return TCL_ERROR; 8870 } 8871 if (objc == 4) { 8872 const char *name = Tcl_GetString(objv[3]); 8873 g_renderer->setGraphicsObjectVisibility<Parallelepiped>(name, state); 8874 } else { 8875 g_renderer->setGraphicsObjectVisibility<Parallelepiped>("all", state); 8876 } 8877 return TCL_OK; 8878 } 8879 8880 static int 8881 ParallelepipedWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 8882 Tcl_Obj *const *objv) 8883 { 8884 bool state; 8885 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 8886 return TCL_ERROR; 8887 } 8888 if (objc == 4) { 8889 const char *name = Tcl_GetString(objv[3]); 8890 g_renderer->setGraphicsObjectWireframe<Parallelepiped>(name, state); 8891 } else { 8892 g_renderer->setGraphicsObjectWireframe<Parallelepiped>("all", state); 8893 } 8894 return TCL_OK; 8895 } 8896 8897 static Rappture::CmdSpec parallelepipedOps[] = { 8898 {"add", 1, ParallelepipedAddOp, 12, 12, "v0x v0y v0z v1x v1y v1z v2x v2y v2z name"}, 8899 {"color", 2, ParallelepipedColorOp, 5, 6, "r g b ?name?"}, 8900 {"culling", 2, ParallelepipedCullingOp, 3, 4, "bool ?name?"}, 8901 {"delete", 1, ParallelepipedDeleteOp, 2, 3, "?name?"}, 8902 {"edges", 1, ParallelepipedEdgeVisibilityOp, 3, 4, "bool ?name?"}, 8903 {"flipnorms", 1, ParallelepipedFlipNormalsOp, 3, 4, "bool ?name?"}, 8904 {"lighting", 3, ParallelepipedLightingOp, 3, 4, "bool ?name?"}, 8905 {"linecolor", 5, ParallelepipedLineColorOp, 5, 6, "r g b ?name?"}, 8906 {"linewidth", 5, ParallelepipedLineWidthOp, 3, 4, "width ?name?"}, 8907 {"material", 1, ParallelepipedMaterialOp, 6, 7, "ambientCoeff diffuseCoeff specularCoeff specularPower ?name?"}, 8908 {"opacity", 2, ParallelepipedOpacityOp, 3, 4, "value ?name?"}, 8909 {"orient", 4, ParallelepipedOrientOp, 6, 7, "qw qx qy qz ?name?"}, 8910 {"origin", 4, ParallelepipedOriginOp, 5, 6, "x y z ?name?"}, 8911 {"pos", 1, ParallelepipedPositionOp, 5, 6, "x y z ?name?"}, 8912 {"scale", 2, ParallelepipedScaleOp, 5, 6, "sx sy sz ?name?"}, 8913 {"shading", 2, ParallelepipedShadingOp, 3, 4, "val ?name?"}, 8914 {"visible", 1, ParallelepipedVisibleOp, 3, 4, "bool ?name?"}, 8915 {"wireframe", 1, ParallelepipedWireframeOp, 3, 4, "bool ?name?"} 8916 }; 8917 static int nParallelepipedOps = NumCmdSpecs(parallelepipedOps); 8918 8919 static int 8920 ParallelepipedCmd(ClientData clientData, Tcl_Interp *interp, int objc, 8921 Tcl_Obj *const *objv) 8922 { 8923 Tcl_ObjCmdProc *proc; 8924 8925 proc = Rappture::GetOpFromObj(interp, nParallelepipedOps, parallelepipedOps, 8926 Rappture::CMDSPEC_ARG1, objc, objv, 0); 8927 if (proc == NULL) { 8928 return TCL_ERROR; 8929 } 8930 return (*proc) (clientData, interp, objc, objv); 8931 } 8932 8933 static int 8561 8934 PolyDataAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 8562 8935 Tcl_Obj *const *objv) … … 12228 12601 { 12229 12602 Tcl_MakeSafe(interp); 12230 Tcl_CreateObjCommand(interp, "arc", ArcCmd, clientData, NULL); 12231 Tcl_CreateObjCommand(interp, "arrow", ArrowCmd, clientData, NULL); 12232 Tcl_CreateObjCommand(interp, "axis", AxisCmd, clientData, NULL); 12233 Tcl_CreateObjCommand(interp, "box", BoxCmd, clientData, NULL); 12234 Tcl_CreateObjCommand(interp, "camera", CameraCmd, clientData, NULL); 12235 Tcl_CreateObjCommand(interp, "clientinfo", ClientInfoCmd, clientData, NULL); 12236 Tcl_CreateObjCommand(interp, "colormap", ColorMapCmd, clientData, NULL); 12237 Tcl_CreateObjCommand(interp, "cone", ConeCmd, clientData, NULL); 12238 Tcl_CreateObjCommand(interp, "contour2d", Contour2DCmd, clientData, NULL); 12239 Tcl_CreateObjCommand(interp, "contour3d", Contour3DCmd, clientData, NULL); 12240 Tcl_CreateObjCommand(interp, "cutplane", CutplaneCmd, clientData, NULL); 12241 Tcl_CreateObjCommand(interp, "cylinder", CylinderCmd, clientData, NULL); 12242 Tcl_CreateObjCommand(interp, "dataset", DataSetCmd, clientData, NULL); 12243 Tcl_CreateObjCommand(interp, "disk", DiskCmd, clientData, NULL); 12244 Tcl_CreateObjCommand(interp, "glyphs", GlyphsCmd, clientData, NULL); 12245 Tcl_CreateObjCommand(interp, "group", GroupCmd, clientData, NULL); 12246 Tcl_CreateObjCommand(interp, "heightmap", HeightMapCmd, clientData, NULL); 12247 Tcl_CreateObjCommand(interp, "image", ImageCmd, clientData, NULL); 12248 Tcl_CreateObjCommand(interp, "imgflush", ImageFlushCmd, clientData, NULL); 12249 Tcl_CreateObjCommand(interp, "legend", LegendCmd, clientData, NULL); 12250 Tcl_CreateObjCommand(interp, "legend2", LegendSimpleCmd,clientData, NULL); 12251 Tcl_CreateObjCommand(interp, "lic", LICCmd, clientData, NULL); 12252 Tcl_CreateObjCommand(interp, "line", LineCmd, clientData, NULL); 12253 Tcl_CreateObjCommand(interp, "molecule", MoleculeCmd, clientData, NULL); 12254 Tcl_CreateObjCommand(interp, "outline", OutlineCmd, clientData, NULL); 12255 Tcl_CreateObjCommand(interp, "polydata", PolyDataCmd, clientData, NULL); 12256 Tcl_CreateObjCommand(interp, "polygon", PolygonCmd, clientData, NULL); 12257 Tcl_CreateObjCommand(interp, "pseudocolor", PseudoColorCmd, clientData, NULL); 12258 Tcl_CreateObjCommand(interp, "renderer", RendererCmd, clientData, NULL); 12259 Tcl_CreateObjCommand(interp, "screen", ScreenCmd, clientData, NULL); 12260 Tcl_CreateObjCommand(interp, "sphere", SphereCmd, clientData, NULL); 12261 Tcl_CreateObjCommand(interp, "streamlines", StreamlinesCmd, clientData, NULL); 12262 Tcl_CreateObjCommand(interp, "text3d", Text3DCmd, clientData, NULL); 12263 Tcl_CreateObjCommand(interp, "volume", VolumeCmd, clientData, NULL); 12264 Tcl_CreateObjCommand(interp, "warp", WarpCmd, clientData, NULL); 12603 Tcl_CreateObjCommand(interp, "arc", ArcCmd, clientData, NULL); 12604 Tcl_CreateObjCommand(interp, "arrow", ArrowCmd, clientData, NULL); 12605 Tcl_CreateObjCommand(interp, "axis", AxisCmd, clientData, NULL); 12606 Tcl_CreateObjCommand(interp, "box", BoxCmd, clientData, NULL); 12607 Tcl_CreateObjCommand(interp, "camera", CameraCmd, clientData, NULL); 12608 Tcl_CreateObjCommand(interp, "clientinfo", ClientInfoCmd, clientData, NULL); 12609 Tcl_CreateObjCommand(interp, "colormap", ColorMapCmd, clientData, NULL); 12610 Tcl_CreateObjCommand(interp, "cone", ConeCmd, clientData, NULL); 12611 Tcl_CreateObjCommand(interp, "contour2d", Contour2DCmd, clientData, NULL); 12612 Tcl_CreateObjCommand(interp, "contour3d", Contour3DCmd, clientData, NULL); 12613 Tcl_CreateObjCommand(interp, "cutplane", CutplaneCmd, clientData, NULL); 12614 Tcl_CreateObjCommand(interp, "cylinder", CylinderCmd, clientData, NULL); 12615 Tcl_CreateObjCommand(interp, "dataset", DataSetCmd, clientData, NULL); 12616 Tcl_CreateObjCommand(interp, "disk", DiskCmd, clientData, NULL); 12617 Tcl_CreateObjCommand(interp, "glyphs", GlyphsCmd, clientData, NULL); 12618 Tcl_CreateObjCommand(interp, "group", GroupCmd, clientData, NULL); 12619 Tcl_CreateObjCommand(interp, "heightmap", HeightMapCmd, clientData, NULL); 12620 Tcl_CreateObjCommand(interp, "image", ImageCmd, clientData, NULL); 12621 Tcl_CreateObjCommand(interp, "imgflush", ImageFlushCmd, clientData, NULL); 12622 Tcl_CreateObjCommand(interp, "legend", LegendCmd, clientData, NULL); 12623 Tcl_CreateObjCommand(interp, "legend2", LegendSimpleCmd, clientData, NULL); 12624 Tcl_CreateObjCommand(interp, "lic", LICCmd, clientData, NULL); 12625 Tcl_CreateObjCommand(interp, "line", LineCmd, clientData, NULL); 12626 Tcl_CreateObjCommand(interp, "molecule", MoleculeCmd, clientData, NULL); 12627 Tcl_CreateObjCommand(interp, "outline", OutlineCmd, clientData, NULL); 12628 Tcl_CreateObjCommand(interp, "parallelepiped", ParallelepipedCmd, clientData, NULL); 12629 Tcl_CreateObjCommand(interp, "polydata", PolyDataCmd, clientData, NULL); 12630 Tcl_CreateObjCommand(interp, "polygon", PolygonCmd, clientData, NULL); 12631 Tcl_CreateObjCommand(interp, "pseudocolor", PseudoColorCmd, clientData, NULL); 12632 Tcl_CreateObjCommand(interp, "renderer", RendererCmd, clientData, NULL); 12633 Tcl_CreateObjCommand(interp, "screen", ScreenCmd, clientData, NULL); 12634 Tcl_CreateObjCommand(interp, "sphere", SphereCmd, clientData, NULL); 12635 Tcl_CreateObjCommand(interp, "streamlines", StreamlinesCmd, clientData, NULL); 12636 Tcl_CreateObjCommand(interp, "text3d", Text3DCmd, clientData, NULL); 12637 Tcl_CreateObjCommand(interp, "volume", VolumeCmd, clientData, NULL); 12638 Tcl_CreateObjCommand(interp, "warp", WarpCmd, clientData, NULL); 12265 12639 } 12266 12640 … … 12295 12669 Tcl_DeleteCommand(interp, "molecule"); 12296 12670 Tcl_DeleteCommand(interp, "outline"); 12671 Tcl_DeleteCommand(interp, "parallelepiped"); 12297 12672 Tcl_DeleteCommand(interp, "polydata"); 12298 12673 Tcl_DeleteCommand(interp, "polygon"); -
branches/blt4/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp
r3892 r3958 28 28 #include "Line.h" 29 29 #include "Molecule.h" 30 #include "Parallelepiped.h" 30 31 #include "PolyData.h" 31 32 #include "PseudoColor.h" … … 123 124 Renderer::getGraphicsObjectHashmap<Outline>() 124 125 { return _outlines; } 126 127 template<> 128 Renderer::ParallelepipedHashmap & 129 Renderer::getGraphicsObjectHashmap<Parallelepiped>() 130 { return _parallelepipeds; } 125 131 126 132 template<> … … 173 179 template Group *Renderer::getGraphicsObject(const DataSetId&); 174 180 template Line *Renderer::getGraphicsObject(const DataSetId&); 181 template Parallelepiped *Renderer::getGraphicsObject(const DataSetId&); 175 182 template Polygon *Renderer::getGraphicsObject(const DataSetId&); 176 183 template Sphere *Renderer::getGraphicsObject(const DataSetId&); … … 287 294 } 288 295 if ((gobj = getGraphicsObject<Line>(id)) != NULL) { 296 return gobj; 297 } 298 if ((gobj = getGraphicsObject<Parallelepiped>(id)) != NULL) { 289 299 return gobj; 290 300 } … … 2938 2948 2939 2949 /** 2950 * \brief Create a new Parallelepiped and associate it with an ID 2951 */ 2952 bool Renderer::addParallelepiped(const DataSetId& id, 2953 double vec1[3], double vec2[3], double vec3[3], 2954 bool flipNormals) 2955 { 2956 Parallelepiped *gobj; 2957 if ((gobj = getGraphicsObject<Parallelepiped>(id)) != NULL) { 2958 WARN("Replacing existing %s %s", gobj->getClassName(), id.c_str()); 2959 deleteGraphicsObject<Parallelepiped>(id); 2960 } 2961 2962 gobj = new Parallelepiped(); 2963 2964 gobj->setDataSet(NULL, this); 2965 2966 if (gobj->getProp() == NULL && 2967 gobj->getOverlayProp() == NULL) { 2968 delete gobj; 2969 return false; 2970 } else { 2971 if (gobj->getProp()) 2972 _renderer->AddViewProp(gobj->getProp()); 2973 if (gobj->getOverlayProp()) 2974 _renderer->AddViewProp(gobj->getOverlayProp()); 2975 } 2976 2977 gobj->setVectors(vec1, vec2, vec3); 2978 if (flipNormals) 2979 gobj->flipNormals(flipNormals); 2980 2981 getGraphicsObjectHashmap<Parallelepiped>()[id] = gobj; 2982 2983 sceneBoundsChanged(); 2984 _needsRedraw = true; 2985 return true; 2986 } 2987 2988 /** 2940 2989 * \brief Create a new n-sided regular Polygon and associate it with an ID 2941 2990 */ -
branches/blt4/packages/vizservers/vtkvis/Volume.cpp
r3892 r3958 14 14 #include <vtkGPUVolumeRayCastMapper.h> 15 15 #include <vtkVolumeTextureMapper3D.h> 16 #include <vtkRectilinearGrid.h> 17 #include <vtkStructuredGrid.h> 16 18 #include <vtkUnstructuredGrid.h> 17 19 #include <vtkPolyData.h> … … 121 123 #endif 122 124 vtkVolumeMapper::SafeDownCast(_volumeMapper)->SetBlendModeToComposite(); 123 } else if (_dataSet->isCloud()) { 124 // DataSet is a 3D point cloud 125 } else if (_dataSet->isCloud() || 126 vtkUnstructuredGrid::SafeDownCast(ds) == NULL) { 127 // DataSet is a 3D point cloud, rectilinear grid or structured grid 125 128 vtkSmartPointer<vtkGaussianSplatter> splatter = vtkSmartPointer<vtkGaussianSplatter>::New(); 126 129 #ifdef USE_VTK6 … … 131 134 int dims[3]; 132 135 dims[0] = dims[1] = dims[2] = 64; 133 TRACE("Generating volume with dims (%d,%d,%d) from point cloud", 134 dims[0], dims[1], dims[2]); 136 if (vtkStructuredGrid::SafeDownCast(ds) != NULL) { 137 vtkStructuredGrid::SafeDownCast(ds)->GetDimensions(dims); 138 } else if (vtkRectilinearGrid::SafeDownCast(ds) != NULL) { 139 vtkRectilinearGrid::SafeDownCast(ds)->GetDimensions(dims); 140 } 141 TRACE("Generating volume with dims (%d,%d,%d) from %d points", 142 dims[0], dims[1], dims[2], ds->GetNumberOfPoints()); 135 143 splatter->SetSampleDimensions(dims); 136 144 splatter->Update(); … … 144 152 _volumeMapper->SetInputConnection(splatter->GetOutputPort()); 145 153 vtkVolumeMapper::SafeDownCast(_volumeMapper)->SetBlendModeToComposite(); 146 } else if (vtkUnstructuredGrid::SafeDownCast(ds) != NULL){154 } else { 147 155 // Unstructured grid with cells (not a cloud) 148 156 vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::SafeDownCast(ds); 157 assert(ugrid != NULL); 149 158 // DataSet is unstructured grid 150 159 // Only works if cells are all tetrahedra … … 177 186 vtkUnstructuredGridVolumeMapper::SafeDownCast(_volumeMapper)-> 178 187 SetBlendModeToComposite(); 179 } else {180 ERROR("Unsupported DataSet type: %s", _dataSet->getVtkType());181 _dataSet = NULL;182 return;183 188 } 184 189 -
branches/blt4/packages/vizservers/vtkvis/protocol.txt
r3892 r3958 685 685 outline scale <sx> <sy> <sz> <?datasetName?> 686 686 outline visible <bool> <?datasetName?> 687 688 parallelepiped add <v0x> <v0y> <v0z> <v1x> <v1y> <v1z> <v2x> <v2y> <v2z> <name> 689 Specify parallelepiped using 3 basis vectors. The 3 vectors should 690 be given in order to create a right-handed coordinate system, i.e. 691 (v0 cross v1) dot v2 should be positive. 692 parallelepiped color <r> <g> <b> <?name?> 693 parallelepiped culling <bool> <?name?> 694 parallelepiped delete <?name?> 695 parallelepiped edges <bool> <?name?> 696 parallelepiped flipnorm <bool> <?name?> 697 parallelepiped lighting <bool> <?name?> 698 parallelepiped linecolor <r> <g> <b> <?name?> 699 parallelepiped linewidth <val> <?name?> 700 parallelepiped material <ambientCoeff> <diffuseCoeff> <specularCoeff> <specularExp> <?name?> 701 parallelepiped opacity <val> <?name?> 702 parallelepiped orient <qw> <qx> <qy> <qz> <?name?> 703 parallelepiped origin <x> <y> <z> <?name?> 704 parallelepiped pos <x> <y> <z> <?name?> 705 parallelepiped scale <sx> <sy> <sz> <?name?> 706 parallelepiped shading <val> <?name?> 707 val = flat|smooth 708 parallelepiped visible <bool> <?name?> 709 parallelepiped wireframe <bool> <?name?> 687 710 688 711 polydata add <?datasetName?>
Note: See TracChangeset
for help on using the changeset viewer.