Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java | ||
---|---|---|
24 | 24 |
import org.distorted.library.type.Static4D; |
25 | 25 |
|
26 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
27 |
|
|
27 |
/** |
|
28 |
* Make a certain Region change its contrast level. |
|
29 |
*/ |
|
28 | 30 |
public class FragmentEffectContrast extends FragmentEffect |
29 | 31 |
{ |
30 | 32 |
private Data1D mContrast; |
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 mContrast.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 contrast level. |
... | ... | |
59 | 75 |
} |
60 | 76 |
|
61 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
62 |
|
|
63 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
64 |
{ |
|
65 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
66 |
return mContrast.get(uniforms,index,currentDuration,step); |
|
67 |
} |
|
68 |
|
|
69 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
70 |
|
|
78 |
/** |
|
79 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
80 |
*/ |
|
71 | 81 |
public static void enable() |
72 | 82 |
{ |
73 | 83 |
addEffect( EffectName.CONTRAST,EffectName.SMOOTH_CONTRAST, |
Also available in: Unified diff
Javadoc.