MeshLib C++ Docs
Loading...
Searching...
No Matches
MRShadowsGL.h
Go to the documentation of this file.
1#pragma once
2#include "MRViewerFwd.h"
3#include "MRMesh/MRVector2.h"
4#include "MRMesh/MRVector4.h"
5#include "MRMesh/MRColor.h"
6#include "MRRenderGLHelpers.h"
7#include <boost/signals2/connection.hpp>
8
9namespace MR
10{
13
14
18class MRVIEWER_CLASS ShadowsGL
19{
20public:
22 MRVIEWER_API ShadowsGL();
23 ShadowsGL( ShadowsGL&& ) noexcept = delete;
24 ShadowsGL& operator=( ShadowsGL&& ) noexcept = delete;
25 MRVIEWER_API ~ShadowsGL();
26
28 MRVIEWER_API void enable( bool on );
29 bool isEnabled() const { return enabled_; }
30
32 const Vector2f& getShadowShift() const { return shadowShift_; }
33 MRVIEWER_API void setShadowShift( const Vector2f& shift );
34
35 const Vector4f& getShadowColor() const { return shadowColor_; }
36 MRVIEWER_API void setShadowColor( const Vector4f& color );
37
38 float getBlurRadius() const { return blurRadius_; }
39 MRVIEWER_API void setBlurRadius( float radius );
40
44 float getQuality() const { return quality_; }
45 MRVIEWER_API void setQuality( float quality );
46private:
48 Vector2f shadowShift_ = Vector2f( 0.0, 0.0 );
49 Vector4f shadowColor_ = Vector4f( Color::yellow() );
50 float blurRadius_{ 40.0f };
51
52 float quality_{ 0.25f };
53 void preDraw_();
54 void postDraw_();
55 void postResize_( int x, int y );
56
57 void drawLowSize_();
58 void convolveX_();
59 void convolveY_();
60 void drawShadow_( bool convX );
61 void drawTexture_( bool scene, bool downsample );
62
63 boost::signals2::connection preDrawConnection_;
64 boost::signals2::connection postDrawConnection_;
65 boost::signals2::connection postResizeConnection_;
66
67 Vector2i sceneSize_;
68 Vector2i lowSize_;
69
70 QuadTextureVertexObject quadObject_;
71
72 FramebufferData sceneFramebuffer_;
73 FramebufferData lowSizeFramebuffer_;
74 FramebufferData convolutionXFramebuffer_;
75
76 bool enabled_{ false };
77};
78
79}
const Vector4f & getShadowColor() const
Definition MRShadowsGL.h:35
float getQuality() const
Definition MRShadowsGL.h:44
void setQuality(float quality)
ShadowsGL(ShadowsGL &&) noexcept=delete
const Vector2f & getShadowShift() const
shift in screen space
Definition MRShadowsGL.h:32
void setShadowColor(const Vector4f &color)
static constexpr Color yellow() noexcept
Definition MRColor.h:34
ShadowsGL()
out-of-line to keep the GL members of this class out of the modules using it
void enable(bool on)
subscribe to viewer events on enable, unsubscribe on disable
float getBlurRadius() const
Definition MRShadowsGL.h:38
void setShadowShift(const Vector2f &shift)
void setBlurRadius(float radius)
bool isEnabled() const
Definition MRShadowsGL.h:29
only for bindings generation
Definition MRCameraOrientationPlugin.h:8