vtk-m/vtkm/rendering/raytracing/ShapeIntersector.h

75 lines
2.6 KiB
C
Raw Normal View History

2018-09-11 02:51:45 +00:00
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
2018-09-11 02:51:45 +00:00
// 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_Shape_Intersector_h
#define vtk_m_rendering_raytracing_Shape_Intersector_h
#include <vtkm/cont/CoordinateSystem.h>
#include <vtkm/rendering/raytracing/BoundingVolumeHierarchy.h>
#include <vtkm/rendering/raytracing/Ray.h>
namespace vtkm
{
namespace rendering
{
namespace raytracing
{
class VTKM_RENDERING_EXPORT ShapeIntersector
{
protected:
LinearBVH BVH;
vtkm::cont::CoordinateSystem CoordsHandle;
vtkm::Bounds ShapeBounds;
void SetAABBs(AABBs& aabbs);
public:
ShapeIntersector();
virtual ~ShapeIntersector();
//
// Intersect Rays finds the nearest intersection shape contained in the derived
// class in between min and max distances. HitIdx will be set to the local
// primitive id unless returnCellIndex is set to true. Cells are often
// decomposed into triangles and setting returnCellIndex to true will set
// HitIdx to the id of the cell.
//
virtual void IntersectRays(Ray<vtkm::Float32>& rays, bool returnCellIndex = false) = 0;
virtual void IntersectRays(Ray<vtkm::Float64>& rays, bool returnCellIndex = false) = 0;
//
// Calling intersection data directly after IntersectRays popoulates
// ray data: intersection point, surface normal, and interpolated scalar
// value at the intersection location. Additionally, distance to intersection
// becomes the new max distance.
//
virtual void IntersectionData(Ray<vtkm::Float32>& rays,
2019-02-22 16:22:29 +00:00
const vtkm::cont::Field scalarField,
2020-04-23 17:31:39 +00:00
const vtkm::Range& scalarRange = vtkm::Range()) = 0;
2018-09-11 02:51:45 +00:00
virtual void IntersectionData(Ray<vtkm::Float64>& rays,
2019-02-22 16:22:29 +00:00
const vtkm::cont::Field scalarField,
2020-04-23 17:31:39 +00:00
const vtkm::Range& scalarRange = vtkm::Range()) = 0;
2018-09-11 02:51:45 +00:00
template <typename Precision>
void IntersectionPointImp(Ray<Precision>& rays);
void IntersectionPoint(Ray<vtkm::Float32>& rays);
void IntersectionPoint(Ray<vtkm::Float64>& rays);
vtkm::Bounds GetShapeBounds() const;
virtual vtkm::Id GetNumberOfShapes() const = 0;
}; // class ShapeIntersector
}
}
} //namespace vtkm::rendering::raytracing
#endif //vtk_m_rendering_raytracing_Shape_Intersector_h