Graphite
Version 3
An experimental 3D geometry processing program
|
Implementation of UnsharpMasking full screen effect. More...
#include <geogram_gfx/full_screen_effects/unsharp_masking.h>
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_ |
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.
|
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_.
|
protected |
Displays the final result.
It composites the final result with the previously rendered frame.
|
inline |
Gets the size of the blurring kernel.
Definition at line 131 of file unsharp_masking.h.
|
inline |
Gets the contrast.
Definition at line 115 of file unsharp_masking.h.
|
inline |
Tests whether halos should be drawn.
true | if halos should be drawn |
false | otherwise |
Definition at line 148 of file unsharp_masking.h.
|
inline |
Gets the intensity.
Definition at line 97 of file unsharp_masking.h.
|
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.
true | if positive_shadows should be drawn |
false | otherwise |
Definition at line 168 of file unsharp_masking.h.
Callback called the first time this FullScreenEffectImpl is used.
[in] | w,h | width 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.
|
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.
Callback called at the beginning of each frame.
[in] | width,height | dimension of the rendering context. |
Baseclass implementation redirects rendering to draw_FBO_.
Reimplemented from GEO::FullScreenEffectImpl.
|
overridevirtual |
Gets the minimum required GLSL version needed to execute the shaders in this FullScreenEffectImpl.
Default implementation returns 1.0.
Reimplemented from GEO::FullScreenEffectImpl.
Callback called whenever the rendering context is resized.
Subclasses may overload this callback, for instance to resize FrameBufferObject.
[in] | w,h | new width and height of the rendering context, in pixels. |
Reimplemented from GEO::FullScreenEffectImpl.
|
inline |
Sets the size of the blurring kernel.
[in] | x | the size of the blurring kernel, in pixels. |
Definition at line 139 of file unsharp_masking.h.
|
inline |
Specifies whether halos should be used.
[in] | x | true if halos should be drawn, false otherwise |
Definition at line 156 of file unsharp_masking.h.
|
inline |
Sets the intensity.
[in] | x | the intensity, as an integer. A value of 50 (default) corresponds to average intensity. |
Definition at line 106 of file unsharp_masking.h.
|
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.
[in] | x | true if positive_shadows should be drawn, false otherwise |
Definition at line 180 of file unsharp_masking.h.
|
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.