Rendu
A lightweight rendering engine for experimentations
Loading...
Searching...
No Matches
ConvolutionPyramid.hpp
1#pragma once
2#include "resources/Texture.hpp"
3#include "resources/ResourcesManager.hpp"
4#include "Common.hpp"
5
14
15public:
22 ConvolutionPyramid(uint width, uint height, uint inoutPadding);
23
30 void setFilters(const float h1[5], float h2, const float g[3]);
31
35 void process(const Texture& texture);
36
41 void resize(uint width, uint height);
42
46 const Texture * texture() const { return &_shifted; }
47
51 unsigned int width() { return _resolution[0]; }
52
56 unsigned int height() { return _resolution[1]; }
57
58private:
63
65 std::vector<Texture> _levelsIn;
66 std::vector<Texture> _levelsOut;
67
68 float _h1[5] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f};
69 float _h2 = 0.0f;
70 float _g[3] = {0.0f, 0.0f, 0.0f};
71
72 glm::ivec2 _resolution = glm::ivec2(0);
73 const int _size = 5;
74 int _padding = 0;
75};
Implements a multiscale scheme for approximating convolution with large filters. This is the basis of...
Definition: ConvolutionPyramid.hpp:13
Texture _shifted
Contains the input data padded to the right size.
Definition: ConvolutionPyramid.hpp:64
void setFilters(const float h1[5], float h2, const float g[3])
Definition: ConvolutionPyramid.cpp:128
void process(const Texture &texture)
Definition: ConvolutionPyramid.cpp:42
glm::ivec2 _resolution
Resolution expected for the input texture.
Definition: ConvolutionPyramid.hpp:72
float _g[3]
g filter coefficients.
Definition: ConvolutionPyramid.hpp:70
std::vector< Texture > _levelsOut
The filtered levels of the pyramid.
Definition: ConvolutionPyramid.hpp:66
void resize(uint width, uint height)
Definition: ConvolutionPyramid.cpp:140
unsigned int height()
Definition: ConvolutionPyramid.hpp:56
int _padding
Additional padding.
Definition: ConvolutionPyramid.hpp:74
const Texture * texture() const
Definition: ConvolutionPyramid.hpp:46
Program * _upscale
Pyramid ascending pass shader.
Definition: ConvolutionPyramid.hpp:60
const int _size
Size of the filter.
Definition: ConvolutionPyramid.hpp:73
Program * _padder
Padding helper shader.
Definition: ConvolutionPyramid.hpp:62
Program * _filter
Filtering shader for the last pyramid level.
Definition: ConvolutionPyramid.hpp:61
Program * _downscale
Pyramid descending pass shader.
Definition: ConvolutionPyramid.hpp:59
float _h2
h2 filter multiplier.
Definition: ConvolutionPyramid.hpp:69
unsigned int width()
Definition: ConvolutionPyramid.hpp:51
std::vector< Texture > _levelsIn
The initial levels of the pyramid.
Definition: ConvolutionPyramid.hpp:65
float _h1[5]
h1 filter coefficients.
Definition: ConvolutionPyramid.hpp:68
Represents a group of shaders used for rendering.
Definition: Program.hpp:31
Represents a texture containing one or more images, stored on the CPU and/or GPU.
Definition: Texture.hpp:12