VTK  9.1.0
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
8namespace RTW
9{
10 /*
11 * Translates OSPRay-ish wrapper API calls to VisRTX
12 */
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 NewCopyData3D(const void *source, RTWDataType, size_t numElements1, size_t numElements2, size_t numElements3) override;
28 RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override;
29 RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override;
30 RTWData NewSharedData3D(const void *soruce, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override;
31 RTWGeometry NewGeometry(const char *type) override;
32 RTWGroup NewInstance(RTWGroup group) override;
33 RTWGroup NewGroup() override;
34 RTWTexture NewTexture(const char* type) override;
35 RTWLight NewLight(const char *light_type);
36 RTWMaterial NewMaterial(const char *renderer_type, const char *material_type);
37 RTWRenderer NewRenderer(const char *type) override;
38 RTWCamera NewCamera(const char *type) override;
39 RTWWorld NewWorld() override;
41 RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override;
42 void Release(RTWObject object) override;
43
44 void SetString(RTWObject, const char *id, const char *s) override;
45 void SetObject(RTWObject, const char *id, RTWObject other) override;
46 void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override;
47 void SetBool(RTWObject object, const char *id, bool x) override;
48 void SetInt(RTWObject object, const char *id, int32_t x) override;
49 void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override;
50 void SetFloat(RTWObject object, const char *id, float x) override;
51 void SetVec2f(RTWObject object, const char *id, float x, float y) override;
52 void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override;
53 void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override;
54 void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override;
55
56 void RemoveParam(RTWObject object, const char *id) override;
57
58 void Commit(RTWObject object) override;
59
60 float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override;
61
62 void FrameBufferClear(RTWFrameBuffer frameBuffer) override;
63 const void* MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override;
64 void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override;
65
66 void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override;
67 int GetColorTextureGL(RTWFrameBuffer frameBuffer) override;
68 int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override;
69
70 public:
71 /*
72 * Unsupported or redundant calls
73 */
74
75 void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
76 {
77 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support the SetParam call");
78 }
79
80 RTWVolume NewVolume(const char *type) override
81 {
82 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric objects");
83 return nullptr;
84 }
85
87 {
88 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric models");
89 return nullptr;
90 }
91
92 RTWTransferFunction NewTransferFunction(const char *type) override
93 {
94 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric transfer functions");
95 return nullptr;
96 }
97
98 };
99}
struct RTWHandle * RTWData
Definition: Types.h:229
struct RTWHandle * RTWCamera
Definition: Types.h:223
RTWFrameBufferFormat
Definition: Types.h:18
struct RTWHandle * RTWObject
Definition: Types.h:236
struct RTWHandle * RTWTexture
Definition: Types.h:235
struct RTWHandle * RTWTransferFunction
Definition: Types.h:234
RTWFeature
Definition: Types.h:241
struct RTWHandle * RTWFrameBuffer
Definition: Types.h:220
struct RTWHandle * RTWGroup
Definition: Types.h:224
struct RTWHandle * RTWGeometry
Definition: Types.h:230
struct RTWHandle * RTWVolume
Definition: Types.h:233
RTWError
Definition: Types.h:7
RTWDataType
Definition: Types.h:120
struct RTWHandle * RTWMaterial
Definition: Types.h:231
struct RTWHandle * RTWRenderer
Definition: Types.h:222
struct RTWHandle * RTWLight
Definition: Types.h:232
RTWFrameBufferChannel
Definition: Types.h:26
struct RTWHandle * RTWWorld
Definition: Types.h:228
struct RTWHandle * RTWGeometricModel
Definition: Types.h:226
RTWData NewData(RTWDataType dataType, size_t numElements) override
void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
Definition: VisRTXBackend.h:75
void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override
RTWData NewSharedData3D(const void *soruce, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override
void FrameBufferClear(RTWFrameBuffer frameBuffer) override
void SetFloat(RTWObject object, const char *id, float x) override
RTWGeometry NewGeometry(const char *type) override
int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override
void Release(RTWObject object) override
RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override
RTWData NewCopyData1D(const void *source, RTWDataType, size_t numElements) override
void SetBool(RTWObject object, const char *id, bool x) override
RTWTexture NewTexture(const char *type) override
RTWError Init() override
void Shutdown() override
RTWGroup NewGroup() override
VisRTXBackend()=default
RTWGeometricModel NewGeometricModel(RTWGeometry geometry) override
RTWRenderer NewRenderer(const char *type) override
RTWWorld NewWorld() override
RTWCamera NewCamera(const char *type) override
~VisRTXBackend()=default
void RemoveParam(RTWObject object, const char *id) override
RTWData NewCopyData2D(const void *source, RTWDataType, size_t numElements1, size_t numElements2) override
RTWData NewCopyData3D(const void *source, RTWDataType, size_t numElements1, size_t numElements2, size_t numElements3) override
const void * MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override
RTWVolume NewVolumetricModel(RTWVolume volume) override
Definition: VisRTXBackend.h:86
void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override
float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override
RTWGroup NewInstance(RTWGroup group) override
RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override
void SetVec2f(RTWObject object, const char *id, float x, float y) override
RTWMaterial NewMaterial(const char *renderer_type, const char *material_type)
void SetObject(RTWObject, const char *id, RTWObject other) override
void Commit(RTWObject object) override
RTWLight NewLight(const char *light_type)
void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override
RTWTransferFunction NewTransferFunction(const char *type) override
Definition: VisRTXBackend.h:92
RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override
void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override
void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override
bool IsSupported(RTWFeature feature) const override
RTWVolume NewVolume(const char *type) override
Definition: VisRTXBackend.h:80
void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override
void SetString(RTWObject, const char *id, const char *s) override
void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override
void SetInt(RTWObject object, const char *id, int32_t x) override
int GetColorTextureGL(RTWFrameBuffer frameBuffer) override
Definition: Backend.h:6
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
#define vtkLogF(verbosity_name,...)
Add to log given the verbosity level.
Definition: vtkLogger.h:484