File: post_processing.h

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (74 lines) | stat: -rw-r--r-- 1,410 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#pragma once

#include "globalincs/pstypes.h"

#include "math/vecmat.h"

namespace graphics {

enum class PostEffectUniformType {
	Invalid,
	NoiseAmount,
	Saturation,
	Brightness,
	Contrast,
	FilmGrain,
	TvStripes,
	Cutoff,
	Tint,
	Dither,
};

struct post_effect_t {
	SCP_string name;
	PostEffectUniformType uniform_type = PostEffectUniformType::Invalid;
	SCP_string define_name;

	float intensity{0.0f};
	float default_intensity{0.0f};
	float div{1.0f};
	float add{0.0f};

	vec3d rgb = vmd_zero_vector;

	bool always_on{false};
};

struct lightshaft_parameters {
	bool on = true; // enabled by default
	float density = 0.5f;
	float weight = 0.02f;
	float falloff = 1.0f;
	float intensity = 0.5f;
	float cpintensity = 0.5f * 50 * 0.02f;
	int samplenum = 50;
};

class PostProcessingManager {
  public:
	bool parse_table();

	void clear();

	const SCP_vector<graphics::post_effect_t>& getPostEffects() const;
	SCP_vector<graphics::post_effect_t>& getPostEffects();

	const lightshaft_parameters& getLightshaftParams() const;
	lightshaft_parameters& getLightshaftParams();

	bool bloomShadersOk() const;
	void setBloomShadersOk(bool ok);

  private:
	SCP_vector<post_effect_t> m_postEffects;

	lightshaft_parameters m_lightshaftParams;
	bool m_bloomShadersOk = true;
};

} // namespace graphics

bool gr_lightshafts_enabled();
int gr_bloom_intensity();
// used by lab
void gr_set_bloom_intensity(int intensity);