Merge topic 'volume_rendering_fix'

7d4334b5 Had conditional backwards
50ccedf8 Fixing the default behavior of the volume renderer

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Kenneth Moreland <kmorel@sandia.gov>
Merge-request: !700
This commit is contained in:
Matt Larsen 2017-02-22 22:17:45 +00:00 committed by Kitware Robot
commit 6d9766943e
2 changed files with 11 additions and 3 deletions

@ -33,6 +33,8 @@
#include <typeinfo>
#define DEFAULT_SAMPLE_DISTANCE -1.f
namespace vtkm {
namespace rendering {
@ -48,7 +50,7 @@ struct MapperVolume::InternalsType
VTKM_CONT
InternalsType()
: Canvas(nullptr),
SampleDistance(-1.f),
SampleDistance(DEFAULT_SAMPLE_DISTANCE),
CompositeBackground(true)
{ }
@ -150,7 +152,12 @@ struct MapperVolume::RenderFunctor
tracer->GetCamera().SetParameters(this->Camera,
*this->Self->Internals->Canvas);
tracer->SetSampleDistance(this->Self->Internals->SampleDistance);
// Check to see of the sample distance was set
if(this->Self->Internals->SampleDistance != DEFAULT_SAMPLE_DISTANCE)
{
tracer->SetSampleDistance(this->Self->Internals->SampleDistance);
}
tracer->SetCompositeBackground(this->Self->Internals->CompositeBackground);
vtkm::Bounds dataBounds = this->Coordinates.GetBounds(Device());

@ -998,7 +998,8 @@ class SamplerCellAssocRect : public vtkm::worklet::WorkletMapField
extent[0] = static_cast<vtkm::Float32>(this->DataBounds.X.Length());
extent[1] = static_cast<vtkm::Float32>(this->DataBounds.Y.Length());
extent[2] = static_cast<vtkm::Float32>(this->DataBounds.Z.Length());
SampleDistance = vtkm::Magnitude(extent) / 1000.f;
const vtkm::Float32 defaultNumberOfSamples = 200.f;
SampleDistance = vtkm::Magnitude(extent) / defaultNumberOfSamples;
}
vtkm::worklet::DispatcherMapField< CalcRayStart >( CalcRayStart( camera.GetPosition(), this->DataBounds ))