1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2016 Leszek Koltunski leszek@koltunski.pl //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// 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
|
// //
|
11
|
// This library is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU //
|
14
|
// Lesser General Public License for more details. //
|
15
|
// //
|
16
|
// 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
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
20
|
|
21
|
package org.distorted.library.effect;
|
22
|
|
23
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
24
|
|
25
|
import org.distorted.library.main.DistortedEffects;
|
26
|
|
27
|
/**
|
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
|
* @see DistortedEffects
|
34
|
*/
|
35
|
public enum EffectQuality
|
36
|
{
|
37
|
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
|
|
42
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
43
|
/**
|
44
|
* Numof of possible qualities.
|
45
|
*/
|
46
|
public static final int LENGTH = values().length;
|
47
|
|
48
|
private final int level;
|
49
|
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
|
|
60
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
61
|
|
62
|
EffectQuality(int level, float mipmap)
|
63
|
{
|
64
|
this.level = level;
|
65
|
this.mipmap= mipmap;
|
66
|
}
|
67
|
|
68
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
69
|
/**
|
70
|
* Only for use by the library itself.
|
71
|
*
|
72
|
* @y.exclude
|
73
|
*/
|
74
|
public int getLevel()
|
75
|
{
|
76
|
return level;
|
77
|
}
|
78
|
|
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
|
}
|
90
|
|