VTK  9.0.20201028
VisRTXBackend.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "vtkLogger.h"
4 
5 #include "../Backend.h"
6 #include <iostream>
7 
8 namespace RTW
9 {
10  /*
11  * Translates OSPRay-ish wrapper API calls to VisRTX
12  */
13  class VisRTXBackend : public RTW::Backend
14  {
15  public:
16  VisRTXBackend() = default;
17  ~VisRTXBackend() = default;
18 
19  RTWError Init() override;
20  void Shutdown() override;
21 
22  bool IsSupported(RTWFeature feature) const override;
23 
24  RTWData NewData(RTWDataType dataType, size_t numElements) override;
25  RTWData NewCopyData1D(const void *source, RTWDataType, size_t numElements) override;
26  RTWData NewCopyData2D(const void *source, RTWDataType, size_t numElements1, size_t numElements2) override;
27  RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override;
28  RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override;
29  RTWData NewSharedData3D(const void *soruce, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override;
30  RTWGeometry NewGeometry(const char *type) override;
31  RTWGroup NewInstance(RTWGroup group) override;
32  RTWGroup NewGroup() override;
33  RTWTexture NewTexture(const char* type) override;
34  RTWLight NewLight(const char *light_type);
35  RTWMaterial NewMaterial(const char *renderer_type, const char *material_type);
36  RTWRenderer NewRenderer(const char *type) override;
37  RTWCamera NewCamera(const char *type) override;
38  RTWWorld NewWorld() override;
40  RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override;
41  void Release(RTWObject object) override;
42 
43  void SetString(RTWObject, const char *id, const char *s) override;
44  void SetObject(RTWObject, const char *id, RTWObject other) override;
45  void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override;
46  void SetBool(RTWObject object, const char *id, bool x) override;
47  void SetInt(RTWObject object, const char *id, int32_t x) override;
48  void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override;
49  void SetFloat(RTWObject object, const char *id, float x) override;
50  void SetVec2f(RTWObject object, const char *id, float x, float y) override;
51  void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override;
52  void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override;
53  void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override;
54 
55  void RemoveParam(RTWObject object, const char *id) override;
56 
57  void Commit(RTWObject object) override;
58 
59  float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override;
60 
61  void FrameBufferClear(RTWFrameBuffer frameBuffer) override;
62  const void* MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override;
63  void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override;
64 
65  void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override;
66  int GetColorTextureGL(RTWFrameBuffer frameBuffer) override;
67  int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override;
68 
69  public:
70  /*
71  * Unsupported or redundant calls
72  */
73 
74  void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
75  {
76  vtkLogF(ERROR, "Error: The VisRTX backend does not currently support the SetParam call");
77  }
78 
79  RTWVolume NewVolume(const char *type) override
80  {
81  vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric objects");
82  return nullptr;
83  }
84 
86  {
87  vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric models");
88  return nullptr;
89  }
90 
92  {
93  vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric transfer functions");
94  return nullptr;
95  }
96 
97  };
98 }
RTWVolume
struct RTWHandle * RTWVolume
Definition: Types.h:220
RTW::VisRTXBackend::Init
RTWError Init() override
RTW::VisRTXBackend::NewMaterial
RTWMaterial NewMaterial(const char *renderer_type, const char *material_type)
RTWLight
struct RTWHandle * RTWLight
Definition: Types.h:220
RTW::VisRTXBackend::RemoveParam
void RemoveParam(RTWObject object, const char *id) override
RTW::VisRTXBackend::GetColorTextureGL
int GetColorTextureGL(RTWFrameBuffer frameBuffer) override
RTW::VisRTXBackend::NewSharedData2D
RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override
RTW::VisRTXBackend::SetParam
void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
Definition: VisRTXBackend.h:74
RTW::VisRTXBackend::NewLight
RTWLight NewLight(const char *light_type)
RTWFrameBuffer
struct RTWHandle * RTWFrameBuffer
Definition: Types.h:220
RTWObject
struct RTWHandle * RTWObject
Definition: Types.h:220
RTW::VisRTXBackend::NewInstance
RTWGroup NewInstance(RTWGroup group) override
RTW::VisRTXBackend::NewSharedData3D
RTWData NewSharedData3D(const void *soruce, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override
RTWFrameBufferChannel
RTWFrameBufferChannel
Definition: Types.h:25
vtkX3D::type
Definition: vtkX3D.h:522
RTWGeometricModel
struct RTWHandle * RTWGeometricModel
Definition: Types.h:220
RTW::VisRTXBackend::Release
void Release(RTWObject object) override
RTWWorld
struct RTWHandle * RTWWorld
Definition: Types.h:220
RTW::VisRTXBackend
Definition: VisRTXBackend.h:13
RTW::VisRTXBackend::NewTransferFunction
RTWTransferFunction NewTransferFunction(const char *type) override
Definition: VisRTXBackend.h:91
RTW
Definition: Backend.h:5
RTWFeature
RTWFeature
Definition: Types.h:240
RTW::VisRTXBackend::NewVolumetricModel
RTWVolume NewVolumetricModel(RTWVolume volume) override
Definition: VisRTXBackend.h:85
vtkLogger.h
RTW::VisRTXBackend::SetVec3i
void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override
RTW::VisRTXBackend::SetObject
void SetObject(RTWObject, const char *id, RTWObject other) override
RTWGroup
struct RTWHandle * RTWGroup
Definition: Types.h:220
RTW::VisRTXBackend::NewRenderer
RTWRenderer NewRenderer(const char *type) override
rtw::vec2i
Definition: Types.h:209
RTW::VisRTXBackend::NewGeometricModel
RTWGeometricModel NewGeometricModel(RTWGeometry geometry) override
vtkLogF
#define vtkLogF(verbosity_name,...)
Definition: vtkLogger.h:442
RTW::VisRTXBackend::NewVolume
RTWVolume NewVolume(const char *type) override
Definition: VisRTXBackend.h:79
RTW::VisRTXBackend::NewGroup
RTWGroup NewGroup() override
RTW::VisRTXBackend::SetObjectAsData
void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:965
RTW::VisRTXBackend::SetVec3f
void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override
RTW::VisRTXBackend::SetDepthNormalizationGL
void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override
RTW::VisRTXBackend::NewTexture
RTWTexture NewTexture(const char *type) override
RTWMaterial
struct RTWHandle * RTWMaterial
Definition: Types.h:220
RTW::VisRTXBackend::SetBool
void SetBool(RTWObject object, const char *id, bool x) override
RTWGeometry
struct RTWHandle * RTWGeometry
Definition: Types.h:220
RTW::VisRTXBackend::NewCopyData1D
RTWData NewCopyData1D(const void *source, RTWDataType, size_t numElements) override
RTW::VisRTXBackend::~VisRTXBackend
~VisRTXBackend()=default
RTWFrameBufferFormat
RTWFrameBufferFormat
Definition: Types.h:17
RTW::VisRTXBackend::RenderFrame
float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override
vtkX3D::size
Definition: vtkX3D.h:259
RTWTransferFunction
struct RTWHandle * RTWTransferFunction
Definition: Types.h:220
RTW::VisRTXBackend::NewFrameBuffer
RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override
RTW::VisRTXBackend::NewCamera
RTWCamera NewCamera(const char *type) override
RTW::VisRTXBackend::NewData
RTWData NewData(RTWDataType dataType, size_t numElements) override
RTWTexture
struct RTWHandle * RTWTexture
Definition: Types.h:220
RTW::VisRTXBackend::Shutdown
void Shutdown() override
RTW::VisRTXBackend::VisRTXBackend
VisRTXBackend()=default
RTW::VisRTXBackend::NewCopyData2D
RTWData NewCopyData2D(const void *source, RTWDataType, size_t numElements1, size_t numElements2) override
RTW::VisRTXBackend::SetVec2i
void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override
RTW::VisRTXBackend::SetString
void SetString(RTWObject, const char *id, const char *s) override
RTW::VisRTXBackend::MapFrameBuffer
const void * MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override
RTW::VisRTXBackend::SetVec2f
void SetVec2f(RTWObject object, const char *id, float x, float y) override
RTW::VisRTXBackend::Commit
void Commit(RTWObject object) override
RTW::VisRTXBackend::FrameBufferClear
void FrameBufferClear(RTWFrameBuffer frameBuffer) override
RTW::VisRTXBackend::UnmapFrameBuffer
void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override
RTW::Backend
Definition: Backend.h:7
RTW::VisRTXBackend::SetFloat
void SetFloat(RTWObject object, const char *id, float x) override
RTW::VisRTXBackend::NewWorld
RTWWorld NewWorld() override
RTWData
struct RTWHandle * RTWData
Definition: Types.h:220
RTW::VisRTXBackend::IsSupported
bool IsSupported(RTWFeature feature) const override
RTW::VisRTXBackend::SetVec4f
void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override
RTWRenderer
struct RTWHandle * RTWRenderer
Definition: Types.h:220
RTW::VisRTXBackend::NewSharedData1D
RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override
RTW::VisRTXBackend::SetInt
void SetInt(RTWObject object, const char *id, int32_t x) override
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:959
RTWError
RTWError
Definition: Types.h:6
RTW::VisRTXBackend::GetDepthTextureGL
int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override
RTWCamera
struct RTWHandle * RTWCamera
Definition: Types.h:220
RTW::VisRTXBackend::NewGeometry
RTWGeometry NewGeometry(const char *type) override
RTWDataType
RTWDataType
Definition: Types.h:119