Revision 6c548f65
Added by Leszek Koltunski about 6 years ago
src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java | ||
---|---|---|
58 | 58 |
import org.distorted.library.type.Static5D; |
59 | 59 |
|
60 | 60 |
import java.lang.ref.WeakReference; |
61 |
import java.lang.reflect.Method; |
|
61 | 62 |
|
62 | 63 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
63 | 64 |
|
... | ... | |
97 | 98 |
private long mId; |
98 | 99 |
|
99 | 100 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
100 |
// requires knowledge about effect nature |
|
101 |
// this will enable() all Fragment Effects twice (once for smooth variant, once for non-smooth) |
|
102 |
// but this shouldn't matter. |
|
101 | 103 |
|
102 | 104 |
static void enableAllEffects() |
103 | 105 |
{ |
104 |
VertexEffectDeform.enable(); |
|
105 |
VertexEffectDistort.enable(); |
|
106 |
VertexEffectPinch.enable(); |
|
107 |
VertexEffectSink.enable(); |
|
108 |
VertexEffectSwirl.enable(); |
|
109 |
VertexEffectWave.enable(); |
|
110 |
|
|
111 |
FragmentEffectAlpha.enable(); |
|
112 |
FragmentEffectBrightness.enable(); |
|
113 |
FragmentEffectChroma.enable(); |
|
114 |
FragmentEffectContrast.enable(); |
|
115 |
FragmentEffectSaturation.enable(); |
|
116 |
|
|
117 |
PostprocessEffectBlur.enable(); |
|
118 |
PostprocessEffectGlow.enable(); |
|
106 |
Method method=null; |
|
107 |
|
|
108 |
for(EffectName name: EffectName.values()) |
|
109 |
{ |
|
110 |
if( name.getType() != EffectType.MATRIX ) // you don't need to enable Matrix Effects |
|
111 |
{ |
|
112 |
Class<? extends Effect> cls = name.getEffectClass(); |
|
113 |
|
|
114 |
try |
|
115 |
{ |
|
116 |
method = cls.getMethod("enable"); |
|
117 |
} |
|
118 |
catch(NoSuchMethodException ex) |
|
119 |
{ |
|
120 |
android.util.Log.e("Effects3DEffect", "exception getting method: "+ex.getMessage()); |
|
121 |
} |
|
122 |
|
|
123 |
try |
|
124 |
{ |
|
125 |
method.invoke(null); |
|
126 |
} |
|
127 |
catch(Exception ex) |
|
128 |
{ |
|
129 |
android.util.Log.e("Effects3DEffect", "exception invoking method: "+ex.getMessage()); |
|
130 |
} |
|
131 |
} |
|
132 |
} |
|
119 | 133 |
} |
120 | 134 |
|
121 | 135 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Minor cleanups.