VTK  9.3.0
vtkOpenGLRenderer.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
23 #ifndef vtkOpenGLRenderer_h
24 #define vtkOpenGLRenderer_h
25 
26 #include "vtkRenderer.h"
27 
28 #include "vtkOpenGLQuadHelper.h" // for ivar
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 #include "vtkSmartPointer.h" // For vtkSmartPointer
31 #include <memory> // for unique_ptr
32 #include <string> // Ivars
33 #include <vector> // STL Header
34 
35 VTK_ABI_NAMESPACE_BEGIN
36 class vtkFloatArray;
38 class vtkRenderPass;
39 class vtkOpenGLState;
40 class vtkOpenGLTexture;
42 class vtkTextureObject;
45 class vtkPBRLUTTexture;
47 class vtkShaderProgram;
48 class vtkShadowMapPass;
49 class vtkSSAOPass;
50 
51 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
52 {
53 public:
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  void DeviceRender() override;
62 
67 
75 
76  void Clear() override;
77 
81  int UpdateLights() override;
82 
90 
96 
103 
104  // Get the state object used to keep track of
105  // OpenGL state
107 
108  // get the standard lighting uniform declarations
109  // for the current set of lights
110  const char* GetLightingUniforms();
111 
112  // update the lighting uniforms for this shader if they
113  // are out of date
115 
116  // get the complexity of the current lights as a int
117  // 0 = no lighting
118  // 1 = headlight
119  // 2 = directional lights
120  // 3 = positional lights
122  {
123  NoLighting = 0,
124  Headlight = 1,
125  Directional = 2,
126  Positional = 3
127  };
128  vtkGetMacro(LightingComplexity, int);
129 
130  // get the number of lights turned on
131  vtkGetMacro(LightingCount, int);
132 
134 
141 
143 
150 
155 
157 
160  vtkSetMacro(UseSphericalHarmonics, bool);
161  vtkGetMacro(UseSphericalHarmonics, bool);
162  vtkBooleanMacro(UseSphericalHarmonics, bool);
164 
168  void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
169 
170  // Method to release graphics resources
172 
173 protected:
175  ~vtkOpenGLRenderer() override;
176 
180  void CheckCompilation(unsigned int fragmentShader);
181 
187  int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
188 
195 
196  friend class vtkOpenGLProperty;
197  friend class vtkOpenGLTexture;
199  friend class vtkOpenGLImageResliceMapper;
200 
205 
210 
215 
220 
225 
226  // Is rendering at translucent geometry stage using depth peeling and
227  // rendering a layer other than the first one? (Boolean value)
228  // If so, the uniform variables UseTexture and Texture can be set.
229  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
231 
232  friend class vtkRenderPass;
233 
238 
243 
248  std::unique_ptr<vtkOpenGLQuadHelper> BackgroundRenderer;
250 
251 private:
252  vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
253  void operator=(const vtkOpenGLRenderer&) = delete;
254 };
255 
256 VTK_ABI_NAMESPACE_END
257 #endif
Implement Depth Peeling for use within a framebuffer pass.
dynamic, self-adjusting array of float
Definition: vtkFloatArray.h:40
abstract interface to OpenGL FBOs
a simple class to control print indentation
Definition: vtkIndent.h:38
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkOpenGLState * GetState()
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
std::unique_ptr< vtkOpenGLQuadHelper > BackgroundRenderer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPBRPrefilterTexture * EnvMapPrefiltered
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Overridden in order to connect the texture to the environment map textures.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
Get environment textures used for image based lighting.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkPBRIrradianceTexture * EnvMapIrradiance
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkPBRLUTTexture * EnvMapLookupTable
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
const char * GetLightingUniforms()
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
int UpdateLights() override
Ask lights to load themselves into graphics pipeline.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
static vtkOpenGLRenderer * New()
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
void DeviceRender() override
Concrete open gl render method.
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
void UpdateLightingUniforms(vtkShaderProgram *prog)
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
void Clear() override
Clear the image to the background color.
~vtkOpenGLRenderer() override
void CheckCompilation(unsigned int fragmentShader)
Check the compilation status of some fragment shader source.
int GetDepthPeelingHigherLayer()
Is rendering at translucent geometry stage using depth peeling and rendering a layer other than the f...
OpenGL state storage.
OpenGL texture map.
Implement OIT rendering using average color.
precompute irradiance texture used in physically based rendering
precompute BRDF look-up table texture used in physically based rendering
precompute prefilter texture used in physically based rendering
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:49
abstract specification for renderers
Definition: vtkRenderer.h:71
Implement a screen-space ambient occlusion pass.
Definition: vtkSSAOPass.h:35
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition: vtkTexture.h:67
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:59
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ string
Definition: vtkX3D.h:490
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:270