VTK  9.4.20241112
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
12VTK_ABI_NAMESPACE_BEGIN
13class vtkActor;
14class vtkMatrix3x3;
15
16class VTKRENDERINGWEBGPU_EXPORT vtkWebGPUCamera : public vtkCamera
17{
18public:
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
41protected:
43 ~vtkWebGPUCamera() override;
44
46 vtkRenderer* LastRenderer = nullptr;
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
65private:
66 vtkWebGPUCamera(const vtkWebGPUCamera&) = delete;
67 void operator=(const vtkWebGPUCamera&) = delete;
68};
69
70VTK_ABI_NAMESPACE_END
71#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
a virtual camera for 3D rendering
Definition vtkCamera.h:151
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 3x3 transformation matrices
Allocate and hold a VTK object.
Definition vtkNew.h:167
abstract specification for renderers
record modification and/or execution time
~vtkWebGPUCamera() override
void * GetCachedSceneTransforms()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTimeStamp KeyMatrixTime
vtkNew< vtkMatrix3x3 > NormalMatrix
static vtkWebGPUCamera * New()
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)