1 |
8eccf334
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
// Copyright 2017 Leszek Koltunski //
|
3 |
|
|
// //
|
4 |
|
|
// This file is part of Distorted. //
|
5 |
|
|
// //
|
6 |
|
|
// Distorted is free software: you can redistribute it and/or modify //
|
7 |
|
|
// it under the terms of the GNU General Public License as published by //
|
8 |
|
|
// the Free Software Foundation, either version 2 of the License, or //
|
9 |
|
|
// (at your option) any later version. //
|
10 |
|
|
// //
|
11 |
|
|
// Distorted 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 //
|
14 |
|
|
// GNU General Public License for more details. //
|
15 |
|
|
// //
|
16 |
|
|
// You should have received a copy of the GNU General Public License //
|
17 |
|
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19 |
|
|
|
20 |
|
|
package org.distorted.library.effect;
|
21 |
|
|
|
22 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23 |
|
|
|
24 |
|
|
public abstract class Effect
|
25 |
|
|
{
|
26 |
b547aaba
|
leszek
|
private final long mID;
|
27 |
|
|
private final int mType;
|
28 |
6d62a900
|
Leszek Koltunski
|
private final int mName;
|
29 |
b547aaba
|
leszek
|
private final int mDimension;
|
30 |
|
|
private final boolean mSupportsR;
|
31 |
|
|
private final boolean mSupportsC;
|
32 |
8eccf334
|
Leszek Koltunski
|
|
33 |
|
|
private static long mNextID = 0;
|
34 |
|
|
|
35 |
b547aaba
|
leszek
|
public static final int MATRIX = 0;
|
36 |
|
|
public static final int VERTEX = 1;
|
37 |
|
|
public static final int FRAGMENT = 2;
|
38 |
|
|
public static final int POSTPROCESS = 3;
|
39 |
|
|
|
40 |
|
|
public static final int LENGTH = 4; // The number of effect types above.
|
41 |
|
|
public static final int MASK= (1<<LENGTH)-1; // Needed when we do bitwise operations on Effect Types.
|
42 |
8eccf334
|
Leszek Koltunski
|
|
43 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
44 |
|
|
|
45 |
b547aaba
|
leszek
|
public static void onDestroy()
|
46 |
8eccf334
|
Leszek Koltunski
|
{
|
47 |
b547aaba
|
leszek
|
mNextID = 0;
|
48 |
8eccf334
|
Leszek Koltunski
|
}
|
49 |
|
|
|
50 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
51 |
|
|
|
52 |
b547aaba
|
leszek
|
public static void reset(int[] maxtable)
|
53 |
8eccf334
|
Leszek Koltunski
|
{
|
54 |
b547aaba
|
leszek
|
maxtable[0] = MatrixEffect.MAX;
|
55 |
|
|
maxtable[1] = VertexEffect.MAX;
|
56 |
|
|
maxtable[2] = FragmentEffect.MAX;
|
57 |
|
|
maxtable[3] = PostprocessEffect.MAX;
|
58 |
|
|
}
|
59 |
8eccf334
|
Leszek Koltunski
|
|
60 |
b547aaba
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
61 |
8eccf334
|
Leszek Koltunski
|
|
62 |
b547aaba
|
leszek
|
public int getType()
|
63 |
|
|
{
|
64 |
|
|
return mType;
|
65 |
|
|
}
|
66 |
8eccf334
|
Leszek Koltunski
|
|
67 |
6d62a900
|
Leszek Koltunski
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
68 |
|
|
|
69 |
|
|
public int getName()
|
70 |
|
|
{
|
71 |
|
|
return mName;
|
72 |
|
|
}
|
73 |
|
|
|
74 |
b547aaba
|
leszek
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
75 |
8eccf334
|
Leszek Koltunski
|
|
76 |
b547aaba
|
leszek
|
public long getID()
|
77 |
|
|
{
|
78 |
|
|
return mID;
|
79 |
8eccf334
|
Leszek Koltunski
|
}
|
80 |
|
|
|
81 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
82 |
|
|
|
83 |
b547aaba
|
leszek
|
public boolean supportsCenter()
|
84 |
8eccf334
|
Leszek Koltunski
|
{
|
85 |
b547aaba
|
leszek
|
return mSupportsC;
|
86 |
8eccf334
|
Leszek Koltunski
|
}
|
87 |
|
|
|
88 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89 |
|
|
|
90 |
b547aaba
|
leszek
|
public boolean supportsRegion()
|
91 |
8eccf334
|
Leszek Koltunski
|
{
|
92 |
b547aaba
|
leszek
|
return mSupportsR;
|
93 |
8eccf334
|
Leszek Koltunski
|
}
|
94 |
|
|
|
95 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
96 |
|
|
|
97 |
b547aaba
|
leszek
|
public int getDimension()
|
98 |
8eccf334
|
Leszek Koltunski
|
{
|
99 |
b547aaba
|
leszek
|
return mDimension;
|
100 |
8eccf334
|
Leszek Koltunski
|
}
|
101 |
|
|
|
102 |
|
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
103 |
|
|
|
104 |
c828808d
|
Leszek Koltunski
|
Effect(int type, int name, int dimension, boolean center, boolean region)
|
105 |
8eccf334
|
Leszek Koltunski
|
{
|
106 |
b547aaba
|
leszek
|
mID = mNextID++;
|
107 |
6d62a900
|
Leszek Koltunski
|
|
108 |
|
|
mName = name;
|
109 |
b547aaba
|
leszek
|
mType = type;
|
110 |
|
|
mDimension = dimension;
|
111 |
|
|
mSupportsC = center;
|
112 |
|
|
mSupportsR = region;
|
113 |
8eccf334
|
Leszek Koltunski
|
}
|
114 |
|
|
}
|