Revision 9d0d8530
Added by Leszek Koltunski over 7 years ago
src/main/java/org/distorted/library/effect/Effect.java | ||
---|---|---|
123 | 123 |
|
124 | 124 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
125 | 125 |
|
126 |
Effect(EffectType type, EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
126 |
Effect(EffectName name)
|
|
127 | 127 |
{ |
128 |
mID = (mNextID++)<<EffectType.LENGTH + type.ordinal(); |
|
129 |
|
|
130 | 128 |
mName = name; |
131 |
mType = type;
|
|
132 |
mDimension = dimension;
|
|
133 |
mSupportsC = center;
|
|
134 |
mSupportsR = region;
|
|
129 |
mType = name.getType();
|
|
130 |
mDimension = name.getDimension();
|
|
131 |
mSupportsC = name.supportsCenter();
|
|
132 |
mSupportsR = name.supportsRegion();
|
|
135 | 133 |
|
136 | 134 |
int n = name.ordinal(); |
137 |
int l = unity.length; |
|
135 |
float[] u = name.getUnity(); |
|
136 |
int l = name.getUnity().length; |
|
138 | 137 |
|
139 | 138 |
for(int i=0; i<l; i++) |
140 | 139 |
{ |
141 |
mUnity[n*MAX_UNITY_DIM+i] = unity[i];
|
|
140 |
mUnity[n*MAX_UNITY_DIM+i] = u[i]; |
|
142 | 141 |
} |
143 | 142 |
|
144 | 143 |
mUnityDim[n] = l; |
144 |
|
|
145 |
mID = (mNextID++)<<EffectType.LENGTH + mType.ordinal(); |
|
145 | 146 |
} |
146 | 147 |
} |
src/main/java/org/distorted/library/effect/EffectName.java | ||
---|---|---|
24 | 24 |
* Names of Effects one can add to the DistortedEffects queues. |
25 | 25 |
* <p> |
26 | 26 |
* Effect's 'Type' is one of the constants defined in {@link EffectType}. |
27 |
* </p> |
|
28 |
* <p> |
|
29 |
* Effect's 'Uniforms' are a vector of 7 (matrix effects) 12 (vertex) or 8 (fragment) floats, which |
|
30 |
* together form full information how to compute a given effect. |
|
31 |
* Typically, some of those values will be Interpolated in CPU (by one of the 'EffectQueueX.compute()' |
|
32 |
* methods) and the effect of such Interpolation sent to the Shaders. |
|
33 |
* </p> |
|
34 |
* <p> |
|
35 |
* Effect's 'Unity' is such a particular vector of its 'interpolated values' which makes the |
|
36 |
* effect NULL. For example, if the effect is 'MOVE' by a 3-dimensional vector, then a 'NULL |
|
37 |
* MOVE' is a MOVE by vector (0,0,0), thus (0,0,0) is the unity of the MOVE effect. |
|
38 |
* This is used by the EffectQueue classes to decide if the final form of the Effect is NULL - and |
|
39 |
* thus if it can safely be removed from Effect Queues without affecting the visual in any way. |
|
40 |
* </p> |
|
27 | 41 |
*/ |
28 | 42 |
|
29 | 43 |
public enum EffectName |
30 | 44 |
{ |
31 |
// EFFECT NAME /////// EFFECT TYPE |
|
32 |
// MATRIX EFFECTS |
|
33 |
ROTATE ( EffectType.MATRIX ), |
|
34 |
QUATERNION ( EffectType.MATRIX ), |
|
35 |
MOVE ( EffectType.MATRIX ), |
|
36 |
SCALE ( EffectType.MATRIX ), |
|
37 |
SHEAR ( EffectType.MATRIX ), |
|
38 |
// add new Matrix effects here... |
|
39 |
// VERTEX EFFECTS |
|
40 |
DISTORT ( EffectType.VERTEX ), |
|
41 |
DEFORM ( EffectType.VERTEX ), |
|
42 |
SINK ( EffectType.VERTEX ), |
|
43 |
PINCH ( EffectType.VERTEX ), |
|
44 |
SWIRL ( EffectType.VERTEX ), |
|
45 |
WAVE ( EffectType.VERTEX ), |
|
46 |
// add new Vertex Effects here... |
|
47 |
// FRAGMENT EFFECTS |
|
48 |
ALPHA ( EffectType.FRAGMENT ), |
|
49 |
SMOOTH_ALPHA ( EffectType.FRAGMENT ), |
|
50 |
CHROMA ( EffectType.FRAGMENT ), |
|
51 |
SMOOTH_CHROMA ( EffectType.FRAGMENT ), |
|
52 |
BRIGHTNESS ( EffectType.FRAGMENT ), |
|
53 |
SMOOTH_BRIGHTNESS( EffectType.FRAGMENT ), |
|
54 |
SATURATION ( EffectType.FRAGMENT ), |
|
55 |
SMOOTH_SATURATION( EffectType.FRAGMENT ), |
|
56 |
CONTRAST ( EffectType.FRAGMENT ), |
|
57 |
SMOOTH_CONTRAST ( EffectType.FRAGMENT ), |
|
58 |
// add new Fragment effects here... |
|
59 |
// POSTPROCESSING EFFECTS. |
|
60 |
BLUR ( EffectType.POSTPROCESS ), |
|
61 |
GLOW ( EffectType.POSTPROCESS ); |
|
62 |
// add new Postprocess effects here... |
|
45 |
// EFFECT NAME /////// EFFECT TYPE /////// EFFECT UNITY //////////// DIM // REGION // CENTER |
|
46 |
ROTATE ( EffectType.MATRIX , new float[] {0.0f} , 4, false, true ), |
|
47 |
QUATERNION ( EffectType.MATRIX , new float[] {0.0f,0.0f,0.0f} , 4, false, true ), |
|
48 |
MOVE ( EffectType.MATRIX , new float[] {0.0f,0.0f,0.0f} , 3, false, false ), |
|
49 |
SCALE ( EffectType.MATRIX , new float[] {1.0f,1.0f,1.0f} , 3, false, false ), |
|
50 |
SHEAR ( EffectType.MATRIX , new float[] {0.0f,0.0f,0.0f} , 3, false, true ), |
|
51 |
DISTORT ( EffectType.VERTEX , new float[] {0.0f,0.0f,0.0f} , 3, true , true ), |
|
52 |
DEFORM ( EffectType.VERTEX , new float[] {0.0f,0.0f,0.0f} , 3, true , true ), |
|
53 |
SINK ( EffectType.VERTEX , new float[] {1.0f} , 1, true , true ), |
|
54 |
PINCH ( EffectType.VERTEX , new float[] {1.0f} , 2, true , true ), |
|
55 |
SWIRL ( EffectType.VERTEX , new float[] {0.0f} , 1, true , true ), |
|
56 |
WAVE ( EffectType.VERTEX , new float[] {0.0f} , 5, true , true ), |
|
57 |
ALPHA ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
58 |
SMOOTH_ALPHA ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
59 |
CHROMA ( EffectType.FRAGMENT, new float[] {0.0f} , 4, true , false ), |
|
60 |
SMOOTH_CHROMA ( EffectType.FRAGMENT, new float[] {0.0f} , 4, true , false ), |
|
61 |
BRIGHTNESS ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
62 |
SMOOTH_BRIGHTNESS( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
63 |
SATURATION ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
64 |
SMOOTH_SATURATION( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
65 |
CONTRAST ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
66 |
SMOOTH_CONTRAST ( EffectType.FRAGMENT, new float[] {1.0f} , 1, true , false ), |
|
67 |
BLUR ( EffectType.POSTPROCESS,new float[] {0.0f} , 1, false, false ), |
|
68 |
GLOW ( EffectType.POSTPROCESS,new float[] {0.0f} , 1, false, false ); |
|
63 | 69 |
|
64 | 70 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
65 | 71 |
|
72 |
private static final int MAXDIM = 4; // maximum supported dimension of effect's unity |
|
66 | 73 |
public static final int LENGTH = values().length; |
74 |
|
|
67 | 75 |
private final EffectType type; |
76 |
private final float[] unity; |
|
77 |
private final int dimension; |
|
78 |
private final boolean supportsR; |
|
79 |
private final boolean supportsC; |
|
80 |
|
|
81 |
private static final float[] unities; |
|
82 |
private static final int[] unityDimensions; |
|
83 |
private static final int[] dimensions; |
|
84 |
private static final boolean[] supportsRegion; |
|
85 |
private static final boolean[] supportsCenter; |
|
68 | 86 |
private static final EffectName[] names; // copy the values() to a local variable so that we |
69 | 87 |
// don't have to keep recreating the array every time |
70 | 88 |
static |
71 | 89 |
{ |
72 | 90 |
int i=0; |
73 |
names = new EffectName[LENGTH]; |
|
91 |
|
|
92 |
unities = new float[MAXDIM*LENGTH]; |
|
93 |
unityDimensions = new int[LENGTH]; |
|
94 |
dimensions = new int[LENGTH]; |
|
95 |
supportsRegion = new boolean[LENGTH]; |
|
96 |
supportsCenter = new boolean[LENGTH]; |
|
97 |
names = new EffectName[LENGTH]; |
|
74 | 98 |
|
75 | 99 |
for(EffectName name: EffectName.values()) |
76 | 100 |
{ |
77 |
names[i++] = name; |
|
101 |
unityDimensions[i] = (name.unity==null ? 0 : name.unity.length); |
|
102 |
dimensions[i] = name.dimension; |
|
103 |
supportsRegion[i] = name.supportsR; |
|
104 |
supportsCenter[i] = name.supportsC; |
|
105 |
names[i] = name; |
|
106 |
|
|
107 |
switch(unityDimensions[i]) |
|
108 |
{ |
|
109 |
case 4: unities[MAXDIM*i+3] = name.unity[3]; |
|
110 |
case 3: unities[MAXDIM*i+2] = name.unity[2]; |
|
111 |
case 2: unities[MAXDIM*i+1] = name.unity[1]; |
|
112 |
case 1: unities[MAXDIM*i ] = name.unity[0]; |
|
113 |
case 0: break; |
|
114 |
} |
|
115 |
|
|
116 |
i++; |
|
78 | 117 |
} |
79 | 118 |
} |
80 | 119 |
|
81 | 120 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
82 | 121 |
|
83 |
EffectName(EffectType type) |
|
122 |
float[] getUnity() |
|
123 |
{ |
|
124 |
return unity; |
|
125 |
} |
|
126 |
|
|
127 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
128 |
|
|
129 |
EffectName(EffectType type, float[] unity, int dimension, boolean supportsR, boolean supportsC) |
|
84 | 130 |
{ |
85 |
this.type = type; |
|
131 |
this.type = type; |
|
132 |
this.unity = unity; |
|
133 |
this.dimension = dimension; |
|
134 |
this.supportsR = supportsR; |
|
135 |
this.supportsC = supportsC; |
|
86 | 136 |
} |
87 | 137 |
|
88 | 138 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
108 | 158 |
{ |
109 | 159 |
return names[ordinal]; |
110 | 160 |
} |
161 |
|
|
162 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
163 |
/** |
|
164 |
* Returns the dimension of an Effect (in other words, the number of interpolated values). |
|
165 |
* @return dimension of the Effect. |
|
166 |
*/ |
|
167 |
public int getDimension() { return dimensions[ordinal()]; } |
|
168 |
|
|
169 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
170 |
/** |
|
171 |
* Do we support being masked by a Region? |
|
172 |
* @return true if the Effect supports being masked with a Region. |
|
173 |
*/ |
|
174 |
public boolean supportsRegion() { return supportsRegion[ordinal()]; } |
|
175 |
|
|
176 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
177 |
/** |
|
178 |
* Does this Effect have a center? |
|
179 |
* @return true if the Effect has a center. |
|
180 |
*/ |
|
181 |
public boolean supportsCenter() { return supportsCenter[ordinal()]; } |
|
111 | 182 |
} |
112 | 183 |
|
src/main/java/org/distorted/library/effect/FragmentEffect.java | ||
---|---|---|
39 | 39 |
|
40 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
41 | 41 |
|
42 |
public FragmentEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
42 |
public FragmentEffect(EffectName name) |
|
43 | 43 |
{ |
44 |
super(EffectType.FRAGMENT,name,dimension,center,region,unity);
|
|
44 |
super(name);
|
|
45 | 45 |
} |
46 | 46 |
} |
src/main/java/org/distorted/library/effect/FragmentEffectAlpha.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectAlpha extends FragmentEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
34 |
private static final int DIMENSION = 1; |
|
35 |
private static final boolean SUPPORTS_CENTER = false; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Makes a certain sub-region of the Object smoothly change its transparency level. |
... | ... | |
47 | 42 |
*/ |
48 | 43 |
public FragmentEffectAlpha(Data1D alpha, Data4D region, boolean smooth) |
49 | 44 |
{ |
50 |
super(smooth? EffectName.SMOOTH_ALPHA:EffectName.ALPHA ,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
45 |
super(smooth? EffectName.SMOOTH_ALPHA:EffectName.ALPHA); |
|
51 | 46 |
|
52 | 47 |
if( alpha instanceof Dynamic1D ) |
53 | 48 |
{ |
... | ... | |
78 | 73 |
*/ |
79 | 74 |
public FragmentEffectAlpha(Data1D alpha) |
80 | 75 |
{ |
81 |
super(EffectName.ALPHA,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
76 |
super(EffectName.ALPHA); |
|
82 | 77 |
|
83 | 78 |
if( alpha instanceof Dynamic1D ) |
84 | 79 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectBrightness.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectBrightness extends FragmentEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
34 |
private static final int DIMENSION = 1; |
|
35 |
private static final boolean SUPPORTS_CENTER = false; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Makes a certain sub-region of the Object smoothly change its brightness level. |
... | ... | |
46 | 41 |
*/ |
47 | 42 |
public FragmentEffectBrightness(Data1D brightness, Data4D region, boolean smooth) |
48 | 43 |
{ |
49 |
super(smooth?EffectName.SMOOTH_BRIGHTNESS:EffectName.BRIGHTNESS ,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
44 |
super(smooth?EffectName.SMOOTH_BRIGHTNESS:EffectName.BRIGHTNESS); |
|
50 | 45 |
|
51 | 46 |
if( brightness instanceof Dynamic1D ) |
52 | 47 |
{ |
... | ... | |
76 | 71 |
*/ |
77 | 72 |
public FragmentEffectBrightness(Data1D brightness) |
78 | 73 |
{ |
79 |
super(EffectName.BRIGHTNESS,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
74 |
super(EffectName.BRIGHTNESS); |
|
80 | 75 |
|
81 | 76 |
if( brightness instanceof Dynamic1D ) |
82 | 77 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectChroma.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class FragmentEffectChroma extends FragmentEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[] {0.0f}; |
|
37 |
private static final int DIMENSION = 4; |
|
38 |
private static final boolean SUPPORTS_CENTER = false; |
|
39 |
private static final boolean SUPPORTS_REGION = true; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Makes a certain sub-region of the Object smoothly change all three of its RGB components. |
... | ... | |
51 | 46 |
*/ |
52 | 47 |
public FragmentEffectChroma(Data1D blend, Data3D color, Data4D region, boolean smooth) |
53 | 48 |
{ |
54 |
super(smooth?EffectName.SMOOTH_CHROMA:EffectName.CHROMA,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
49 |
super(smooth?EffectName.SMOOTH_CHROMA:EffectName.CHROMA); |
|
55 | 50 |
|
56 | 51 |
if( blend instanceof Dynamic1D ) |
57 | 52 |
{ |
... | ... | |
92 | 87 |
*/ |
93 | 88 |
public FragmentEffectChroma(Data1D blend, Data3D color) |
94 | 89 |
{ |
95 |
super(EffectName.CHROMA,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
90 |
super(EffectName.CHROMA); |
|
96 | 91 |
|
97 | 92 |
if( blend instanceof Dynamic1D ) |
98 | 93 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectContrast.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectContrast extends FragmentEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
34 |
private static final int DIMENSION = 1; |
|
35 |
private static final boolean SUPPORTS_CENTER = false; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Makes a certain sub-region of the Object smoothly change its contrast level. |
... | ... | |
46 | 41 |
*/ |
47 | 42 |
public FragmentEffectContrast(Data1D contrast, Data4D region, boolean smooth) |
48 | 43 |
{ |
49 |
super(smooth?EffectName.SMOOTH_CONTRAST:EffectName.CONTRAST,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
44 |
super(smooth?EffectName.SMOOTH_CONTRAST:EffectName.CONTRAST); |
|
50 | 45 |
|
51 | 46 |
if( contrast instanceof Dynamic1D ) |
52 | 47 |
{ |
... | ... | |
76 | 71 |
*/ |
77 | 72 |
public FragmentEffectContrast(Data1D contrast) |
78 | 73 |
{ |
79 |
super(EffectName.CONTRAST,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
74 |
super(EffectName.CONTRAST); |
|
80 | 75 |
|
81 | 76 |
if( contrast instanceof Dynamic1D ) |
82 | 77 |
{ |
src/main/java/org/distorted/library/effect/FragmentEffectSaturation.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class FragmentEffectSaturation extends FragmentEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
34 |
private static final int DIMENSION = 1; |
|
35 |
private static final boolean SUPPORTS_CENTER = false; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Makes a certain sub-region of the Object smoothly change its saturation level. |
... | ... | |
46 | 41 |
*/ |
47 | 42 |
public FragmentEffectSaturation(Data1D saturation, Data4D region, boolean smooth) |
48 | 43 |
{ |
49 |
super(smooth?EffectName.SMOOTH_SATURATION:EffectName.SATURATION ,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
44 |
super(smooth?EffectName.SMOOTH_SATURATION:EffectName.SATURATION); |
|
50 | 45 |
|
51 | 46 |
if( saturation instanceof Dynamic1D ) |
52 | 47 |
{ |
... | ... | |
76 | 71 |
*/ |
77 | 72 |
public FragmentEffectSaturation(Data1D saturation) |
78 | 73 |
{ |
79 |
super(EffectName.SATURATION,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
74 |
super(EffectName.SATURATION); |
|
80 | 75 |
|
81 | 76 |
if( saturation instanceof Dynamic1D ) |
82 | 77 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffect.java | ||
---|---|---|
36 | 36 |
|
37 | 37 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
38 | 38 |
|
39 |
public MatrixEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
39 |
public MatrixEffect(EffectName name) |
|
40 | 40 |
{ |
41 |
super(EffectType.MATRIX,name,dimension,center,region,unity);
|
|
41 |
super(name);
|
|
42 | 42 |
} |
43 | 43 |
} |
src/main/java/org/distorted/library/effect/MatrixEffectMove.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public class MatrixEffectMove extends MatrixEffect |
29 | 29 |
{ |
30 |
private static final float[] UNITIES = new float[]{0.0f, 0.0f, 0.0f}; |
|
31 |
private static final int DIMENSION = 3; |
|
32 |
private static final boolean SUPPORTS_CENTER = false; |
|
33 |
private static final boolean SUPPORTS_REGION = false; |
|
34 |
|
|
35 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 31 |
/** |
37 | 32 |
* Moves the Object by a (possibly changing in time) vector. |
... | ... | |
41 | 36 |
*/ |
42 | 37 |
public MatrixEffectMove(Data3D vector) |
43 | 38 |
{ |
44 |
super(EffectName.MOVE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
39 |
super(EffectName.MOVE); |
|
45 | 40 |
|
46 | 41 |
if( vector instanceof Static3D) |
47 | 42 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectQuaternion.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class MatrixEffectQuaternion extends MatrixEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[]{0.0f, 0.0f, 0.0f}; |
|
34 |
private static final int DIMENSION = 4; |
|
35 |
private static final boolean SUPPORTS_CENTER = true; |
|
36 |
private static final boolean SUPPORTS_REGION = false; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Rotates the Object by quaternion. |
... | ... | |
44 | 39 |
*/ |
45 | 40 |
public MatrixEffectQuaternion(Data4D quaternion, Data3D center ) |
46 | 41 |
{ |
47 |
super(EffectName.QUATERNION,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
42 |
super(EffectName.QUATERNION); |
|
48 | 43 |
|
49 | 44 |
if( quaternion instanceof Static4D) |
50 | 45 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectRotate.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class MatrixEffectRotate extends MatrixEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[]{0.0f}; |
|
37 |
private static final int DIMENSION = 4; |
|
38 |
private static final boolean SUPPORTS_CENTER = true; |
|
39 |
private static final boolean SUPPORTS_REGION = false; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Rotates the Object by 'angle' degrees around the center. |
... | ... | |
49 | 44 |
*/ |
50 | 45 |
public MatrixEffectRotate(Data1D angle, Static3D axis, Data3D center) |
51 | 46 |
{ |
52 |
super(EffectName.ROTATE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
47 |
super(EffectName.ROTATE); |
|
53 | 48 |
|
54 | 49 |
if( angle instanceof Static1D ) |
55 | 50 |
{ |
... | ... | |
82 | 77 |
*/ |
83 | 78 |
public MatrixEffectRotate(Data4D angleaxis, Data3D center) |
84 | 79 |
{ |
85 |
super(EffectName.ROTATE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
80 |
super(EffectName.ROTATE); |
|
86 | 81 |
|
87 | 82 |
if( angleaxis instanceof Static4D) |
88 | 83 |
{ |
src/main/java/org/distorted/library/effect/MatrixEffectScale.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public class MatrixEffectScale extends MatrixEffect |
29 | 29 |
{ |
30 |
private static final float[] UNITIES = new float[] {1.0f,1.0f,1.0f}; |
|
31 |
private static final int DIMENSION = 3; |
|
32 |
private static final boolean SUPPORTS_CENTER = false; |
|
33 |
private static final boolean SUPPORTS_REGION = false; |
|
34 |
|
|
35 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 31 |
/** |
37 | 32 |
* Scales the Object by (possibly changing in time) 3D scale factors. |
... | ... | |
41 | 36 |
*/ |
42 | 37 |
public MatrixEffectScale(Data3D scale) |
43 | 38 |
{ |
44 |
super(EffectName.SCALE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
39 |
super(EffectName.SCALE); |
|
45 | 40 |
|
46 | 41 |
if( scale instanceof Static3D) |
47 | 42 |
{ |
... | ... | |
61 | 56 |
*/ |
62 | 57 |
public MatrixEffectScale(float scale) |
63 | 58 |
{ |
64 |
super(EffectName.SCALE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
59 |
super(EffectName.SCALE); |
|
65 | 60 |
|
66 | 61 |
mStatic0 = new Static3D(scale,scale,scale); |
67 | 62 |
} |
src/main/java/org/distorted/library/effect/MatrixEffectShear.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public class MatrixEffectShear extends MatrixEffect |
29 | 29 |
{ |
30 |
private static final float[] UNITIES = new float[] {0.0f,0.0f,0.0f}; |
|
31 |
private static final int DIMENSION = 3; |
|
32 |
private static final boolean SUPPORTS_CENTER = true; |
|
33 |
private static final boolean SUPPORTS_REGION = false; |
|
34 |
|
|
35 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 31 |
/** |
37 | 32 |
* Shears the Object. |
... | ... | |
44 | 39 |
*/ |
45 | 40 |
public MatrixEffectShear(Data3D shear, Data3D center) |
46 | 41 |
{ |
47 |
super(EffectName.SHEAR,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
42 |
super(EffectName.SHEAR); |
|
48 | 43 |
|
49 | 44 |
if( shear instanceof Static3D) |
50 | 45 |
{ |
src/main/java/org/distorted/library/effect/PostprocessEffect.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
37 | 37 |
|
38 |
public PostprocessEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
38 |
public PostprocessEffect(EffectName name) |
|
39 | 39 |
{ |
40 |
super(EffectType.POSTPROCESS,name,dimension,center,region,unity);
|
|
40 |
super(name);
|
|
41 | 41 |
} |
42 | 42 |
} |
src/main/java/org/distorted/library/effect/PostprocessEffectBlur.java | ||
---|---|---|
27 | 27 |
|
28 | 28 |
public class PostprocessEffectBlur extends PostprocessEffect |
29 | 29 |
{ |
30 |
private static final float[] UNITIES = new float[] {0.0f}; |
|
31 |
private static final int DIMENSION = 1; |
|
32 |
private static final boolean SUPPORTS_CENTER = false; |
|
33 |
private static final boolean SUPPORTS_REGION = false; |
|
34 |
|
|
35 | 30 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
36 | 31 |
/** |
37 | 32 |
* Blur the object. |
... | ... | |
41 | 36 |
*/ |
42 | 37 |
public PostprocessEffectBlur(Data1D radius) |
43 | 38 |
{ |
44 |
super(EffectName.BLUR,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
39 |
super(EffectName.BLUR); |
|
45 | 40 |
|
46 | 41 |
if( radius instanceof Dynamic1D) |
47 | 42 |
{ |
src/main/java/org/distorted/library/effect/PostprocessEffectGlow.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class PostprocessEffectGlow extends PostprocessEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {0.0f}; |
|
34 |
private static final int DIMENSION = 5; |
|
35 |
private static final boolean SUPPORTS_CENTER = false; |
|
36 |
private static final boolean SUPPORTS_REGION = false; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Make the object glow with a specific color and a halo of specific radius. |
... | ... | |
45 | 40 |
*/ |
46 | 41 |
public PostprocessEffectGlow(Data1D radius, Data4D color) |
47 | 42 |
{ |
48 |
super(EffectName.GLOW,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
43 |
super(EffectName.GLOW); |
|
49 | 44 |
|
50 | 45 |
if( radius instanceof Dynamic1D) |
51 | 46 |
{ |
src/main/java/org/distorted/library/effect/VertexEffect.java | ||
---|---|---|
43 | 43 |
|
44 | 44 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
45 | 45 |
|
46 |
public VertexEffect(EffectName name, int dimension, boolean center, boolean region, float[] unity)
|
|
46 |
public VertexEffect(EffectName name) |
|
47 | 47 |
{ |
48 |
super(EffectType.VERTEX,name,dimension,center,region,unity);
|
|
48 |
super(name);
|
|
49 | 49 |
} |
50 | 50 |
} |
src/main/java/org/distorted/library/effect/VertexEffectDeform.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class VertexEffectDeform extends VertexEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {0.0f,0.0f,0.0f}; |
|
34 |
private static final int DIMENSION = 3; |
|
35 |
private static final boolean SUPPORTS_CENTER = true; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to |
... | ... | |
46 | 41 |
*/ |
47 | 42 |
public VertexEffectDeform(Data3D vector, Data3D center, Data4D region) |
48 | 43 |
{ |
49 |
super(EffectName.DEFORM,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
44 |
super(EffectName.DEFORM); |
|
50 | 45 |
|
51 | 46 |
if( vector instanceof Dynamic3D ) |
52 | 47 |
{ |
... | ... | |
86 | 81 |
*/ |
87 | 82 |
public VertexEffectDeform(Data3D vector, Data3D center) |
88 | 83 |
{ |
89 |
super(EffectName.DEFORM,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
84 |
super(EffectName.DEFORM); |
|
90 | 85 |
|
91 | 86 |
if( vector instanceof Dynamic3D ) |
92 | 87 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectDistort.java | ||
---|---|---|
30 | 30 |
|
31 | 31 |
public class VertexEffectDistort extends VertexEffect |
32 | 32 |
{ |
33 |
private static final float[] UNITIES = new float[] {0.0f,0.0f,0.0f}; |
|
34 |
private static final int DIMENSION = 3; |
|
35 |
private static final boolean SUPPORTS_CENTER = true; |
|
36 |
private static final boolean SUPPORTS_REGION = true; |
|
37 |
|
|
38 | 33 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
39 | 34 |
/** |
40 | 35 |
* Distort a (possibly changing in time) part of the Object by a (possibly changing in time) vector of force. |
... | ... | |
46 | 41 |
*/ |
47 | 42 |
public VertexEffectDistort(Data3D vector, Data3D center, Data4D region) |
48 | 43 |
{ |
49 |
super(EffectName.DISTORT,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
44 |
super(EffectName.DISTORT); |
|
50 | 45 |
|
51 | 46 |
if( vector instanceof Dynamic3D ) |
52 | 47 |
{ |
... | ... | |
86 | 81 |
*/ |
87 | 82 |
public VertexEffectDistort(Data3D vector, Data3D center) |
88 | 83 |
{ |
89 |
super(EffectName.DISTORT,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
84 |
super(EffectName.DISTORT); |
|
90 | 85 |
|
91 | 86 |
if( vector instanceof Dynamic3D ) |
92 | 87 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectPinch.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class VertexEffectPinch extends VertexEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
37 |
private static final int DIMENSION = 2; |
|
38 |
private static final boolean SUPPORTS_CENTER = true; |
|
39 |
private static final boolean SUPPORTS_REGION = true; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Pull all points around the center of the Effect towards a line passing through the center |
... | ... | |
49 | 44 |
*/ |
50 | 45 |
public VertexEffectPinch(Data2D pinch, Data3D center, Data4D region) |
51 | 46 |
{ |
52 |
super(EffectName.PINCH,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
47 |
super(EffectName.PINCH); |
|
53 | 48 |
|
54 | 49 |
if( pinch instanceof Dynamic2D) |
55 | 50 |
{ |
... | ... | |
89 | 84 |
*/ |
90 | 85 |
public VertexEffectPinch(Data2D pinch, Data3D center) |
91 | 86 |
{ |
92 |
super(EffectName.PINCH,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
87 |
super(EffectName.PINCH); |
|
93 | 88 |
|
94 | 89 |
if( pinch instanceof Dynamic2D) |
95 | 90 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSink.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class VertexEffectSink extends VertexEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[] {1.0f}; |
|
37 |
private static final int DIMENSION = 1; |
|
38 |
private static final boolean SUPPORTS_CENTER = true; |
|
39 |
private static final boolean SUPPORTS_REGION = true; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Pull all points around the center of the Effect towards the center (if degree>=1) or push them |
... | ... | |
49 | 44 |
*/ |
50 | 45 |
public VertexEffectSink(Data1D sink, Data3D center, Data4D region) |
51 | 46 |
{ |
52 |
super(EffectName.SINK,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
47 |
super(EffectName.SINK); |
|
53 | 48 |
|
54 | 49 |
if( sink instanceof Dynamic1D) |
55 | 50 |
{ |
... | ... | |
89 | 84 |
*/ |
90 | 85 |
public VertexEffectSink(Data1D sink, Data3D center) |
91 | 86 |
{ |
92 |
super(EffectName.SINK,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
87 |
super(EffectName.SINK); |
|
93 | 88 |
|
94 | 89 |
if( sink instanceof Dynamic1D) |
95 | 90 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectSwirl.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class VertexEffectSwirl extends VertexEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[] {0.0f}; |
|
37 |
private static final int DIMENSION = 1; |
|
38 |
private static final boolean SUPPORTS_CENTER = true; |
|
39 |
private static final boolean SUPPORTS_REGION = true; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Rotate part of the Object around the Center of the Effect by a certain angle. |
... | ... | |
48 | 43 |
*/ |
49 | 44 |
public VertexEffectSwirl(Data1D swirl, Data3D center, Data4D region) |
50 | 45 |
{ |
51 |
super(EffectName.SWIRL,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
46 |
super(EffectName.SWIRL); |
|
52 | 47 |
|
53 | 48 |
if( swirl instanceof Dynamic1D) |
54 | 49 |
{ |
... | ... | |
87 | 82 |
*/ |
88 | 83 |
public VertexEffectSwirl(Data1D swirl, Data3D center) |
89 | 84 |
{ |
90 |
super(EffectName.SWIRL,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
85 |
super(EffectName.SWIRL); |
|
91 | 86 |
|
92 | 87 |
if( swirl instanceof Dynamic1D) |
93 | 88 |
{ |
src/main/java/org/distorted/library/effect/VertexEffectWave.java | ||
---|---|---|
33 | 33 |
|
34 | 34 |
public class VertexEffectWave extends VertexEffect |
35 | 35 |
{ |
36 |
private static final float[] UNITIES = new float[] {0.0f}; |
|
37 |
private static final int DIMENSION = 5; |
|
38 |
private static final boolean SUPPORTS_CENTER = true; |
|
39 |
private static final boolean SUPPORTS_REGION = true; |
|
40 |
|
|
41 | 36 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
42 | 37 |
/** |
43 | 38 |
* Directional, sinusoidal wave effect. |
... | ... | |
68 | 63 |
*/ |
69 | 64 |
public VertexEffectWave(Data5D wave, Data3D center) |
70 | 65 |
{ |
71 |
super(EffectName.WAVE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
66 |
super(EffectName.WAVE); |
|
72 | 67 |
|
73 | 68 |
if( wave instanceof Dynamic5D) |
74 | 69 |
{ |
... | ... | |
101 | 96 |
*/ |
102 | 97 |
public VertexEffectWave(Data5D wave, Data3D center, Data4D region) |
103 | 98 |
{ |
104 |
super(EffectName.WAVE,DIMENSION,SUPPORTS_CENTER,SUPPORTS_REGION,UNITIES);
|
|
99 |
super(EffectName.WAVE); |
|
105 | 100 |
|
106 | 101 |
if( wave instanceof Dynamic5D) |
107 | 102 |
{ |
Also available in: Unified diff
Progress with Effect classes - everything compiles now!