Revision faa3ff56
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java | ||
---|---|---|
25 | 25 |
import org.distorted.library.type.Static4D; |
26 | 26 |
|
27 | 27 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 |
|
|
28 |
/** |
|
29 |
* Make a certain Region change its color. |
|
30 |
*/ |
|
29 | 31 |
public class FragmentEffectChroma extends FragmentEffect |
30 | 32 |
{ |
31 | 33 |
private Data1D mBlend; |
32 | 34 |
private Data3D mColor; |
33 | 35 |
private Data4D mRegion; |
34 | 36 |
|
37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
38 |
/** |
|
39 |
* Only for use by the library itself. |
|
40 |
* |
|
41 |
* @y.exclude |
|
42 |
*/ |
|
43 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
44 |
{ |
|
45 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
46 |
mColor.get(uniforms,index+1,currentDuration,step); |
|
47 |
return mBlend.get(uniforms,index,currentDuration,step); |
|
48 |
} |
|
49 |
|
|
50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
51 |
// PUBLIC API |
|
35 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 53 |
/** |
37 | 54 |
* Makes a certain sub-region of the Object smoothly change all three of its RGB components. |
... | ... | |
69 | 86 |
} |
70 | 87 |
|
71 | 88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
72 |
|
|
73 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
|
74 |
{ |
|
75 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
76 |
mColor.get(uniforms,index+1,currentDuration,step); |
|
77 |
return mBlend.get(uniforms,index,currentDuration,step); |
|
78 |
} |
|
79 |
|
|
80 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
81 |
|
|
89 |
/** |
|
90 |
* Have to call this before the shaders get compiled (i.e before Distorted.onCreate()) for the Effect to work. |
|
91 |
*/ |
|
82 | 92 |
public static void enable() |
83 | 93 |
{ |
84 | 94 |
addEffect( EffectName.CHROMA,EffectName.SMOOTH_CHROMA, |
Also available in: Unified diff
Javadoc.