Easy3D 2.6.1
Loading...
Searching...
No Matches
soft_shadow.h
1/********************************************************************
2 * Copyright (C) 2015 Liangliang Nan <liangliang.nan@gmail.com>
3 * https://3d.bk.tudelft.nl/liangliang/
4 *
5 * This file is part of Easy3D. If it is useful in your research/work,
6 * I would be grateful if you show your appreciation by citing it:
7 * ------------------------------------------------------------------
8 * Liangliang Nan.
9 * Easy3D: a lightweight, easy-to-use, and efficient C++ library
10 * for processing and rendering 3D data.
11 * Journal of Open Source Software, 6(64), 3255, 2021.
12 * ------------------------------------------------------------------
13 *
14 * Easy3D is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License Version 3
16 * as published by the Free Software Foundation.
17 *
18 * Easy3D is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
22 *
23 * You should have received a copy of the GNU General Public License
24 * along with this program. If not, see <http://www.gnu.org/licenses/>.
25 ********************************************************************/
26
27#ifndef EASY3D_RENDERER_SOFT_SHADOW_H
28#define EASY3D_RENDERER_SOFT_SHADOW_H
29
30#include <easy3d/renderer/shadow.h>
31
32
33namespace easy3d {
34
68
69 class SoftShadow : public Shadow
70 {
71 public:
80
81 public:
86 explicit SoftShadow(Camera* cam);
90 ~SoftShadow() override = default;
91
96 float softness() const { return softness_; }
101 void set_softness(float s) { softness_ = s; }
102
107 SamplePattern sample_pattern() const { return sample_pattern_; }
112 void set_sample_pattern(SamplePattern pattern) { sample_pattern_ = pattern; }
113
114 protected:
115 void ensure_fbo() override;
116 void shadow_map_pass(const std::vector<TrianglesDrawable*>& surfaces) override;
117 void render_pass(const std::vector<TrianglesDrawable*>& surfaces) override;
118
119 protected:
120 // The softness of the shadow, in [0, 1] (w.r.t. 10% of the light's size)
121 float softness_;
122
123 SamplePattern sample_pattern_;
124
125 private:
126 //copying disabled
127 SoftShadow(const SoftShadow&);
128 SoftShadow& operator=(const SoftShadow&);
129 };
130
131}
132
133#endif // EASY3D_RENDERER_SOFT_SHADOW_H
A perspective or orthographic camera.
Definition camera.h:113
Shadow(Camera *cam)
Constructor.
Definition shadow.cpp:50
An implementation of the Percentage-Closer Soft Shadows.
Definition soft_shadow.h:70
~SoftShadow() override=default
Destructor.
SoftShadow(Camera *cam)
Constructor.
Definition soft_shadow.cpp:43
void set_softness(float s)
Set the softness of the shadow.
Definition soft_shadow.h:101
SamplePattern sample_pattern() const
Get the sample pattern used for blocker search and PCF filtering.
Definition soft_shadow.h:107
void set_sample_pattern(SamplePattern pattern)
Set the sample pattern used for blocker search and PCF filtering.
Definition soft_shadow.h:112
float softness() const
Get the softness of the shadow.
Definition soft_shadow.h:96
SamplePattern
The sample pattern used for blocker search and PCF filtering.
Definition soft_shadow.h:73
@ SP_Poisson_64_128
64 samples for the blocker search, 128 samples for the PCF filtering, all samples using a Poisson dis...
Definition soft_shadow.h:76
@ SP_Poisson_100_100
100 samples for the blocker search, 100 samples for the PCF filtering, all samples using a Poisson di...
Definition soft_shadow.h:77
@ SP_Poisson_25_25
25 samples for the blocker search, 25 samples in the PCF filtering, all samples using a Poisson disk
Definition soft_shadow.h:74
@ SP_Regular_49_225
49 samples for the blocker search, 225 samples for the PCF filtering, all samples using regular sampl...
Definition soft_shadow.h:78
@ SP_Poisson_32_64
32 samples for the blocker search, 64 samples for the PCF filtering, all samples using a Poisson disk
Definition soft_shadow.h:75
Definition collider.cpp:182