Revision da9b3f07
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
30 | 30 |
{ |
31 | 31 |
public static final int NUM_UNIFORMS = 5; |
32 | 32 |
|
33 |
public static final int BLUR = MAX_EFFECTS*POSTPROCESS ; |
|
34 |
public static final int GLOW = MAX_EFFECTS*POSTPROCESS + 1; |
|
35 |
public static final int NUM_EFFECTS= 2; |
|
36 |
|
|
37 |
static final int MAX = 5; |
|
38 |
private static final int MAX_UNITY_DIM = 1; |
|
39 |
|
|
40 | 33 |
Dynamic mDynamic0, mDynamic1; |
41 | 34 |
Static mStatic0, mStatic1; |
42 | 35 |
|
43 |
private final static float[] mUnity= new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
44 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
45 |
|
|
46 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
47 | 37 |
|
48 |
public PostprocessEffect(int name, float[] unity, int dimension, boolean center, boolean region, final String str)
|
|
38 |
public PostprocessEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
49 | 39 |
{ |
50 |
super(POSTPROCESS,name,dimension,center,region,str); |
|
51 |
|
|
52 |
for(int i=0; i<unity.length; i++) |
|
53 |
{ |
|
54 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
55 |
} |
|
56 |
|
|
57 |
mUnityDim[name] = unity.length; |
|
58 |
} |
|
59 |
|
|
60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
61 |
|
|
62 |
public static boolean isUnity(int name, float[] buffer, int index) |
|
63 |
{ |
|
64 |
switch(mUnityDim[name]) |
|
65 |
{ |
|
66 |
case 0: return true; |
|
67 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
68 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
69 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
70 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
71 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
72 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
73 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
74 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
75 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
76 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
77 |
} |
|
78 |
|
|
79 |
return false; |
|
40 |
super(EffectType.POSTPROCESS,name,dimension,center,region,unity); |
|
80 | 41 |
} |
81 | 42 |
} |
Also available in: Unified diff
Progress with support for Effect classes.
The library compiles now!