VTK  9.4.20241112
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
18VTK_ABI_NAMESPACE_BEGIN
19class vtkRenderer;
20class vtkCamera;
21
22class VTKRENDERINGWEBGPU_EXPORT vtkWebGPULight : public vtkLight
23{
24public:
26 vtkTypeMacro(vtkWebGPULight, vtkLight);
27 void PrintSelf(ostream& os, vtkIndent indent) override;
28
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
35protected:
36 vtkWebGPULight() = default;
37 ~vtkWebGPULight() override = default;
38
39 struct LightInfo
40 {
41 vtkTypeUInt8 Pad[12] = {}; // so that Type begins at n modulo 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
56private:
57 vtkWebGPULight(const vtkWebGPULight&) = delete;
58 void operator=(const vtkWebGPULight&) = delete;
59};
60
61VTK_ABI_NAMESPACE_END
62#endif
a virtual camera for 3D rendering
Definition vtkCamera.h:151
a simple class to control print indentation
Definition vtkIndent.h:108
a virtual light for 3D rendering
Definition vtkLight.h:159
abstract specification for renderers
OpenGL light.
void Render(vtkRenderer *, int) override
Abstract interface to renderer.
const void * GetCachedLightInformation()
void CacheLightInformation(vtkRenderer *renderer, vtkCamera *camera)
static vtkWebGPULight * New()
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
static std::size_t GetCacheSizeBytes()
~vtkWebGPULight() override=default
vtkWebGPULight()=default
LightInfo CachedLightInfo