VTK  9.5.20250806
vtkWebGPUHardwareSelector.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
15#ifndef vtkWebGPUHardwareSelector_h
16#define vtkWebGPUHardwareSelector_h
17
18#include "vtkHardwareSelector.h"
19
20#include "vtkRenderingWebGPUModule.h" // For export macro
21#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22
23VTK_ABI_NAMESPACE_BEGIN
24class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUHardwareSelector
25 : public vtkHardwareSelector
26{
27public:
30 void PrintSelf(ostream& os, vtkIndent indent) override;
31
37 bool CaptureBuffers() override;
38
43 void BeginRenderProp() override{};
44 void EndRenderProp() override{};
45
50 void RenderCompositeIndex(unsigned int /*index*/) override{};
51
56 void RenderProcessId(unsigned int /*processid*/) override{};
57
58 // we need to initialize the depth buffer
59 void BeginSelection() override;
60 void EndSelection() override;
61
66 vtkProp* GetPropFromID(int id) override;
67
68 PixelInformation GetPixelInformation(const unsigned int inDisplayPosition[2], int maxDist,
69 unsigned int outSelectedPosition[2]) override;
70
71protected:
74
75 void PreCapturePass(int /*pass*/) override{};
76 void PostCapturePass(int /*pass*/) override{};
77
79 void EndRenderProp(vtkRenderWindow*) override{};
80
81 void SavePixelBuffer(int) override{};
82
83 void ReleasePixBuffers() override;
84
85 int Convert(int xx, int yy, unsigned char* pb) override;
86
87private:
89 struct Ids
90 {
91 vtkTypeUInt32 AttributeId;
92 vtkTypeUInt32 PropId;
93 vtkTypeUInt32 CompositeId;
94 vtkTypeUInt32 ProcessId;
95 };
96
97 bool MapReady = false;
98 std::vector<Ids> IdBuffer;
99
100 vtkProp** PropArray = nullptr;
101
103 void operator=(const vtkWebGPUHardwareSelector&) = delete;
104};
105
106VTK_ABI_NAMESPACE_END
107#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:69
create a window for renderers to draw into
implements the device specific code of vtkWebGPUHardwareSelector.
void BeginRenderProp(vtkRenderWindow *) override
vtkProp * GetPropFromID(int id) override
returns the prop associated with a ID.
void ReleasePixBuffers() override
Clears all pixel buffers.
PixelInformation GetPixelInformation(const unsigned int inDisplayPosition[2], int maxDist, unsigned int outSelectedPosition[2]) override
It is possible to use the vtkHardwareSelector for a custom picking.
void EndRenderProp() override
Called by the mapper before and after rendering each prop.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void EndRenderProp(vtkRenderWindow *) override
static vtkWebGPUHardwareSelector * New()
int Convert(int xx, int yy, unsigned char *pb) override
pos must be relative to the lower-left corner of this->Area.
void RenderProcessId(unsigned int) override
Called by any vtkMapper or subclass to render process id.
void BeginRenderProp() override
Called by the mapper before and after rendering each prop.
void RenderCompositeIndex(unsigned int) override
Called by any vtkMapper or vtkProp subclass to render a composite-index.
bool CaptureBuffers() override
The super class repeatedly renders the frame for different passes.
~vtkWebGPUHardwareSelector() override
void EndSelection() override
void BeginSelection() override
WebGPU rendering window.
Struct used to return information about a pixel location.
#define VTK_MARSHALAUTO