VTK  9.4.20241219
VisRTXBackend.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3#pragma once
4
5#include "vtkLogger.h"
6
7#include "../Backend.h"
8#include <iostream>
9
10namespace RTW
11{
12VTK_ABI_NAMESPACE_BEGIN
13 /*
14 * Translates OSPRay-ish wrapper API calls to VisRTX
15 */
17 {
18 public:
19 VisRTXBackend() = default;
20 ~VisRTXBackend() = default;
21
22 RTWError Init() override;
23 void Shutdown() override;
24
25 bool IsSupported(RTWFeature feature) const override;
26
27 RTWData NewData(RTWDataType dataType, size_t numElements) override;
28 RTWData NewCopyData1D(const void *source, RTWDataType, size_t numElements) override;
29 RTWData NewCopyData2D(const void *source, RTWDataType, size_t numElements1, size_t numElements2) override;
30 RTWData NewCopyData3D(const void *source, RTWDataType, size_t numElements1, size_t numElements2, size_t numElements3) override;
31 RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override;
32 RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override;
33 RTWData NewSharedData3D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override;
34 RTWGeometry NewGeometry(const char *type) override;
35 RTWGroup NewInstance(RTWGroup group) override;
36 RTWGroup NewGroup() override;
37 RTWTexture NewTexture(const char* type) override;
38 RTWLight NewLight(const char *light_type);
39 RTWMaterial NewMaterial(const char *material_type);
40 RTWRenderer NewRenderer(const char *type) override;
41 RTWCamera NewCamera(const char *type) override;
42 RTWWorld NewWorld() override;
44 RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override;
45 void Release(RTWObject object) override;
46
47 void SetString(RTWObject, const char *id, const char *s) override;
48 void SetObject(RTWObject, const char *id, RTWObject other) override;
49 void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override;
50 void SetBool(RTWObject object, const char *id, bool x) override;
51 void SetInt(RTWObject object, const char *id, int32_t x) override;
52 void SetUInt(RTWObject object, const char *id, uint32_t x) override;
53 void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override;
54 void SetFloat(RTWObject object, const char *id, float x) override;
55 void SetVec2f(RTWObject object, const char *id, float x, float y) override;
56 void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override;
57 void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override;
58 void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override;
59 void SetBox1f(RTWObject object, const char *id, float x, float y) override;
60 void SetLinear2f(RTWObject object, const char *id, float x, float y, float z, float w) override;
61
62 void RemoveParam(RTWObject object, const char *id) override;
63
64 void Commit(RTWObject object) override;
65
66 float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override;
67
68 void FrameBufferClear(RTWFrameBuffer frameBuffer) override;
69 const void* MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override;
70 void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override;
71
72 void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override;
73 int GetColorTextureGL(RTWFrameBuffer frameBuffer) override;
74 int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override;
75
76 public:
77 /*
78 * Unsupported or redundant calls
79 */
80
81 void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
82 {
83 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support the SetParam call");
84 }
85
86 RTWVolume NewVolume(const char *type) override
87 {
88 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric objects");
89 return nullptr;
90 }
91
93 {
94 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric models");
95 return nullptr;
96 }
97
98 RTWTransferFunction NewTransferFunction(const char *type) override
99 {
100 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric transfer functions");
101 return nullptr;
102 }
103
104 };
105VTK_ABI_NAMESPACE_END
106}
struct RTWHandle * RTWData
Definition Types.h:238
struct RTWHandle * RTWCamera
Definition Types.h:232
RTWFrameBufferFormat
Definition Types.h:22
struct RTWHandle * RTWObject
Definition Types.h:245
struct RTWHandle * RTWTexture
Definition Types.h:244
struct RTWHandle * RTWTransferFunction
Definition Types.h:243
RTWFeature
Definition Types.h:250
struct RTWHandle * RTWFrameBuffer
Definition Types.h:229
struct RTWHandle * RTWGroup
Definition Types.h:233
struct RTWHandle * RTWGeometry
Definition Types.h:239
struct RTWHandle * RTWVolume
Definition Types.h:242
RTWError
Definition Types.h:11
RTWDataType
Definition Types.h:124
struct RTWHandle * RTWMaterial
Definition Types.h:240
struct RTWHandle * RTWRenderer
Definition Types.h:231
struct RTWHandle * RTWLight
Definition Types.h:241
RTWFrameBufferChannel
Definition Types.h:30
struct RTWHandle * RTWWorld
Definition Types.h:237
struct RTWHandle * RTWGeometricModel
Definition Types.h:235
RTWData NewData(RTWDataType dataType, size_t numElements) override
void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override
void FrameBufferClear(RTWFrameBuffer frameBuffer) override
RTWMaterial NewMaterial(const char *material_type)
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
void SetBox1f(RTWObject object, const char *id, float x, float y) override
void SetLinear2f(RTWObject object, const char *id, float x, float y, float z, float w) override
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
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
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
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
void SetUInt(RTWObject object, const char *id, uint32_t x) override
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
RTWData NewSharedData3D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override
int GetColorTextureGL(RTWFrameBuffer frameBuffer) override
Definition Backend.h:8
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:499