Ignore:
Timestamp:
Aug 15, 2013 2:41:12 PM (11 years ago)
Author:
ldelgass
Message:

Handle rectilinear/structured grids in vtk volume rendering using splat
resampling (for now).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/vizservers/vtkvis/Volume.cpp

    r3761 r3866  
    1414#include <vtkGPUVolumeRayCastMapper.h>
    1515#include <vtkVolumeTextureMapper3D.h>
     16#include <vtkRectilinearGrid.h>
     17#include <vtkStructuredGrid.h>
    1618#include <vtkUnstructuredGrid.h>
    1719#include <vtkPolyData.h>
     
    121123#endif
    122124        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
    125128        vtkSmartPointer<vtkGaussianSplatter> splatter = vtkSmartPointer<vtkGaussianSplatter>::New();
    126129#ifdef USE_VTK6
     
    131134        int dims[3];
    132135        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());
    135143        splatter->SetSampleDimensions(dims);
    136144        splatter->Update();
     
    144152        _volumeMapper->SetInputConnection(splatter->GetOutputPort());
    145153        vtkVolumeMapper::SafeDownCast(_volumeMapper)->SetBlendModeToComposite();
    146     } else if (vtkUnstructuredGrid::SafeDownCast(ds) != NULL) {
     154    } else {
    147155        // Unstructured grid with cells (not a cloud)
    148156        vtkUnstructuredGrid *ugrid = vtkUnstructuredGrid::SafeDownCast(ds);
     157        assert(ugrid != NULL);
    149158        // DataSet is unstructured grid
    150159        // Only works if cells are all tetrahedra
     
    177186        vtkUnstructuredGridVolumeMapper::SafeDownCast(_volumeMapper)->
    178187            SetBlendModeToComposite();
    179     } else {
    180         ERROR("Unsupported DataSet type: %s", _dataSet->getVtkType());
    181         _dataSet = NULL;
    182         return;
    183188    }
    184189
Note: See TracChangeset for help on using the changeset viewer.