Graphite  Version 3
An experimental 3D geometry processing program
GEO::UnsharpMaskingImpl Class Reference

Implementation of UnsharpMasking full screen effect. More...

#include <geogram_gfx/full_screen_effects/unsharp_masking.h>

Inheritance diagram for GEO::UnsharpMaskingImpl:
GEO::FullScreenEffectImpl GEO::Counted GEO::GLSL::PseudoFileProvider

Public Member Functions

 UnsharpMaskingImpl ()
 UnsharpMaskingImpl constructor.
 
 ~UnsharpMaskingImpl () override
 UnsharpMaskingImpl destructor.
 
double required_GLSL_version () const override
 Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl. More...
 
void pre_render (index_t w, index_t h) override
 Callback called at the beginning of each frame. More...
 
void post_render () override
 Callback called at the end of each frame. More...
 
void update () override
 Callback called whenever parameters are changed in the GUI. More...
 
index_t get_intensity () const
 Gets the intensity. More...
 
void set_intensity (index_t x)
 Sets the intensity. More...
 
index_t get_contrast () const
 Gets the contrast. More...
 
void set_contrast (index_t x)
 Sets the contrast. A value of 50 (default) corresponds to average contrast.
 
index_t get_blur_width () const
 Gets the size of the blurring kernel. More...
 
void set_blur_width (index_t x)
 Sets the size of the blurring kernel. More...
 
bool get_halos () const
 Tests whether halos should be drawn. More...
 
void set_halos (bool x)
 Specifies whether halos should be used. More...
 
bool get_positive_shadows () const
 Tests whether positive_shadows should be drawn. More...
 
void set_positive_shadows (bool x)
 Specifies whether positive_shadows should be used. More...
 
- Public Member Functions inherited from GEO::FullScreenEffectImpl
 FullScreenEffectImpl ()
 FullScreenEffectImpl constructor.
 
 ~FullScreenEffectImpl () override
 FullScreenEffectImpl destructor.
 
index_t width () const
 Gets the width of the rendering context. More...
 
index_t height () const
 Gets the height of the rendering context. More...
 
bool OK () const
 Tests whether this FullScreenEffect can be used. More...
 
virtual void get_vertex_shader_preamble_pseudo_file (std::vector< GLSL::Source > &sources)
 Gets the content of the virtual file GLUP/current_profile/vertex_shader_preamble.h. More...
 
virtual void get_fragment_shader_preamble_pseudo_file (std::vector< GLSL::Source > &sources)
 Gets the content of the virtual file GLUP/current_profile/fragment_shader_preamble.h. More...
 
- Public Member Functions inherited from GEO::Counted
void ref () const
 Increments the reference count. More...
 
void unref () const
 Decrements the reference count. More...
 
bool is_shared () const
 Check if the object is shared. More...
 
int nb_refs () const
 Gets the number of references that point to this object. More...
 
- Public Member Functions inherited from GEO::GLSL::PseudoFileProvider
virtual ~PseudoFileProvider ()
 PseudoFileProvider destructor.
 

Protected Member Functions

void initialize (index_t w, index_t h) override
 Callback called the first time this FullScreenEffectImpl is used. More...
 
void resize (index_t width, index_t height) override
 Callback called whenever the rendering context is resized. More...
 
void blur ()
 Applies a Gaussian blur to the depth buffer. More...
 
void display_final_texture ()
 Displays the final result. More...
 
- Protected Member Functions inherited from GEO::FullScreenEffectImpl
void reset_alpha ()
 Resets alpha plane to 1.0 (opaque)
 
- Protected Member Functions inherited from GEO::Counted
 Counted ()
 Creates a reference counted object. More...
 
virtual ~Counted ()
 Destroys a reference counted object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from GEO::Counted
static void ref (const Counted *counted)
 Increments the reference count. More...
 
static void unref (const Counted *counted)
 Decrements the reference count. More...
 
- Protected Attributes inherited from GEO::FullScreenEffectImpl
FrameBufferObject draw_FBO_
 
bool ES_profile_
 

Detailed Description

Implementation of UnsharpMasking full screen effect.

Reference: Image Enhancement by Unsharp Masking the Depth Buffer, by Luft, Colditz and Deussen, ACM SIGGRAPH conference proceedings 2006.

Definition at line 60 of file unsharp_masking.h.

Member Function Documentation

◆ blur()

void GEO::UnsharpMaskingImpl::blur ( )
protected

Applies a Gaussian blur to the depth buffer.

