Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java | ||
---|---|---|
24 | 24 |
import org.distorted.library.type.Static4D; |
25 | 25 |
|
26 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 |
|
|
27 |
/** |
|
28 |
* Make a certain Region change its transparency level. |
|
29 |
*/ |
|
28 | 30 |
public class FragmentEffectAlpha extends FragmentEffect |
29 | 31 |
{ |
30 | 32 |
private Data1D mAlpha; |
31 | 33 |
private Data4D mRegion; |
32 | 34 |
|
35 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
36 |
/** |
|
37 |
* Only for use by the library itself. |
|
38 |
* |
|
39 |
* @y.exclude |
|
40 |
*/ |
|
41 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
42 |
{ |
|
43 |
mRegion.get(uniforms, index+4, currentDuration, step); |
|
44 |
return mAlpha.get(uniforms,index, currentDuration, step); |
|
45 |
} |
|
46 |
|
|
47 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
48 |
// PUBLIC API |
|
33 | 49 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 50 |
/** |
35 | 51 |
* Makes a certain sub-region of the Object smoothly change its transparency level. |
... | ... | |
61 | 77 |
} |
62 | 78 |
|
63 | 79 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
64 |
|
|
65 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
66 |
{ |
|
67 |
mRegion.get(uniforms, index+4, currentDuration, step); |
|
68 |
return mAlpha.get(uniforms,index, currentDuration, step); |
|
69 |
} |
|
70 |
|
|
71 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
72 |
|
|
80 |
/** |
|
81 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
82 |
*/ |
|
73 | 83 |
public static void enable() |
74 | 84 |
{ |
75 | 85 |
addEffect( EffectName.ALPHA,EffectName.SMOOTH_ALPHA, |
Also available in: Unified diff
Javadoc.