Revision c828808d
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/effect/Effect.java | ||
---|---|---|
26 | 26 |
private final long mID; |
27 | 27 |
private final int mType; |
28 | 28 |
private final int mName; |
29 |
private final float[] mUnity; |
|
30 | 29 |
private final int mDimension; |
31 | 30 |
private final boolean mSupportsR; |
32 | 31 |
private final boolean mSupportsC; |
... | ... | |
102 | 101 |
|
103 | 102 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
104 | 103 |
|
105 |
Effect(int type, int name, float[] unity, int dimension, boolean center, boolean region)
|
|
104 |
Effect(int type, int name, int dimension, boolean center, boolean region) |
|
106 | 105 |
{ |
107 | 106 |
mID = mNextID++; |
108 | 107 |
|
109 | 108 |
mName = name; |
110 | 109 |
mType = type; |
111 |
mUnity = unity; |
|
112 | 110 |
mDimension = dimension; |
113 | 111 |
mSupportsC = center; |
114 | 112 |
mSupportsR = region; |
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public abstract class FragmentEffect extends Effect |
29 | 29 |
{ |
30 |
static final int MAX = 5; |
|
30 |
public static final int CHROMA = 0; |
|
31 |
public static final int SMOOTH_CHROMA = 1; |
|
32 |
public static final int ALPHA = 2; |
|
33 |
public static final int SMOOTH_ALPHA = 3; |
|
34 |
public static final int BRIGHTNESS = 4; |
|
35 |
public static final int SMOOTH_BRIGHTNESS = 5; |
|
36 |
public static final int CONTRAST = 6; |
|
37 |
public static final int SMOOTH_CONTRAST = 7; |
|
38 |
public static final int SATURATION = 8; |
|
39 |
public static final int SMOOTH_SATURATION = 9; |
|
40 |
public static final int NUM_EFFECTS =10; |
|
31 | 41 |
|
32 |
public static int CHROMA = 0; |
|
33 |
public static int SMOOTH_CHROMA = 1; |
|
34 |
public static int ALPHA = 2; |
|
35 |
public static int SMOOTH_ALPHA = 3; |
|
36 |
public static int BRIGHTNESS = 4; |
|
37 |
public static int SMOOTH_BRIGHTNESS = 5; |
|
38 |
public static int CONTRAST = 6; |
|
39 |
public static int SMOOTH_CONTRAST = 7; |
|
40 |
public static int SATURATION = 8; |
|
41 |
public static int SMOOTH_SATURATION = 9; |
|
42 |
static final int MAX = 5; |
|
43 |
private static final int MAX_UNITY_DIM = 1; |
|
42 | 44 |
|
43 | 45 |
Dynamic mDynamic0, mDynamic1; |
44 | 46 |
Static mStatic0, mStatic1; |
45 | 47 |
Data4D mRegion; |
46 | 48 |
|
49 |
private final static float[] mUnity = new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
50 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
51 |
|
|
47 | 52 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
48 | 53 |
|
49 | 54 |
public FragmentEffect(int name,float[] unity, int dimension, boolean center, boolean region) |
50 | 55 |
{ |
51 |
super(FRAGMENT,name,unity,dimension,center,region); |
|
56 |
super(FRAGMENT,name,dimension,center,region); |
|
57 |
|
|
58 |
for(int i=0; i<unity.length; i++) |
|
59 |
{ |
|
60 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
61 |
} |
|
62 |
|
|
63 |
mUnityDim[name] = unity.length; |
|
64 |
} |
|
65 |
|
|
66 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
67 |
|
|
68 |
static boolean isUnity(int name, float[] buffer, int index) |
|
69 |
{ |
|
70 |
switch(mUnityDim[name]) |
|
71 |
{ |
|
72 |
case 0: return true; |
|
73 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
74 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
75 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
76 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
77 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
78 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
79 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
80 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
81 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
82 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
83 |
} |
|
84 |
|
|
85 |
return false; |
|
52 | 86 |
} |
53 | 87 |
} |
src/main/java/org/distorted/library/effect/MatrixEffect.java | ||
---|---|---|
25 | 25 |
|
26 | 26 |
public abstract class MatrixEffect extends Effect |
27 | 27 |
{ |
28 |
static final int MAX = 10; |
|
29 |
|
|
30 | 28 |
public static final int MOVE = 0; |
31 | 29 |
public static final int SCALE = 1; |
32 | 30 |
public static final int ROTATE = 2; |
33 | 31 |
public static final int QUATERNION = 3; |
34 | 32 |
public static final int SHEAR = 4; |
33 |
public static final int NUM_EFFECTS= 5; |
|
34 |
|
|
35 |
static final int MAX = 5; |
|
36 |
private static final int MAX_UNITY_DIM = 3; |
|
35 | 37 |
|
36 | 38 |
Dynamic mDynamic0; |
37 | 39 |
Static mStatic0, mStatic1; |
38 | 40 |
Data3D mCenter; |
39 | 41 |
|
42 |
private final static float[] mUnity= new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
43 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
44 |
|
|
40 | 45 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 46 |
|
42 | 47 |
public MatrixEffect(int name, float[] unity, int dimension, boolean center, boolean region) |
43 | 48 |
{ |
44 |
super(MATRIX,name,unity,dimension,center,region); |
|
49 |
super(MATRIX,name,dimension,center,region); |
|
50 |
|
|
51 |
for(int i=0; i<unity.length; i++) |
|
52 |
{ |
|
53 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
54 |
} |
|
55 |
|
|
56 |
mUnityDim[name] = unity.length; |
|
57 |
} |
|
58 |
|
|
59 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
60 |
|
|
61 |
static boolean isUnity(int name, float[] buffer, int index) |
|
62 |
{ |
|
63 |
switch(mUnityDim[name]) |
|
64 |
{ |
|
65 |
case 0: return true; |
|
66 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
67 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
68 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
69 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
70 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
71 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
72 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
73 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
74 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
75 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
76 |
} |
|
77 |
|
|
78 |
return false; |
|
45 | 79 |
} |
46 | 80 |
} |
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
26 | 26 |
|
27 | 27 |
public abstract class PostprocessEffect extends Effect |
28 | 28 |
{ |
29 |
static final int MAX = 5; |
|
29 |
public static final int BLUR =0; |
|
30 |
public static final int GLOW =1; |
|
31 |
public static final int NUM_EFFECTS=2; |
|
30 | 32 |
|
31 |
public static int BLUR = 0;
|
|
32 |
public static int GLOW = 1;
|
|
33 |
static final int MAX = 5;
|
|
34 |
private static final int MAX_UNITY_DIM = 1;
|
|
33 | 35 |
|
34 | 36 |
Dynamic mDynamic0, mDynamic1; |
35 | 37 |
Static mStatic0, mStatic1; |
36 | 38 |
|
39 |
private final static float[] mUnity= new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
40 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
41 |
|
|
37 | 42 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 43 |
|
39 | 44 |
public PostprocessEffect(int name, float[] unity, int dimension, boolean center, boolean region) |
40 | 45 |
{ |
41 |
super(POSTPROCESS,name,unity,dimension,center,region); |
|
46 |
super(POSTPROCESS,name,dimension,center,region); |
|
47 |
|
|
48 |
for(int i=0; i<unity.length; i++) |
|
49 |
{ |
|
50 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
51 |
} |
|
52 |
|
|
53 |
mUnityDim[name] = unity.length; |
|
54 |
} |
|
55 |
|
|
56 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
57 |
|
|
58 |
static boolean isUnity(int name, float[] buffer, int index) |
|
59 |
{ |
|
60 |
switch(mUnityDim[name]) |
|
61 |
{ |
|
62 |
case 0: return true; |
|
63 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
64 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
65 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
66 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
67 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
68 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
69 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
70 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
71 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
72 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
73 |
} |
|
74 |
|
|
75 |
return false; |
|
42 | 76 |
} |
43 | 77 |
} |
src/main/java/org/distorted/library/effect/VertexEffect.java | ||
---|---|---|
28 | 28 |
|
29 | 29 |
public abstract class VertexEffect extends Effect |
30 | 30 |
{ |
31 |
static final int MAX = 5; |
|
31 |
public static final int DISTORT =0; |
|
32 |
public static final int DEFORM =1; |
|
33 |
public static final int SINK =2; |
|
34 |
public static final int PINCH =3; |
|
35 |
public static final int SWIRL =4; |
|
36 |
public static final int WAVE =5; |
|
37 |
public static final int NUM_EFFECTS=6; |
|
32 | 38 |
|
33 |
public static int DISTORT = 0; |
|
34 |
public static int DEFORM = 1; |
|
35 |
public static int SINK = 2; |
|
36 |
public static int PINCH = 3; |
|
37 |
public static int SWIRL = 4; |
|
38 |
public static int WAVE = 5; |
|
39 |
static final int MAX = 5; |
|
40 |
private static final int MAX_UNITY_DIM = 3; |
|
39 | 41 |
|
40 | 42 |
Dynamic mDynamic0; |
41 | 43 |
Static mStatic0; |
42 | 44 |
Data3D mCenter; |
43 | 45 |
Data4D mRegion; |
44 | 46 |
|
47 |
private final static float[] mUnity= new float[MAX_UNITY_DIM*NUM_EFFECTS]; |
|
48 |
private final static int[] mUnityDim = new int[NUM_EFFECTS]; |
|
49 |
|
|
45 | 50 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
46 | 51 |
|
47 | 52 |
public VertexEffect(int name, float[] unity, int dimension, boolean center, boolean region) |
48 | 53 |
{ |
49 |
super(VERTEX,name,unity,dimension,center,region); |
|
54 |
super(VERTEX,name,dimension,center,region); |
|
55 |
|
|
56 |
for(int i=0; i<unity.length; i++) |
|
57 |
{ |
|
58 |
mUnity[name*MAX_UNITY_DIM+i] = unity[i]; |
|
59 |
} |
|
60 |
|
|
61 |
mUnityDim[name] = unity.length; |
|
62 |
} |
|
63 |
|
|
64 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
65 |
|
|
66 |
static boolean isUnity(int name, float[] buffer, int index) |
|
67 |
{ |
|
68 |
switch(mUnityDim[name]) |
|
69 |
{ |
|
70 |
case 0: return true; |
|
71 |
case 1: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ]; |
|
72 |
case 2: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
73 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1]; |
|
74 |
case 3: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
75 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
76 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2]; |
|
77 |
case 4: return buffer[index ]==mUnity[MAX_UNITY_DIM*name ] && |
|
78 |
buffer[index+1]==mUnity[MAX_UNITY_DIM*name+1] && |
|
79 |
buffer[index+2]==mUnity[MAX_UNITY_DIM*name+2] && |
|
80 |
buffer[index+3]==mUnity[MAX_UNITY_DIM*name+3]; |
|
81 |
} |
|
82 |
|
|
83 |
return false; |
|
50 | 84 |
} |
51 | 85 |
} |
Also available in: Unified diff
Progress with support for Effect classes.