Revision a1d92a36
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.library.effect; |
21 | 21 |
|
22 |
import org.distorted.library.type.Dynamic; |
|
23 |
import org.distorted.library.type.Dynamic4D; |
|
24 |
import org.distorted.library.type.Static; |
|
25 |
import org.distorted.library.type.Static4D; |
|
26 |
|
|
27 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
28 | 23 |
// FRAGMENT EFFECTS |
29 | 24 |
// 8 Uniforms: 4-per effect interpolated values, 4 dimensional Region. |
... | ... | |
32 | 27 |
{ |
33 | 28 |
public static final int NUM_UNIFORMS = 8; |
34 | 29 |
|
35 |
Dynamic mDynamic0, mDynamic1; |
|
36 |
Static mStatic0, mStatic1; |
|
37 |
Dynamic4D mDynamicRegion; |
|
38 |
Static4D mStaticRegion; |
|
39 |
|
|
40 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 31 |
|
42 | 32 |
public FragmentEffect(EffectName name) |
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java | ||
---|---|---|
21 | 21 |
|
22 | 22 |
import org.distorted.library.type.Data1D; |
23 | 23 |
import org.distorted.library.type.Data4D; |
24 |
import org.distorted.library.type.Dynamic1D; |
|
25 |
import org.distorted.library.type.Dynamic4D; |
|
26 |
import org.distorted.library.type.Static1D; |
|
27 | 24 |
import org.distorted.library.type.Static4D; |
28 | 25 |
|
29 | 26 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
30 | 27 |
|
31 | 28 |
public class FragmentEffectAlpha extends FragmentEffect |
32 | 29 |
{ |
30 |
private Data1D mAlpha; |
|
31 |
private Data4D mRegion; |
|
32 |
|
|
33 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 34 |
/** |
35 | 35 |
* Makes a certain sub-region of the Object smoothly change its transparency level. |
... | ... | |
44 | 44 |
{ |
45 | 45 |
super(smooth? EffectName.SMOOTH_ALPHA:EffectName.ALPHA); |
46 | 46 |
|
47 |
if( alpha instanceof Dynamic1D ) |
|
48 |
{ |
|
49 |
mDynamic0 = (Dynamic1D)alpha; |
|
50 |
} |
|
51 |
else if ( alpha instanceof Static1D ) |
|
52 |
{ |
|
53 |
mStatic0 = (Static1D)alpha; |
|
54 |
} |
|
55 |
|
|
56 |
if( region == null ) |
|
57 |
{ |
|
58 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
59 |
} |
|
60 |
else |
|
61 |
{ |
|
62 |
if (region instanceof Static4D) |
|
63 |
{ |
|
64 |
mStaticRegion = (Static4D) region; |
|
65 |
} |
|
66 |
else if (region instanceof Dynamic4D) |
|
67 |
{ |
|
68 |
mDynamicRegion = (Dynamic4D) region; |
|
69 |
} |
|
70 |
} |
|
47 |
mAlpha = alpha; |
|
48 |
mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region); |
|
71 | 49 |
} |
72 | 50 |
|
73 | 51 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
82 | 60 |
{ |
83 | 61 |
super(EffectName.ALPHA); |
84 | 62 |
|
85 |
if( alpha instanceof Dynamic1D ) |
|
86 |
{ |
|
87 |
mDynamic0 = (Dynamic1D)alpha; |
|
88 |
} |
|
89 |
else if ( alpha instanceof Static1D ) |
|
90 |
{ |
|
91 |
mStatic0 = (Static1D)alpha; |
|
92 |
} |
|
93 |
|
|
94 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
63 |
mAlpha = alpha; |
|
64 |
mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
95 | 65 |
} |
96 | 66 |
|
97 | 67 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
98 | 68 |
|
99 | 69 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
100 | 70 |
{ |
101 |
if( mDynamicRegion!=null ) |
|
102 |
{ |
|
103 |
mDynamicRegion.interpolateMain(uniforms,index+4,currentDuration,step); |
|
104 |
} |
|
105 |
else |
|
106 |
{ |
|
107 |
uniforms[index+4] = mStaticRegion.getX(); |
|
108 |
uniforms[index+5] = mStaticRegion.getY(); |
|
109 |
uniforms[index+6] = mStaticRegion.getZ(); |
|
110 |
uniforms[index+7] = mStaticRegion.getW(); |
|
111 |
} |
|
112 |
|
|
113 |
if( mDynamic0!=null ) |
|
114 |
{ |
|
115 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step); |
|
116 |
} |
|
117 |
else |
|
118 |
{ |
|
119 |
uniforms[index] = ((Static1D)mStatic0).getX(); |
|
120 |
return false; |
|
121 |
} |
|
71 |
mRegion.get(uniforms, index+4, currentDuration, step); |
|
72 |
return mAlpha.get(uniforms,index, currentDuration, step); |
|
122 | 73 |
} |
123 | 74 |
} |
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectBrightness extends FragmentEffect |
32 | 32 |
{ |
33 |
private Data1D mBrightness; |
|
34 |
private Data4D mRegion; |
|
35 |
|
|
33 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 37 |
/** |
35 | 38 |
* Makes a certain sub-region of the Object smoothly change its brightness level. |
... | ... | |
43 | 46 |
{ |
44 | 47 |
super(smooth?EffectName.SMOOTH_BRIGHTNESS:EffectName.BRIGHTNESS); |
45 | 48 |
|
46 |
if( brightness instanceof Dynamic1D ) |
|
47 |
{ |
|
48 |
mDynamic0 = (Dynamic1D)brightness; |
|
49 |
} |
|
50 |
else if ( brightness instanceof Static1D ) |
|
51 |
{ |
|
52 |
mStatic0 = (Static1D)brightness; |
|
53 |
} |
|
54 |
|
|
55 |
if( region == null ) |
|
56 |
{ |
|
57 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
58 |
} |
|
59 |
else |
|
60 |
{ |
|
61 |
if (region instanceof Static4D) |
|
62 |
{ |
|
63 |
mStaticRegion = (Static4D) region; |
|
64 |
} |
|
65 |
else if (region instanceof Dynamic4D) |
|
66 |
{ |
|
67 |
mDynamicRegion = (Dynamic4D) region; |
|
68 |
} |
|
69 |
} |
|
49 |
mBrightness = brightness; |
|
50 |
mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region); |
|
70 | 51 |
} |
71 | 52 |
|
72 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
80 | 61 |
{ |
81 | 62 |
super(EffectName.BRIGHTNESS); |
82 | 63 |
|
83 |
if( brightness instanceof Dynamic1D ) |
|
84 |
{ |
|
85 |
mDynamic0 = (Dynamic1D)brightness; |
|
86 |
} |
|
87 |
else if ( brightness instanceof Static1D ) |
|
88 |
{ |
|
89 |
mStatic0 = (Static1D)brightness; |
|
90 |
} |
|
91 |
|
|
92 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
64 |
mBrightness = brightness; |
|
65 |
mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
93 | 66 |
} |
94 | 67 |
|
95 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
96 | 69 |
|
97 | 70 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
98 | 71 |
{ |
99 |
if( mDynamicRegion!=null ) |
|
100 |
{ |
|
101 |
mDynamicRegion.interpolateMain(uniforms,index+4,currentDuration,step); |
|
102 |
} |
|
103 |
else |
|
104 |
{ |
|
105 |
uniforms[index+4] = mStaticRegion.getX(); |
|
106 |
uniforms[index+5] = mStaticRegion.getY(); |
|
107 |
uniforms[index+6] = mStaticRegion.getZ(); |
|
108 |
uniforms[index+7] = mStaticRegion.getW(); |
|
109 |
} |
|
110 |
|
|
111 |
if( mDynamic0!=null ) |
|
112 |
{ |
|
113 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
uniforms[index] = ((Static1D)mStatic0).getX(); |
|
118 |
return false; |
|
119 |
} |
|
72 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
73 |
return mBrightness.get(uniforms,index,currentDuration,step); |
|
120 | 74 |
} |
121 | 75 |
} |
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class FragmentEffectChroma extends FragmentEffect |
35 | 35 |
{ |
36 |
private Data1D mBlend; |
|
37 |
private Data3D mColor; |
|
38 |
private Data4D mRegion; |
|
39 |
|
|
36 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 41 |
/** |
38 | 42 |
* Makes a certain sub-region of the Object smoothly change all three of its RGB components. |
... | ... | |
48 | 52 |
{ |
49 | 53 |
super(smooth?EffectName.SMOOTH_CHROMA:EffectName.CHROMA); |
50 | 54 |
|
51 |
if( blend instanceof Dynamic1D ) |
|
52 |
{ |
|
53 |
mDynamic0 = (Dynamic1D)blend; |
|
54 |
} |
|
55 |
else if ( blend instanceof Static1D ) |
|
56 |
{ |
|
57 |
mStatic0 = (Static1D)blend; |
|
58 |
} |
|
59 |
|
|
60 |
if( color instanceof Dynamic3D ) |
|
61 |
{ |
|
62 |
mDynamic1 = (Dynamic3D)color; |
|
63 |
} |
|
64 |
else if ( color instanceof Static3D) |
|
65 |
{ |
|
66 |
mStatic1 = (Static3D)color; |
|
67 |
} |
|
68 |
|
|
69 |
if( region == null ) |
|
70 |
{ |
|
71 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
72 |
} |
|
73 |
else |
|
74 |
{ |
|
75 |
if (region instanceof Static4D) |
|
76 |
{ |
|
77 |
mStaticRegion = (Static4D) region; |
|
78 |
} |
|
79 |
else if (region instanceof Dynamic4D) |
|
80 |
{ |
|
81 |
mDynamicRegion = (Dynamic4D) region; |
|
82 |
} |
|
83 |
} |
|
55 |
mBlend = blend; |
|
56 |
mColor = color; |
|
57 |
mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region); |
|
84 | 58 |
} |
85 | 59 |
|
86 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
96 | 70 |
{ |
97 | 71 |
super(EffectName.CHROMA); |
98 | 72 |
|
99 |
if( blend instanceof Dynamic1D ) |
|
100 |
{ |
|
101 |
mDynamic0 = (Dynamic1D)blend; |
|
102 |
} |
|
103 |
else if ( blend instanceof Static1D ) |
|
104 |
{ |
|
105 |
mStatic0 = (Static1D)blend; |
|
106 |
} |
|
107 |
|
|
108 |
if( color instanceof Dynamic3D ) |
|
109 |
{ |
|
110 |
mDynamic1 = (Dynamic3D)color; |
|
111 |
} |
|
112 |
else if ( color instanceof Static3D) |
|
113 |
{ |
|
114 |
mStatic1 = (Static3D)color; |
|
115 |
} |
|
116 |
|
|
117 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
73 |
mBlend = blend; |
|
74 |
mColor = color; |
|
75 |
mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
118 | 76 |
} |
119 | 77 |
|
120 | 78 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
121 | 79 |
|
122 | 80 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
123 | 81 |
{ |
124 |
if( mDynamicRegion!=null ) |
|
125 |
{ |
|
126 |
mDynamicRegion.interpolateMain(uniforms,index+4,currentDuration,step); |
|
127 |
} |
|
128 |
else |
|
129 |
{ |
|
130 |
uniforms[index+4] = mStaticRegion.getX(); |
|
131 |
uniforms[index+5] = mStaticRegion.getY(); |
|
132 |
uniforms[index+6] = mStaticRegion.getZ(); |
|
133 |
uniforms[index+7] = mStaticRegion.getW(); |
|
134 |
} |
|
135 |
|
|
136 |
if( mDynamic1!=null ) |
|
137 |
{ |
|
138 |
mDynamic1.interpolateMain(uniforms,index+1,currentDuration,step); |
|
139 |
} |
|
140 |
else |
|
141 |
{ |
|
142 |
uniforms[index+1] = ((Static3D)mStatic1).getX(); |
|
143 |
uniforms[index+2] = ((Static3D)mStatic1).getY(); |
|
144 |
uniforms[index+3] = ((Static3D)mStatic1).getZ(); |
|
145 |
} |
|
146 |
|
|
147 |
if( mDynamic0!=null ) |
|
148 |
{ |
|
149 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step); |
|
150 |
} |
|
151 |
else |
|
152 |
{ |
|
153 |
uniforms[index ] = ((Static1D)mStatic0).getX(); |
|
154 |
return false; |
|
155 |
} |
|
82 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
83 |
mColor.get(uniforms,index+1,currentDuration,step); |
|
84 |
return mBlend.get(uniforms,index,currentDuration,step); |
|
156 | 85 |
} |
157 | 86 |
} |
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectContrast extends FragmentEffect |
32 | 32 |
{ |
33 |
private Data1D mContrast; |
|
34 |
private Data4D mRegion; |
|
35 |
|
|
33 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 37 |
/** |
35 | 38 |
* Makes a certain sub-region of the Object smoothly change its contrast level. |
... | ... | |
43 | 46 |
{ |
44 | 47 |
super(smooth?EffectName.SMOOTH_CONTRAST:EffectName.CONTRAST); |
45 | 48 |
|
46 |
if( contrast instanceof Dynamic1D ) |
|
47 |
{ |
|
48 |
mDynamic0 = (Dynamic1D)contrast; |
|
49 |
} |
|
50 |
else if ( contrast instanceof Static1D ) |
|
51 |
{ |
|
52 |
mStatic0 = (Static1D)contrast; |
|
53 |
} |
|
54 |
|
|
55 |
if( region == null ) |
|
56 |
{ |
|
57 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
58 |
} |
|
59 |
else |
|
60 |
{ |
|
61 |
if (region instanceof Static4D) |
|
62 |
{ |
|
63 |
mStaticRegion = (Static4D) region; |
|
64 |
} |
|
65 |
else if (region instanceof Dynamic4D) |
|
66 |
{ |
|
67 |
mDynamicRegion = (Dynamic4D) region; |
|
68 |
} |
|
69 |
} |
|
49 |
mContrast = contrast; |
|
50 |
mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region); |
|
70 | 51 |
} |
71 | 52 |
|
72 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
80 | 61 |
{ |
81 | 62 |
super(EffectName.CONTRAST); |
82 | 63 |
|
83 |
if( contrast instanceof Dynamic1D ) |
|
84 |
{ |
|
85 |
mDynamic0 = (Dynamic1D)contrast; |
|
86 |
} |
|
87 |
else if ( contrast instanceof Static1D ) |
|
88 |
{ |
|
89 |
mStatic0 = (Static1D)contrast; |
|
90 |
} |
|
91 |
|
|
92 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
64 |
mContrast = contrast; |
|
65 |
mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
93 | 66 |
} |
94 | 67 |
|
95 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
96 | 69 |
|
97 | 70 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
98 | 71 |
{ |
99 |
if( mDynamicRegion!=null ) |
|
100 |
{ |
|
101 |
mDynamicRegion.interpolateMain(uniforms,index+4,currentDuration,step); |
|
102 |
} |
|
103 |
else |
|
104 |
{ |
|
105 |
uniforms[index+4] = mStaticRegion.getX(); |
|
106 |
uniforms[index+5] = mStaticRegion.getY(); |
|
107 |
uniforms[index+6] = mStaticRegion.getZ(); |
|
108 |
uniforms[index+7] = mStaticRegion.getW(); |
|
109 |
} |
|
110 |
|
|
111 |
if( mDynamic0!=null ) |
|
112 |
{ |
|
113 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
uniforms[index] = ((Static1D)mStatic0).getX(); |
|
118 |
return false; |
|
119 |
} |
|
72 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
73 |
return mContrast.get(uniforms,index,currentDuration,step); |
|
120 | 74 |
} |
121 | 75 |
} |
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectSaturation extends FragmentEffect |
32 | 32 |
{ |
33 |
private Data1D mSaturation; |
|
34 |
private Data4D mRegion; |
|
35 |
|
|
33 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
34 | 37 |
/** |
35 | 38 |
* Makes a certain sub-region of the Object smoothly change its saturation level. |
... | ... | |
43 | 46 |
{ |
44 | 47 |
super(smooth?EffectName.SMOOTH_SATURATION:EffectName.SATURATION); |
45 | 48 |
|
46 |
if( saturation instanceof Dynamic1D ) |
|
47 |
{ |
|
48 |
mDynamic0 = (Dynamic1D)saturation; |
|
49 |
} |
|
50 |
else if ( saturation instanceof Static1D ) |
|
51 |
{ |
|
52 |
mStatic0 = (Static1D)saturation; |
|
53 |
} |
|
54 |
|
|
55 |
if( region == null ) |
|
56 |
{ |
|
57 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
58 |
} |
|
59 |
else |
|
60 |
{ |
|
61 |
if (region instanceof Static4D) |
|
62 |
{ |
|
63 |
mStaticRegion = (Static4D) region; |
|
64 |
} |
|
65 |
else if (region instanceof Dynamic4D) |
|
66 |
{ |
|
67 |
mDynamicRegion = (Dynamic4D) region; |
|
68 |
} |
|
69 |
} |
|
49 |
mSaturation = saturation; |
|
50 |
mRegion = (region==null ? new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE) : region); |
|
70 | 51 |
} |
71 | 52 |
|
72 | 53 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
80 | 61 |
{ |
81 | 62 |
super(EffectName.SATURATION); |
82 | 63 |
|
83 |
if( saturation instanceof Dynamic1D ) |
|
84 |
{ |
|
85 |
mDynamic0 = (Dynamic1D)saturation; |
|
86 |
} |
|
87 |
else if ( saturation instanceof Static1D ) |
|
88 |
{ |
|
89 |
mStatic0 = (Static1D)saturation; |
|
90 |
} |
|
91 |
|
|
92 |
mStaticRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
64 |
mSaturation = saturation; |
|
65 |
mRegion = new Static4D(0,0,Float.MAX_VALUE, Float.MAX_VALUE); |
|
93 | 66 |
} |
94 | 67 |
|
95 | 68 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
96 | 69 |
|
97 | 70 |
public boolean compute(float[] uniforms, int index, long currentDuration, long step ) |
98 | 71 |
{ |
99 |
if( mDynamicRegion!=null ) |
|
100 |
{ |
|
101 |
mDynamicRegion.interpolateMain(uniforms,index+4,currentDuration,step); |
|
102 |
} |
|
103 |
else |
|
104 |
{ |
|
105 |
uniforms[index+4] = mStaticRegion.getX(); |
|
106 |
uniforms[index+5] = mStaticRegion.getY(); |
|
107 |
uniforms[index+6] = mStaticRegion.getZ(); |
|
108 |
uniforms[index+7] = mStaticRegion.getW(); |
|
109 |
} |
|
110 |
|
|
111 |
if( mDynamic0!=null ) |
|
112 |
{ |
|
113 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
uniforms[index] = ((Static1D)mStatic0).getX(); |
|
118 |
return false; |
|
119 |
} |
|
72 |
mRegion.get(uniforms,index+4,currentDuration,step); |
|
73 |
return mSaturation.get(uniforms,index,currentDuration,step); |
|
120 | 74 |
} |
121 | 75 |
} |
src/main/java/org/distorted/library/effect/MatrixEffectMove.java | ||
---|---|---|
54 | 54 |
{ |
55 | 55 |
if( mDynamic0!=null ) |
56 | 56 |
{ |
57 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
57 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
58 | 58 |
} |
59 | 59 |
else |
60 | 60 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java | ||
---|---|---|
22 | 22 |
import org.distorted.library.type.Data3D; |
23 | 23 |
import org.distorted.library.type.Data4D; |
24 | 24 |
import org.distorted.library.type.Dynamic3D; |
25 |
import org.distorted.library.type.Dynamic4D; |
|
26 | 25 |
import org.distorted.library.type.DynamicQuat; |
27 | 26 |
import org.distorted.library.type.Static3D; |
28 | 27 |
import org.distorted.library.type.Static4D; |
... | ... | |
67 | 66 |
{ |
68 | 67 |
if( mDynamicCenter!=null ) |
69 | 68 |
{ |
70 |
mDynamicCenter.interpolateMain(uniforms,index+4,currentDuration,step);
|
|
69 |
mDynamicCenter.get(uniforms,index+4,currentDuration,step);
|
|
71 | 70 |
} |
72 | 71 |
else |
73 | 72 |
{ |
... | ... | |
78 | 77 |
|
79 | 78 |
if( mDynamic0!=null ) |
80 | 79 |
{ |
81 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
80 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
82 | 81 |
} |
83 | 82 |
else |
84 | 83 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectRotate.java | ||
---|---|---|
104 | 104 |
{ |
105 | 105 |
if( mDynamicCenter!=null ) |
106 | 106 |
{ |
107 |
mDynamicCenter.interpolateMain(uniforms,index+4,currentDuration,step);
|
|
107 |
mDynamicCenter.get(uniforms,index+4,currentDuration,step);
|
|
108 | 108 |
} |
109 | 109 |
else |
110 | 110 |
{ |
... | ... | |
122 | 122 |
|
123 | 123 |
if( mDynamic0!=null ) |
124 | 124 |
{ |
125 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
125 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
126 | 126 |
} |
127 | 127 |
else |
128 | 128 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectScale.java | ||
---|---|---|
67 | 67 |
{ |
68 | 68 |
if( mDynamic0!=null ) |
69 | 69 |
{ |
70 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
70 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
71 | 71 |
} |
72 | 72 |
else |
73 | 73 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectShear.java | ||
---|---|---|
66 | 66 |
{ |
67 | 67 |
if( mDynamicCenter!=null ) |
68 | 68 |
{ |
69 |
mDynamicCenter.interpolateMain(uniforms,index+4,currentDuration,step);
|
|
69 |
mDynamicCenter.get(uniforms,index+4,currentDuration,step);
|
|
70 | 70 |
} |
71 | 71 |
else |
72 | 72 |
{ |
... | ... | |
77 | 77 |
|
78 | 78 |
if( mDynamic0!=null ) |
79 | 79 |
{ |
80 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
80 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
81 | 81 |
} |
82 | 82 |
else |
83 | 83 |
{ |
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java | ||
---|---|---|
54 | 54 |
{ |
55 | 55 |
if( mDynamic0!=null ) |
56 | 56 |
{ |
57 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
57 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
58 | 58 |
} |
59 | 59 |
else |
60 | 60 |
{ |
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
---|---|---|
67 | 67 |
{ |
68 | 68 |
if( mDynamic1!=null ) |
69 | 69 |
{ |
70 |
mDynamic1.interpolateMain(uniforms,index+1,currentDuration,step);
|
|
70 |
mDynamic1.get(uniforms,index+1,currentDuration,step);
|
|
71 | 71 |
} |
72 | 72 |
else |
73 | 73 |
{ |
... | ... | |
79 | 79 |
|
80 | 80 |
if( mDynamic0!=null ) |
81 | 81 |
{ |
82 |
return mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
82 |
return mDynamic0.get(uniforms,index,currentDuration,step);
|
|
83 | 83 |
} |
84 | 84 |
else |
85 | 85 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectDeform.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
if( mDynamicCenter!=null ) |
121 | 121 |
{ |
122 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
122 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
123 | 123 |
} |
124 | 124 |
else |
125 | 125 |
{ |
... | ... | |
130 | 130 |
|
131 | 131 |
if( mDynamicRegion!=null ) |
132 | 132 |
{ |
133 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
133 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
134 | 134 |
} |
135 | 135 |
else |
136 | 136 |
{ |
... | ... | |
142 | 142 |
|
143 | 143 |
if( mDynamic0!=null ) |
144 | 144 |
{ |
145 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
145 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
146 | 146 |
} |
147 | 147 |
else |
148 | 148 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectDistort.java | ||
---|---|---|
119 | 119 |
|
120 | 120 |
if( mDynamicCenter!=null ) |
121 | 121 |
{ |
122 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
122 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
123 | 123 |
} |
124 | 124 |
else |
125 | 125 |
{ |
... | ... | |
130 | 130 |
|
131 | 131 |
if( mDynamicRegion!=null ) |
132 | 132 |
{ |
133 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
133 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
134 | 134 |
} |
135 | 135 |
else |
136 | 136 |
{ |
... | ... | |
142 | 142 |
|
143 | 143 |
if( mDynamic0!=null ) |
144 | 144 |
{ |
145 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
145 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
146 | 146 |
} |
147 | 147 |
else |
148 | 148 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectPinch.java | ||
---|---|---|
122 | 122 |
|
123 | 123 |
if( mDynamicCenter!=null ) |
124 | 124 |
{ |
125 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
125 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
126 | 126 |
} |
127 | 127 |
else |
128 | 128 |
{ |
... | ... | |
133 | 133 |
|
134 | 134 |
if( mDynamicRegion!=null ) |
135 | 135 |
{ |
136 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
136 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
137 | 137 |
} |
138 | 138 |
else |
139 | 139 |
{ |
... | ... | |
145 | 145 |
|
146 | 146 |
if( mDynamic0!=null ) |
147 | 147 |
{ |
148 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
148 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
149 | 149 |
} |
150 | 150 |
else |
151 | 151 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSink.java | ||
---|---|---|
122 | 122 |
|
123 | 123 |
if( mDynamicCenter!=null ) |
124 | 124 |
{ |
125 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
125 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
126 | 126 |
} |
127 | 127 |
else |
128 | 128 |
{ |
... | ... | |
133 | 133 |
|
134 | 134 |
if( mDynamicRegion!=null ) |
135 | 135 |
{ |
136 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
136 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
137 | 137 |
} |
138 | 138 |
else |
139 | 139 |
{ |
... | ... | |
145 | 145 |
|
146 | 146 |
if( mDynamic0!=null ) |
147 | 147 |
{ |
148 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
148 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
149 | 149 |
} |
150 | 150 |
else |
151 | 151 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java | ||
---|---|---|
120 | 120 |
|
121 | 121 |
if( mDynamicCenter!=null ) |
122 | 122 |
{ |
123 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
123 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
124 | 124 |
} |
125 | 125 |
else |
126 | 126 |
{ |
... | ... | |
131 | 131 |
|
132 | 132 |
if( mDynamicRegion!=null ) |
133 | 133 |
{ |
134 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
134 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
135 | 135 |
} |
136 | 136 |
else |
137 | 137 |
{ |
... | ... | |
143 | 143 |
|
144 | 144 |
if( mDynamic0!=null ) |
145 | 145 |
{ |
146 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
146 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
147 | 147 |
} |
148 | 148 |
else |
149 | 149 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectWave.java | ||
---|---|---|
141 | 141 |
|
142 | 142 |
if( mDynamicCenter!=null ) |
143 | 143 |
{ |
144 |
mDynamicCenter.interpolateMain(uniforms,index+5,currentDuration,step);
|
|
144 |
mDynamicCenter.get(uniforms,index+5,currentDuration,step);
|
|
145 | 145 |
} |
146 | 146 |
else |
147 | 147 |
{ |
... | ... | |
152 | 152 |
|
153 | 153 |
if( mDynamicRegion!=null ) |
154 | 154 |
{ |
155 |
mDynamicRegion.interpolateMain(uniforms,index+8,currentDuration,step);
|
|
155 |
mDynamicRegion.get(uniforms,index+8,currentDuration,step);
|
|
156 | 156 |
} |
157 | 157 |
else |
158 | 158 |
{ |
... | ... | |
164 | 164 |
|
165 | 165 |
if( mDynamic0!=null ) |
166 | 166 |
{ |
167 |
ret = mDynamic0.interpolateMain(uniforms,index,currentDuration,step);
|
|
167 |
ret = mDynamic0.get(uniforms,index,currentDuration,step);
|
|
168 | 168 |
} |
169 | 169 |
else |
170 | 170 |
{ |
src/main/java/org/distorted/library/type/Data1D.java | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
public interface Data1D |
29 | 29 |
{ |
30 |
|
|
30 |
boolean get(float[] buffer, int offset, long time, long step); |
|
31 | 31 |
} |
src/main/java/org/distorted/library/type/Data2D.java | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
public interface Data2D |
29 | 29 |
{ |
30 |
|
|
30 |
boolean get(float[] buffer, int offset, long time, long step); |
|
31 | 31 |
} |
src/main/java/org/distorted/library/type/Data3D.java | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
public interface Data3D |
29 | 29 |
{ |
30 |
|
|
30 |
boolean get(float[] buffer, int offset, long time, long step); |
|
31 | 31 |
} |
src/main/java/org/distorted/library/type/Data4D.java | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
public interface Data4D |
29 | 29 |
{ |
30 |
|
|
30 |
boolean get(float[] buffer, int offset, long time, long step); |
|
31 | 31 |
} |
src/main/java/org/distorted/library/type/Data5D.java | ||
---|---|---|
27 | 27 |
*/ |
28 | 28 |
public interface Data5D |
29 | 29 |
{ |
30 |
|
|
30 |
boolean get(float[] buffer, int offset, long time, long step); |
|
31 | 31 |
} |
src/main/java/org/distorted/library/type/Dynamic.java | ||
---|---|---|
588 | 588 |
* @param time Time of interpolation. Time=0.0 would return the first Point, Time=0.5 - the last, |
589 | 589 |
* time=1.0 - the first again, and time 0.1 would be 1/5 of the way between the first and the last Points. |
590 | 590 |
*/ |
591 |
public void interpolateMain(float[] buffer, int offset, long time)
|
|
591 |
public void get(float[] buffer, int offset, long time)
|
|
592 | 592 |
{ |
593 | 593 |
if( mDuration<=0.0f ) |
594 | 594 |
{ |
... | ... | |
620 | 620 |
* if the previous time we were called the effect wasn't finished yet, but now it is. |
621 | 621 |
* @return true if the interpolation reached its end. |
622 | 622 |
*/ |
623 |
public boolean interpolateMain(float[] buffer, int offset, long time, long step)
|
|
623 |
public boolean get(float[] buffer, int offset, long time, long step)
|
|
624 | 624 |
{ |
625 | 625 |
if( mDuration<=0.0f ) |
626 | 626 |
{ |
src/main/java/org/distorted/library/type/Static.java | ||
---|---|---|
26 | 26 |
* N-dimensional Point a few of which the Dynamic interpolates between. |
27 | 27 |
*/ |
28 | 28 |
|
29 |
public class Static |
|
29 |
public abstract class Static
|
|
30 | 30 |
{ |
31 | 31 |
private final int mDimension; |
32 | 32 |
|
src/main/java/org/distorted/library/type/Static1D.java | ||
---|---|---|
117 | 117 |
return x; |
118 | 118 |
} |
119 | 119 |
|
120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
121 |
/** |
|
122 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
|
123 |
* <p> |
|
124 |
* |
|
125 |
* @param buffer Float buffer we will write the results to. |
|
126 |
* @param offset Offset in the buffer where to write the result. |
|
127 |
* @param time not used |
|
128 |
* @param step not used |
|
129 |
* @return <code>false</code> |
|
130 |
*/ |
|
131 |
public boolean get(float[] buffer, int offset, long time, long step) |
|
132 |
{ |
|
133 |
buffer[offset] = x; |
|
134 |
return false; |
|
135 |
} |
|
120 | 136 |
} |
src/main/java/org/distorted/library/type/Static2D.java | ||
---|---|---|
123 | 123 |
return y; |
124 | 124 |
} |
125 | 125 |
|
126 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
127 |
/** |
|
128 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
|
129 |
* <p> |
|
130 |
* |
|
131 |
* @param buffer Float buffer we will write the results to. |
|
132 |
* @param offset Offset in the buffer where to write the result. |
|
133 |
* @param time not used |
|
134 |
* @param step not used |
|
135 |
* @return <code>false</code> |
|
136 |
*/ |
|
137 |
public boolean get(float[] buffer, int offset, long time, long step) |
|
138 |
{ |
|
139 |
buffer[offset ] = x; |
|
140 |
buffer[offset+1] = y; |
|
141 |
return false; |
|
142 |
} |
|
126 | 143 |
} |
src/main/java/org/distorted/library/type/Static3D.java | ||
---|---|---|
129 | 129 |
return z; |
130 | 130 |
} |
131 | 131 |
|
132 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
133 |
/** |
|
134 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
|
135 |
* <p> |
|
136 |
* |
|
137 |
* @param buffer Float buffer we will write the results to. |
|
138 |
* @param offset Offset in the buffer where to write the result. |
|
139 |
* @param time not used |
|
140 |
* @param step not used |
|
141 |
* @return <code>false</code> |
|
142 |
*/ |
|
143 |
public boolean get(float[] buffer, int offset, long time, long step) |
|
144 |
{ |
|
145 |
buffer[offset ] = x; |
|
146 |
buffer[offset+1] = y; |
|
147 |
buffer[offset+2] = z; |
|
148 |
return false; |
|
149 |
} |
|
132 | 150 |
} |
src/main/java/org/distorted/library/type/Static4D.java | ||
---|---|---|
135 | 135 |
return w; |
136 | 136 |
} |
137 | 137 |
|
138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
139 |
/** |
|
140 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
|
141 |
* <p> |
|
142 |
* |
|
143 |
* @param buffer Float buffer we will write the results to. |
|
144 |
* @param offset Offset in the buffer where to write the result. |
|
145 |
* @param time not used |
|
146 |
* @param step not used |
|
147 |
* @return <code>false</code> |
|
148 |
*/ |
|
149 |
public boolean get(float[] buffer, int offset, long time, long step) |
|
150 |
{ |
|
151 |
buffer[offset ] = x; |
|
152 |
buffer[offset+1] = y; |
|
153 |
buffer[offset+2] = z; |
|
154 |
buffer[offset+3] = w; |
|
155 |
return false; |
|
156 |
} |
|
138 | 157 |
} |
src/main/java/org/distorted/library/type/Static5D.java | ||
---|---|---|
133 | 133 |
return v; |
134 | 134 |
} |
135 | 135 |
|
136 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
137 |
/** |
|
138 |
* 'Interpolation' between the single Point (i.e. always this very value) returned to the buffer. |
|
139 |
* <p> |
|
140 |
* |
|
141 |
* @param buffer Float buffer we will write the results to. |
|
142 |
* @param offset Offset in the buffer where to write the result. |
|
143 |
* @param time not used |
|
144 |
* @param step not used |
|
145 |
* @return <code>false</code> |
|
146 |
*/ |
|
147 |
public boolean get(float[] buffer, int offset, long time, long step) |
|
148 |
{ |
|
149 |
buffer[offset ] = x; |
|
150 |
buffer[offset+1] = y; |
|
151 |
buffer[offset+2] = z; |
|
152 |
buffer[offset+3] = w; |
|
153 |
buffer[offset+4] = v; |
|
154 |
return false; |
|
155 |
} |
|
136 | 156 |
} |
Also available in: Unified diff
Beginnings of support for the unified Data data type.