The input is taken from the depth buffer of draw_FBO_. The result is in blur_1_. The function uses blur_2_ as a work variable. It does two passes of 1D blurring (horizontal and vertical, one from the depth buffer to blur_2_ and the other from blur_2_ to blur_1_.

◆ display_final_texture()

void GEO::UnsharpMaskingImpl::display_final_texture ( )
protected

Displays the final result.

It composites the final result with the previously rendered frame.

◆ get_blur_width()

index_t GEO::UnsharpMaskingImpl::get_blur_width ( ) const
inline

Gets the size of the blurring kernel.

Returns
the size of the blurring kernel, in pixels.

Definition at line 131 of file unsharp_masking.h.

◆ get_contrast()

index_t GEO::UnsharpMaskingImpl::get_contrast ( ) const
inline

Gets the contrast.

Returns
the contrast, as an integer. A value of 50 (default) corresponds to average contrast.

Definition at line 115 of file unsharp_masking.h.

◆ get_halos()

bool GEO::UnsharpMaskingImpl::get_halos ( ) const
inline

Tests whether halos should be drawn.

Return values
trueif halos should be drawn
falseotherwise

Definition at line 148 of file unsharp_masking.h.

◆ get_intensity()

index_t GEO::UnsharpMaskingImpl::get_intensity ( ) const
inline

Gets the intensity.

Returns
the intensity, as an integer. A value of 50 (default) corresponds to average intensity.

Definition at line 97 of file unsharp_masking.h.

◆ get_positive_shadows()

bool GEO::UnsharpMaskingImpl::get_positive_shadows ( ) const
inline

Tests whether positive_shadows should be drawn.

Positive shadows are white shadows that appear on zones opposite to dark shadows. It further enhances the perception of the shape.

Return values
trueif positive_shadows should be drawn
falseotherwise

Definition at line 168 of file unsharp_masking.h.

◆ initialize()

void GEO::UnsharpMaskingImpl::initialize ( index_t  w,
index_t  h 
)
overrideprotectedvirtual

Callback called the first time this FullScreenEffectImpl is used.

Parameters
[in]w,hwidth and height of the rendering context.

Subclasses may overload this callback. The OpenGL context is properly bound when this function is called.

Reimplemented from GEO::FullScreenEffectImpl.

◆ post_render()

void GEO::UnsharpMaskingImpl::post_render ( )
overridevirtual

Callback called at the end of each frame.

Subclasses may overload this function, and use it to transfered the content of FrameBufferObjects to the screen. Baseclass implementation copies the contents of draw_FBO_ to the screen.

Reimplemented from GEO::FullScreenEffectImpl.

◆ pre_render()

void GEO::UnsharpMaskingImpl::pre_render ( index_t  w,
index_t  h 
)
overridevirtual

Callback called at the beginning of each frame.

Parameters
[in]width,heightdimension of the rendering context.

Baseclass implementation redirects rendering to draw_FBO_.

Reimplemented from GEO::FullScreenEffectImpl.

◆ required_GLSL_version()

double GEO::UnsharpMaskingImpl::required_GLSL_version ( ) const
overridevirtual

Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl.

Default implementation returns 1.0.

Returns
the minimum required GLSL version as a double precision floating point number.

Reimplemented from GEO::FullScreenEffectImpl.

◆ resize()

void GEO::UnsharpMaskingImpl::resize ( index_t  width,
index_t  height 
)
overrideprotectedvirtual

Callback called whenever the rendering context is resized.

Subclasses may overload this callback, for instance to resize FrameBufferObject.

Parameters
[in]w,hnew width and height of the rendering context, in pixels.

Reimplemented from GEO::FullScreenEffectImpl.

◆ set_blur_width()

void GEO::UnsharpMaskingImpl::set_blur_width ( index_t  x)
inline

Sets the size of the blurring kernel.

Parameters
[in]xthe size of the blurring kernel, in pixels.

Definition at line 139 of file unsharp_masking.h.

◆ set_halos()

void GEO::UnsharpMaskingImpl::set_halos ( bool  x)
inline

Specifies whether halos should be used.

Parameters
[in]xtrue if halos should be drawn, false otherwise

Definition at line 156 of file unsharp_masking.h.

◆ set_intensity()

void GEO::UnsharpMaskingImpl::set_intensity ( index_t  x)
inline

Sets the intensity.

Parameters
[in]xthe intensity, as an integer. A value of 50 (default) corresponds to average intensity.

Definition at line 106 of file unsharp_masking.h.

◆ set_positive_shadows()

void GEO::UnsharpMaskingImpl::set_positive_shadows ( bool  x)
inline

Specifies whether positive_shadows should be used.

Positive shadows are white shadows that appear on zones opposite to dark shadows. It further enhances the perception of the shape.

Parameters
[in]xtrue if positive_shadows should be drawn, false otherwise

Definition at line 180 of file unsharp_masking.h.

◆ update()

void GEO::UnsharpMaskingImpl::update ( )
overridevirtual

Callback called whenever parameters are changed in the GUI.

Subclasses may overload this function, and use it to transfer parameters to shader uniforms.

Reimplemented from GEO::FullScreenEffectImpl.


The documentation for this class was generated from the following file: