VTK: Rendering/RayTracing/RTWrapper/VisRTX/VisRTXBackend.h Source File

| VTK 9.3.1

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
10 namespace RTW
11 {
12 VTK_ABI_NAMESPACE_BEGIN
13 /*
14 * Translates OSPRay-ish wrapper API calls to VisRTX
15 */
16 class VisRTXBackend : public RTW::Backend
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 *renderer_type, const char *material_type);
40 RTWRenderer NewRenderer(const char *type) override;
41 RTWCamera NewCamera(const char *type) override;
42 RTWWorld NewWorld() override;
43 RTWGeometricModel NewGeometricModel(RTWGeometry geometry) 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 SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override;
53 void SetFloat(RTWObject object, const char *id, float x) override;
54 void SetVec2f(RTWObject object, const char *id, float x, float y) override;
55 void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override;
56 void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override;
57 void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override;
58
59 void RemoveParam(RTWObject object, const char *id) override;
60
61 void Commit(RTWObject object) override;
62
63 float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override;
64
65 void FrameBufferClear(RTWFrameBuffer frameBuffer) override;
66 const void* MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override;
67 void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override;
68
69 void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override;
70 int GetColorTextureGL(RTWFrameBuffer frameBuffer) override;
71 int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override;
72
73 public:
74 /*
75 * Unsupported or redundant calls
76 */
77
78 void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
79 {
80 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support the SetParam call");
81 }
82
83 RTWVolume NewVolume(const char *type) override
84 {
85 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric objects");
86 return nullptr;
87 }
88
89 RTWVolume NewVolumetricModel(RTWVolume volume) override
90 {
91 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric models");
92 return nullptr;
93 }
94
95 RTWTransferFunction NewTransferFunction(const char *type) override
96 {
97 vtkLogF(ERROR, "Error: The VisRTX backend does not currently support volumetric transfer functions");
98 return nullptr;
99 }
100
101 };
102 VTK_ABI_NAMESPACE_END
103 }
RTWData
struct RTWHandle * RTWData
Definition: Types.h:238
RTWCamera
struct RTWHandle * RTWCamera
Definition: Types.h:232
RTWFrameBufferFormat
RTWFrameBufferFormat
Definition: Types.h:22
RTWObject
struct RTWHandle * RTWObject
Definition: Types.h:245
RTWTexture
struct RTWHandle * RTWTexture
Definition: Types.h:244
RTWTransferFunction
struct RTWHandle * RTWTransferFunction
Definition: Types.h:243
RTWFeature
RTWFeature
Definition: Types.h:250
RTWFrameBuffer
struct RTWHandle * RTWFrameBuffer
Definition: Types.h:229
RTWGroup
struct RTWHandle * RTWGroup
Definition: Types.h:233
RTWGeometry
struct RTWHandle * RTWGeometry
Definition: Types.h:239
RTWVolume
struct RTWHandle * RTWVolume
Definition: Types.h:242
RTWError
RTWError
Definition: Types.h:11
RTWDataType
RTWDataType
Definition: Types.h:124
RTWMaterial
struct RTWHandle * RTWMaterial
Definition: Types.h:240
RTWRenderer
struct RTWHandle * RTWRenderer
Definition: Types.h:231
RTWLight
struct RTWHandle * RTWLight
Definition: Types.h:241
RTWFrameBufferChannel
RTWFrameBufferChannel
Definition: Types.h:30
RTWWorld
struct RTWHandle * RTWWorld
Definition: Types.h:237
RTWGeometricModel
struct RTWHandle * RTWGeometricModel
Definition: Types.h:235
RTW::Backend
Definition: Backend.h:11
RTW::VisRTXBackend
Definition: VisRTXBackend.h:17
RTW::VisRTXBackend::MapFrameBuffer
const void * MapFrameBuffer(RTWFrameBuffer frameBuffer, const RTWFrameBufferChannel channel) override
RTW::VisRTXBackend::NewData
RTWData NewData(RTWDataType dataType, size_t numElements) override
RTW::VisRTXBackend::SetParam
void SetParam(RTWObject target, const char *id, RTWDataType type, const void *mem) override
Definition: VisRTXBackend.h:78
RTW::VisRTXBackend::SetObjectAsData
void SetObjectAsData(RTWObject target, const char *id, RTWDataType type, RTWObject obj) override
RTW::VisRTXBackend::FrameBufferClear
void FrameBufferClear(RTWFrameBuffer frameBuffer) override
RTW::VisRTXBackend::SetFloat
void SetFloat(RTWObject object, const char *id, float x) override
RTW::VisRTXBackend::NewGeometry
RTWGeometry NewGeometry(const char *type) override
RTW::VisRTXBackend::GetDepthTextureGL
int GetDepthTextureGL(RTWFrameBuffer frameBuffer) override
RTW::VisRTXBackend::Release
void Release(RTWObject object) override
RTW::VisRTXBackend::NewFrameBuffer
RTWFrameBuffer NewFrameBuffer(const rtw::vec2i &size, const RTWFrameBufferFormat format, const uint32_t frameBufferChannels) override
RTW::VisRTXBackend::NewCopyData1D
RTWData NewCopyData1D(const void *source, RTWDataType, size_t numElements) override
RTW::VisRTXBackend::SetBool
void SetBool(RTWObject object, const char *id, bool x) override
RTW::VisRTXBackend::NewTexture
RTWTexture NewTexture(const char *type) override
RTW::VisRTXBackend::Init
RTWError Init() override
RTW::VisRTXBackend::Shutdown
void Shutdown() override
RTW::VisRTXBackend::NewGroup
RTWGroup NewGroup() override
RTW::VisRTXBackend::VisRTXBackend
VisRTXBackend()=default
RTW::VisRTXBackend::NewGeometricModel
RTWGeometricModel NewGeometricModel(RTWGeometry geometry) override
RTW::VisRTXBackend::NewRenderer
RTWRenderer NewRenderer(const char *type) override
RTW::VisRTXBackend::NewWorld
RTWWorld NewWorld() override
RTW::VisRTXBackend::NewCamera
RTWCamera NewCamera(const char *type) override
RTW::VisRTXBackend::~VisRTXBackend
~VisRTXBackend()=default
RTW::VisRTXBackend::RemoveParam
void RemoveParam(RTWObject object, const char *id) override
RTW::VisRTXBackend::NewCopyData2D
RTWData NewCopyData2D(const void *source, RTWDataType, size_t numElements1, size_t numElements2) override
RTW::VisRTXBackend::NewCopyData3D
RTWData NewCopyData3D(const void *source, RTWDataType, size_t numElements1, size_t numElements2, size_t numElements3) override
RTW::VisRTXBackend::NewVolumetricModel
RTWVolume NewVolumetricModel(RTWVolume volume) override
Definition: VisRTXBackend.h:89
RTW::VisRTXBackend::SetVec3f
void SetVec3f(RTWObject object, const char *id, float x, float y, float z) override
RTW::VisRTXBackend::RenderFrame
float RenderFrame(RTWFrameBuffer frameBuffer, RTWRenderer renderer, RTWCamera camera, RTWWorld world) override
RTW::VisRTXBackend::NewInstance
RTWGroup NewInstance(RTWGroup group) override
RTW::VisRTXBackend::NewSharedData1D
RTWData NewSharedData1D(const void *source, RTWDataType, uint32_t numElements) override
RTW::VisRTXBackend::SetVec2f
void SetVec2f(RTWObject object, const char *id, float x, float y) override
RTW::VisRTXBackend::NewMaterial
RTWMaterial NewMaterial(const char *renderer_type, const char *material_type)
RTW::VisRTXBackend::SetObject
void SetObject(RTWObject, const char *id, RTWObject other) override
RTW::VisRTXBackend::Commit
void Commit(RTWObject object) override
RTW::VisRTXBackend::NewLight
RTWLight NewLight(const char *light_type)
RTW::VisRTXBackend::SetVec4f
void SetVec4f(RTWObject object, const char *id, float x, float y, float z, float w) override
RTW::VisRTXBackend::NewTransferFunction
RTWTransferFunction NewTransferFunction(const char *type) override
Definition: VisRTXBackend.h:95
RTW::VisRTXBackend::NewSharedData2D
RTWData NewSharedData2D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2) override
RTW::VisRTXBackend::SetVec2i
void SetVec2i(RTWObject object, const char *id, int32_t x, int32_t y) override
RTW::VisRTXBackend::UnmapFrameBuffer
void UnmapFrameBuffer(const void *mapped, RTWFrameBuffer frameBuffer) override
RTW::VisRTXBackend::IsSupported
bool IsSupported(RTWFeature feature) const override
RTW::VisRTXBackend::NewVolume
RTWVolume NewVolume(const char *type) override
Definition: VisRTXBackend.h:83
RTW::VisRTXBackend::SetVec3i
void SetVec3i(RTWObject object, const char *id, int x, int y, int z) override
RTW::VisRTXBackend::SetString
void SetString(RTWObject, const char *id, const char *s) override
RTW::VisRTXBackend::SetDepthNormalizationGL
void SetDepthNormalizationGL(RTWFrameBuffer frameBuffer, float clipMin, float clipMax) override
RTW::VisRTXBackend::SetInt
void SetInt(RTWObject object, const char *id, int32_t x) override
RTW::VisRTXBackend::NewSharedData3D
RTWData NewSharedData3D(const void *source, RTWDataType, uint32_t numElements1, uint32_t numElements2, uint32_t numElements3) override
RTW::VisRTXBackend::GetColorTextureGL
int GetColorTextureGL(RTWFrameBuffer frameBuffer) override
RTW
Definition: Backend.h:8
vtkX3D::type
@ type
Definition: vtkX3D.h:516
vtkX3D::size
@ size
Definition: vtkX3D.h:253
rtw::vec2i
Definition: Types.h:215
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:964
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:970
vtkLogger.h
vtkLogF
#define vtkLogF(verbosity_name,...)
Add to log given the verbosity level.
Definition: vtkLogger.h:465