Changeset 2523
- Timestamp:
- Sep 18, 2011 10:49:05 PM (12 years ago)
- Location:
- branches/vtkvis_threaded
- Files:
-
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/vtkvis_threaded/Makefile.in
r2495 r2523 47 47 DEBUG = #yes 48 48 TRACE = #yes 49 USE_CUSTOM_AXES = yes 50 USE_GPU_RAYCASTING = yes 51 USE_OFFSCREEN_RENDERING = yes 49 HAVE_GLYPH3D_MAPPER = #yes 50 USE_CUSTOM_AXES = yes 51 USE_GPU_RAYCASTING = yes 52 USE_OFFSCREEN_RENDERING = yes 52 53 USE_THREADS = yes 53 54 … … 61 62 ifdef TRACE 62 63 DEFINES += -DWANT_TRACE 64 endif 65 ifdef HAVE_GLYPH3D_MAPPER 66 DEFINES += -DHAVE_GLYPH3D_MAPPER 63 67 endif 64 68 ifdef USE_CUSTOM_AXES … … 82 86 RpContour2D.cpp \ 83 87 RpContour3D.cpp \ 88 RpCutplane.cpp \ 84 89 RpGlyphs.cpp \ 85 90 RpHeightMap.cpp \ … … 140 145 RpContour2D.o: RpContour2D.h RpVtkGraphicsObject.h RpVtkDataSet.h Trace.h 141 146 RpContour3D.o: RpContour3D.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 147 RpCutplane.o: RpCutplane.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 142 148 RpGlyphs.o: RpGlyphs.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 143 149 RpHeightMap.o: RpHeightMap.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h … … 149 155 RpVolume.o: RpVolume.h RpVtkGraphicsObject.h RpVtkDataSet.h ColorMap.h Trace.h 150 156 RpVtkDataSet.o: RpVtkDataSet.h Trace.h 151 RpVtkRenderer.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h152 RpVtkRendererCmd.o: RpVtkRenderer.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h153 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h157 RpVtkRenderer.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h Trace.h 158 RpVtkRendererCmd.o: RpVtkRenderer.h vtkRpCubeAxesActor2D.h RpVtkDataSet.h RpContour2D.h RpContour3D.h RpGlyphs.h RpHeightMap.h RpLIC.h RpMolecule.h RpPolyData.h RpPseudoColor.h RpStreamlines.h RpVolume.h ColorMap.h ResponseQueue.h Trace.h CmdProc.h PPMWriter.h TGAWriter.h 159 RpVtkRenderServer.o: RpVtkRenderServer.h RpVtkRendererCmd.h RpVtkRenderer.h vtkRpCubeAxesActor2D.h ResponseQueue.h Trace.h PPMWriter.h TGAWriter.h 154 160 Trace.o: Trace.h 155 161 TGAWriter.o: TGAWriter.h ResponseQueue.h Trace.h -
branches/vtkvis_threaded/RpContour3D.cpp
r2459 r2523 172 172 _contourMapper->SetResolveCoincidentTopologyToPolygonOffset(); 173 173 _contourMapper->SetInputConnection(_contourFilter->GetOutputPort()); 174 _contourMapper->SetColorModeToMapScalars(); 174 175 getActor()->SetMapper(_contourMapper); 175 176 } -
branches/vtkvis_threaded/RpHeightMap.cpp
r2459 r2523 91 91 _dataRange[1] = scalarRange[1]; 92 92 } else { 93 dataSet->getScalarRange(_dataRange);93 _dataSet->getScalarRange(_dataRange); 94 94 } 95 95 -
branches/vtkvis_threaded/RpHeightMap.h
r2457 r2523 73 73 void setHeightScale(double scale); 74 74 75 double getHeightScale() 76 { 77 return _warpScale; 78 } 79 75 80 void setNumContours(int numContours); 76 81 -
branches/vtkvis_threaded/RpLIC.cpp
r2459 r2523 24 24 #include "RpLIC.h" 25 25 #include "Trace.h" 26 #include "RpVtkRenderServer.h"27 26 28 27 using namespace Rappture::VtkVis; -
branches/vtkvis_threaded/RpPseudoColor.cpp
r2496 r2523 10 10 #include <vtkDataSet.h> 11 11 #include <vtkPointData.h> 12 #include <vtkCellData.h> 12 13 #include <vtkDataSetMapper.h> 13 14 #include <vtkUnstructuredGrid.h> … … 235 236 case COLOR_BY_VECTOR_MAGNITUDE: { 236 237 _dsMapper->ScalarVisibilityOn(); 237 _dsMapper->SetScalarModeToUsePointFieldData();238 238 if (ds->GetPointData() != NULL && 239 239 ds->GetPointData()->GetVectors() != NULL) { 240 _dsMapper->SetScalarModeToUsePointFieldData(); 240 241 _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 242 } else if (ds->GetCellData() != NULL && 243 ds->GetCellData()->GetVectors() != NULL) { 244 _dsMapper->SetScalarModeToUseCellFieldData(); 245 _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName()); 241 246 } 242 247 if (_lut != NULL) { … … 248 253 case COLOR_BY_VECTOR_X: 249 254 _dsMapper->ScalarVisibilityOn(); 250 _dsMapper->SetScalarModeToUsePointFieldData();251 255 if (ds->GetPointData() != NULL && 252 256 ds->GetPointData()->GetVectors() != NULL) { 257 _dsMapper->SetScalarModeToUsePointFieldData(); 253 258 _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 259 } else if (ds->GetCellData() != NULL && 260 ds->GetCellData()->GetVectors() != NULL) { 261 _dsMapper->SetScalarModeToUseCellFieldData(); 262 _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName()); 254 263 } 255 264 if (_lut != NULL) { … … 261 270 case COLOR_BY_VECTOR_Y: 262 271 _dsMapper->ScalarVisibilityOn(); 263 _dsMapper->SetScalarModeToUsePointFieldData();264 272 if (ds->GetPointData() != NULL && 265 273 ds->GetPointData()->GetVectors() != NULL) { 274 _dsMapper->SetScalarModeToUsePointFieldData(); 266 275 _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 276 } else if (ds->GetCellData() != NULL && 277 ds->GetCellData()->GetVectors() != NULL) { 278 _dsMapper->SetScalarModeToUseCellFieldData(); 279 _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName()); 267 280 } 268 281 if (_lut != NULL) { … … 274 287 case COLOR_BY_VECTOR_Z: 275 288 _dsMapper->ScalarVisibilityOn(); 276 _dsMapper->SetScalarModeToUsePointFieldData();277 289 if (ds->GetPointData() != NULL && 278 290 ds->GetPointData()->GetVectors() != NULL) { 291 _dsMapper->SetScalarModeToUsePointFieldData(); 279 292 _dsMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 293 } else if (ds->GetCellData() != NULL && 294 ds->GetCellData()->GetVectors() != NULL) { 295 _dsMapper->SetScalarModeToUseCellFieldData(); 296 _dsMapper->SelectColorArray(ds->GetCellData()->GetVectors()->GetName()); 280 297 } 281 298 if (_lut != NULL) { -
branches/vtkvis_threaded/RpStreamlines.cpp
r2467 r2523 21 21 #include <vtkCellData.h> 22 22 #include <vtkCellDataToPointData.h> 23 #include <vtkPolygon.h> 23 24 #include <vtkPolyData.h> 24 25 #include <vtkTubeFilter.h> … … 26 27 #include <vtkTransform.h> 27 28 #include <vtkTransformPolyDataFilter.h> 29 #include <vtkVertexGlyphFilter.h> 28 30 29 31 #include "RpStreamlines.h" … … 123 125 _seedActor = vtkSmartPointer<vtkActor>::New(); 124 126 _seedActor->GetProperty()->SetColor(_seedColor[0], _seedColor[1], _seedColor[2]); 127 _seedActor->GetProperty()->SetEdgeColor(_seedColor[0], _seedColor[1], _seedColor[2]); 125 128 _seedActor->GetProperty()->SetLineWidth(1); 126 129 _seedActor->GetProperty()->SetPointSize(2); … … 172 175 */ 173 176 void Streamlines::getRandomPointInTriangle(double pt[3], 177 const double v0[3], 174 178 const double v1[3], 175 const double v2[3], 176 const double v3[3]) 179 const double v2[3]) 177 180 { 178 181 // Choose random barycentric coordinates … … 189 192 // Convert to cartesian coords 190 193 for (int i = 0; i < 3; i++) { 191 pt[i] = v1[i] * bary[0] + v2[i] * bary[1] + v3[i] * bary[2]; 194 pt[i] = v0[i] * bary[0] + v1[i] * bary[1] + v2[i] * bary[2]; 195 } 196 } 197 198 void Streamlines::getRandomPointInTetrahedron(double pt[3], 199 const double v0[3], 200 const double v1[3], 201 const double v2[3], 202 const double v3[3]) 203 { 204 // Choose random barycentric coordinates 205 double bary[4]; 206 bary[0] = getRandomNum(0, 1); 207 bary[1] = getRandomNum(0, 1); 208 bary[2] = getRandomNum(0, 1); 209 if (bary[0] + bary[1] > 1.0) { 210 bary[0] = 1.0 - bary[0]; 211 bary[1] = 1.0 - bary[1]; 212 } 213 if (bary[1] + bary[2] > 1.0) { 214 double tmp = bary[2]; 215 bary[2] = 1.0 - bary[0] - bary[1]; 216 bary[1] = 1.0 - tmp; 217 } else if (bary[0] + bary[1] + bary[2] > 1.0) { 218 double tmp = bary[2]; 219 bary[2] = bary[0] + bary[1] + bary[2] - 1.0; 220 bary[0] = 1.0 - bary[1] - tmp; 221 } 222 bary[3] = 1.0 - bary[0] - bary[1] - bary[2]; 223 TRACE("bary %g %g %g %g", bary[0], bary[1], bary[2], bary[3]); 224 // Convert to cartesian coords 225 for (int i = 0; i < 3; i++) { 226 #if 0 227 pt[i] = (v0[i] - v3[i]) * bary[0] + 228 (v1[i] - v3[i]) * bary[1] + 229 (v2[i] - v3[i]) * bary[2] + v3[i]; 230 #else 231 pt[i] = v0[i] * bary[0] + v1[i] * bary[1] + 232 v2[i] * bary[2] + v3[i] * bary[3]; 233 #endif 192 234 } 193 235 } … … 209 251 * \brief Get a random point within a vtkDataSet's mesh 210 252 * 211 * Note: This currently doesn't give a uniform distribution of 212 * points in space and can generate points outside the mesh 253 * Note: This currently doesn't always give a uniform distribution 254 * of points in space and can generate points outside the mesh for 255 * unusual cell types 213 256 */ 214 257 void Streamlines::getRandomCellPt(double pt[3], vtkDataSet *ds) … … 218 261 // all cells are equal area/volume) 219 262 int cell = rand() % numCells; 220 double bounds[6]; 221 ds->GetCellBounds(cell, bounds); 222 // Note: point is inside AABB of cell, but may be outside the cell 223 getRandomPoint(pt, bounds); 263 int type = ds->GetCellType(cell); 264 if (type == VTK_VERTEX) { 265 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 266 ds->GetCellPoints(cell, ptIds); 267 assert(ptIds->GetNumberOfIds() == 1); 268 ds->GetPoint(ptIds->GetId(0), pt); 269 } else if (type == VTK_POLY_VERTEX) { 270 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 271 ds->GetCellPoints(cell, ptIds); 272 assert(ptIds->GetNumberOfIds() >= 1); 273 int id = rand() % ptIds->GetNumberOfIds(); 274 ds->GetPoint(ptIds->GetId(id), pt); 275 } else if (type == VTK_LINE) { 276 double v[2][3]; 277 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 278 ds->GetCellPoints(cell, ptIds); 279 assert(ptIds->GetNumberOfIds() == 2); 280 for (int i = 0; i < 2; i++) { 281 ds->GetPoint(ptIds->GetId(i), v[i]); 282 } 283 getRandomPointOnLineSegment(pt, v[0], v[1]); 284 } else if (type == VTK_POLY_LINE) { 285 double v[2][3]; 286 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 287 ds->GetCellPoints(cell, ptIds); 288 assert(ptIds->GetNumberOfIds() >= 2); 289 int id = rand() % (ptIds->GetNumberOfIds()-1); 290 for (int i = 0; i < 2; i++) { 291 ds->GetPoint(ptIds->GetId(id+i), v[i]); 292 } 293 getRandomPointOnLineSegment(pt, v[0], v[1]); 294 } else if (type == VTK_TRIANGLE) { 295 double v[3][3]; 296 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 297 ds->GetCellPoints(cell, ptIds); 298 assert(ptIds->GetNumberOfIds() == 3); 299 for (int i = 0; i < 3; i++) { 300 ds->GetPoint(ptIds->GetId(i), v[i]); 301 } 302 getRandomPointInTriangle(pt, v[0], v[1], v[2]); 303 } else if (type == VTK_TRIANGLE_STRIP) { 304 double v[3][3]; 305 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 306 ds->GetCellPoints(cell, ptIds); 307 assert(ptIds->GetNumberOfIds() >= 3); 308 int id = rand() % (ptIds->GetNumberOfIds()-2); 309 for (int i = 0; i < 3; i++) { 310 ds->GetPoint(ptIds->GetId(id+i), v[i]); 311 } 312 getRandomPointInTriangle(pt, v[0], v[1], v[2]); 313 } else if (type == VTK_POLYGON) { 314 vtkPolygon *poly = vtkPolygon::SafeDownCast(ds->GetCell(cell)); 315 assert (poly != NULL); 316 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 317 poly->Triangulate(ptIds); 318 assert(ptIds->GetNumberOfIds() >= 3 && ptIds->GetNumberOfIds() % 3 == 0); 319 int tri = rand() % (ptIds->GetNumberOfIds()/3); 320 double v[3][3]; 321 for (int i = 0; i < 3; i++) { 322 ds->GetPoint(ptIds->GetId(i + tri * 3), v[i]); 323 } 324 getRandomPointInTriangle(pt, v[0], v[1], v[2]); 325 } else if (type == VTK_QUAD) { 326 double v[4][3]; 327 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 328 ds->GetCellPoints(cell, ptIds); 329 assert(ptIds->GetNumberOfIds() == 4); 330 for (int i = 0; i < 4; i++) { 331 ds->GetPoint(ptIds->GetId(i), v[i]); 332 } 333 int tri = rand() & 0x1; 334 if (tri) { 335 getRandomPointInTriangle(pt, v[0], v[1], v[2]); 336 } else { 337 getRandomPointInTriangle(pt, v[0], v[2], v[3]); 338 } 339 } else if (type == VTK_TETRA) { 340 double v[4][3]; 341 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 342 ds->GetCellPoints(cell, ptIds); 343 assert(ptIds->GetNumberOfIds() == 4); 344 for (int i = 0; i < 4; i++) { 345 ds->GetPoint(ptIds->GetId(i), v[i]); 346 } 347 getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[3]); 348 } else if (type == VTK_HEXAHEDRON) { 349 double v[8][3]; 350 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 351 ds->GetCellPoints(cell, ptIds); 352 assert(ptIds->GetNumberOfIds() == 8); 353 for (int i = 0; i < 8; i++) { 354 ds->GetPoint(ptIds->GetId(i), v[i]); 355 } 356 int tetra = rand() % 5; 357 switch (tetra) { 358 case 0: 359 getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[5]); 360 break; 361 case 1: 362 getRandomPointInTetrahedron(pt, v[0], v[2], v[7], v[3]); 363 break; 364 case 2: 365 getRandomPointInTetrahedron(pt, v[0], v[5], v[7], v[4]); 366 break; 367 case 3: 368 getRandomPointInTetrahedron(pt, v[5], v[2], v[7], v[6]); 369 break; 370 case 4: 371 default: 372 getRandomPointInTetrahedron(pt, v[0], v[2], v[7], v[5]); 373 break; 374 } 375 } else if (type == VTK_WEDGE) { 376 double v[6][3]; 377 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 378 ds->GetCellPoints(cell, ptIds); 379 assert(ptIds->GetNumberOfIds() == 6); 380 for (int i = 0; i < 6; i++) { 381 ds->GetPoint(ptIds->GetId(i), v[i]); 382 } 383 double vv[3][3]; 384 getRandomPointOnLineSegment(vv[0], v[0], v[3]); 385 getRandomPointOnLineSegment(vv[1], v[1], v[4]); 386 getRandomPointOnLineSegment(vv[2], v[2], v[5]); 387 getRandomPointInTriangle(pt, vv[0], vv[1], vv[2]); 388 } else if (type == VTK_PYRAMID) { 389 double v[5][3]; 390 vtkSmartPointer<vtkIdList> ptIds = vtkSmartPointer<vtkIdList>::New(); 391 ds->GetCellPoints(cell, ptIds); 392 assert(ptIds->GetNumberOfIds() == 5); 393 for (int i = 0; i < 5; i++) { 394 ds->GetPoint(ptIds->GetId(i), v[i]); 395 } 396 int tetra = rand() & 0x1; 397 if (tetra) { 398 getRandomPointInTetrahedron(pt, v[0], v[1], v[2], v[4]); 399 } else { 400 getRandomPointInTetrahedron(pt, v[0], v[2], v[3], v[4]); 401 } 402 } else { 403 double bounds[6]; 404 ds->GetCellBounds(cell, bounds); 405 // Note: For pixel/voxel cells, this is exact. However, if the cell is 406 // not an axis aligned box, the point may be outside the cell 407 getRandomPoint(pt, bounds); 408 } 224 409 } 225 410 … … 237 422 double bounds[6]; 238 423 _dataSet->getBounds(bounds); 424 double xLen = bounds[1] - bounds[0]; 425 double yLen = bounds[3] - bounds[2]; 426 double zLen = bounds[5] - bounds[4]; 239 427 double maxBound = 0.0; 240 if ( bounds[1] - bounds[0]> maxBound) {241 maxBound = bounds[1] - bounds[0];242 } 243 if ( bounds[3] - bounds[2]> maxBound) {244 maxBound = bounds[3] - bounds[2];245 } 246 if ( bounds[5] - bounds[4]> maxBound) {247 maxBound = bounds[5] - bounds[4];428 if (xLen > maxBound) { 429 maxBound = xLen; 430 } 431 if (yLen > maxBound) { 432 maxBound = yLen; 433 } 434 if (zLen > maxBound) { 435 maxBound = zLen; 248 436 } 249 437 … … 276 464 277 465 _streamTracer->SetInput(ds); 278 _streamTracer->SetMaximumPropagation(maxBound); 466 _streamTracer->SetMaximumPropagation(xLen + yLen + zLen); 467 _streamTracer->SetIntegratorTypeToRungeKutta45(); 468 469 TRACE("Setting streamlines max length to %g", 470 _streamTracer->GetMaximumPropagation()); 279 471 280 472 if (_pdMapper == NULL) { … … 286 478 _seedMapper = vtkSmartPointer<vtkPolyDataMapper>::New(); 287 479 _seedMapper->SetResolveCoincidentTopologyToPolygonOffset(); 480 _seedMapper->ScalarVisibilityOff(); 288 481 } 289 482 290 483 // Set up seed source object 291 setSeedTo RandomPoints(200);484 setSeedToFilledMesh(200); 292 485 293 486 switch (_lineType) { … … 343 536 344 537 /** 345 * \brief Use randomly distributed seed points 538 * \brief Use points of the DataSet associated with this 539 * Streamlines as seeds 540 */ 541 void Streamlines::setSeedToMeshPoints() 542 { 543 setSeedToMeshPoints(_dataSet->getVtkDataSet()); 544 } 545 546 /** 547 * \brief Use seed points randomly distributed within the cells 548 * of the DataSet associated with this Streamlines 346 549 * 347 550 * Note: The current implementation doesn't give a uniform … … 351 554 * \param[in] numPoints Number of random seed points to generate 352 555 */ 353 void Streamlines::setSeedToRandomPoints(int numPoints) 556 void Streamlines::setSeedToFilledMesh(int numPoints) 557 { 558 setSeedToFilledMesh(_dataSet->getVtkDataSet(), numPoints); 559 } 560 561 /** 562 * \brief Use points of a supplied vtkDataSet as seeds 563 * 564 * \param[in] seed vtkDataSet with points to use as seeds 565 */ 566 void Streamlines::setSeedToMeshPoints(vtkDataSet *seed) 567 { 568 if (_streamTracer != NULL) { 569 TRACE("Seed points: %d", seed->GetNumberOfPoints()); 570 vtkSmartPointer<vtkDataSet> oldSeed; 571 if (_streamTracer->GetSource() != NULL) { 572 oldSeed = _streamTracer->GetSource(); 573 } 574 575 _streamTracer->SetSource(seed); 576 if (oldSeed != NULL) { 577 oldSeed->SetPipelineInformation(NULL); 578 } 579 580 if (vtkPolyData::SafeDownCast(seed) != NULL) { 581 _seedMapper->SetInput(vtkPolyData::SafeDownCast(seed)); 582 } else { 583 vtkSmartPointer<vtkVertexGlyphFilter> vertFilter = vtkSmartPointer<vtkVertexGlyphFilter>::New(); 584 vertFilter->SetInput(seed); 585 _seedMapper->SetInputConnection(vertFilter->GetOutputPort()); 586 } 587 } 588 } 589 590 /** 591 * \brief Use seed points randomly distributed within the cells 592 * of a supplied vtkDataSet 593 * 594 * Note: The current implementation doesn't give a uniform 595 * distribution of points, and points outside the mesh bounds 596 * may be generated 597 * 598 * \param[in] ds vtkDataSet containing cells 599 * \param[in] numPoints Number of random seed points to generate 600 */ 601 void Streamlines::setSeedToFilledMesh(vtkDataSet *ds, int numPoints) 354 602 { 355 603 if (_streamTracer != NULL) { … … 359 607 vtkSmartPointer<vtkCellArray> cells = vtkSmartPointer<vtkCellArray>::New(); 360 608 609 if (ds->GetNumberOfCells() < 1) { 610 ERROR("No cells in mesh"); 611 } 612 361 613 for (int i = 0; i < numPoints; i++) { 362 614 double pt[3]; 363 getRandomCellPt(pt, _dataSet->getVtkDataSet());364 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);615 getRandomCellPt(pt, ds); 616 //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]); 365 617 pts->InsertNextPoint(pt); 366 618 cells->InsertNextCell(1); … … 415 667 pt[ii] = start[ii] + dir[ii] * ((double)i / (numPoints-1)); 416 668 } 417 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);669 //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]); 418 670 pts->InsertNextPoint(pt); 419 671 polyline->GetPointIds()->SetId(i, i); … … 507 759 pt[i] = center[i] + r * (px[i] * cos(angle) + py[i] * sin(angle)); 508 760 } 509 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);761 //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]); 510 762 pts->InsertNextPoint(pt); 511 763 cells->InsertNextCell(1); … … 662 914 py[i] * sin(theta)); 663 915 } 664 TRACE("Vert %d: %g %g %g", j, verts[j][0], verts[j][1], verts[j][2]);916 //TRACE("Vert %d: %g %g %g", j, verts[j][0], verts[j][1], verts[j][2]); 665 917 } 666 918 … … 671 923 double pt[3]; 672 924 getRandomPointInTriangle(pt, verts[0], verts[1], verts[2]); 673 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);925 //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]); 674 926 pts->InsertNextPoint(pt); 675 927 cells->InsertNextCell(1); … … 682 934 double pt[3]; 683 935 getRandomPointInTriangle(pt, center, verts[tri], verts[(tri+1) % numSides]); 684 TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]);936 //TRACE("Seed pt: %g %g %g", pt[0], pt[1], pt[2]); 685 937 pts->InsertNextPoint(pt); 686 938 cells->InsertNextCell(1); … … 708 960 709 961 /** 710 * \brief Set maximum length of stream lines in world coordinates 962 * \brief Set the integration method used 963 */ 964 void Streamlines::setIntegrator(IntegratorType integrator) 965 { 966 if (_streamTracer != NULL) { 967 switch (integrator) { 968 case RUNGE_KUTTA2: 969 _streamTracer->SetIntegratorTypeToRungeKutta2(); 970 break; 971 case RUNGE_KUTTA4: 972 _streamTracer->SetIntegratorTypeToRungeKutta4(); 973 break; 974 case RUNGE_KUTTA45: 975 _streamTracer->SetIntegratorTypeToRungeKutta45(); 976 break; 977 default: 978 ; 979 } 980 } 981 } 982 983 /** 984 * \brief Set the direction of integration 985 */ 986 void Streamlines::setIntegrationDirection(IntegrationDirection dir) 987 { 988 if (_streamTracer != NULL) { 989 switch (dir) { 990 case FORWARD: 991 _streamTracer->SetIntegrationDirectionToForward(); 992 break; 993 case BACKWARD: 994 _streamTracer->SetIntegrationDirectionToBackward(); 995 break; 996 case BOTH: 997 _streamTracer->SetIntegrationDirectionToBoth(); 998 break; 999 default: 1000 ; 1001 } 1002 } 1003 } 1004 1005 /** 1006 * \brief Set the step size units. Length units are world 1007 * coordinates, and cell units means steps are from cell to 1008 * cell. Default is cell units. 1009 * 1010 * Note: calling this function will not convert existing 1011 * initial, minimum or maximum step value settings to the 1012 * new units, so this function should be called before 1013 * setting step values. 1014 */ 1015 void Streamlines::setIntegrationStepUnit(StepUnit unit) 1016 { 1017 if (_streamTracer != NULL) { 1018 switch (unit) { 1019 case LENGTH_UNIT: 1020 _streamTracer->SetIntegrationStepUnit(vtkStreamTracer::LENGTH_UNIT); 1021 break; 1022 case CELL_LENGTH_UNIT: 1023 _streamTracer->SetIntegrationStepUnit(vtkStreamTracer::CELL_LENGTH_UNIT); 1024 break; 1025 default: 1026 ; 1027 } 1028 } 1029 } 1030 1031 /** 1032 * \brief Set initial step size for adaptive step integrator in 1033 * step units (see setIntegrationStepUnit). For non-adaptive 1034 * integrators, this is the fixed step size. 1035 */ 1036 void Streamlines::setInitialIntegrationStep(double step) 1037 { 1038 if (_streamTracer != NULL) { 1039 _streamTracer->SetInitialIntegrationStep(step); 1040 } 1041 } 1042 1043 /** 1044 * \brief Set minimum step for adaptive step integrator in 1045 * step units (see setIntegrationStepUnit) 1046 */ 1047 void Streamlines::setMinimumIntegrationStep(double step) 1048 { 1049 if (_streamTracer != NULL) { 1050 _streamTracer->SetMinimumIntegrationStep(step); 1051 } 1052 } 1053 1054 /** 1055 * \brief Set maximum step for adaptive step integrator in 1056 * step units (see setIntegrationStepUnit) 1057 */ 1058 void Streamlines::setMaximumIntegrationStep(double step) 1059 { 1060 if (_streamTracer != NULL) { 1061 _streamTracer->SetMaximumIntegrationStep(step); 1062 } 1063 } 1064 1065 /** 1066 * \brief Set maximum error tolerance 1067 */ 1068 void Streamlines::setMaximumError(double error) 1069 { 1070 if (_streamTracer != NULL) { 1071 _streamTracer->SetMaximumError(error); 1072 } 1073 } 1074 1075 /** 1076 * \brief Set maximum length of stream lines in world 1077 * coordinates 711 1078 */ 712 1079 void Streamlines::setMaxPropagation(double length) … … 714 1081 if (_streamTracer != NULL) { 715 1082 _streamTracer->SetMaximumPropagation(length); 1083 } 1084 } 1085 1086 /** 1087 * \brief Set maximum number of integration steps 1088 */ 1089 void Streamlines::setMaxNumberOfSteps(int steps) 1090 { 1091 if (_streamTracer != NULL) { 1092 _streamTracer->SetMaximumNumberOfSteps(steps); 1093 } 1094 } 1095 1096 /** 1097 * \brief Set the minimum speed before integration stops 1098 */ 1099 void Streamlines::setTerminalSpeed(double speed) 1100 { 1101 if (_streamTracer != NULL) { 1102 _streamTracer->SetTerminalSpeed(speed); 716 1103 } 717 1104 } … … 820 1207 return; 821 1208 822 vtkDataSet *ds = _dataSet->getVtkDataSet();823 824 1209 switch (mode) { 825 1210 case COLOR_BY_SCALAR: { … … 834 1219 _pdMapper->ScalarVisibilityOn(); 835 1220 _pdMapper->SetScalarModeToUsePointFieldData(); 836 if (ds->GetPointData() != NULL && 837 ds->GetPointData()->GetVectors() != NULL) { 838 _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 839 } 1221 _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName()); 840 1222 if (_lut != NULL) { 841 1223 _lut->SetRange(_vectorMagnitudeRange); … … 847 1229 _pdMapper->ScalarVisibilityOn(); 848 1230 _pdMapper->SetScalarModeToUsePointFieldData(); 849 if (ds->GetPointData() != NULL && 850 ds->GetPointData()->GetVectors() != NULL) { 851 _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 852 } 1231 _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName()); 853 1232 if (_lut != NULL) { 854 1233 _lut->SetRange(_vectorComponentRange[0]); … … 860 1239 _pdMapper->ScalarVisibilityOn(); 861 1240 _pdMapper->SetScalarModeToUsePointFieldData(); 862 if (ds->GetPointData() != NULL && 863 ds->GetPointData()->GetVectors() != NULL) { 864 _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 865 } 1241 _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName()); 866 1242 if (_lut != NULL) { 867 1243 _lut->SetRange(_vectorComponentRange[1]); … … 873 1249 _pdMapper->ScalarVisibilityOn(); 874 1250 _pdMapper->SetScalarModeToUsePointFieldData(); 875 if (ds->GetPointData() != NULL && 876 ds->GetPointData()->GetVectors() != NULL) { 877 _pdMapper->SelectColorArray(ds->GetPointData()->GetVectors()->GetName()); 878 } 1251 _pdMapper->SelectColorArray(_dataSet->getActiveVectorsName()); 879 1252 if (_lut != NULL) { 880 1253 _lut->SetRange(_vectorComponentRange[2]); … … 1058 1431 _seedColor[1] = color[1]; 1059 1432 _seedColor[2] = color[2]; 1060 if (_seedActor != NULL) 1433 if (_seedActor != NULL) { 1061 1434 _seedActor->GetProperty()->SetColor(_seedColor[0], _seedColor[1], _seedColor[2]); 1435 _seedActor->GetProperty()->SetEdgeColor(_seedColor[0], _seedColor[1], _seedColor[2]); 1436 } 1062 1437 } 1063 1438 -
branches/vtkvis_threaded/RpStreamlines.h
r2454 r2523 44 44 COLOR_CONSTANT 45 45 }; 46 enum StepUnit { 47 LENGTH_UNIT, 48 CELL_LENGTH_UNIT 49 }; 50 enum IntegratorType { 51 RUNGE_KUTTA2, 52 RUNGE_KUTTA4, 53 RUNGE_KUTTA45 54 }; 55 enum IntegrationDirection { 56 FORWARD, 57 BACKWARD, 58 BOTH 59 }; 46 60 47 61 Streamlines(); … … 77 91 virtual void setClippingPlanes(vtkPlaneCollection *planes); 78 92 79 void setSeedToRandomPoints(int numPoints); 93 void setSeedToMeshPoints(); 94 95 void setSeedToFilledMesh(int numPoints); 96 97 void setSeedToMeshPoints(vtkDataSet *ds); 98 99 void setSeedToFilledMesh(vtkDataSet *ds, int numPoints); 80 100 81 101 void setSeedToRake(double start[3], double end[3], int numPoints); … … 92 112 int numSides, int numPoints); 93 113 114 void setIntegrator(IntegratorType integrator); 115 116 void setIntegrationDirection(IntegrationDirection dir); 117 118 void setIntegrationStepUnit(StepUnit unit); 119 120 void setInitialIntegrationStep(double step); 121 122 void setMinimumIntegrationStep(double step); 123 124 void setMaximumIntegrationStep(double step); 125 126 void setMaximumError(double error); 127 94 128 void setMaxPropagation(double length); 129 130 void setMaxNumberOfSteps(int steps); 131 132 void setTerminalSpeed(double speed); 95 133 96 134 void setLineTypeToLines(); … … 130 168 static void getRandomPoint(double pt[3], const double bounds[6]); 131 169 static void getRandomPointInTriangle(double pt[3], 170 const double v0[3], 132 171 const double v1[3], 133 const double v2[3], 134 const double v3[3]); 172 const double v2[3]); 135 173 static void getRandomPointOnLineSegment(double pt[3], 136 174 const double endpt[3], 137 175 const double endpt2[3]); 176 static void getRandomPointInTetrahedron(double pt[3], 177 const double v0[3], 178 const double v1[3], 179 const double v2[3], 180 const double v3[3]); 138 181 static void getRandomCellPt(double pt[3], vtkDataSet *ds); 139 182 -
branches/vtkvis_threaded/RpVtkRenderServer.h
r2100 r2523 9 9 #define __RAPPTURE_VTKVIS_RENDERSERVER_H__ 10 10 11 #include "RpVtkRenderer.h"12 13 11 namespace Rappture { 14 12 namespace VtkVis { 13 14 class Renderer; 15 15 16 16 extern int g_fdIn; -
branches/vtkvis_threaded/RpVtkRenderer.cpp
r2496 r2523 158 158 } 159 159 _contour3Ds.clear(); 160 TRACE("Deleting Cutplanes"); 161 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 162 itr != _cutplanes.end(); ++itr) { 163 delete itr->second; 164 } 165 _cutplanes.clear(); 160 166 TRACE("Deleting Glyphs"); 161 167 for (GlyphsHashmap::iterator itr = _glyphs.begin(); … … 314 320 315 321 /** 322 * \brief Remove the Cutplane for the specified DataSet 323 * 324 * The underlying Cutplane is deleted, freeing its memory 325 */ 326 void Renderer::deleteCutplane(const DataSetId& id) 327 { 328 CutplaneHashmap::iterator itr; 329 330 bool doAll = false; 331 332 if (id.compare("all") == 0) { 333 itr = _cutplanes.begin(); 334 doAll = true; 335 } else { 336 itr = _cutplanes.find(id); 337 } 338 if (itr == _cutplanes.end()) { 339 ERROR("Cutplane not found: %s", id.c_str()); 340 return; 341 } 342 343 TRACE("Deleting Cutplanes for %s", id.c_str()); 344 345 do { 346 Cutplane *cutplane = itr->second; 347 if (cutplane->getProp()) 348 _renderer->RemoveViewProp(cutplane->getProp()); 349 delete cutplane; 350 351 itr = _cutplanes.erase(itr); 352 } while (doAll && itr != _cutplanes.end()); 353 354 _renderer->ResetCameraClippingRange(); 355 _needsRedraw = true; 356 } 357 358 /** 316 359 * \brief Remove the Glyphs for the specified DataSet 317 360 * … … 637 680 deleteContour2D(itr->second->getName()); 638 681 deleteContour3D(itr->second->getName()); 682 deleteCutplane(itr->second->getName()); 639 683 deleteGlyphs(itr->second->getName()); 640 684 deleteHeightMap(itr->second->getName()); … … 858 902 // Don't offset labels at origin 859 903 _cubeAxesActor->SetCornerOffset(0); 860 _cubeAxesActor->SetFlyModeTo ClosestTriad();904 _cubeAxesActor->SetFlyModeToStaticTriad(); 861 905 862 906 #ifdef USE_CUSTOM_AXES … … 1213 1257 } 1214 1258 } 1259 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 1260 itr != _cutplanes.end(); ++itr) { 1261 if (itr->second->getColorMap() == cmap) { 1262 itr->second->updateColorMap(); 1263 _needsRedraw = true; 1264 } 1265 } 1215 1266 for (GlyphsHashmap::iterator itr = _glyphs.begin(); 1216 1267 itr != _glyphs.end(); ++itr) { … … 1271 1322 for (Contour3DHashmap::iterator itr = _contour3Ds.begin(); 1272 1323 itr != _contour3Ds.end(); ++itr) { 1324 if (itr->second->getColorMap() == cmap) 1325 return true; 1326 } 1327 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 1328 itr != _cutplanes.end(); ++itr) { 1273 1329 if (itr->second->getColorMap() == cmap) 1274 1330 return true; … … 2197 2253 } while (doAll && ++itr != _dataSets.end()); 2198 2254 2199 if (_cameraMode == IMAGE)2200 setCameraMode(PERSPECTIVE);2201 2255 initCamera(); 2202 2256 _needsRedraw = true; … … 2672 2726 2673 2727 /** 2728 * \brief Create a new Cutplane and associate it with the named DataSet 2729 */ 2730 bool Renderer::addCutplane(const DataSetId& id) 2731 { 2732 DataSetHashmap::iterator itr; 2733 2734 bool doAll = false; 2735 2736 if (id.compare("all") == 0) { 2737 itr = _dataSets.begin(); 2738 } else { 2739 itr = _dataSets.find(id); 2740 } 2741 if (itr == _dataSets.end()) { 2742 ERROR("Unknown dataset %s", id.c_str()); 2743 return false; 2744 } 2745 2746 do { 2747 DataSet *ds = itr->second; 2748 const DataSetId& dsID = ds->getName(); 2749 2750 if (getCutplane(dsID)) { 2751 WARN("Replacing existing Cutplane %s", dsID.c_str()); 2752 deleteCutplane(dsID); 2753 } 2754 2755 Cutplane *cutplane = new Cutplane(); 2756 _cutplanes[dsID] = cutplane; 2757 2758 cutplane->setDataSet(ds, 2759 _useCumulativeRange, 2760 _cumulativeScalarRange, 2761 _cumulativeVectorMagnitudeRange, 2762 _cumulativeVectorComponentRange); 2763 2764 _renderer->AddViewProp(cutplane->getProp()); 2765 } while (doAll && ++itr != _dataSets.end()); 2766 2767 _needsRedraw = true; 2768 return true; 2769 } 2770 2771 /** 2772 * \brief Get the Cutplane associated with a named DataSet 2773 */ 2774 Cutplane *Renderer::getCutplane(const DataSetId& id) 2775 { 2776 CutplaneHashmap::iterator itr = _cutplanes.find(id); 2777 2778 if (itr == _cutplanes.end()) { 2779 #ifdef DEBUG 2780 TRACE("Cutplane not found: %s", id.c_str()); 2781 #endif 2782 return NULL; 2783 } else 2784 return itr->second; 2785 } 2786 2787 /** 2788 * \brief Set an additional transform on the prop 2789 */ 2790 void Renderer::setCutplaneTransform(const DataSetId& id, vtkMatrix4x4 *trans) 2791 { 2792 CutplaneHashmap::iterator itr; 2793 2794 bool doAll = false; 2795 2796 if (id.compare("all") == 0) { 2797 itr = _cutplanes.begin(); 2798 doAll = true; 2799 } else { 2800 itr = _cutplanes.find(id); 2801 } 2802 if (itr == _cutplanes.end()) { 2803 ERROR("Cutplane not found: %s", id.c_str()); 2804 return; 2805 } 2806 2807 do { 2808 itr->second->setTransform(trans); 2809 } while (doAll && ++itr != _cutplanes.end()); 2810 2811 resetAxes(); 2812 _needsRedraw = true; 2813 } 2814 2815 /** 2816 * \brief Set the prop orientation with a quaternion 2817 */ 2818 void Renderer::setCutplaneOrientation(const DataSetId& id, double quat[4]) 2819 { 2820 CutplaneHashmap::iterator itr; 2821 2822 bool doAll = false; 2823 2824 if (id.compare("all") == 0) { 2825 itr = _cutplanes.begin(); 2826 doAll = true; 2827 } else { 2828 itr = _cutplanes.find(id); 2829 } 2830 if (itr == _cutplanes.end()) { 2831 ERROR("Cutplane not found: %s", id.c_str()); 2832 return; 2833 } 2834 2835 do { 2836 itr->second->setOrientation(quat); 2837 } while (doAll && ++itr != _cutplanes.end()); 2838 2839 resetAxes(); 2840 _needsRedraw = true; 2841 } 2842 2843 /** 2844 * \brief Set the prop orientation with a rotation about an axis 2845 */ 2846 void Renderer::setCutplaneOrientation(const DataSetId& id, double angle, double axis[3]) 2847 { 2848 CutplaneHashmap::iterator itr; 2849 2850 bool doAll = false; 2851 2852 if (id.compare("all") == 0) { 2853 itr = _cutplanes.begin(); 2854 doAll = true; 2855 } else { 2856 itr = _cutplanes.find(id); 2857 } 2858 if (itr == _cutplanes.end()) { 2859 ERROR("Cutplane not found: %s", id.c_str()); 2860 return; 2861 } 2862 2863 do { 2864 itr->second->setOrientation(angle, axis); 2865 } while (doAll && ++itr != _cutplanes.end()); 2866 2867 resetAxes(); 2868 _needsRedraw = true; 2869 } 2870 2871 /** 2872 * \brief Set the prop position in world coords 2873 */ 2874 void Renderer::setCutplanePosition(const DataSetId& id, double pos[3]) 2875 { 2876 CutplaneHashmap::iterator itr; 2877 2878 bool doAll = false; 2879 2880 if (id.compare("all") == 0) { 2881 itr = _cutplanes.begin(); 2882 doAll = true; 2883 } else { 2884 itr = _cutplanes.find(id); 2885 } 2886 if (itr == _cutplanes.end()) { 2887 ERROR("Cutplane not found: %s", id.c_str()); 2888 return; 2889 } 2890 2891 do { 2892 itr->second->setPosition(pos); 2893 } while (doAll && ++itr != _cutplanes.end()); 2894 2895 resetAxes(); 2896 _needsRedraw = true; 2897 } 2898 2899 /** 2900 * \brief Set the prop scaling 2901 */ 2902 void Renderer::setCutplaneScale(const DataSetId& id, double scale[3]) 2903 { 2904 CutplaneHashmap::iterator itr; 2905 2906 bool doAll = false; 2907 2908 if (id.compare("all") == 0) { 2909 itr = _cutplanes.begin(); 2910 doAll = true; 2911 } else { 2912 itr = _cutplanes.find(id); 2913 } 2914 if (itr == _cutplanes.end()) { 2915 ERROR("Cutplane not found: %s", id.c_str()); 2916 return; 2917 } 2918 2919 do { 2920 itr->second->setScale(scale); 2921 } while (doAll && ++itr != _cutplanes.end()); 2922 2923 resetAxes(); 2924 _needsRedraw = true; 2925 } 2926 2927 /** 2928 * \brief Set the volume slice used for mapping volumetric data 2929 */ 2930 void Renderer::setCutplaneVolumeSlice(const DataSetId& id, Cutplane::Axis axis, double ratio) 2931 { 2932 CutplaneHashmap::iterator itr; 2933 2934 bool doAll = false; 2935 2936 if (id.compare("all") == 0) { 2937 itr = _cutplanes.begin(); 2938 doAll = true; 2939 } else { 2940 itr = _cutplanes.find(id); 2941 } 2942 2943 if (itr == _cutplanes.end()) { 2944 ERROR("Cutplane not found: %s", id.c_str()); 2945 return; 2946 } 2947 2948 do { 2949 itr->second->selectVolumeSlice(axis, ratio); 2950 } while (doAll && ++itr != _cutplanes.end()); 2951 2952 _renderer->ResetCameraClippingRange(); 2953 _needsRedraw = true; 2954 } 2955 2956 /** 2957 * \brief Associate an existing named color map with a Cutplane for the given DataSet 2958 */ 2959 void Renderer::setCutplaneColorMap(const DataSetId& id, const ColorMapId& colorMapId) 2960 { 2961 CutplaneHashmap::iterator itr; 2962 2963 bool doAll = false; 2964 2965 if (id.compare("all") == 0) { 2966 itr = _cutplanes.begin(); 2967 doAll = true; 2968 } else { 2969 itr = _cutplanes.find(id); 2970 } 2971 2972 if (itr == _cutplanes.end()) { 2973 ERROR("Cutplane not found: %s", id.c_str()); 2974 return; 2975 } 2976 2977 ColorMap *cmap = getColorMap(colorMapId); 2978 if (cmap == NULL) { 2979 ERROR("Unknown colormap: %s", colorMapId.c_str()); 2980 return; 2981 } 2982 2983 do { 2984 TRACE("Set Cutplane color map: %s for dataset %s", colorMapId.c_str(), 2985 itr->second->getDataSet()->getName().c_str()); 2986 2987 itr->second->setColorMap(cmap); 2988 } while (doAll && ++itr != _cutplanes.end()); 2989 2990 _needsRedraw = true; 2991 } 2992 2993 /** 2994 * \brief Set the color mode for the specified DataSet 2995 */ 2996 void Renderer::setCutplaneColorMode(const DataSetId& id, Cutplane::ColorMode mode) 2997 { 2998 CutplaneHashmap::iterator itr; 2999 3000 bool doAll = false; 3001 3002 if (id.compare("all") == 0) { 3003 itr = _cutplanes.begin(); 3004 doAll = true; 3005 } else { 3006 itr = _cutplanes.find(id); 3007 } 3008 if (itr == _cutplanes.end()) { 3009 ERROR("Cutplane not found: %s", id.c_str()); 3010 return; 3011 } 3012 3013 do { 3014 itr->second->setColorMode(mode); 3015 } while (doAll && ++itr != _cutplanes.end()); 3016 3017 _needsRedraw = true; 3018 } 3019 3020 /** 3021 * \brief Set opacity of height map for the given DataSet 3022 */ 3023 void Renderer::setCutplaneOpacity(const DataSetId& id, double opacity) 3024 { 3025 CutplaneHashmap::iterator itr; 3026 3027 bool doAll = false; 3028 3029 if (id.compare("all") == 0) { 3030 itr = _cutplanes.begin(); 3031 doAll = true; 3032 } else { 3033 itr = _cutplanes.find(id); 3034 } 3035 if (itr == _cutplanes.end()) { 3036 ERROR("Cutplane not found: %s", id.c_str()); 3037 return; 3038 } 3039 3040 do { 3041 itr->second->setOpacity(opacity); 3042 } while (doAll && ++itr != _cutplanes.end()); 3043 3044 _needsRedraw = true; 3045 } 3046 3047 /** 3048 * \brief Turn on/off rendering height map for the given DataSet 3049 */ 3050 void Renderer::setCutplaneVisibility(const DataSetId& id, bool state) 3051 { 3052 CutplaneHashmap::iterator itr; 3053 3054 bool doAll = false; 3055 3056 if (id.compare("all") == 0) { 3057 itr = _cutplanes.begin(); 3058 doAll = true; 3059 } else { 3060 itr = _cutplanes.find(id); 3061 } 3062 if (itr == _cutplanes.end()) { 3063 ERROR("Cutplane not found: %s", id.c_str()); 3064 return; 3065 } 3066 3067 do { 3068 itr->second->setVisibility(state); 3069 } while (doAll && ++itr != _cutplanes.end()); 3070 3071 _needsRedraw = true; 3072 } 3073 3074 /** 3075 * \brief Set wireframe rendering for the specified DataSet 3076 */ 3077 void Renderer::setCutplaneWireframe(const DataSetId& id, bool state) 3078 { 3079 CutplaneHashmap::iterator itr; 3080 3081 bool doAll = false; 3082 3083 if (id.compare("all") == 0) { 3084 itr = _cutplanes.begin(); 3085 doAll = true; 3086 } else { 3087 itr = _cutplanes.find(id); 3088 } 3089 if (itr == _cutplanes.end()) { 3090 ERROR("Cutplane not found: %s", id.c_str()); 3091 return; 3092 } 3093 3094 do { 3095 itr->second->setWireframe(state); 3096 } while (doAll && ++itr != _cutplanes.end()); 3097 3098 _needsRedraw = true; 3099 } 3100 3101 /** 3102 * \brief Turn on/off rendering height map mesh edges for the given DataSet 3103 */ 3104 void Renderer::setCutplaneEdgeVisibility(const DataSetId& id, bool state) 3105 { 3106 CutplaneHashmap::iterator itr; 3107 3108 bool doAll = false; 3109 3110 if (id.compare("all") == 0) { 3111 itr = _cutplanes.begin(); 3112 doAll = true; 3113 } else { 3114 itr = _cutplanes.find(id); 3115 } 3116 if (itr == _cutplanes.end()) { 3117 ERROR("Cutplane not found: %s", id.c_str()); 3118 return; 3119 } 3120 3121 do { 3122 itr->second->setEdgeVisibility(state); 3123 } while (doAll && ++itr != _cutplanes.end()); 3124 3125 _needsRedraw = true; 3126 } 3127 3128 /** 3129 * \brief Set the RGB height map mesh edge color for the specified DataSet 3130 */ 3131 void Renderer::setCutplaneEdgeColor(const DataSetId& id, float color[3]) 3132 { 3133 CutplaneHashmap::iterator itr; 3134 3135 bool doAll = false; 3136 3137 if (id.compare("all") == 0) { 3138 itr = _cutplanes.begin(); 3139 doAll = true; 3140 } else { 3141 itr = _cutplanes.find(id); 3142 } 3143 if (itr == _cutplanes.end()) { 3144 ERROR("Cutplane not found: %s", id.c_str()); 3145 return; 3146 } 3147 3148 do { 3149 itr->second->setEdgeColor(color); 3150 } while (doAll && ++itr != _cutplanes.end()); 3151 3152 _needsRedraw = true; 3153 } 3154 3155 /** 3156 * \brief Set the height map mesh edge width for the specified DataSet (may be a no-op) 3157 * 3158 * If the OpenGL implementation/hardware does not support wide lines, 3159 * this function may not have an effect. 3160 */ 3161 void Renderer::setCutplaneEdgeWidth(const DataSetId& id, float edgeWidth) 3162 { 3163 CutplaneHashmap::iterator itr; 3164 3165 bool doAll = false; 3166 3167 if (id.compare("all") == 0) { 3168 itr = _cutplanes.begin(); 3169 doAll = true; 3170 } else { 3171 itr = _cutplanes.find(id); 3172 } 3173 if (itr == _cutplanes.end()) { 3174 ERROR("Cutplane not found: %s", id.c_str()); 3175 return; 3176 } 3177 3178 do { 3179 itr->second->setEdgeWidth(edgeWidth); 3180 } while (doAll && ++itr != _cutplanes.end()); 3181 3182 _needsRedraw = true; 3183 } 3184 3185 /** 3186 * \brief Turn height map lighting on/off for the specified DataSet 3187 */ 3188 void Renderer::setCutplaneLighting(const DataSetId& id, bool state) 3189 { 3190 CutplaneHashmap::iterator itr; 3191 3192 bool doAll = false; 3193 3194 if (id.compare("all") == 0) { 3195 itr = _cutplanes.begin(); 3196 doAll = true; 3197 } else { 3198 itr = _cutplanes.find(id); 3199 } 3200 if (itr == _cutplanes.end()) { 3201 ERROR("Cutplane not found: %s", id.c_str()); 3202 return; 3203 } 3204 3205 do { 3206 itr->second->setLighting(state); 3207 } while (doAll && ++itr != _cutplanes.end()); 3208 _needsRedraw = true; 3209 } 3210 3211 /** 2674 3212 * \brief Create a new Glyphs and associate it with the named DataSet 2675 3213 */ … … 2717 3255 } while (doAll && ++itr != _dataSets.end()); 2718 3256 2719 if (_cameraMode == IMAGE)2720 setCameraMode(PERSPECTIVE);2721 3257 initCamera(); 2722 3258 … … 3322 3858 } while (doAll && ++itr != _dataSets.end()); 3323 3859 3324 if (_cameraMode == IMAGE)3325 setCameraMode(PERSPECTIVE);3326 3860 initCamera(); 3327 3861 … … 3376 3910 } while (doAll && ++itr != _dataSets.end()); 3377 3911 3378 if (_cameraMode == IMAGE)3379 setCameraMode(PERSPECTIVE);3380 3912 initCamera(); 3381 3913 … … 3561 4093 } 3562 4094 4095 bool initCam = false; 3563 4096 do { 3564 4097 itr->second->selectVolumeSlice(axis, ratio); 4098 if (itr->second->getHeightScale() > 0.0) 4099 initCam = true; 3565 4100 } while (doAll && ++itr != _heightMaps.end()); 3566 4101 3567 initCamera(); 4102 if (initCam) 4103 initCamera(); 4104 else 4105 _renderer->ResetCameraClippingRange(); 3568 4106 _needsRedraw = true; 3569 4107 } … … 4032 4570 } while (doAll && ++itr != _dataSets.end()); 4033 4571 4034 if (_cameraMode == IMAGE)4035 setCameraMode(PERSPECTIVE);4036 4572 initCamera(); 4037 4573 _needsRedraw = true; … … 4220 4756 } while (doAll && ++itr != _lics.end()); 4221 4757 4222 initCamera();4758 _renderer->ResetCameraClippingRange(); 4223 4759 _needsRedraw = true; 4224 4760 } … … 4462 4998 } while (doAll && ++itr != _dataSets.end()); 4463 4999 4464 if (_cameraMode == IMAGE)4465 setCameraMode(PERSPECTIVE);4466 5000 initCamera(); 4467 5001 _needsRedraw = true; … … 4971 5505 } while (doAll && ++itr != _dataSets.end()); 4972 5506 4973 if (_cameraMode == IMAGE)4974 setCameraMode(PERSPECTIVE);4975 5507 initCamera(); 4976 5508 _needsRedraw = true; … … 6073 6605 6074 6606 /** 6607 * \brief Set the streamlines seed to points of the streamlines DataSet 6608 */ 6609 void Renderer::setStreamlinesSeedToMeshPoints(const DataSetId& id) 6610 { 6611 StreamlinesHashmap::iterator itr; 6612 6613 bool doAll = false; 6614 6615 if (id.compare("all") == 0) { 6616 itr = _streamlines.begin(); 6617 doAll = true; 6618 } else { 6619 itr = _streamlines.find(id); 6620 } 6621 if (itr == _streamlines.end()) { 6622 ERROR("Streamlines not found: %s", id.c_str()); 6623 return; 6624 } 6625 6626 do { 6627 itr->second->setSeedToMeshPoints(); 6628 } while (doAll && ++itr != _streamlines.end()); 6629 6630 _needsRedraw = true; 6631 } 6632 6633 /** 6634 * \brief Set the streamlines seed to points distributed randomly inside 6635 * cells of the streamlines DataSet 6636 */ 6637 void Renderer::setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints) 6638 { 6639 StreamlinesHashmap::iterator itr; 6640 6641 bool doAll = false; 6642 6643 if (id.compare("all") == 0) { 6644 itr = _streamlines.begin(); 6645 doAll = true; 6646 } else { 6647 itr = _streamlines.find(id); 6648 } 6649 if (itr == _streamlines.end()) { 6650 ERROR("Streamlines not found: %s", id.c_str()); 6651 return; 6652 } 6653 6654 do { 6655 itr->second->setSeedToFilledMesh(numPoints); 6656 } while (doAll && ++itr != _streamlines.end()); 6657 6658 _needsRedraw = true; 6659 } 6660 6661 /** 6662 * \brief Set the streamlines seed to points of a DataSet 6663 * 6664 * \param[in] id DataSet identifier 6665 * \param[in] data Bytes of VTK DataSet file 6666 * \param[in] nbytes Length of data array 6667 * 6668 * \return boolean indicating success or failure 6669 */ 6670 bool Renderer::setStreamlinesSeedToMeshPoints(const DataSetId& id, 6671 char *data, size_t nbytes) 6672 { 6673 vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New(); 6674 vtkSmartPointer<vtkCharArray> dataSetString = vtkSmartPointer<vtkCharArray>::New(); 6675 6676 dataSetString->SetArray(data, nbytes, 1); 6677 reader->SetInputArray(dataSetString); 6678 reader->ReadFromInputStringOn(); 6679 reader->Update(); 6680 6681 vtkSmartPointer<vtkDataSet> dataSet = reader->GetOutput(); 6682 if (dataSet == NULL) { 6683 return false; 6684 } 6685 dataSet->SetPipelineInformation(NULL); 6686 6687 StreamlinesHashmap::iterator itr; 6688 6689 bool doAll = false; 6690 6691 if (id.compare("all") == 0) { 6692 itr = _streamlines.begin(); 6693 doAll = true; 6694 } else { 6695 itr = _streamlines.find(id); 6696 } 6697 if (itr == _streamlines.end()) { 6698 ERROR("Streamlines not found: %s", id.c_str()); 6699 return false; 6700 } 6701 6702 do { 6703 itr->second->setSeedToMeshPoints(dataSet); 6704 } while (doAll && ++itr != _streamlines.end()); 6705 6706 _needsRedraw = true; 6707 return true; 6708 } 6709 6710 /** 6075 6711 * \brief Set the streamlines seed to points distributed randomly inside 6076 6712 * cells of DataSet 6077 */ 6078 void Renderer::setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints) 6079 { 6713 * 6714 * \param[in] id DataSet identifier 6715 * \param[in] data Bytes of VTK DataSet file 6716 * \param[in] nbytes Length of data array 6717 * \param[in] numPoints Number of random seed points to generate 6718 * 6719 * \return boolean indicating success or failure 6720 */ 6721 bool Renderer::setStreamlinesSeedToFilledMesh(const DataSetId& id, 6722 char *data, size_t nbytes, 6723 int numPoints) 6724 { 6725 vtkSmartPointer<vtkDataSetReader> reader = vtkSmartPointer<vtkDataSetReader>::New(); 6726 vtkSmartPointer<vtkCharArray> dataSetString = vtkSmartPointer<vtkCharArray>::New(); 6727 6728 dataSetString->SetArray(data, nbytes, 1); 6729 reader->SetInputArray(dataSetString); 6730 reader->ReadFromInputStringOn(); 6731 reader->Update(); 6732 6733 vtkSmartPointer<vtkDataSet> dataSet = reader->GetOutput(); 6734 if (dataSet == NULL) { 6735 return false; 6736 } 6737 dataSet->SetPipelineInformation(NULL); 6738 6080 6739 StreamlinesHashmap::iterator itr; 6081 6740 … … 6090 6749 if (itr == _streamlines.end()) { 6091 6750 ERROR("Streamlines not found: %s", id.c_str()); 6092 return ;6093 } 6094 6095 do { 6096 itr->second->setSeedTo RandomPoints(numPoints);6751 return false; 6752 } 6753 6754 do { 6755 itr->second->setSeedToFilledMesh(dataSet, numPoints); 6097 6756 } while (doAll && ++itr != _streamlines.end()); 6098 6757 6099 6758 _needsRedraw = true; 6759 return true; 6100 6760 } 6101 6761 … … 6681 7341 } while (doAll && ++itr != _dataSets.end()); 6682 7342 6683 if (_cameraMode == IMAGE)6684 setCameraMode(PERSPECTIVE);6685 7343 initCamera(); 6686 7344 _needsRedraw = true; … … 7416 8074 _cameraOrientation[3] = 0.0; 7417 8075 } 7418 setViewAngle(_windowHeight);8076 //setViewAngle(_windowHeight); 7419 8077 double bounds[6]; 7420 8078 collectBounds(bounds, false); … … 7952 8610 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 7953 8611 } 8612 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 8613 itr != _cutplanes.end(); ++itr) { 8614 if ((!onlyVisible || itr->second->getVisibility()) && 8615 itr->second->getProp() != NULL) 8616 mergeBounds(bounds, bounds, itr->second->getProp()->GetBounds()); 8617 } 7954 8618 for (GlyphsHashmap::iterator itr = _glyphs.begin(); 7955 8619 itr != _glyphs.end(); ++itr) { … … 8048 8712 for (Contour3DHashmap::iterator itr = _contour3Ds.begin(); 8049 8713 itr != _contour3Ds.end(); ++itr) { 8714 itr->second->updateRanges(_useCumulativeRange, 8715 _cumulativeScalarRange, 8716 _cumulativeVectorMagnitudeRange, 8717 _cumulativeVectorComponentRange); 8718 } 8719 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 8720 itr != _cutplanes.end(); ++itr) { 8050 8721 itr->second->updateRanges(_useCumulativeRange, 8051 8722 _cumulativeScalarRange, … … 8383 9054 if (id.compare("all") == 0 || getContour3D(id) != NULL) 8384 9055 setContour3DOpacity(id, opacity); 9056 if (id.compare("all") == 0 || getCutplane(id) != NULL) 9057 setCutplaneOpacity(id, opacity); 8385 9058 if (id.compare("all") == 0 || getGlyphs(id) != NULL) 8386 9059 setGlyphsOpacity(id, opacity); … … 8431 9104 if (id.compare("all") == 0 || getContour3D(id) != NULL) 8432 9105 setContour3DVisibility(id, state); 9106 if (id.compare("all") == 0 || getCutplane(id) != NULL) 9107 setCutplaneVisibility(id, state); 8433 9108 if (id.compare("all") == 0 || getGlyphs(id) != NULL) 8434 9109 setGlyphsVisibility(id, state); … … 8537 9212 } 8538 9213 } else { 8539 if (ratio > 0.0) {9214 if (ratio < 1.0) { 8540 9215 if (_userClipPlanes[1] == NULL) { 8541 9216 _userClipPlanes[1] = vtkSmartPointer<vtkPlane>::New(); … … 8560 9235 } 8561 9236 } else { 8562 if (ratio > 0.0) {9237 if (ratio < 1.0) { 8563 9238 if (_userClipPlanes[3] == NULL) { 8564 9239 _userClipPlanes[3] = vtkSmartPointer<vtkPlane>::New(); … … 8583 9258 } 8584 9259 } else { 8585 if (ratio > 0.0) {9260 if (ratio < 1.0) { 8586 9261 if (_userClipPlanes[5] == NULL) { 8587 9262 _userClipPlanes[5] = vtkSmartPointer<vtkPlane>::New(); … … 8639 9314 itr->second->setClippingPlanes(_activeClipPlanes); 8640 9315 } 9316 for (CutplaneHashmap::iterator itr = _cutplanes.begin(); 9317 itr != _cutplanes.end(); ++itr) { 9318 itr->second->setClippingPlanes(_activeClipPlanes); 9319 } 8641 9320 for (GlyphsHashmap::iterator itr = _glyphs.begin(); 8642 9321 itr != _glyphs.end(); ++itr) { -
branches/vtkvis_threaded/RpVtkRenderer.h
r2496 r2523 29 29 #include "RpContour2D.h" 30 30 #include "RpContour3D.h" 31 #include "RpCutplane.h" 31 32 #include "RpGlyphs.h" 32 33 #include "RpHeightMap.h" … … 101 102 typedef std::tr1::unordered_map<DataSetId, Contour2D *> Contour2DHashmap; 102 103 typedef std::tr1::unordered_map<DataSetId, Contour3D *> Contour3DHashmap; 104 typedef std::tr1::unordered_map<DataSetId, Cutplane *> CutplaneHashmap; 103 105 typedef std::tr1::unordered_map<DataSetId, Glyphs *> GlyphsHashmap; 104 106 typedef std::tr1::unordered_map<DataSetId, HeightMap *> HeightMapHashmap; … … 164 166 void setViewAngle(int height); 165 167 168 vtkCamera *getVtkCamera() 169 { 170 if (_renderer != NULL) 171 return _renderer->GetActiveCamera(); 172 else 173 return NULL; 174 } 175 166 176 void setCameraMode(CameraMode mode); 167 177 … … 333 343 void setContour3DColorMap(const DataSetId& id, const ColorMapId& colorMapId); 334 344 345 // Cutplanes 346 347 bool addCutplane(const DataSetId& id); 348 349 void deleteCutplane(const DataSetId& id); 350 351 Cutplane *getCutplane(const DataSetId& id); 352 353 void setCutplaneTransform(const DataSetId& id, vtkMatrix4x4 *trans); 354 355 void setCutplaneOrientation(const DataSetId& id, double quat[4]); 356 357 void setCutplaneOrientation(const DataSetId& id, double angle, double axis[3]); 358 359 void setCutplanePosition(const DataSetId& id, double pos[3]); 360 361 void setCutplaneScale(const DataSetId& id, double scale[3]); 362 363 void setCutplaneEdgeVisibility(const DataSetId& id, bool state); 364 365 void setCutplaneEdgeColor(const DataSetId& id, float color[3]); 366 367 void setCutplaneEdgeWidth(const DataSetId& id, float edgeWidth); 368 369 void setCutplaneLighting(const DataSetId& id, bool state); 370 371 void setCutplaneOpacity(const DataSetId& id, double opacity); 372 373 void setCutplaneVisibility(const DataSetId& id, bool state); 374 375 void setCutplaneWireframe(const DataSetId& id, bool state); 376 377 void setCutplaneVolumeSlice(const DataSetId& id, Cutplane::Axis axis, double ratio); 378 379 void setCutplaneColorMap(const DataSetId& id, const ColorMapId& colorMapId); 380 381 void setCutplaneColorMode(const DataSetId& id, Cutplane::ColorMode mode); 382 335 383 // Glyphs 336 384 … … 611 659 void setStreamlinesVisibility(const DataSetId& id, bool state); 612 660 613 void setStreamlinesSeedToRandomPoints(const DataSetId& id, int numPoints); 661 void setStreamlinesSeedToMeshPoints(const DataSetId& id); 662 663 void setStreamlinesSeedToFilledMesh(const DataSetId& id, int numPoints); 664 665 bool setStreamlinesSeedToMeshPoints(const DataSetId& id, 666 char *data, size_t nbytes); 667 668 bool setStreamlinesSeedToFilledMesh(const DataSetId& id, 669 char *data, size_t nbytes, 670 int numPoints); 614 671 615 672 void setStreamlinesSeedToRake(const DataSetId& id, … … 745 802 Contour2DHashmap _contour2Ds; 746 803 Contour3DHashmap _contour3Ds; 804 CutplaneHashmap _cutplanes; 747 805 GlyphsHashmap _glyphs; 748 806 HeightMapHashmap _heightMaps; -
branches/vtkvis_threaded/RpVtkRendererCmd.cpp
r2500 r2523 21 21 #include "RpVtkRendererCmd.h" 22 22 #include "RpVtkRenderServer.h" 23 #include "RpVtkRenderer.h" 23 24 #include "PPMWriter.h" 24 25 #include "TGAWriter.h" … … 63 64 64 65 #endif /*USE_THREADS*/ 66 67 static size_t 68 SocketRead(void *bytes, size_t len) 69 { 70 #ifdef notdef 71 size_t ofs = 0; 72 ssize_t bytesRead = 0; 73 while ((bytesRead = read(g_fdIn, bytes + ofs, len - ofs)) > 0) { 74 ofs += bytesRead; 75 if (ofs == len) 76 break; 77 } 78 TRACE("bytesRead: %lu", ofs); 79 return ofs; 80 #else 81 size_t bytesRead = fread(bytes, 1, len, g_fIn); 82 TRACE("bytesRead: %lu", bytesRead); 83 return bytesRead; 84 #endif 85 } 65 86 66 87 static int … … 203 224 { 204 225 const char *title = Tcl_GetString(objv[3]); 226 if (strlen(title) > 30) { 227 Tcl_AppendResult(interp, "axis name \"", title, 228 "\" is too long", (char*)NULL); 229 return TCL_ERROR; 230 } 205 231 const char *string = Tcl_GetString(objv[2]); 206 232 char c = string[0]; … … 270 296 { 271 297 const char *units = Tcl_GetString(objv[3]); 298 if (strlen(units) > 10) { 299 Tcl_AppendResult(interp, "axis units name \"", units, 300 "\" is too long", (char*)NULL); 301 return TCL_ERROR; 302 } 272 303 const char *string = Tcl_GetString(objv[2]); 273 304 char c = string[0]; … … 277 308 g_renderer->setAxisUnits(Renderer::Y_AXIS, units); 278 309 } else if ((c == 'z') && (strcmp(string, "z") == 0)) { 310 g_renderer->setAxisUnits(Renderer::Z_AXIS, units); 311 } else if ((c == 'a') && (strcmp(string, "all") == 0)) { 312 g_renderer->setAxisUnits(Renderer::X_AXIS, units); 313 g_renderer->setAxisUnits(Renderer::Y_AXIS, units); 279 314 g_renderer->setAxisUnits(Renderer::Z_AXIS, units); 280 315 } else { … … 1266 1301 1267 1302 static int 1303 CutplaneAddOp(ClientData clientData, Tcl_Interp *interp, int objc, 1304 Tcl_Obj *const *objv) 1305 { 1306 if (objc == 3) { 1307 const char *name = Tcl_GetString(objv[2]); 1308 if (!g_renderer->addCutplane(name)) { 1309 Tcl_AppendResult(interp, "Failed to create cutplane", (char*)NULL); 1310 return TCL_ERROR; 1311 } 1312 } else { 1313 if (!g_renderer->addCutplane("all")) { 1314 Tcl_AppendResult(interp, "Failed to create cutplane for one or more data sets", (char*)NULL); 1315 return TCL_ERROR; 1316 } 1317 } 1318 return TCL_OK; 1319 } 1320 1321 static int 1322 CutplaneColorMapOp(ClientData clientData, Tcl_Interp *interp, int objc, 1323 Tcl_Obj *const *objv) 1324 { 1325 const char *colorMapName = Tcl_GetString(objv[2]); 1326 if (objc == 4) { 1327 const char *dataSetName = Tcl_GetString(objv[3]); 1328 g_renderer->setCutplaneColorMap(dataSetName, colorMapName); 1329 } else { 1330 g_renderer->setCutplaneColorMap("all", colorMapName); 1331 } 1332 return TCL_OK; 1333 } 1334 1335 static int 1336 CutplaneColorModeOp(ClientData clientData, Tcl_Interp *interp, int objc, 1337 Tcl_Obj *const *objv) 1338 { 1339 Cutplane::ColorMode mode; 1340 const char *str = Tcl_GetString(objv[2]); 1341 if (str[0] == 's' && strcmp(str, "scalar") == 0) { 1342 mode = Cutplane::COLOR_BY_SCALAR; 1343 } else if (str[0] == 'v' && strcmp(str, "vmag") == 0) { 1344 mode = Cutplane::COLOR_BY_VECTOR_MAGNITUDE; 1345 } else if (str[0] == 'v' && strcmp(str, "vx") == 0) { 1346 mode = Cutplane::COLOR_BY_VECTOR_X; 1347 } else if (str[0] == 'v' && strcmp(str, "vy") == 0) { 1348 mode = Cutplane::COLOR_BY_VECTOR_Y; 1349 } else if (str[0] == 'v' && strcmp(str, "vz") == 0) { 1350 mode = Cutplane::COLOR_BY_VECTOR_Z; 1351 } else { 1352 Tcl_AppendResult(interp, "bad color mode option \"", str, 1353 "\": should be one of: 'scalar', 'vmag', 'vx', 'vy', 'vz'", (char*)NULL); 1354 return TCL_ERROR; 1355 } 1356 if (objc == 4) { 1357 const char *name = Tcl_GetString(objv[3]); 1358 g_renderer->setCutplaneColorMode(name, mode); 1359 } else { 1360 g_renderer->setCutplaneColorMode("all", mode); 1361 } 1362 return TCL_OK; 1363 } 1364 1365 static int 1366 CutplaneDeleteOp(ClientData clientData, Tcl_Interp *interp, int objc, 1367 Tcl_Obj *const *objv) 1368 { 1369 if (objc == 3) { 1370 const char *name = Tcl_GetString(objv[2]); 1371 g_renderer->deleteCutplane(name); 1372 } else { 1373 g_renderer->deleteCutplane("all"); 1374 } 1375 return TCL_OK; 1376 } 1377 1378 static int 1379 CutplaneEdgeVisibilityOp(ClientData clientData, Tcl_Interp *interp, int objc, 1380 Tcl_Obj *const *objv) 1381 { 1382 bool state; 1383 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1384 return TCL_ERROR; 1385 } 1386 if (objc == 4) { 1387 const char *name = Tcl_GetString(objv[3]); 1388 g_renderer->setCutplaneEdgeVisibility(name, state); 1389 } else { 1390 g_renderer->setCutplaneEdgeVisibility("all", state); 1391 } 1392 return TCL_OK; 1393 } 1394 1395 static int 1396 CutplaneLightingOp(ClientData clientData, Tcl_Interp *interp, int objc, 1397 Tcl_Obj *const *objv) 1398 { 1399 bool state; 1400 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1401 return TCL_ERROR; 1402 } 1403 if (objc == 4) { 1404 const char *name = Tcl_GetString(objv[3]); 1405 g_renderer->setCutplaneLighting(name, state); 1406 } else { 1407 g_renderer->setCutplaneLighting("all", state); 1408 } 1409 return TCL_OK; 1410 } 1411 1412 static int 1413 CutplaneLineColorOp(ClientData clientData, Tcl_Interp *interp, int objc, 1414 Tcl_Obj *const *objv) 1415 { 1416 float color[3]; 1417 if (GetFloatFromObj(interp, objv[2], &color[0]) != TCL_OK || 1418 GetFloatFromObj(interp, objv[3], &color[1]) != TCL_OK || 1419 GetFloatFromObj(interp, objv[4], &color[2]) != TCL_OK) { 1420 return TCL_ERROR; 1421 } 1422 if (objc == 6) { 1423 const char *name = Tcl_GetString(objv[5]); 1424 g_renderer->setCutplaneEdgeColor(name, color); 1425 } else { 1426 g_renderer->setCutplaneEdgeColor("all", color); 1427 } 1428 return TCL_OK; 1429 } 1430 1431 static int 1432 CutplaneLineWidthOp(ClientData clientData, Tcl_Interp *interp, int objc, 1433 Tcl_Obj *const *objv) 1434 { 1435 float width; 1436 if (GetFloatFromObj(interp, objv[2], &width) != TCL_OK) { 1437 return TCL_ERROR; 1438 } 1439 if (objc == 4) { 1440 const char *name = Tcl_GetString(objv[3]); 1441 g_renderer->setCutplaneEdgeWidth(name, width); 1442 } else { 1443 g_renderer->setCutplaneEdgeWidth("all", width); 1444 } 1445 return TCL_OK; 1446 } 1447 1448 static int 1449 CutplaneOpacityOp(ClientData clientData, Tcl_Interp *interp, int objc, 1450 Tcl_Obj *const *objv) 1451 { 1452 double opacity; 1453 if (Tcl_GetDoubleFromObj(interp, objv[2], &opacity) != TCL_OK) { 1454 return TCL_ERROR; 1455 } 1456 if (objc == 4) { 1457 const char *name = Tcl_GetString(objv[3]); 1458 g_renderer->setCutplaneOpacity(name, opacity); 1459 } else { 1460 g_renderer->setCutplaneOpacity("all", opacity); 1461 } 1462 return TCL_OK; 1463 } 1464 1465 static int 1466 CutplaneOrientOp(ClientData clientData, Tcl_Interp *interp, int objc, 1467 Tcl_Obj *const *objv) 1468 { 1469 double quat[4]; 1470 if (Tcl_GetDoubleFromObj(interp, objv[2], &quat[0]) != TCL_OK || 1471 Tcl_GetDoubleFromObj(interp, objv[3], &quat[1]) != TCL_OK || 1472 Tcl_GetDoubleFromObj(interp, objv[4], &quat[2]) != TCL_OK || 1473 Tcl_GetDoubleFromObj(interp, objv[5], &quat[3]) != TCL_OK) { 1474 return TCL_ERROR; 1475 } 1476 if (objc == 7) { 1477 const char *name = Tcl_GetString(objv[6]); 1478 g_renderer->setCutplaneOrientation(name, quat); 1479 } else { 1480 g_renderer->setCutplaneOrientation("all", quat); 1481 } 1482 return TCL_OK; 1483 } 1484 1485 static int 1486 CutplanePositionOp(ClientData clientData, Tcl_Interp *interp, int objc, 1487 Tcl_Obj *const *objv) 1488 { 1489 double pos[3]; 1490 if (Tcl_GetDoubleFromObj(interp, objv[2], &pos[0]) != TCL_OK || 1491 Tcl_GetDoubleFromObj(interp, objv[3], &pos[1]) != TCL_OK || 1492 Tcl_GetDoubleFromObj(interp, objv[4], &pos[2]) != TCL_OK) { 1493 return TCL_ERROR; 1494 } 1495 if (objc == 6) { 1496 const char *name = Tcl_GetString(objv[5]); 1497 g_renderer->setCutplanePosition(name, pos); 1498 } else { 1499 g_renderer->setCutplanePosition("all", pos); 1500 } 1501 return TCL_OK; 1502 } 1503 1504 static int 1505 CutplaneScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 1506 Tcl_Obj *const *objv) 1507 { 1508 double scale[3]; 1509 if (Tcl_GetDoubleFromObj(interp, objv[2], &scale[0]) != TCL_OK || 1510 Tcl_GetDoubleFromObj(interp, objv[3], &scale[1]) != TCL_OK || 1511 Tcl_GetDoubleFromObj(interp, objv[4], &scale[2]) != TCL_OK) { 1512 return TCL_ERROR; 1513 } 1514 if (objc == 6) { 1515 const char *name = Tcl_GetString(objv[5]); 1516 g_renderer->setCutplaneScale(name, scale); 1517 } else { 1518 g_renderer->setCutplaneScale("all", scale); 1519 } 1520 return TCL_OK; 1521 } 1522 1523 static int 1524 CutplaneVisibleOp(ClientData clientData, Tcl_Interp *interp, int objc, 1525 Tcl_Obj *const *objv) 1526 { 1527 bool state; 1528 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1529 return TCL_ERROR; 1530 } 1531 if (objc == 4) { 1532 const char *name = Tcl_GetString(objv[3]); 1533 g_renderer->setCutplaneVisibility(name, state); 1534 } else { 1535 g_renderer->setCutplaneVisibility("all", state); 1536 } 1537 return TCL_OK; 1538 } 1539 1540 static int 1541 CutplaneVolumeSliceOp(ClientData clientData, Tcl_Interp *interp, int objc, 1542 Tcl_Obj *const *objv) 1543 { 1544 double ratio; 1545 if (Tcl_GetDoubleFromObj(interp, objv[3], &ratio) != TCL_OK) { 1546 return TCL_ERROR; 1547 } 1548 const char *string = Tcl_GetString(objv[2]); 1549 char c = string[0]; 1550 Cutplane::Axis axis; 1551 if ((c == 'x') && (strcmp(string, "x") == 0)) { 1552 axis = Cutplane::X_AXIS; 1553 } else if ((c == 'y') && (strcmp(string, "y") == 0)) { 1554 axis = Cutplane::Y_AXIS; 1555 } else if ((c == 'z') && (strcmp(string, "z") == 0)) { 1556 axis = Cutplane::Z_AXIS; 1557 } else { 1558 Tcl_AppendResult(interp, "bad axis option \"", string, 1559 "\": should be axisName ratio", (char*)NULL); 1560 return TCL_ERROR; 1561 } 1562 if (objc == 5) { 1563 const char *name = Tcl_GetString(objv[4]); 1564 g_renderer->setCutplaneVolumeSlice(name, axis, ratio); 1565 } else { 1566 g_renderer->setCutplaneVolumeSlice("all", axis, ratio); 1567 } 1568 return TCL_OK; 1569 } 1570 1571 static int 1572 CutplaneWireframeOp(ClientData clientData, Tcl_Interp *interp, int objc, 1573 Tcl_Obj *const *objv) 1574 { 1575 bool state; 1576 if (GetBooleanFromObj(interp, objv[2], &state) != TCL_OK) { 1577 return TCL_ERROR; 1578 } 1579 if (objc == 4) { 1580 const char *name = Tcl_GetString(objv[3]); 1581 g_renderer->setCutplaneWireframe(name, state); 1582 } else { 1583 g_renderer->setCutplaneWireframe("all", state); 1584 } 1585 return TCL_OK; 1586 } 1587 1588 static Rappture::CmdSpec cutplaneOps[] = { 1589 {"add", 1, CutplaneAddOp, 2, 3, "oper value ?dataSetName?"}, 1590 {"colormap", 7, CutplaneColorMapOp, 3, 4, "colorMapName ?dataSetName?"}, 1591 {"colormode", 7, CutplaneColorModeOp, 3, 4, "mode ?dataSetNme?"}, 1592 {"delete", 1, CutplaneDeleteOp, 2, 3, "?dataSetName?"}, 1593 {"edges", 1, CutplaneEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"}, 1594 {"lighting", 3, CutplaneLightingOp, 3, 4, "bool ?dataSetName?"}, 1595 {"linecolor", 5, CutplaneLineColorOp, 5, 6, "r g b ?dataSetName?"}, 1596 {"linewidth", 5, CutplaneLineWidthOp, 3, 4, "width ?dataSetName?"}, 1597 {"opacity", 2, CutplaneOpacityOp, 3, 4, "value ?dataSetName?"}, 1598 {"orient", 2, CutplaneOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 1599 {"pos", 1, CutplanePositionOp, 5, 6, "x y z ?dataSetName?"}, 1600 {"scale", 2, CutplaneScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 1601 {"slice", 2, CutplaneVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}, 1602 {"visible", 1, CutplaneVisibleOp, 3, 4, "bool ?dataSetName?"}, 1603 {"wireframe", 1, CutplaneWireframeOp, 3, 4, "bool ?dataSetName?"} 1604 }; 1605 static int nCutplaneOps = NumCmdSpecs(cutplaneOps); 1606 1607 static int 1608 CutplaneCmd(ClientData clientData, Tcl_Interp *interp, int objc, 1609 Tcl_Obj *const *objv) 1610 { 1611 Tcl_ObjCmdProc *proc; 1612 1613 proc = Rappture::GetOpFromObj(interp, nCutplaneOps, cutplaneOps, 1614 Rappture::CMDSPEC_ARG1, objc, objv, 0); 1615 if (proc == NULL) { 1616 return TCL_ERROR; 1617 } 1618 return (*proc) (clientData, interp, objc, objv); 1619 } 1620 1621 static int 1268 1622 DataSetActiveScalarsOp(ClientData clientData, Tcl_Interp *interp, int objc, 1269 1623 Tcl_Obj *const *objv) … … 1334 1688 } 1335 1689 char *data = (char *)malloc(nbytes); 1336 size_t bytesRead = fread(data, 1, nbytes, g_fIn); 1337 TRACE("bytesRead: %d", bytesRead); 1690 size_t bytesRead = SocketRead(data, nbytes); 1338 1691 if (bytesRead < (size_t)nbytes) { 1339 1692 free(data); … … 2589 2942 static Rappture::CmdSpec heightmapOps[] = { 2590 2943 {"add", 1, HeightMapAddOp, 5, 6, "oper value ?dataSetName?"}, 2591 {"colormap", 2, HeightMapColorMapOp, 3, 4, "colorMapName ?dataSetName?"},2592 {"contourlist", 2, HeightMapContourListOp, 3, 4, "contourList ?dataSetName?"},2944 {"colormap", 3, HeightMapColorMapOp, 3, 4, "colorMapName ?dataSetName?"}, 2945 {"contourlist", 3, HeightMapContourListOp, 3, 4, "contourList ?dataSetName?"}, 2593 2946 {"delete", 1, HeightMapDeleteOp, 2, 3, "?dataSetName?"}, 2594 2947 {"edges", 1, HeightMapEdgeVisibilityOp, 3, 4, "bool ?dataSetName?"}, … … 2604 2957 {"orient", 2, HeightMapOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 2605 2958 {"pos", 1, HeightMapPositionOp, 5, 6, "x y z ?dataSetName?"}, 2606 {"scale", 1, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 2959 {"scale", 2, HeightMapScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 2960 {"slice", 2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}, 2607 2961 {"surface", 2, HeightMapContourSurfaceVisibleOp, 3, 4, "bool ?dataSetName?"}, 2608 {"visible", 2, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"}, 2609 {"volumeslice", 2, HeightMapVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}, 2962 {"visible", 1, HeightMapVisibleOp, 3, 4, "bool ?dataSetName?"}, 2610 2963 {"wireframe", 1, HeightMapWireframeOp, 3, 4, "bool ?dataSetName?"} 2611 2964 }; … … 2978 3331 {"orient", 2, LICOrientOp, 6, 7, "qw qx qy qz ?dataSetName?"}, 2979 3332 {"pos", 1, LICPositionOp, 5, 6, "x y z ?dataSetName?"}, 2980 {"scale", 1, LICScaleOp, 5, 6, "sx sy sz ?dataSetName?"},2981 {" visible", 2, LICVisibleOp, 3, 4, "bool?dataSetName?"},2982 {"v olumeslice", 2, LICVolumeSliceOp, 4, 5, "axis ratio?dataSetName?"}3333 {"scale", 2, LICScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 3334 {"slice", 2, LICVolumeSliceOp, 4, 5, "axis ratio ?dataSetName?"}, 3335 {"visible", 1, LICVisibleOp, 3, 4, "bool ?dataSetName?"} 2983 3336 }; 2984 3337 static int nLICOps = NumCmdSpecs(licOps); … … 4386 4739 4387 4740 static int 4741 StreamlinesSeedFilledMeshOp(ClientData clientData, Tcl_Interp *interp, 4742 int objc, Tcl_Obj *const *objv) 4743 { 4744 int numPoints = 0; 4745 if (Tcl_GetIntFromObj(interp, objv[3], &numPoints) != TCL_OK || 4746 numPoints < 1) { 4747 return TCL_ERROR; 4748 } 4749 const char *string = Tcl_GetString(objv[4]); 4750 char c = string[0]; 4751 if ((c != 'd') || (strcmp(string, "data") != 0)) { 4752 Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"", 4753 string, "\": should be data", (char*)NULL); 4754 return TCL_ERROR; 4755 } 4756 string = Tcl_GetString(objv[5]); 4757 c = string[0]; 4758 if ((c != 'f') || (strcmp(string, "follows") != 0)) { 4759 Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"", 4760 string, "\": should be follows", (char*)NULL); 4761 return TCL_ERROR; 4762 } 4763 int nbytes = 0; 4764 if (Tcl_GetIntFromObj(interp, objv[6], &nbytes) != TCL_OK || 4765 nbytes < 0) { 4766 return TCL_ERROR; 4767 } 4768 char *data = (char *)malloc(nbytes); 4769 size_t bytesRead = SocketRead(data, nbytes); 4770 if (bytesRead < (size_t)nbytes) { 4771 free(data); 4772 return TCL_ERROR; 4773 } 4774 if (objc == 8) { 4775 const char *name = Tcl_GetString(objv[7]); 4776 if (!g_renderer->setStreamlinesSeedToFilledMesh(name, data, nbytes, 4777 numPoints)) { 4778 free(data); 4779 Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL); 4780 return TCL_ERROR; 4781 } 4782 } else { 4783 if (!g_renderer->setStreamlinesSeedToFilledMesh("all", data, nbytes, 4784 numPoints)) { 4785 free(data); 4786 Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL); 4787 return TCL_ERROR; 4788 } 4789 } 4790 free(data); 4791 return TCL_OK; 4792 } 4793 4794 static int 4795 StreamlinesSeedMeshPointsOp(ClientData clientData, Tcl_Interp *interp, 4796 int objc, Tcl_Obj *const *objv) 4797 { 4798 const char *string = Tcl_GetString(objv[3]); 4799 char c = string[0]; 4800 if ((c != 'd') || (strcmp(string, "data") != 0)) { 4801 Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"", 4802 string, "\": should be data", (char*)NULL); 4803 return TCL_ERROR; 4804 } 4805 string = Tcl_GetString(objv[4]); 4806 c = string[0]; 4807 if ((c != 'f') || (strcmp(string, "follows") != 0)) { 4808 Tcl_AppendResult(interp, "bad streamlines seed fmesh option \"", 4809 string, "\": should be follows", (char*)NULL); 4810 return TCL_ERROR; 4811 } 4812 int nbytes = 0; 4813 if (Tcl_GetIntFromObj(interp, objv[5], &nbytes) != TCL_OK || 4814 nbytes < 0) { 4815 return TCL_ERROR; 4816 } 4817 char *data = (char *)malloc(nbytes); 4818 size_t bytesRead = SocketRead(data, nbytes); 4819 if (bytesRead < (size_t)nbytes) { 4820 free(data); 4821 return TCL_ERROR; 4822 } 4823 if (objc == 7) { 4824 const char *name = Tcl_GetString(objv[6]); 4825 if (!g_renderer->setStreamlinesSeedToMeshPoints(name, data, nbytes)) { 4826 free(data); 4827 Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL); 4828 return TCL_ERROR; 4829 } 4830 } else { 4831 if (!g_renderer->setStreamlinesSeedToMeshPoints("all", data, nbytes)) { 4832 free(data); 4833 Tcl_AppendResult(interp, "Couldn't read mesh data or streamlines not found", (char*)NULL); 4834 return TCL_ERROR; 4835 } 4836 } 4837 free(data); 4838 return TCL_OK; 4839 } 4840 4841 static int 4842 StreamlinesSeedPointsOp(ClientData clientData, Tcl_Interp *interp, int objc, 4843 Tcl_Obj *const *objv) 4844 { 4845 if (objc == 4) { 4846 const char *name = Tcl_GetString(objv[3]); 4847 g_renderer->setStreamlinesSeedToMeshPoints(name); 4848 } else { 4849 g_renderer->setStreamlinesSeedToMeshPoints("all"); 4850 } 4851 return TCL_OK; 4852 } 4853 4854 static int 4388 4855 StreamlinesSeedPolygonOp(ClientData clientData, Tcl_Interp *interp, int objc, 4389 4856 Tcl_Obj *const *objv) … … 4498 4965 if (objc == 5) { 4499 4966 const char *name = Tcl_GetString(objv[4]); 4500 g_renderer->setStreamlinesSeedTo RandomPoints(name, numPoints);4501 } else { 4502 g_renderer->setStreamlinesSeedTo RandomPoints("all", numPoints);4967 g_renderer->setStreamlinesSeedToFilledMesh(name, numPoints); 4968 } else { 4969 g_renderer->setStreamlinesSeedToFilledMesh("all", numPoints); 4503 4970 } 4504 4971 return TCL_OK; … … 4525 4992 {"color", 1, StreamlinesSeedColorOp, 6, 7, "r g b ?dataSetName?"}, 4526 4993 {"disk", 1, StreamlinesSeedDiskOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ radius innerRadius numPoints ?dataSetName?"}, 4527 {"fpoly", 1, StreamlinesSeedFilledPolygonOp, 13, 14, "centerX centerY centerZ normalX normalY normalZ angle radius numSides numPoints ?dataSetName?"}, 4528 {"polygon", 1, StreamlinesSeedPolygonOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ angle radius numSides ?dataSetName?"}, 4994 {"fmesh", 2, StreamlinesSeedFilledMeshOp, 7, 8, "numPoints data follows nbytes ?dataSetName?"}, 4995 {"fpoly", 2, StreamlinesSeedFilledPolygonOp, 13, 14, "centerX centerY centerZ normalX normalY normalZ angle radius numSides numPoints ?dataSetName?"}, 4996 {"mesh", 1, StreamlinesSeedMeshPointsOp, 6, 7, "data follows nbytes ?dataSetName?"}, 4997 {"points", 3, StreamlinesSeedPointsOp, 3, 4, "?dataSetName?"}, 4998 {"polygon", 3, StreamlinesSeedPolygonOp, 12, 13, "centerX centerY centerZ normalX normalY normalZ angle radius numSides ?dataSetName?"}, 4529 4999 {"rake", 3, StreamlinesSeedRakeOp, 10, 11, "startX startY startZ endX endY endZ numPoints ?dataSetName?"}, 4530 5000 {"random", 3, StreamlinesSeedRandomOp, 4, 5, "numPoints ?dataSetName?"}, … … 4602 5072 {"ribbons", 1, StreamlinesRibbonsOp, 4, 5, "width angle ?dataSetName?"}, 4603 5073 {"scale", 2, StreamlinesScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 4604 {"seed", 2, StreamlinesSeedOp, 4, 14, "op params... ?dataSetName?"},5074 {"seed", 2, StreamlinesSeedOp, 3, 14, "op params... ?dataSetName?"}, 4605 5075 {"tubes", 1, StreamlinesTubesOp, 4, 5, "numSides radius ?dataSetName?"}, 4606 5076 {"visible", 1, StreamlinesVisibleOp, 3, 4, "bool ?dataSetName?"} … … 4980 5450 Tcl_CreateObjCommand(interp, "contour2d", Contour2DCmd, clientData, NULL); 4981 5451 Tcl_CreateObjCommand(interp, "contour3d", Contour3DCmd, clientData, NULL); 5452 Tcl_CreateObjCommand(interp, "cutplane", CutplaneCmd, clientData, NULL); 4982 5453 Tcl_CreateObjCommand(interp, "dataset", DataSetCmd, clientData, NULL); 4983 5454 Tcl_CreateObjCommand(interp, "glyphs", GlyphsCmd, clientData, NULL); … … 5006 5477 Tcl_DeleteCommand(interp, "contour2d"); 5007 5478 Tcl_DeleteCommand(interp, "contour3d"); 5479 Tcl_DeleteCommand(interp, "cutplane"); 5008 5480 Tcl_DeleteCommand(interp, "dataset"); 5009 5481 Tcl_DeleteCommand(interp, "glyphs"); -
branches/vtkvis_threaded/Trace.cpp
r2495 r2523 3 3 * Copyright (C) 2011, Purdue Research Foundation 4 4 * 5 * Author: ?5 * Author: George A. Howlett <gah@purdue.edu> 6 6 */ 7 7 -
branches/vtkvis_threaded/Trace.h
r2495 r2523 3 3 * Copyright (C) 2011, Purdue Research Foundation 4 4 * 5 * Author: ?5 * Author: George A. Howlett <gah@purdue.edu> 6 6 */ 7 7 -
branches/vtkvis_threaded/protocol.txt
r2496 r2523 144 144 contour3d wireframe <bool> <?datasetName?> 145 145 146 glyphs add <?dataSetName?> 146 cutplane add <?dataSetName?> 147 cutplane colormap <colorMapName> <?dataSetName?> 148 cutplane colormode <scalar|vmag|vx|vy|vz> <?datasetName?> 149 Set the field used to color the object. 'scalar' uses 150 the active scalar field. 'vmag' uses the magnitude of the current 151 vector field, and 'vx','vy','vz' use the corresponding component of 152 the active vector field. 153 cutplane delete <?dataSetName?> 154 cutplane edges <bool> <?dataSetName?> 155 cutplane lighting <bool> <?dataSetName?> 156 cutplane linecolor <r> <g> <b> <?dataSetName?> 157 cutplane linewidth <width> <?dataSetName?> 158 cutplane opacity <value> <?dataSetName?> 159 cutplane orient <qw> <qx> <qy> <qz> <?dataSetName?> 160 cutplane pos <x> <y> <z> <?dataSetName?> 161 cutplane scale <sx> <sy> <sz> <?dataSetName?> 162 cutplane slice axis ratio <?dataSetName?> 163 For 3D data, select a slice along a principle axis of the volume. The 164 ratio is [0,1] 165 cutplane visible <bool> <?dataSetName?> 166 cutplane wireframe <bool> <?datasetName?> 167 168 glyphs add <shape> <?dataSetName?> 169 See 'glyphs shape' for list of shapes 147 170 glyphs ccolor r g b <?datasetName?> 148 171 glyphs colormap <colorMapName> <?dataSetName?> … … 193 216 heightmap pos <x> <y> <z> <?dataSetName?> 194 217 heightmap scale <sx> <sy> <sz> <?dataSetName?> 218 heightmap slice axis ratio <?dataSetName?> 219 For 3D data, select a slice along a principle axis of the volume. The 220 ratio is [0,1] 195 221 heightmap surface <bool> <?dataSetName?> 196 222 Toggle rendering of colormapped surface (mountain plot or cutplane) 197 223 heightmap visible <bool> <?dataSetName?> 198 heightmap volumeslice axis ratio <?dataSetName?>199 For 3D data, select a slice along a principle axis of the volume. The200 ratio is [0,1]201 224 heightmap wireframe <bool> <?datasetName?> 202 225 … … 212 235 lic pos <x> <y> <z> <?dataSetName?> 213 236 lic scale <sx> <sy> <sz> <?dataSetName?> 237 lic slice <axis> <ratio> <?datasetName?> 238 For 3D data, select a slice along a principle axis of the volume. The 239 ratio is [0,1] 214 240 lic visible <bool> <?datasetName?> 215 lic volumeslice <axis> <ratio> <?datasetName?>216 241 217 242 molecule add <?datasetName?> … … 305 330 Create a disk seed area with optional hole, filled with randomly 306 331 placed points 332 streamlines seed fmesh <numPoints> data follows <nbytes> <?datasetName?> 333 Fill a mesh supplied as a VTK data file with randomly placed points 307 334 streamlines seed fpoly <centerX> <centerY> <centerZ> <normalX> <normalY> <normalZ> <angle> <radius> <numSides> <numPoints> <?dataSetName?> 308 335 Create a regular n-sided polygonal seed area filled with randomly 309 336 placed points 337 streamlines seed mesh data follows <nbytes> <?datasetName?> 338 Use points of a mesh supplied as a VTK data file 339 streamlines seed points <?datasetName?> 340 Use points of the streamlines' dataset mesh 310 341 streamlines seed polygon <centerX> <centerY> <centerZ> <normalX> <normalY> <normalZ> <angle> <radius> <numSides> <?dataSetName?> 311 342 Create seed points from vertices of a regular n-sided polygon 312 343 streamlines seed rake <startX> <startY> <startZ> <endX> <endY> <endZ> <numPoints> <?datasetName?> 313 344 streamlines seed random <numPoints> <?datasetName?> 345 Fill the streamlines' dataset mesh with randomly placed points 314 346 streamlines seed visible <bool> <?datasetName?> 315 347 streamlines tubes <numSides> <radius> <?datasetName?> -
branches/vtkvis_threaded/vtkRpCubeAxesActor2D.cpp
r2496 r2523 439 439 // can be changed). Therefore, we can not just assign pointers otherwise 440 440 // each individual axis text prop would point to the same text prop. 441 #if def notdef441 #if 1 442 442 if (this->AxisLabelTextProperty && 443 443 this->AxisLabelTextProperty->GetMTime() > this->BuildTime) … … 1078 1078 } 1079 1079 1080 //----------------------------------------------------------------------------1081 1082 // Disable warnings about qualifiers on return types.1083 #if defined(_COMPILER_VERSION)1084 # pragma set woff 33031085 #endif1086 #if defined(__INTEL_COMPILER)1087 # pragma warning (disable:858)1088 #endif1089 1090 #ifndef VTK_LEGACY_REMOVE1091 # ifdef VTK_WORKAROUND_WINDOWS_MANGLE1092 # undef SetProp1093 # undef GetProp1094 void vtkRpCubeAxesActor2D::SetPropA(vtkProp* prop)1095 {1096 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",1097 vtkRpCubeAxesActor2D::SetViewProp);1098 this->SetViewProp(prop);1099 }1100 void vtkRpCubeAxesActor2D::SetPropW(vtkProp* prop)1101 {1102 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",1103 vtkRpCubeAxesActor2D::SetViewProp);1104 this->SetViewProp(prop);1105 }1106 vtkProp* vtkRpCubeAxesActor2D::GetPropA()1107 {1108 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",1109 vtkRpCubeAxesActor2D::GetViewProp);1110 return this->GetViewProp();1111 }1112 vtkProp* vtkRpCubeAxesActor2D::GetPropW()1113 {1114 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",1115 vtkRpCubeAxesActor2D::GetViewProp);1116 return this->GetViewProp();1117 }1118 # endif1119 void vtkRpCubeAxesActor2D::SetProp(vtkProp* prop)1120 {1121 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::SetProp, "VTK 5.0",1122 vtkRpCubeAxesActor2D::SetViewProp);1123 this->SetViewProp(prop);1124 }1125 vtkProp* vtkRpCubeAxesActor2D::GetProp()1126 {1127 VTK_LEGACY_REPLACED_BODY(vtkRpCubeAxesActor2D::GetProp, "VTK 5.0",1128 vtkRpCubeAxesActor2D::GetViewProp);1129 return this->GetViewProp();1130 }1131 #endif -
branches/vtkvis_threaded/vtkRpCubeAxesActor2D.h
r2320 r2523 253 253 void ShallowCopy(vtkRpCubeAxesActor2D *actor); 254 254 255 // Disable warnings about qualifiers on return types.256 #if defined(_COMPILER_VERSION)257 # pragma set woff 3303258 #endif259 #if defined(__INTEL_COMPILER)260 # pragma warning (push)261 # pragma warning (disable:858)262 #endif263 264 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE265 # define SetPropA SetProp266 # define SetPropW SetProp267 # define GetPropA GetProp268 # define GetPropW GetProp269 #endif270 271 // Description:272 // @deprecated Replaced by vtkRpCubeAxesActor2D::SetViewProp() as of VTK 5.0.273 VTK_LEGACY(virtual void SetProp(vtkProp* prop));274 275 // Description:276 // @deprecated Replaced by vtkRpCubeAxesActor2D::GetViewProp() as of VTK 5.0.277 VTK_LEGACY(virtual vtkProp* GetProp());278 279 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE280 # undef SetPropW281 # undef SetPropA282 # undef GetPropW283 # undef GetPropA284 //BTX285 VTK_LEGACY(virtual void SetPropA(vtkProp* prop));286 VTK_LEGACY(virtual void SetPropW(vtkProp* prop));287 VTK_LEGACY(virtual vtkProp* GetPropA());288 VTK_LEGACY(virtual vtkProp* GetPropW());289 //ETX290 #endif291 292 // Reset disabled warning about qualifiers on return types.293 #if defined(__INTEL_COMPILER)294 # pragma warning (pop)295 #endif296 #if defined(_COMPILER_VERSION)297 # pragma reset woff 3303298 #endif299 300 255 protected: 301 256 vtkRpCubeAxesActor2D();
Note: See TracChangeset
for help on using the changeset viewer.