Project

General

Profile

« Previous | Next » 

Revision a1c83f28

Added by Leszek Koltunski over 7 years ago

Unify Effects3D and Matrix3D (still incomplete!)

View differences:

src/main/java/org/distorted/library/EffectNames.java
53 53
   * <p>
54 54
   * Unity: angle==0
55 55
   */
56
  ROTATE           ( EffectTypes.MATRIX  ,   new float[] {0.0f}           , 1, false ),
56
  ROTATE           ( EffectTypes.MATRIX  ,   new float[] {0.0f}           , 1, false, true ),
57 57
 /**
58 58
   * Rotate the whole Object around a center point (in quaternion notation).
59 59
   * <p>
......
61 61
   * <p>
62 62
   * Unity: (quatX,quatY,quatZ) = (0,0,0)
63 63
   */
64
  QUATERNION       ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 4, false ),
64
  QUATERNION       ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 4, false, true ),
65 65
 /**
66 66
   * Move the whole Object by a vector.
67 67
   * <p>
......
69 69
   * <p>
70 70
   * Unity: (vectorX,vectorY,vectorZ) = (0,0,0)
71 71
   */
72
  MOVE             ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false ),
72
  MOVE             ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false, false ),
73 73
 /**
74 74
   * Scale the whole Object independently in all 3 dimensions.
75 75
   * <p>
......
77 77
   * <p>
78 78
   * Unity: (scaleX,scaleY,scaleZ) = (1,1,1)
79 79
   */
80
  SCALE            ( EffectTypes.MATRIX  ,   new float[] {1.0f,1.0f,1.0f} , 3, false ),
80
  SCALE            ( EffectTypes.MATRIX  ,   new float[] {1.0f,1.0f,1.0f} , 3, false, false ),
81 81
 /**
82 82
   * Shear the whole Object in 3 dimensions around a center point.
83 83
   * <p>
......
85 85
   * <p>
86 86
   * Unity:  (shearX,shearY,shearZ) = (0,0,0)
87 87
   */
88
  SHEAR            ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false ),
88
  SHEAR            ( EffectTypes.MATRIX  ,   new float[] {0.0f,0.0f,0.0f} , 3, false, true ),
89 89
  // add new Matrix effects here...
90 90

  
91 91
 /////////////////////////////////////////////////////////////////////////////////
......
101 101
   * <p>
102 102
   * Unity: (forceX,forceY,forceZ) = (0,0,0)
103 103
   */
104
  DISTORT          ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f,0.0f} , 3, true ),
104
  DISTORT          ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f,0.0f} , 3, true, true ),
105 105
 /**
106 106
   * Deform the whole Object by applying a 2D vector of force to a center point.
107 107
   * <p>
......
111 111
   * <p>
112 112
   * Unity: (forceX,forceY) = (0,0)
113 113
   */
114
  DEFORM           ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f}      , 3, false ),
114
  DEFORM           ( EffectTypes.VERTEX  ,   new float[] {0.0f,0.0f}      , 3, false, true ),
115 115
 /**
116 116
   * Pull (or push away) all points around a center point to (from) it.
117 117
   * <p>
......
121 121
   * <p>
122 122
   * Unity: sinkFactor = 1
123 123
   */
124
  SINK             ( EffectTypes.VERTEX  ,   new float[] {1.0f}           , 1, true ),
124
  SINK             ( EffectTypes.VERTEX  ,   new float[] {1.0f}           , 1, true, true ),
125 125
 /**
126 126
   * Smoothly rotate a limited area around a center point.
127 127
   * <p>
......
131 131
   * <p>
132 132
   * Unity: swirlAngle = 0
133 133
   */
134
  SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 1, true ),
134
  SWIRL            ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 1, true, true ),
135 135
  /**
136 136
   * Directional sinusoidal wave effect. The direction of the wave is given by the 'angle'
137 137
   * parameters. Details: {@link DistortedObject#wave(Data5D,Data2D)}
......
142 142
   * <p>
143 143
   * Unity: amplitude  = 0
144 144
   */
145
  WAVE             ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 5, true ),
145
  WAVE             ( EffectTypes.VERTEX  ,   new float[] {0.0f}           , 5, true, true ),
146 146
  // add new Vertex Effects here...
147 147

  
148 148
 /////////////////////////////////////////////////////////////////////////////////
......
155 155
   * <p>
156 156
   * Unity: transparencyLevel = 1
157 157
   */
158
  ALPHA            ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
158
  ALPHA            ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
159 159
 /**
160 160
   * Make a given Region (partially) transparent.
161 161
   * Effect smoothly fades towards the edges of the region.
......
163 163
   * Uniforms: (transparencyLevel,UNUSED,UNUSED,UNUSED, regionX, regionY, regionRX, regionRY)
164 164
   * Unity: transparencyLevel = 1
165 165
   */
166
  SMOOTH_ALPHA     ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
166
  SMOOTH_ALPHA     ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
167 167
 /**
168 168
   * Blend current color in the texture with a given color.
169 169
   * <p>
......
171 171
   * <p>
172 172
   * Unity: blendLevel = 0
173 173
   */
174
  CHROMA           ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true ),
174
  CHROMA           ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true, false ),
