VTK  9.3.0
vtkWebGPUCamera.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 #ifndef vtkWebGPUCamera_h
4 #define vtkWebGPUCamera_h
5 
6 #include "vtkCamera.h"
7 
8 #include "vtkMatrix4x4.h" // for ivar
9 #include "vtkNew.h" // for ivar
10 #include "vtkRenderingWebGPUModule.h" // for export macro
11 
12 VTK_ABI_NAMESPACE_BEGIN
13 class vtkActor;
14 class vtkMatrix3x3;
15 
16 class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUCamera : public vtkCamera
17 {
18 public:
19  static vtkWebGPUCamera* New();
20  vtkTypeMacro(vtkWebGPUCamera, vtkCamera);
21  void PrintSelf(ostream& os, vtkIndent indent) override;
22 
24  inline void* GetCachedSceneTransforms() { return &(this->CachedSceneTransforms); }
25  static std::size_t GetCacheSizeBytes() { return sizeof(SceneTransforms); }
26 
33  void Render(vtkRenderer* renderer) override;
34 
39  void UpdateViewport(vtkRenderer* renderer) override;
40 
41 protected:
43  ~vtkWebGPUCamera() override;
44 
48 
49  // Pack uniforms as needed.
51  {
52  // Viewport dimensions
53  vtkTypeFloat32 Viewport[4];
54  // World -> Camera space
55  vtkTypeFloat32 ViewMatrix[4][4] = {};
56  // Camera space -> Clipped space
57  vtkTypeFloat32 ProjectionMatrix[4][4] = {};
58  // Normal matrix Inverted and transposed ViewMatrix
59  vtkTypeFloat32 NormalMatrix[4][4] = {};
60  // Clipped space -> Camera space
61  vtkTypeFloat32 InvertedProjectionMatrix[4][4] = {};
62  };
64 
65 private:
66  vtkWebGPUCamera(const vtkWebGPUCamera&) = delete;
67  void operator=(const vtkWebGPUCamera&) = delete;
68 };
69 
70 VTK_ABI_NAMESPACE_END
71 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:41
a virtual camera for 3D rendering
Definition: vtkCamera.h:41
a simple class to control print indentation
Definition: vtkIndent.h:29
represent and manipulate 3x3 transformation matrices
Definition: vtkMatrix3x3.h:26
abstract specification for renderers
Definition: vtkRenderer.h:62
record modification and/or execution time
Definition: vtkTimeStamp.h:25
void * GetCachedSceneTransforms()
~vtkWebGPUCamera() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp KeyMatrixTime
static vtkWebGPUCamera * New()
vtkNew< vtkMatrix3x3 > NormalMatrix
vtkRenderer * LastRenderer
SceneTransforms CachedSceneTransforms
void Render(vtkRenderer *renderer) override
Implement base class method.
void UpdateViewport(vtkRenderer *renderer) override
Invokes setViewport, setScissor (if needed) followed by updating the view, projection buffers.
static std::size_t GetCacheSizeBytes()
void CacheSceneTransforms(vtkRenderer *renderer)