-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPostProcessor.cpp
More file actions
63 lines (56 loc) · 1.23 KB
/
Copy pathPostProcessor.cpp
File metadata and controls
63 lines (56 loc) · 1.23 KB
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
#include "PostProcessor.hpp"
PostProcessor::PostProcessor()
{
}
PostProcessor::~PostProcessor()
{
}
void PostProcessor::controlExposure(Texture &imageIn, Texture &imageOut, int resX, int resY, ExposureType expT){
float dHighest = 0;
switch (expT)
{
case AUTO:
if (m_HighestExposure > 1)
{
dHighest = 1 / m_HighestExposure;
for (int i = 0; i < resX; i++)
{
for (int j = 0; j < resY; j++)
{
colRGB col = imageIn.getRGB(i, j);
col *= dHighest;
imageOut.setRGB(col, i, j);
}
}
}
break;
case CLIP:
for (int i = 0; i < resX; i++)
{
for (int j = 0; j < resY; j++)
{
colRGB col = imageIn.getRGB(i, j);
if (col.red>1.f)col.red = 1.f;
if (col.green>1.f)col.green = 1.f;
if (col.blue>1.f)col.blue = 1.f;
imageOut.setRGB(col, i, j);
}
}
break;
default:
break;
}
}
void PostProcessor::updateHighestExposure(Texture &image, int resX, int resY){
m_HighestExposure = 0;
for (int i = 0; i < resX; i++)
{
for (int j = 0; j < resY; j++)
{
colRGB col = image.getRGB(i, j);
if (col.red>m_HighestExposure)m_HighestExposure = col.red;
if (col.green>m_HighestExposure)m_HighestExposure = col.green;
if (col.blue>m_HighestExposure)m_HighestExposure = col.blue;
}
}
}