2016-05-18 05:13:36 +00:00
|
|
|
//============================================================================
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// Copyright 2015 Sandia Corporation.
|
|
|
|
// Copyright 2015 UT-Battelle, LLC.
|
|
|
|
// Copyright 2015 Los Alamos National Security.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
|
|
|
|
// the U.S. Government retains certain rights in this software.
|
|
|
|
//
|
|
|
|
// Under the terms of Contract DE-AC52-06NA25396 with Los Alamos National
|
|
|
|
// Laboratory (LANL), the U.S. Government retains certain rights in
|
|
|
|
// this software.
|
|
|
|
//============================================================================
|
|
|
|
#ifndef vtk_m_worklet_BoundingVolumeHierachy_h
|
|
|
|
#define vtk_m_worklet_BoundingVolumeHierachy_h
|
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
#include <vtkm/cont/ArrayHandle.h>
|
|
|
|
#include <vtkm/cont/DataSet.h>
|
|
|
|
#include <vtkm/rendering/vtkm_rendering_export.h>
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2017-05-18 14:29:41 +00:00
|
|
|
namespace vtkm
|
|
|
|
{
|
|
|
|
namespace rendering
|
|
|
|
{
|
|
|
|
namespace raytracing
|
|
|
|
{
|
2017-06-17 21:28:45 +00:00
|
|
|
|
2016-05-18 05:13:36 +00:00
|
|
|
//
|
|
|
|
// This is the data structure that is passed to the ray tracer.
|
|
|
|
//
|
2017-06-17 21:28:45 +00:00
|
|
|
class VTKM_RENDERING_EXPORT LinearBVH
|
2016-05-18 05:13:36 +00:00
|
|
|
{
|
|
|
|
public:
|
2017-06-17 21:28:45 +00:00
|
|
|
typedef vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Float32, 4>> InnerNodesHandle;
|
|
|
|
typedef vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Int32, 4>> LeafNodesHandle;
|
|
|
|
InnerNodesHandle FlatBVH;
|
|
|
|
LeafNodesHandle LeafNodes;
|
|
|
|
struct ConstructFunctor;
|
2016-05-18 05:13:36 +00:00
|
|
|
vtkm::Id LeafCount;
|
2017-07-04 22:10:17 +00:00
|
|
|
vtkm::Bounds CoordBounds;
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
protected:
|
|
|
|
vtkm::cont::DynamicArrayHandleCoordinateSystem CoordsHandle;
|
|
|
|
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> Triangles;
|
|
|
|
bool IsConstructed;
|
|
|
|
bool CanConstruct;
|
2017-05-18 14:29:41 +00:00
|
|
|
|
2016-05-18 05:13:36 +00:00
|
|
|
public:
|
2017-06-17 21:28:45 +00:00
|
|
|
LinearBVH();
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-06-17 21:28:45 +00:00
|
|
|
LinearBVH(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
2017-07-04 22:10:17 +00:00
|
|
|
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
|
|
|
vtkm::Bounds coordBounds);
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-06-17 21:28:45 +00:00
|
|
|
LinearBVH(const LinearBVH& other);
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
template <typename DeviceAdapter>
|
|
|
|
VTKM_CONT void Allocate(const vtkm::Id& leafCount, DeviceAdapter deviceAdapter);
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2016-10-19 22:42:58 +00:00
|
|
|
VTKM_CONT
|
2017-06-17 21:28:45 +00:00
|
|
|
void Construct();
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
VTKM_CONT
|
|
|
|
void SetData(vtkm::cont::DynamicArrayHandleCoordinateSystem coordsHandle,
|
2017-07-04 22:10:17 +00:00
|
|
|
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> triangles,
|
|
|
|
vtkm::Bounds coordBounds);
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
template <typename Device>
|
|
|
|
VTKM_CONT void ConstructOnDevice(Device device);
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
VTKM_CONT
|
|
|
|
bool GetIsConstructed() const;
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::DynamicArrayHandleCoordinateSystem GetCoordsHandle() const;
|
2016-05-19 23:15:06 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
VTKM_CONT
|
|
|
|
vtkm::cont::ArrayHandle<vtkm::Vec<vtkm::Id, 4>> GetTriangles() const;
|
2016-05-18 05:13:36 +00:00
|
|
|
|
2017-06-17 21:28:45 +00:00
|
|
|
vtkm::Id GetNumberOfTriangles() const;
|
|
|
|
}; // class LinearBVH
|
2017-05-18 14:29:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} // namespace vtkm::rendering::raytracing
|
2016-05-18 05:13:36 +00:00
|
|
|
#endif //vtk_m_worklet_BoundingVolumeHierachy_h
|