VTK  9.7.1
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 "vtkTypeUInt32Array.h"
22 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23 
24 VTK_ABI_NAMESPACE_BEGIN
26 class VTKRENDERINGWEBGPU_EXPORT VTK_MARSHALAUTO vtkWebGPUHardwareSelector
27  : public vtkHardwareSelector
28 {
29 public:
32  static vtkOverrideAttribute* CreateOverrideAttributes();
34  void PrintSelf(ostream& os, vtkIndent indent) override;
35 
41  bool CaptureBuffers() override;
42 
47  void BeginRenderProp() override {};
48  void EndRenderProp() override {};
49 
54  void RenderCompositeIndex(unsigned int /*index*/) override {};
55 
60  void RenderProcessId(unsigned int /*processid*/) override {};
61 
62  // we need to initialize the depth buffer
63  void BeginSelection() override;
64  void EndSelection() override;
65 
70  vtkProp* GetPropFromID(int id) override;
71 
72  PixelInformation GetPixelInformation(const unsigned int inDisplayPosition[2], int maxDist,
73  unsigned int outSelectedPosition[2]) override;
74 
75 protected:
77  ~vtkWebGPUHardwareSelector() override;
78 
79  void PreCapturePass(int /*pass*/) override {};
80  void PostCapturePass(int /*pass*/) override {};
81 
82  void BeginRenderProp(vtkRenderWindow*) override {};
83  void EndRenderProp(vtkRenderWindow*) override {};
84 
85  void SavePixelBuffer(int) override {};
86 
87  void ReleasePixBuffers() override;
88 
89  int Convert(int xx, int yy, unsigned char* pb) override;
90 
91 private:
92  friend class vtkWebGPURenderWindow;
93  struct Ids
94  {
95  vtkTypeUInt32 AttributeId;
96  vtkTypeUInt32 PropId;
97  vtkTypeUInt32 CompositeId;
98  vtkTypeUInt32 ProcessId;
99  };
100 
101  bool MapReady = false;
103 
104  vtkProp** PropArray = nullptr;
105 
107  void operator=(const vtkWebGPUHardwareSelector&) = delete;
108 };
109 
110 #define vtkWebGPUHardwareSelector_OVERRIDE_ATTRIBUTES \
111  vtkWebGPUHardwareSelector::CreateOverrideAttributes()
112 VTK_ABI_NAMESPACE_END
113 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
Attribute for vtkObjectFactory overrides.
void BeginRenderProp(vtkRenderWindow *) override
virtual void EndSelection()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void BeginRenderProp() override
Called by the mapper before and after rendering each prop.
virtual void ReleasePixBuffers()
Clears all pixel buffers.
void EndRenderProp(vtkRenderWindow *) override
virtual bool CaptureBuffers()
It is possible to use the vtkHardwareSelector for a custom picking.
void RenderProcessId(unsigned int) override
Called by any vtkMapper or subclass to render process id.
implements the device specific code of vtkWebGPUHardwareSelector.
static void Convert(vtkIdType id, float tcoord[3])
a simple class to control print indentation
Definition: vtkIndent.h:28
void EndRenderProp() override
Called by the mapper before and after rendering each prop.
#define VTK_NEWINSTANCE
virtual void BeginSelection()
static vtkHardwareSelector * New()
virtual vtkProp * GetPropFromID(int id)
returns the prop associated with a ID.
void RenderCompositeIndex(unsigned int) override
Called by any vtkMapper or vtkProp subclass to render a composite-index.
create a window for renderers to draw into
PixelInformation GetPixelInformation(const unsigned int display_position[2])
It is possible to use the vtkHardwareSelector for a custom picking.
#define VTK_MARSHALAUTO
WebGPU rendering window.