VTK  9.4.20250409
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
22VTK_ABI_NAMESPACE_BEGIN
23class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUHardwareSelector : public vtkHardwareSelector
24{
25public:
28 void PrintSelf(ostream& os, vtkIndent indent) override;
29
35 bool CaptureBuffers() override;
36
41 void BeginRenderProp() override{};
42 void EndRenderProp() override{};
43
48 void RenderCompositeIndex(unsigned int /*index*/) override{};
49
54 void RenderProcessId(unsigned int /*processid*/) override{};
55
56 // we need to initialize the depth buffer
57 void BeginSelection() override;
58 void EndSelection() override;
59
64 vtkProp* GetPropFromID(int id) override;
65
66 PixelInformation GetPixelInformation(const unsigned int inDisplayPosition[2], int maxDist,
67 unsigned int outSelectedPosition[2]) override;
68
69protected:
72
73 void PreCapturePass(int /*pass*/) override{};
74 void PostCapturePass(int /*pass*/) override{};
75
77 void EndRenderProp(vtkRenderWindow*) override{};
78
79 void SavePixelBuffer(int) override{};
80
81 void ReleasePixBuffers() override;
82
83 int Convert(int xx, int yy, unsigned char* pb) override;
84
85private:
87 struct Ids
88 {
89 vtkTypeUInt32 AttributeId;
90 vtkTypeUInt32 PropId;
91 vtkTypeUInt32 CompositeId;
92 vtkTypeUInt32 ProcessId;
93 };
94
95 bool MapReady = false;
96 std::vector<Ids> IdBuffer;
97
98 vtkProp** PropArray = nullptr;
99
101 void operator=(const vtkWebGPUHardwareSelector&) = delete;
102};
103
104VTK_ABI_NAMESPACE_END
105#endif
a simple class to control print indentation
Definition vtkIndent.h:108
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
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.