Revision da9b3f07
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
32 | 32 |
{ |
33 | 33 |
public static final int NUM_UNIFORMS = 8; |
34 | 34 |
|
35 |
public static final int CHROMA = MAX_EFFECTS*FRAGMENT ; |
|
36 |
public static final int SMOOTH_CHROMA = MAX_EFFECTS*FRAGMENT + 1; |
|
37 |
public static final int ALPHA = MAX_EFFECTS*FRAGMENT + 2; |
|
38 |
public static final int SMOOTH_ALPHA = MAX_EFFECTS*FRAGMENT + 3; |
|
39 |
public static final int BRIGHTNESS = MAX_EFFECTS*FRAGMENT + 4; |
|
40 |
public static final int SMOOTH_BRIGHTNESS = MAX_EFFECTS*FRAGMENT + 5; |
|
41 |
public static final int CONTRAST = MAX_EFFECTS*FRAGMENT + 6; |
|
42 |
public static final int SMOOTH_CONTRAST = MAX_EFFECTS*FRAGMENT + 7; |
|
43 |
public static final int SATURATION = MAX_EFFECTS*FRAGMENT + 8; |
|
44 |
public static final int SMOOTH_SATURATION = MAX_EFFECTS*FRAGMENT + 9; |
|
45 |
public static final int NUM_EFFECTS = 10; |
|
46 |
|
|
47 |
static final int MAX = 5; |
|
48 |
private static final int MAX_UNITY_DIM = 1; |
|
49 |
|
|
50 | 35 |
Dynamic mDynamic0, mDynamic1; |
51 | 36 |
Static mStatic0, mStatic1; |
52 | 37 |
Dynamic4D mDynamicRegion; |
53 | 38 |
Static4D mStaticRegion; |
54 | 39 |
|
55 |
private final static float[] mUnity = new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
56 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
57 |
|
|
58 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
59 | 41 |
|
60 |
public FragmentEffect(int name,float[] unity, int dimension, boolean center, boolean region, final String str)
|
|
42 |
public FragmentEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
61 | 43 |
{ |
62 |
super(FRAGMENT,name,dimension,center,region,str); |
|
63 |
|
|
64 |
for(int i=0; i<unity.length; i++) |
|
65 |
{ |
|
66 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
67 |
} |
|
68 |
|
|
69 |
mUnityDim[name] = unity.length; |
|
70 |
} |
|
71 |
|
|
72 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
73 |
|
|
74 |
public static boolean isUnity(int name, float[] buffer, int index) |
|
75 |
{ |
|
76 |
switch(mUnityDim[name]) |
|
77 |
{ |
|
78 |
case 0: return true; |
|
79 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
80 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
81 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
82 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
83 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
84 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
85 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
86 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
87 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
88 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
89 |
} |
|
90 |
|
|
91 |
return false; |
|
44 |
super(EffectType.FRAGMENT,name,dimension,center,region,unity); |
|
92 | 45 |
} |
93 | 46 |
} |
Also available in: Unified diff
Progress with support for Effect classes.
The library compiles now!