mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
use lambda instead of functor, remove unused code
This commit is contained in:
parent
141d0e70ef
commit
86e6c5c3e0
@ -11,7 +11,6 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
|
||||||
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
#include <vtkm/cont/ArrayHandleCartesianProduct.h>
|
||||||
#include <vtkm/cont/ArrayHandleCounting.h>
|
#include <vtkm/cont/ArrayHandleCounting.h>
|
||||||
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
#include <vtkm/cont/ArrayHandleUniformPointCoordinates.h>
|
||||||
@ -20,7 +19,6 @@
|
|||||||
#include <vtkm/cont/ErrorBadValue.h>
|
#include <vtkm/cont/ErrorBadValue.h>
|
||||||
#include <vtkm/cont/Timer.h>
|
#include <vtkm/cont/Timer.h>
|
||||||
#include <vtkm/cont/TryExecute.h>
|
#include <vtkm/cont/TryExecute.h>
|
||||||
#include <vtkm/rendering/raytracing/Camera.h>
|
|
||||||
#include <vtkm/rendering/raytracing/Logger.h>
|
#include <vtkm/rendering/raytracing/Logger.h>
|
||||||
#include <vtkm/rendering/raytracing/Ray.h>
|
#include <vtkm/rendering/raytracing/Ray.h>
|
||||||
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
#include <vtkm/rendering/raytracing/RayTracingTypeDefs.h>
|
||||||
@ -33,6 +31,9 @@ namespace rendering
|
|||||||
{
|
{
|
||||||
namespace raytracing
|
namespace raytracing
|
||||||
{
|
{
|
||||||
|
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
||||||
|
using CartesianArrayHandle =
|
||||||
|
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
@ -41,9 +42,6 @@ template <typename Device>
|
|||||||
class RectilinearLocator
|
class RectilinearLocator
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
using DefaultHandle = vtkm::cont::ArrayHandle<vtkm::FloatDefault>;
|
|
||||||
using CartesianArrayHandle =
|
|
||||||
vtkm::cont::ArrayHandleCartesianProduct<DefaultHandle, DefaultHandle, DefaultHandle>;
|
|
||||||
using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
|
using DefaultConstHandle = typename DefaultHandle::ReadPortalType;
|
||||||
using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
|
using CartesianConstPortal = typename CartesianArrayHandle::ReadPortalType;
|
||||||
|
|
||||||
@ -728,13 +726,6 @@ public:
|
|||||||
}
|
}
|
||||||
}; //class CalcRayStart
|
}; //class CalcRayStart
|
||||||
|
|
||||||
VolumeRendererStructured::VolumeRendererStructured()
|
|
||||||
{
|
|
||||||
IsSceneDirty = false;
|
|
||||||
IsUniformDataSet = true;
|
|
||||||
SampleDistance = -1.f;
|
|
||||||
}
|
|
||||||
|
|
||||||
void VolumeRendererStructured::SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap)
|
void VolumeRendererStructured::SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap)
|
||||||
{
|
{
|
||||||
ColorMap = colorMap;
|
ColorMap = colorMap;
|
||||||
@ -754,35 +745,15 @@ void VolumeRendererStructured::SetData(const vtkm::cont::CoordinateSystem& coord
|
|||||||
ScalarRange = scalarRange;
|
ScalarRange = scalarRange;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Precision>
|
|
||||||
struct VolumeRendererStructured::RenderFunctor
|
|
||||||
{
|
|
||||||
protected:
|
|
||||||
vtkm::rendering::raytracing::VolumeRendererStructured* Self;
|
|
||||||
vtkm::rendering::raytracing::Ray<Precision>& Rays;
|
|
||||||
|
|
||||||
public:
|
|
||||||
VTKM_CONT
|
|
||||||
RenderFunctor(vtkm::rendering::raytracing::VolumeRendererStructured* self,
|
|
||||||
vtkm::rendering::raytracing::Ray<Precision>& rays)
|
|
||||||
: Self(self)
|
|
||||||
, Rays(rays)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
template <typename Device>
|
|
||||||
VTKM_CONT bool operator()(Device)
|
|
||||||
{
|
|
||||||
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
|
||||||
|
|
||||||
this->Self->RenderOnDevice(this->Rays, Device());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
void VolumeRendererStructured::Render(vtkm::rendering::raytracing::Ray<vtkm::Float32>& rays)
|
void VolumeRendererStructured::Render(vtkm::rendering::raytracing::Ray<vtkm::Float32>& rays)
|
||||||
{
|
{
|
||||||
RenderFunctor<vtkm::Float32> functor(this, rays);
|
auto functor = [&](auto device) {
|
||||||
|
using Device = typename std::decay_t<decltype(device)>;
|
||||||
|
VTKM_IS_DEVICE_ADAPTER_TAG(Device);
|
||||||
|
|
||||||
|
this->RenderOnDevice(rays, device);
|
||||||
|
return true;
|
||||||
|
};
|
||||||
vtkm::cont::TryExecute(functor);
|
vtkm::cont::TryExecute(functor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,19 +25,6 @@ namespace raytracing
|
|||||||
class VTKM_RENDERING_EXPORT VolumeRendererStructured
|
class VTKM_RENDERING_EXPORT VolumeRendererStructured
|
||||||
{
|
{
|
||||||
public:
|
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
|
VTKM_CONT
|
||||||
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
|
void SetColorMap(const vtkm::cont::ArrayHandle<vtkm::Vec4f_32>& colorMap);
|
||||||
|
|
||||||
@ -60,17 +47,15 @@ public:
|
|||||||
protected:
|
protected:
|
||||||
template <typename Precision, typename Device>
|
template <typename Precision, typename Device>
|
||||||
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
|
VTKM_CONT void RenderOnDevice(vtkm::rendering::raytracing::Ray<Precision>& rays, Device);
|
||||||
template <typename Precision>
|
|
||||||
struct RenderFunctor;
|
|
||||||
|
|
||||||
bool IsSceneDirty;
|
bool IsSceneDirty = false;
|
||||||
bool IsUniformDataSet;
|
bool IsUniformDataSet = true;
|
||||||
vtkm::Bounds SpatialExtent;
|
vtkm::Bounds SpatialExtent;
|
||||||
vtkm::cont::CoordinateSystem Coordinates;
|
vtkm::cont::CoordinateSystem Coordinates;
|
||||||
vtkm::cont::CellSetStructured<3> Cellset;
|
vtkm::cont::CellSetStructured<3> Cellset;
|
||||||
const vtkm::cont::Field* ScalarField;
|
const vtkm::cont::Field* ScalarField;
|
||||||
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
|
vtkm::cont::ArrayHandle<vtkm::Vec4f_32> ColorMap;
|
||||||
vtkm::Float32 SampleDistance;
|
vtkm::Float32 SampleDistance = -1.f;
|
||||||
vtkm::Range ScalarRange;
|
vtkm::Range ScalarRange;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user