175 175
 /**
176 176
   * Smoothly blend current color in the texture with a given color.
177 177
   * <p>
178 178
   * Uniforms: (blendLevel,colorR,colorG,colorB, regionX, regionY, regionRX, regionRY)
179 179
   * Unity: blendLevel = 0
180 180
   */
181
  SMOOTH_CHROMA    ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true ),
181
  SMOOTH_CHROMA    ( EffectTypes.FRAGMENT,   new float[] {0.0f}           , 4, true, false ),
182 182
 /**
183 183
   * Change brightness level of a given Region.
184 184
   * <p>
......
186 186
   * <p>
187 187
   * Unity: brightnessLevel = 1
188 188
   */
189
  BRIGHTNESS       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
189
  BRIGHTNESS       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
190 190
 /**
191 191
   * Smoothly change brightness level of a given Region.
192 192
   * <p>
......
194 194
   * <p>
195 195
   * Unity: brightnessLevel = 1
196 196
   */
197
  SMOOTH_BRIGHTNESS( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
197
  SMOOTH_BRIGHTNESS( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
198 198
 /**
199 199
   * Change saturation level of a given Region.
200 200
   * <p>
......
202 202
   * <p>
203 203
   * Unity: saturationLevel = 1
204 204
   */
205
  SATURATION       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
205
  SATURATION       ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
206 206
 /**
207 207
   * Smoothly change saturation level of a given Region.
208 208
   * <p>
......
210 210
   * <p>
211 211
   * Unity: saturationLevel = 1
212 212
   */
213
  SMOOTH_SATURATION( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
213
  SMOOTH_SATURATION( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
214 214
 /**
215 215
   * Change contrast level of a given Region.
216 216
   * <p>
......
218 218
   * <p>
219 219
   * Unity: contrastLevel = 1
220 220
   */
221
  CONTRAST         ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true ),
221
  CONTRAST         ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false ),
222 222
 /**
223 223
   * Smoothly change contrast level of a given Region.
224 224
   * <p>
......
226 226
   * <p>
227 227
   * Unity: contrastLevel = 1
228 228
   */
229
  SMOOTH_CONTRAST  ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true );
229
  SMOOTH_CONTRAST  ( EffectTypes.FRAGMENT,   new float[] {1.0f}           , 1, true, false );
230 230
  // add new Fragment effects here...
231 231

  
232 232
///////////////////////////////////////////////////////////////////////////////////////////////////
......
236 236
  private final EffectTypes type;
237 237
  private final float[] unity;
238 238
  private final int dimension;
239
  private final boolean supportsRegion;
240
  
239
  private final boolean supportsR;
240
  private final boolean supportsC;
241

  
241 242
  private static final float[] unities;
242 243
  private static final int[] unityDimensions;
243 244
  private static final int[] dimensions;
244
  private static final boolean[] supports;
245
  private static final boolean[] supportsRegion;
246
  private static final boolean[] supportsCenter;
245 247
  private static final EffectNames[] names;
246 248

  
247 249
  static
......
251 253
    
252 254
    unityDimensions = new int[len];
253 255
    dimensions      = new int[len];
254
    supports        = new boolean[len];
256
    supportsRegion  = new boolean[len];
257
    supportsCenter  = new boolean[len];
255 258
    unities         = new float[MAXDIM*len];
256 259
    names           = new EffectNames[len];
257 260

  
......
259 262
      {
260 263
      unityDimensions[i] = (name.unity==null ? 0 : name.unity.length);
261 264
      dimensions[i]      = name.dimension;
262
      supports[i]        = name.supportsRegion;
265
      supportsRegion[i]  = name.supportsR;
266
      supportsCenter[i]  = name.supportsC;
263 267
      names[i]           = name;
264 268

  
265 269
      switch(unityDimensions[i])
......
277 281
  
278 282
///////////////////////////////////////////////////////////////////////////////////////////////////
279 283
  
280
  EffectNames(EffectTypes type, float[] unity, int dimension, boolean supportsRegion)
284
  EffectNames(EffectTypes type, float[] unity, int dimension, boolean supportsR, boolean supportsC)
281 285
    {
282
    this.type           = type;
283
    this.unity          = unity;
284
    this.dimension      = dimension;
285
    this.supportsRegion = supportsRegion;
286
    this.type      = type;
287
    this.unity     = unity;
288
    this.dimension = dimension;
289
    this.supportsR = supportsR;
290
    this.supportsC = supportsC;
286 291
    }
287 292

  
288 293
///////////////////////////////////////////////////////////////////////////////////////////////////
......
372 377
 * Do we support being masked by a Region?
373 378
 * @return true if the Effect supports being masked with a Region.
374 379
 */
375
  public boolean supportsRegion() { return supports[ordinal()]; }
380
  public boolean supportsRegion() { return supportsRegion[ordinal()]; }
381

  
382
///////////////////////////////////////////////////////////////////////////////////////////////////
383

  
384
/**
385
 * Does this Effect have a center?
386
 * @return true if the Effect has a center.
387
 */
388
  public boolean supportsCenter() { return supportsCenter[ordinal()]; }
376 389

  
377 390
  }

Also available in: Unified diff