1 |
8426bd6a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
cc62b34a
|
Leszek Koltunski
|
// Copyright 2016 Leszek Koltunski leszek@koltunski.pl //
|
3 |
8426bd6a
|
Leszek Koltunski
|
// //
|
4 |
46b572b5
|
Leszek Koltunski
|
// This file is part of Distorted. //
|
5 |
8426bd6a
|
Leszek Koltunski
|
// //
|
6 |
cc62b34a
|
Leszek Koltunski
|
// This library is free software; you can redistribute it and/or //
|
7 |
|
|
// modify it under the terms of the GNU Lesser General Public //
|
8 |
|
|
// License as published by the Free Software Foundation; either //
|
9 |
|
|
// version 2.1 of the License, or (at your option) any later version. //
|
10 |
8426bd6a
|
Leszek Koltunski
|
// //
|
11 |
cc62b34a
|
Leszek Koltunski
|
// This library is distributed in the hope that it will be useful, //
|
12 |
8426bd6a
|
Leszek Koltunski
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13 |
cc62b34a
|
Leszek Koltunski
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
|
14 |
|
|
// Lesser General Public License for more details. //
|
15 |
8426bd6a
|
Leszek Koltunski
|
// //
|
16 |
cc62b34a
|
Leszek Koltunski
|
// You should have received a copy of the GNU Lesser General Public //
|
17 |
|
|
// License along with this library; if not, write to the Free Software //
|
18 |
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA //
|
19 |
8426bd6a
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
20 |
|
|
|
21 |
3521c6fe
|
leszek
|
package org.distorted.library.effect;
|
22 |
8426bd6a
|
Leszek Koltunski
|
|
23 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
24 |
3521c6fe
|
leszek
|
|
25 |
|
|
import org.distorted.library.main.DistortedEffects;
|
26 |
|
|
|
27 |
8426bd6a
|
Leszek Koltunski
|
/**
|
28 |
|
|
* A list of quality levels.
|
29 |
|
|
* <p>
|
30 |
|
|
* One can set quality of a Postprocessing Effect to one of those. The lower the quality, the faster
|
31 |
|
|
* the rendering will be.
|
32 |
|
|
*
|
33 |
3521c6fe
|
leszek
|
* @see DistortedEffects
|
34 |
8426bd6a
|
Leszek Koltunski
|
*/
|
35 |
|
|
public enum EffectQuality
|
36 |
|
|
{
|
37 |
46dc4091
|
Leszek Koltunski
|
HIGHEST ( 0, 1.000f ), // has to start from 0
|
38 |
|
|
HIGH ( 1, 0.500f ),
|
39 |
|
|
MEDIUM ( 2, 0.250f ),
|
40 |
|
|
LOW ( 3, 0.125f );
|
41 |
8426bd6a
|
Leszek Koltunski
|
|
42 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43 |
faa3ff56
|
Leszek Koltunski
|
/**
|
44 |
|
|
* Numof of possible qualities.
|
45 |
|
|
*/
|
46 |
3521c6fe
|
leszek
|
public static final int LENGTH = values().length;
|
47 |
8426bd6a
|
Leszek Koltunski
|
|
48 |
3521c6fe
|
leszek
|
private final int level;
|
49 |
46dc4091
|
Leszek Koltunski
|
private final float mipmap;
|
50 |
|
|
|
51 |
|
|
private static final EffectQuality[] qualities;
|
52 |
|
|
|
53 |
|
|
static
|
54 |
|
|
{
|
55 |
|
|
int i=0;
|
56 |
|
|
qualities= new EffectQuality[LENGTH];
|
57 |
|
|
for(EffectQuality q: EffectQuality.values()) qualities[i++] = q;
|
58 |
|
|
}
|
59 |
3521c6fe
|
leszek
|
|
60 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
61 |
8426bd6a
|
Leszek Koltunski
|
|
62 |
46dc4091
|
Leszek Koltunski
|
EffectQuality(int level, float mipmap)
|
63 |
8426bd6a
|
Leszek Koltunski
|
{
|
64 |
|
|
this.level = level;
|
65 |
46dc4091
|
Leszek Koltunski
|
this.mipmap= mipmap;
|
66 |
8426bd6a
|
Leszek Koltunski
|
}
|
67 |
3521c6fe
|
leszek
|
|
68 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
69 |
faa3ff56
|
Leszek Koltunski
|
/**
|
70 |
|
|
* Only for use by the library itself.
|
71 |
|
|
*
|
72 |
|
|
* @y.exclude
|
73 |
|
|
*/
|
74 |
3521c6fe
|
leszek
|
public int getLevel()
|
75 |
|
|
{
|
76 |
|
|
return level;
|
77 |
|
|
}
|
78 |
46dc4091
|
Leszek Koltunski
|
|
79 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
80 |
|
|
/**
|
81 |
|
|
* Only for use by the library itself.
|
82 |
|
|
*
|
83 |
|
|
* @y.exclude
|
84 |
|
|
*/
|
85 |
|
|
public static float getMipmap(int quality)
|
86 |
|
|
{
|
87 |
|
|
return qualities[quality].mipmap;
|
88 |
|
|
}
|
89 |
8426bd6a
|
Leszek Koltunski
|
}
|