SPH
Filmic.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "gui/objects/Color.h"
4 
6 
8 class FilmicMapping {
9 public:
10  struct UserParams {
11  float toeStrength = 0.f;
12  float toeLength = 0.5f;
13  float shoulderStrength = 0.f;
14  float shoulderLength = 0.5f;
15  float shoulderAngle = 0.f;
16  float gamma = 1.f;
17  };
18 
19 private:
20  struct DirectParams {
21  float x0 = 0.25f;
22  float y0 = 0.25f;
23  float x1 = 0.75f;
24  float y1 = 0.75f;
25  float W = 1.f;
26  float overshootX = 0.f;
27  float overshootY = 0.f;
28  float gamma = 1.f;
29  };
30 
31  struct CurveSegment {
32  float offsetX = 0.f;
33  float offsetY = 0.f;
34  float scaleX = 1.f;
35  float scaleY = 1.f;
36  float lnA = 0.f;
37  float B = 1.f;
38 
39  float eval(const float x) const;
40  };
41 
42 
43  float W = 1.f;
44  float invW = 1.f;
45 
46  float x0 = 0.25f;
47  float x1 = 0.75f;
48  float y0 = 0.25f;
49  float y1 = 0.75f;
50 
51  CurveSegment segments[3];
52 
53 public:
55 
56  void create(const UserParams& userParams);
57 
58  float operator()(const float x) const;
59 
60 private:
61  void create(const DirectParams& srcParams);
62  void getDirectParams(DirectParams& dstParams, const UserParams& srcParams);
63 };
64 
65 
NAMESPACE_SPH_BEGIN
Definition: BarnesHut.cpp:13
#define NAMESPACE_SPH_END
Definition: Object.h:12
Using http://filmicworlds.com/blog/filmic-tonemapping-with-piecewise-power-curves/.
Definition: Filmic.h:8
float operator()(const float x) const
Definition: Filmic.cpp:27
void create(const UserParams &userParams)
Definition: Filmic.cpp:21