VTK-m  2.2
ANARIMapperGlyphs.h
Go to the documentation of this file.
1 //============================================================================
2 // Copyright (c) Kitware, Inc.
3 // All rights reserved.
4 // See LICENSE.txt for details.
5 //
6 // This software is distributed WITHOUT ANY WARRANTY; without even
7 // the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8 // PURPOSE. See the above copyright notice for more information.
9 //============================================================================
10 
11 #ifndef vtk_m_interop_anari_ANARIMapperGlyphs_h
12 #define vtk_m_interop_anari_ANARIMapperGlyphs_h
13 
15 
16 namespace vtkm
17 {
18 namespace interop
19 {
20 namespace anari
21 {
22 
26 {
27  struct VertexData
28  {
29  anari_cpp::Array1D Position{ nullptr };
30  anari_cpp::Array1D Radius{ nullptr };
31  } Vertex{};
32 
33  unsigned int NumPrimitives{ 0 };
34 };
35 
39 {
42  std::shared_ptr<vtkm::cont::Token> Token{ new vtkm::cont::Token };
43 };
44 
49 struct VTKM_ANARI_EXPORT ANARIMapperGlyphs : public ANARIMapper
50 {
54  anari_cpp::Device device,
55  const ANARIActor& actor = {},
56  const char* name = "<glyphs>",
58 
61  ~ANARIMapperGlyphs() override;
62 
69  void SetActor(const ANARIActor& actor) override;
70 
76  void SetOffsetGlyphs(bool enabled);
77 
81  anari_cpp::Geometry GetANARIGeometry() override;
82 
86  anari_cpp::Surface GetANARISurface() override;
87 
88 private:
92  void ConstructArrays(bool regenerate = false);
94  void UpdateGeometry();
95 
97  struct ANARIHandles
98  {
99  anari_cpp::Device Device{ nullptr };
100  anari_cpp::Geometry Geometry{ nullptr };
101  anari_cpp::Material Material{ nullptr };
102  anari_cpp::Surface Surface{ nullptr };
104  ~ANARIHandles();
105  void ReleaseArrays();
106  };
107 
108  std::shared_ptr<ANARIHandles> Handles;
109 
110  bool Offset{ false };
112 };
113 
114 } // namespace anari
115 } // namespace interop
116 } // namespace vtkm
117 
118 #endif
anari
Definition: VtkmANARITypes.h:30
ANARIMapper.h
vtkm::cont::ArrayHandle
Manages an array-worth of data.
Definition: ArrayHandle.h:300
vtkm::interop::anari::GlyphArrays::Token
std::shared_ptr< vtkm::cont::Token > Token
Definition: ANARIMapperGlyphs.h:42
vtkm::interop::anari::ANARIMapperGlyphs::ANARIHandles::Parameters
GlyphsParameters Parameters
Definition: ANARIMapperGlyphs.h:103
vtkm
Groups connected points that have the same field value.
Definition: Atomic.h:19
vtkm::cont::ColorTable
Color Table for coloring arbitrary fields.
Definition: cont/ColorTable.h:89
vtkm::interop::anari::ANARIMapperGlyphs::Arrays
GlyphArrays Arrays
Definition: ANARIMapperGlyphs.h:111
vtkm::interop::anari::ANARIMapper
This is the base class used for all ANARI mappers.
Definition: ANARIMapper.h:37
vtkm::interop::anari::ANARIMapperGlyphs::ANARIHandles
Container of all relevant ANARI scene object handles.
Definition: ANARIMapperGlyphs.h:97
vtkm::interop::anari::GlyphsParameters::NumPrimitives
unsigned int NumPrimitives
Definition: ANARIMapperGlyphs.h:33
vtkm::interop::anari::GlyphsParameters::VertexData::Position
anari_cpp::Array1D Position
Definition: ANARIMapperGlyphs.h:29
vtkm::interop::anari::GlyphsParameters
Raw ANARI arrays and parameter values set on the ANARIGeometry.
Definition: ANARIMapperGlyphs.h:25
vtkm::cont::Token
A token to hold the scope of an ArrayHandle or other object.
Definition: Token.h:35
vtkm::interop::anari::GlyphArrays
VTK-m data arrays underlying the ANARIArray handles created by the mapper.
Definition: ANARIMapperGlyphs.h:38
vtkm::interop::anari::GlyphArrays::Vertices
vtkm::cont::ArrayHandle< vtkm::Vec3f_32 > Vertices
Definition: ANARIMapperGlyphs.h:40
vtkm::interop::anari::GlyphsParameters::VertexData::Radius
anari_cpp::Array1D Radius
Definition: ANARIMapperGlyphs.h:30
vtkm::interop::anari::ANARIActor
Collects cells, coords, and 0-4 fields for ANARI mappers to consume.
Definition: ANARIActor.h:52
vtkm::interop::anari::GlyphsParameters::Vertex
struct vtkm::interop::anari::GlyphsParameters::VertexData Vertex
vtkm::interop::anari::ANARIMapperGlyphs
Mapper which turns vector data into arrow glyphs.
Definition: ANARIMapperGlyphs.h:49
vtkm::cont::ColorTable::Preset::Default
@ Default
vtkm::interop::anari::ANARIMapperGlyphs::Handles
std::shared_ptr< ANARIHandles > Handles
Definition: ANARIMapperGlyphs.h:108
vtkm::interop::anari::GlyphsParameters::VertexData
Definition: ANARIMapperGlyphs.h:27
Offset
vtkm::Float32 Offset
Definition: Wireframer.h:393
vtkm::interop::anari::GlyphArrays::Radii
vtkm::cont::ArrayHandle< vtkm::Float32 > Radii
Definition: ANARIMapperGlyphs.h:41