vtk-m/vtkm/rendering/raytracing/VolumeRendererStructured.h
Kenneth Moreland be7f06bbe7 CoordinateSystem data is VariantArrayHandle
`CoordinateSystem` differed from `Field` in that its `GetData`
method returned an `ArrayHandleVirtualCoordinates` instead of
a `VariantArrayHandle`. This is probably confusing since
`CoordianteSystem` inherits `Field` and has a pretty dramatic
difference in this behavior.

In preparation to deprecate `ArrayHandleVirtualCoordinates`, this
changes `CoordiantSystem` to be much more like `Field`. (In the
future, we may change the `CoordinateSystem` to point to a `Field`
rather than be a special `Field`.)

A method named `GetDataAsMultiplexer` has been added to
`CoordinateSystem`. This method allows you to get data from
`CoordinateSystem` as a single array type without worrying
about creating functors to handle different types and without
needing virtual methods.
2020-07-14 08:50:39 -06:00

80 lines
2.3 KiB
C++

//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
//
// This software is distributed WITHOUT ANY WARRANTY; without even
// the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
// PURPOSE. See the above copyright notice for more information.
//============================================================================
#ifndef vtk_m_rendering_raytracing_VolumeRendererStructured_h
#define vtk_m_rendering_raytracing_VolumeRendererStructured_h
#include <vtkm/cont/DataSet.h>
#include <vtkm/rendering/raytracing/Ray.h>
#include <vtkm/rendering/vtkm_rendering_export.h>
namespace vtkm
{
namespace rendering
{
namespace raytracing
{
class VTKM_RENDERING_EXPORT VolumeRendererStructured
{
public:
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
using CartesianArrayHandle =
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
VTKM_CONT
VolumeRendererStructured();
VTKM_CONT
void EnableCompositeBackground();
VTKM_CONT
void DisableCompositeBackground();
VTKM_CONT
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
VTKM_CONT
void SetData(const vtkm::cont::CoordinateSystem& coords,
const vtkm::cont::Field& scalarField,
const vtkm::cont::CellSetStructured<3>& cellset,
const vtkm::Range& scalarRange);
VTKM_CONT
void Render(vtkm::rendering::raytracing::Ray<vtkm::Float32>& rays);
//VTKM_CONT
///void Render(vtkm::rendering::raytracing::Ray<vtkm::Float64>& rays);
VTKM_CONT
void SetSampleDistance(const vtkm::Float32& distance);
protected:
template <typename Precision, typename Device>
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
template <typename Precision>
struct RenderFunctor;
bool IsSceneDirty;
bool IsUniformDataSet;
vtkm::Bounds SpatialExtent;
vtkm::cont::CoordinateSystem Coordinates;
vtkm::cont::CellSetStructured<3> Cellset;
const vtkm::cont::Field* ScalarField;
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
vtkm::Float32 SampleDistance;
vtkm::Range ScalarRange;
};
}
}
} //namespace vtkm::rendering::raytracing
#endif