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

81 lines
1.9 KiB
C
Raw Normal View History

2016-05-18 05:13:36 +00:00
//============================================================================
// Copyright (c) Kitware, Inc.
// All rights reserved.
// See LICENSE.txt for details.
2019-04-15 23:24:21 +00:00
//
2016-05-18 05:13:36 +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_worklet_BoundingVolumeHierachy_h
#define vtk_m_worklet_BoundingVolumeHierachy_h
#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
{
2018-09-11 02:25:42 +00:00
struct AABBs
{
vtkm::cont::ArrayHandle<vtkm::Float32> xmins;
vtkm::cont::ArrayHandle<vtkm::Float32> ymins;
vtkm::cont::ArrayHandle<vtkm::Float32> zmins;
vtkm::cont::ArrayHandle<vtkm::Float32> xmaxs;
vtkm::cont::ArrayHandle<vtkm::Float32> ymaxs;
vtkm::cont::ArrayHandle<vtkm::Float32> zmaxs;
};
2016-05-18 05:13:36 +00:00
//
// This is the data structure that is passed to the ray tracer.
//
class VTKM_RENDERING_EXPORT LinearBVH
2016-05-18 05:13:36 +00:00
{
public:
using InnerNodesHandle = vtkm::cont::ArrayHandle<vtkm::Vec4f_32>;
2018-09-11 02:25:42 +00:00
using LeafNodesHandle = vtkm::cont::ArrayHandle<Id>;
AABBs AABB;
InnerNodesHandle FlatBVH;
2018-09-11 02:25:42 +00:00
LeafNodesHandle Leafs;
vtkm::Bounds TotalBounds;
2016-05-18 05:13:36 +00:00
vtkm::Id LeafCount;
protected:
bool IsConstructed;
bool CanConstruct;
2017-05-18 14:29:41 +00:00
2016-05-18 05:13:36 +00:00
public:
LinearBVH();
2016-05-18 05:13:36 +00:00
VTKM_CONT
2018-09-11 02:25:42 +00:00
LinearBVH(AABBs& aabbs);
VTKM_CONT
LinearBVH(const LinearBVH& other);
2019-02-25 23:27:42 +00:00
VTKM_CONT void Allocate(const vtkm::Id& leafCount);
VTKM_CONT
void Construct();
2016-05-18 05:13:36 +00:00
VTKM_CONT
2018-09-11 02:25:42 +00:00
void SetData(AABBs& aabbs);
VTKM_CONT
AABBs& GetAABBs();
2016-05-18 05:13:36 +00:00
VTKM_CONT
bool GetIsConstructed() const;
2018-09-11 02:25:42 +00:00
vtkm::Id GetNumberOfAABBs() 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