VTK  9.3.1
vtkWebGPULight.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
11 #ifndef vtkWebGPULight_h
12 #define vtkWebGPULight_h
13 
14 #include "vtkLight.h"
15 
16 #include "vtkRenderingWebGPUModule.h" // For export macro
17 
18 VTK_ABI_NAMESPACE_BEGIN
19 class vtkRenderer;
20 class vtkCamera;
21 
22 class VTKRENDERINGWEBGPU_EXPORT vtkWebGPULight : public vtkLight
23 {
24 public:
25  static vtkWebGPULight* New();
26  vtkTypeMacro(vtkWebGPULight, vtkLight);
27  void PrintSelf(ostream& os, vtkIndent indent) override;
28 
29  void CacheLightInformation(vtkRenderer* renderer, vtkCamera* camera);
30  inline const void* GetCachedLightInformation() { return &(this->CachedLightInfo); }
31  static std::size_t GetCacheSizeBytes() { return sizeof(LightInfo); }
32 
33  void Render(vtkRenderer*, int) override;
34 
35 protected:
36  vtkWebGPULight() = default;
37  ~vtkWebGPULight() override = default;
38 
39  struct LightInfo
40  {
41  vtkTypeUInt8 Pad[12] = {}; // so that Type begins at n module 16 byte. LightCount
42  // a 4-byte integer is the first element in lights ssbo.
43  // 0 : deferred, 1 : headlight, 2 : lightkit, 3 : positional
44  vtkTypeUInt32 Type = 0;
45  // 0 : not positional, 1 : positional
46  vtkTypeUInt32 Positional = 0;
47  vtkTypeFloat32 ConeAngle = 0;
48  vtkTypeFloat32 Exponent = 0;
49  vtkTypeFloat32 Color[4] = {};
50  vtkTypeFloat32 DirectionVC[4] = {}; // normalized
51  vtkTypeFloat32 PositionVC[4] = {};
52  vtkTypeFloat32 Attenuation[4] = {};
53  };
55 
56 private:
57  vtkWebGPULight(const vtkWebGPULight&) = delete;
58  void operator=(const vtkWebGPULight&) = delete;
59 };
60 
61 VTK_ABI_NAMESPACE_END
62 #endif
const void * GetCachedLightInformation()
abstract specification for renderers
Definition: vtkRenderer.h:61
static vtkLight * New()
Create a light with the focal point at the origin and its position set to (0,0,1).
a simple class to control print indentation
Definition: vtkIndent.h:28
a virtual camera for 3D rendering
Definition: vtkCamera.h:40
a virtual light for 3D rendering
Definition: vtkLight.h:48
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static std::size_t GetCacheSizeBytes()
OpenGL light.
LightInfo CachedLightInfo
virtual void Render(vtkRenderer *, int)
Abstract interface to renderer.
Definition: vtkLight.h:78