1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2016 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Distorted. //
|
5
|
// //
|
6
|
// Distorted is free software: you can redistribute it and/or modify //
|
7
|
// it under the terms of the GNU General Public License as published by //
|
8
|
// the Free Software Foundation, either version 2 of the License, or //
|
9
|
// (at your option) any later version. //
|
10
|
// //
|
11
|
// Distorted is distributed in the hope that it will be useful, //
|
12
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
13
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
14
|
// GNU General Public License for more details. //
|
15
|
// //
|
16
|
// You should have received a copy of the GNU General Public License //
|
17
|
// along with Distorted. If not, see <http://www.gnu.org/licenses/>. //
|
18
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
19
|
|
20
|
package org.distorted.library;
|
21
|
|
22
|
import android.graphics.Bitmap;
|
23
|
import android.opengl.GLES20;
|
24
|
import android.opengl.GLUtils;
|
25
|
|
26
|
import org.distorted.library.message.EffectListener;
|
27
|
import org.distorted.library.type.Data1D;
|
28
|
import org.distorted.library.type.Data3D;
|
29
|
import org.distorted.library.type.Data4D;
|
30
|
import org.distorted.library.type.Dynamic;
|
31
|
import org.distorted.library.type.Dynamic1D;
|
32
|
import org.distorted.library.type.Dynamic2D;
|
33
|
import org.distorted.library.type.Dynamic3D;
|
34
|
import org.distorted.library.type.Dynamic4D;
|
35
|
import org.distorted.library.type.Static1D;
|
36
|
import org.distorted.library.type.Static2D;
|
37
|
import org.distorted.library.type.Static3D;
|
38
|
import org.distorted.library.type.Static4D;
|
39
|
import org.distorted.library.type.DynamicQuat;
|
40
|
|
41
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
42
|
/**
|
43
|
* All Objects to which Distorted Graphics effects can be applied need to be extended from here.
|
44
|
*/
|
45
|
public abstract class DistortedObject
|
46
|
{
|
47
|
private static final Static2D mZero2D = new Static2D(0,0);
|
48
|
private static final Static3D mZero3D = new Static3D(0,0,0);
|
49
|
|
50
|
private static float[] mViewMatrix = new float[16];
|
51
|
|
52
|
protected EffectQueueMatrix mM;
|
53
|
protected EffectQueueFragment mF;
|
54
|
protected EffectQueueVertex mV;
|
55
|
|
56
|
protected boolean matrixCloned, vertexCloned, fragmentCloned;
|
57
|
|
58
|
protected DistortedObjectGrid mGrid = null;
|
59
|
protected long mID;
|
60
|
protected int mSizeX, mSizeY, mSizeZ, mSize; // in screen space
|
61
|
|
62
|
protected Bitmap[] mBmp= null; //
|
63
|
int[] mTextureDataH; // have to be shared among all the cloned Objects
|
64
|
boolean[] mBitmapSet; //
|
65
|
|
66
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
67
|
|
68
|
protected abstract DistortedObject deepCopy(int flags);
|
69
|
|
70
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71
|
|
72
|
protected void initializeData(int size)
|
73
|
{
|
74
|
mID = DistortedObjectList.add(this);
|
75
|
mSize = size;
|
76
|
mTextureDataH = new int[1];
|
77
|
mTextureDataH[0]= 0;
|
78
|
mBmp = new Bitmap[1];
|
79
|
mBmp[0] = null;
|
80
|
mBitmapSet = new boolean[1];
|
81
|
mBitmapSet[0] = false;
|
82
|
|
83
|
initializeEffectLists(this,0);
|
84
|
|
85
|
if( Distorted.isInitialized() ) resetTexture();
|
86
|
}
|
87
|
|
88
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
89
|
|
90
|
protected void initializeEffectLists(DistortedObject d, int flags)
|
91
|
{
|
92
|
if( (flags & Distorted.CLONE_PRESHADER) != 0 )
|
93
|
{
|
94
|
mM = d.mM;
|
95
|
matrixCloned = true;
|
96
|
}
|
97
|
else
|
98
|
{
|
99
|
mM = new EffectQueueMatrix(d);
|
100
|
matrixCloned = false;
|
101
|
}
|
102
|
|
103
|
if( (flags & Distorted.CLONE_VERTEX) != 0 )
|
104
|
{
|
105
|
mV = d.mV;
|
106
|
vertexCloned = true;
|
107
|
}
|
108
|
else
|
109
|
{
|
110
|
mV = new EffectQueueVertex(d);
|
111
|
vertexCloned = false;
|
112
|
}
|
113
|
|
114
|
if( (flags & Distorted.CLONE_FRAGMENT) != 0 )
|
115
|
{
|
116
|
mF = d.mF;
|
117
|
fragmentCloned = true;
|
118
|
}
|
119
|
else
|
120
|
{
|
121
|
mF = new EffectQueueFragment(d);
|
122
|
fragmentCloned = false;
|
123
|
}
|
124
|
}
|
125
|
|
126
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
127
|
// this will be called on startup and every time OpenGL context has been lost
|
128
|
// also call this from the constructor if the OpenGL context has been created already.
|
129
|
|
130
|
void resetTexture()
|
131
|
{
|
132
|
if( mTextureDataH!=null )
|
133
|
{
|
134
|
if( mTextureDataH[0]==0 ) GLES20.glGenTextures(1, mTextureDataH, 0);
|
135
|
|
136
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);
|
137
|
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER, GLES20.GL_LINEAR );
|
138
|
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MAG_FILTER, GLES20.GL_LINEAR );
|
139
|
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S, GLES20.GL_CLAMP_TO_EDGE );
|
140
|
GLES20.glTexParameteri ( GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T, GLES20.GL_CLAMP_TO_EDGE );
|
141
|
|
142
|
if( mBmp!=null && mBmp[0]!=null)
|
143
|
{
|
144
|
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, mBmp[0], 0);
|
145
|
mBmp[0] = null;
|
146
|
}
|
147
|
}
|
148
|
}
|
149
|
|
150
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
151
|
|
152
|
void drawPriv(long currTime, DistortedProjection dp)
|
153
|
{
|
154
|
GLES20.glViewport(0, 0, dp.width, dp.height);
|
155
|
|
156
|
mM.compute(currTime);
|
157
|
mM.send(mViewMatrix, dp);
|
158
|
|
159
|
mV.compute(currTime);
|
160
|
mV.postprocess();
|
161
|
mV.send();
|
162
|
|
163
|
mF.compute(currTime);
|
164
|
mF.postprocess(mViewMatrix);
|
165
|
mF.send();
|
166
|
|
167
|
mGrid.draw();
|
168
|
}
|
169
|
|
170
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
171
|
|
172
|
void drawNoEffectsPriv(DistortedProjection dp)
|
173
|
{
|
174
|
GLES20.glViewport(0, 0, dp.width, dp.height);
|
175
|
mM.sendNoEffects(dp);
|
176
|
mV.sendZero();
|
177
|
mF.sendZero();
|
178
|
mGrid.draw();
|
179
|
}
|
180
|
|
181
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
182
|
|
183
|
void releasePriv()
|
184
|
{
|
185
|
if( matrixCloned ==false) mM.abortAll();
|
186
|
if( vertexCloned ==false) mV.abortAll();
|
187
|
if( fragmentCloned==false) mF.abortAll();
|
188
|
|
189
|
mBmp = null;
|
190
|
mGrid = null;
|
191
|
mM = null;
|
192
|
mV = null;
|
193
|
mF = null;
|
194
|
mTextureDataH = null;
|
195
|
}
|
196
|
|
197
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
198
|
|
199
|
long getBitmapID()
|
200
|
{
|
201
|
return mBmp==null ? 0 : mBmp.hashCode();
|
202
|
}
|
203
|
|
204
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
205
|
|
206
|
/**
|
207
|
* Default empty constructor so that derived classes can call it
|
208
|
*/
|
209
|
public DistortedObject()
|
210
|
{
|
211
|
|
212
|
}
|
213
|
|
214
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
215
|
/**
|
216
|
* Copy constructor used to create a DistortedObject based on various parts of another object.
|
217
|
* <p>
|
218
|
* Whatever we do not clone gets created just like in the default constructor.
|
219
|
* We only call this from the descendant's classes' constructors where we have to pay attention
|
220
|
* to give it the appropriate type of a DistortedObject!
|
221
|
*
|
222
|
* @param dc Source object to create our object from
|
223
|
* @param flags A bitmask of values specifying what to copy.
|
224
|
* For example, CLONE_BITMAP | CLONE_MATRIX.
|
225
|
*/
|
226
|
public DistortedObject(DistortedObject dc, int flags)
|
227
|
{
|
228
|
initializeEffectLists(dc,flags);
|
229
|
|
230
|
mID = DistortedObjectList.add(this);
|
231
|
|
232
|
mSizeX = dc.mSizeX;
|
233
|
mSizeY = dc.mSizeY;
|
234
|
mSizeZ = dc.mSizeZ;
|
235
|
mSize = dc.mSize;
|
236
|
mGrid = dc.mGrid;
|
237
|
|
238
|
if( (flags & Distorted.CLONE_BITMAP) != 0 )
|
239
|
{
|
240
|
mTextureDataH = dc.mTextureDataH;
|
241
|
mBmp = dc.mBmp;
|
242
|
mBitmapSet = dc.mBitmapSet;
|
243
|
}
|
244
|
else
|
245
|
{
|
246
|
mTextureDataH = new int[1];
|
247
|
mTextureDataH[0]= 0;
|
248
|
mBitmapSet = new boolean[1];
|
249
|
mBitmapSet[0] = false;
|
250
|
mBmp = new Bitmap[1];
|
251
|
mBmp[0] = null;
|
252
|
|
253
|
if( Distorted.isInitialized() ) resetTexture();
|
254
|
}
|
255
|
}
|
256
|
|
257
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
258
|
/**
|
259
|
* Draw the DistortedObject to the location specified by current Matrix effects.
|
260
|
*
|
261
|
* @param currTime current time, in milliseconds, as returned by System.currentTimeMillis().
|
262
|
* This gets passed on to Interpolators inside the Effects that are currently applied to the
|
263
|
* Object.
|
264
|
*/
|
265
|
public void draw(long currTime)
|
266
|
{
|
267
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
268
|
GLES20.glBindFramebuffer(GLES20.GL_FRAMEBUFFER, 0);
|
269
|
GLES20.glUniform1i(Distorted.mTextureUniformH, 0);
|
270
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);
|
271
|
|
272
|
drawPriv(currTime, Distorted.mProjection);
|
273
|
}
|
274
|
|
275
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
276
|
/**
|
277
|
* Releases all resources.
|
278
|
*/
|
279
|
public synchronized void release()
|
280
|
{
|
281
|
releasePriv();
|
282
|
DistortedObjectList.remove(this);
|
283
|
}
|
284
|
|
285
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
286
|
/**
|
287
|
* Sets the underlying android.graphics.Bitmap object and uploads it to the GPU.
|
288
|
* <p>
|
289
|
* You can only recycle() the passed Bitmap once the OpenGL context gets created (i.e. after call
|
290
|
* to onSurfaceCreated) because only after this point can the Library upload it to the GPU!
|
291
|
*
|
292
|
* @param bmp The android.graphics.Bitmap object to apply effects to and display.
|
293
|
*/
|
294
|
|
295
|
public void setBitmap(Bitmap bmp)
|
296
|
{
|
297
|
mBitmapSet[0] = true;
|
298
|
|
299
|
if( Distorted.isInitialized() )
|
300
|
{
|
301
|
GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
|
302
|
GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureDataH[0]);
|
303
|
GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bmp, 0);
|
304
|
}
|
305
|
else
|
306
|
{
|
307
|
mBmp[0] = bmp;
|
308
|
}
|
309
|
}
|
310
|
|
311
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
312
|
/**
|
313
|
* Adds the calling class to the list of Listeners that get notified each time some event happens
|
314
|
* to one of the Effects that are currently applied to the DistortedObject.
|
315
|
*
|
316
|
* @param el A class implementing the EffectListener interface that wants to get notifications.
|
317
|
*/
|
318
|
public void addEventListener(EffectListener el)
|
319
|
{
|
320
|
mV.addListener(el);
|
321
|
mF.addListener(el);
|
322
|
mM.addListener(el);
|
323
|
}
|
324
|
|
325
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
326
|
/**
|
327
|
* Removes the calling class from the list of Listeners.
|
328
|
*
|
329
|
* @param el A class implementing the EffectListener interface that no longer wants to get notifications.
|
330
|
*/
|
331
|
public void removeEventListener(EffectListener el)
|
332
|
{
|
333
|
mV.removeListener(el);
|
334
|
mF.removeListener(el);
|
335
|
mM.removeListener(el);
|
336
|
}
|
337
|
|
338
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
339
|
/**
|
340
|
* Returns the height of the DistortedObject.
|
341
|
*
|
342
|
* @return height of the object, in pixels.
|
343
|
*/
|
344
|
public int getWidth()
|
345
|
{
|
346
|
return mSizeX;
|
347
|
}
|
348
|
|
349
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
350
|
/**
|
351
|
* Returns the width of the DistortedObject.
|
352
|
*
|
353
|
* @return width of the Object, in pixels.
|
354
|
*/
|
355
|
public int getHeight()
|
356
|
{
|
357
|
return mSizeY;
|
358
|
}
|
359
|
|
360
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
361
|
/**
|
362
|
* Returns the depth of the DistortedObject.
|
363
|
*
|
364
|
* @return depth of the Object, in pixels.
|
365
|
*/
|
366
|
public int getDepth()
|
367
|
{
|
368
|
return mSizeZ;
|
369
|
}
|
370
|
|
371
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
372
|
/**
|
373
|
* Returns unique ID of this instance.
|
374
|
*
|
375
|
* @return ID of the object.
|
376
|
*/
|
377
|
public long getID()
|
378
|
{
|
379
|
return mID;
|
380
|
}
|
381
|
|
382
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
383
|
/**
|
384
|
* Aborts all Effects.
|
385
|
* @return Number of effects aborted.
|
386
|
*/
|
387
|
public int abortAllEffects()
|
388
|
{
|
389
|
return mM.abortAll() + mV.abortAll() + mF.abortAll();
|
390
|
}
|
391
|
|
392
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
393
|
/**
|
394
|
* Aborts all Effects of a given type, for example all MATRIX Effects.
|
395
|
*
|
396
|
* @param type one of the constants defined in {@link EffectTypes}
|
397
|
* @return Number of effects aborted.
|
398
|
*/
|
399
|
public int abortEffects(EffectTypes type)
|
400
|
{
|
401
|
switch(type)
|
402
|
{
|
403
|
case MATRIX : return mM.abortAll();
|
404
|
case VERTEX : return mV.abortAll();
|
405
|
case FRAGMENT: return mF.abortAll();
|
406
|
default : return 0;
|
407
|
}
|
408
|
}
|
409
|
|
410
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
411
|
/**
|
412
|
* Aborts a single Effect.
|
413
|
*
|
414
|
* @param id ID of the Effect we want to abort.
|
415
|
* @return number of Effects aborted. Always either 0 or 1.
|
416
|
*/
|
417
|
public int abortEffect(long id)
|
418
|
{
|
419
|
int type = (int)(id&EffectTypes.MASK);
|
420
|
|
421
|
if( type==EffectTypes.MATRIX.type ) return mM.removeByID(id>>EffectTypes.LENGTH);
|
422
|
if( type==EffectTypes.VERTEX.type ) return mV.removeByID(id>>EffectTypes.LENGTH);
|
423
|
if( type==EffectTypes.FRAGMENT.type ) return mF.removeByID(id>>EffectTypes.LENGTH);
|
424
|
|
425
|
return 0;
|
426
|
}
|
427
|
|
428
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
429
|
/**
|
430
|
* Abort all Effects of a given type, for example all rotations.
|
431
|
*
|
432
|
* @param name one of the constants defined in {@link EffectNames}
|
433
|
* @return number of Effects aborted.
|
434
|
*/
|
435
|
public int abortEffects(EffectNames name)
|
436
|
{
|
437
|
switch(name.getType())
|
438
|
{
|
439
|
case MATRIX : return mM.removeByType(name);
|
440
|
case VERTEX : return mV.removeByType(name);
|
441
|
case FRAGMENT: return mF.removeByType(name);
|
442
|
default : return 0;
|
443
|
}
|
444
|
}
|
445
|
|
446
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
447
|
/**
|
448
|
* Print some info about a given Effect to Android's standard out. Used for debugging only.
|
449
|
*
|
450
|
* @param id Effect ID we want to print info about
|
451
|
* @return <code>true</code> if a single Effect of type effectType has been found.
|
452
|
*/
|
453
|
|
454
|
public boolean printEffect(long id)
|
455
|
{
|
456
|
int type = (int)(id&EffectTypes.MASK);
|
457
|
|
458
|
if( type==EffectTypes.MATRIX.type ) return mM.printByID(id>>EffectTypes.LENGTH);
|
459
|
if( type==EffectTypes.VERTEX.type ) return mV.printByID(id>>EffectTypes.LENGTH);
|
460
|
if( type==EffectTypes.FRAGMENT.type ) return mF.printByID(id>>EffectTypes.LENGTH);
|
461
|
|
462
|
return false;
|
463
|
}
|
464
|
|
465
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
466
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
467
|
// Individual effect functions.
|
468
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
469
|
// Matrix-based effects
|
470
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
471
|
/**
|
472
|
* Moves the Object by a vector that changes in time as interpolated by the Dynamic.
|
473
|
*
|
474
|
* @param vector 3-dimensional Data which at any given time will return a Static3D
|
475
|
* representing the current coordinates of the vector we want to move the Object with.
|
476
|
* @return ID of the effect added, or -1 if we failed to add one.
|
477
|
*/
|
478
|
public long move(Data3D vector)
|
479
|
{
|
480
|
return mM.add(EffectNames.MOVE,vector);
|
481
|
}
|
482
|
|
483
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
484
|
/**
|
485
|
* Scales the Object by factors that change in time as returned by the Dynamic.
|
486
|
*
|
487
|
* @param scale 3-dimensional Dynamic which at any given time returns a Static3D
|
488
|
* representing the current x- , y- and z- scale factors.
|
489
|
* @return ID of the effect added, or -1 if we failed to add one.
|
490
|
*/
|
491
|
public long scale(Data3D scale)
|
492
|
{
|
493
|
return mM.add(EffectNames.SCALE,scale);
|
494
|
}
|
495
|
|
496
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
497
|
/**
|
498
|
* Rotates the Object by 'angle' degrees around the center.
|
499
|
* Static axis of rotation is given by the last parameter.
|
500
|
*
|
501
|
* @param center Coordinates of the Point we are rotating around.
|
502
|
* @param angle Angle that we want to rotate the Object to. Unit: degrees
|
503
|
* @param axis Axis of rotation
|
504
|
* @return ID of the effect added, or -1 if we failed to add one.
|
505
|
*/
|
506
|
public long rotate(Data3D center, Data1D angle, Static3D axis)
|
507
|
{
|
508
|
return mM.add(EffectNames.ROTATE, center, angle, axis);
|
509
|
}
|
510
|
|
511
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
512
|
/**
|
513
|
* Rotates the Object by 'angle' degrees around the center.
|
514
|
* Static axis of rotation is given by the last parameter.
|
515
|
*
|
516
|
* @param center Coordinates of the Point we are rotating around.
|
517
|
* @param angleaxis Combined 4-tuple representing the (angle,axisX,axisY,axisZ).
|
518
|
* @return ID of the effect added, or -1 if we failed to add one.
|
519
|
*/
|
520
|
public long rotate(Data3D center, Data4D angleaxis)
|
521
|
{
|
522
|
return mM.add(EffectNames.ROTATE, center, angleaxis);
|
523
|
}
|
524
|
|
525
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
526
|
/**
|
527
|
* Rotates the Object by quaternion.
|
528
|
*
|
529
|
* @param center Coordinates of the Point we are rotating around.
|
530
|
* @param quaternion The quaternion describing the rotation.
|
531
|
* @return ID of the effect added, or -1 if we failed to add one.
|
532
|
*/
|
533
|
public long quaternion(Data3D center, Data4D quaternion)
|
534
|
{
|
535
|
return mM.add(EffectNames.QUATERNION,center,quaternion);
|
536
|
}
|
537
|
|
538
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
539
|
/**
|
540
|
* Shears the Object.
|
541
|
*
|
542
|
* @param center Center of shearing, i.e. the point which stays unmoved.
|
543
|
* @param shear The 3-tuple of shear factors.
|
544
|
* @return ID of the effect added, or -1 if we failed to add one.
|
545
|
*/
|
546
|
public long shear(Data3D center, Data3D shear)
|
547
|
{
|
548
|
return mM.add(EffectNames.SHEAR, center, shear);
|
549
|
}
|
550
|
|
551
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
552
|
// Fragment-based effects
|
553
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
554
|
// MACROBLOCK
|
555
|
/**
|
556
|
* Creates macroblocks at and around point defined by the Dynamic2D and the Region.
|
557
|
* Size of the macroblocks at any given time is returned by the Dynamic1D.
|
558
|
*
|
559
|
* @param size 1-dimensional Dynamic which, at any given time, returns the size of the macroblocks.
|
560
|
* @param region Region this Effect is limited to.
|
561
|
* Null here means 'apply the effect to the whole Object'.
|
562
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing the
|
563
|
* current center of the effect.
|
564
|
* @return ID of the effect added, or -1 if we failed to add one.
|
565
|
*/
|
566
|
public long macroblock(Dynamic1D size, Static4D region, Dynamic2D center)
|
567
|
{
|
568
|
return mF.add(EffectNames.MACROBLOCK, size, region, center);
|
569
|
}
|
570
|
|
571
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
572
|
/**
|
573
|
* Creates macroblocks at and around point defined by the Point2D and the Region.
|
574
|
* Size of the macroblocks at any given time is returned by the Dynamic1D.
|
575
|
* <p>
|
576
|
* The difference between this and the previous method is that here the center of the Effect stays constant.
|
577
|
*
|
578
|
* @param size 1-dimensional Dynamic which, at any given time, returns the size of the macroblocks.
|
579
|
* @param region Region this Effect is limited to.
|
580
|
* Null here means 'apply the effect to the whole Object'.
|
581
|
* @param center Center of the Effect.
|
582
|
* @return ID of the effect added, or -1 if we failed to add one.
|
583
|
*/
|
584
|
public long macroblock(Dynamic1D size, Static4D region, Static2D center)
|
585
|
{
|
586
|
return mF.add(EffectNames.MACROBLOCK, size, region, center);
|
587
|
}
|
588
|
|
589
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
590
|
/**
|
591
|
* Creates macroblocks at and around point defined by the Dynamic2D and the Region.
|
592
|
* <p>
|
593
|
* The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds
|
594
|
* they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
|
595
|
* size is 1X1, i.e. 1 pixel).
|
596
|
*
|
597
|
* @param pixels Maximum size, in pixels, of the Macroblocks we want to see.
|
598
|
* @param region Region this Effect is limited to.
|
599
|
* Null here means 'apply the effect to the whole Object'.
|
600
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing the
|
601
|
* current center of the effect.
|
602
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
603
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
604
|
* @return ID of the effect added, or -1 if we failed to add one.
|
605
|
*/
|
606
|
public long macroblock(int pixels, Static4D region, Dynamic2D center, int duration, float count)
|
607
|
{
|
608
|
Dynamic1D di = new Dynamic1D();
|
609
|
di.setCount(count);
|
610
|
di.setDuration(duration);
|
611
|
di.add(new Static1D(1));
|
612
|
di.add(new Static1D(pixels));
|
613
|
|
614
|
return mF.add(EffectNames.MACROBLOCK, di, region, center);
|
615
|
}
|
616
|
|
617
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
618
|
/**
|
619
|
* Creates macroblocks at and around point defined by the Point2D and the Region.
|
620
|
* <p>
|
621
|
* The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds
|
622
|
* they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
|
623
|
* size is 1X1, i.e. 1 pixel).
|
624
|
* <p>
|
625
|
* The difference between this and the previous method is that here the center of the Effect stays constant.
|
626
|
*
|
627
|
* @param pixels Maximum size, in pixels, of the Macroblocks we want to see.
|
628
|
* @param region Region this Effect is limited to.
|
629
|
* Null here means 'apply the effect to the whole Object'.
|
630
|
* @param center Center of the Effect.
|
631
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
632
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
633
|
* @return ID of the effect added, or -1 if we failed to add one.
|
634
|
*/
|
635
|
public long macroblock(int pixels, Static4D region, Static2D center, int duration, float count)
|
636
|
{
|
637
|
Dynamic1D di = new Dynamic1D();
|
638
|
di.setCount(count);
|
639
|
di.setDuration(duration);
|
640
|
di.add(new Static1D(1));
|
641
|
di.add(new Static1D(pixels));
|
642
|
|
643
|
return mF.add(EffectNames.MACROBLOCK, di, region, center);
|
644
|
}
|
645
|
|
646
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
647
|
/**
|
648
|
* Creates macroblocks on the whole Object.
|
649
|
* <p>
|
650
|
* The macroblocks change in size; at time 0 there are none, and after 'duration/2' milliseconds
|
651
|
* they are of (pixels X pixels) size; after 'duration' milliseconds there are again none (i.e. their
|
652
|
* size is 1X1, i.e. 1 pixel).
|
653
|
* <p>
|
654
|
* The difference between this and the previous method is that here there is no masking Region; thus
|
655
|
* there is also no center of the Effect.
|
656
|
*
|
657
|
* @param pixels Maximum size, in pixels, of the Macroblocks we want to see.
|
658
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
659
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
660
|
* @return ID of the effect added, or -1 if we failed to add one.
|
661
|
*/
|
662
|
public long macroblock(int pixels, int duration, float count)
|
663
|
{
|
664
|
Dynamic1D di = new Dynamic1D();
|
665
|
di.setCount(count);
|
666
|
di.setDuration(duration);
|
667
|
di.add(new Static1D(1));
|
668
|
di.add(new Static1D(pixels));
|
669
|
|
670
|
return mF.add(EffectNames.MACROBLOCK, di, null, mZero2D);
|
671
|
}
|
672
|
|
673
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
674
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
675
|
// CHROMA
|
676
|
/**
|
677
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
678
|
*
|
679
|
* @param blend 1-dimensional Dynamic that returns the level of blend a given pixel will be
|
680
|
* mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
|
681
|
* @param color Color to mix. (1,0,0) is RED.
|
682
|
* @param region Region this Effect is limited to.
|
683
|
* Null here means 'apply the Effect to the whole Object'.
|
684
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing
|
685
|
* the current center of the effect.
|
686
|
* @return ID of the effect added, or -1 if we failed to add one.
|
687
|
*/
|
688
|
public long chroma(Dynamic1D blend, Static3D color, Static4D region, Dynamic2D center)
|
689
|
{
|
690
|
return mF.add(EffectNames.CHROMA, blend, color, region, center);
|
691
|
}
|
692
|
|
693
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
694
|
/**
|
695
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
696
|
* <p>
|
697
|
* Here the center of the Effect stays constant.
|
698
|
*
|
699
|
* @param blend 1-dimensional Dynamic that returns the level of blend a given pixel will be
|
700
|
* mixed with the next parameter 'color': pixel = (1-level)*pixel + level*color
|
701
|
* @param color Color to mix. (1,0,0) is RED.
|
702
|
* @param region Region this Effect is limited to.
|
703
|
* Null here means 'apply the Effect to the whole Object'.
|
704
|
* @param center Center of the Effect.
|
705
|
* @return ID of the effect added, or -1 if we failed to add one.
|
706
|
*/
|
707
|
public long chroma(Dynamic1D blend, Static3D color, Static4D region, Static2D center)
|
708
|
{
|
709
|
return mF.add(EffectNames.CHROMA, blend, color, region, center);
|
710
|
}
|
711
|
|
712
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
713
|
/**
|
714
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
715
|
*
|
716
|
* @param blend Level of blend a given pixel will be mixed with the next parameter 'color':
|
717
|
* pixel = (1-t)*pixel + t*color
|
718
|
* @param color Color to mix. (1,0,0) is RED.
|
719
|
* @param region Region this Effect is limited to.
|
720
|
* Null here means 'apply the Effect to the whole Object'.
|
721
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing the
|
722
|
* current center of the effect.
|
723
|
* @return ID of the effect added, or -1 if we failed to add one.
|
724
|
*/
|
725
|
public long chroma(float blend, Static3D color, Static4D region, Dynamic2D center)
|
726
|
{
|
727
|
return mF.add(EffectNames.CHROMA, blend, color, region, center);
|
728
|
}
|
729
|
|
730
|
///// //////////////////////////////////////////////////////////////////////////////////////////////
|
731
|
/**
|
732
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
733
|
* <p>
|
734
|
* Here the center of the Effect stays constant.
|
735
|
*
|
736
|
* @param blend Level of blend a given pixel will be mixed with the next parameter 'color':
|
737
|
* pixel = (1-t)*pixel + t*color
|
738
|
* @param color Color to mix. (1,0,0) is RED.
|
739
|
* @param region The Region this Effect is limited to.
|
740
|
* Null here means 'apply the Effect to the whole Object'.
|
741
|
* @param center Center of the Effect.
|
742
|
* @return ID of the effect added, or -1 if we failed to add one.
|
743
|
*/
|
744
|
public long chroma(float blend, Static3D color, Static4D region, Static2D center)
|
745
|
{
|
746
|
return mF.add(EffectNames.CHROMA, blend, color, region, center);
|
747
|
}
|
748
|
|
749
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
750
|
/**
|
751
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
752
|
* <p>
|
753
|
* Here the Effect applies to the whole Object.
|
754
|
*
|
755
|
* @param blend Level of blend a given pixel will be mixed with the next parameter 'color':
|
756
|
* pixel = (1-t)*pixel + t*color
|
757
|
* @param color Color to mix. (1,0,0) is RED.
|
758
|
* @return ID of the effect added, or -1 if we failed to add one.
|
759
|
*/
|
760
|
public long chroma(float blend, Static3D color)
|
761
|
{
|
762
|
return mF.add(EffectNames.CHROMA, blend, color, null, mZero2D);
|
763
|
}
|
764
|
|
765
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
766
|
/**
|
767
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
768
|
*
|
769
|
* See {@link #chroma(Dynamic1D, Static3D, Static4D, Dynamic2D)}
|
770
|
*/
|
771
|
public long smooth_chroma(Dynamic1D blend, Static3D color, Static4D region, Dynamic2D center)
|
772
|
{
|
773
|
return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
|
774
|
}
|
775
|
|
776
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
777
|
/**
|
778
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
779
|
*
|
780
|
* See {@link #chroma(Dynamic1D, Static3D, Static4D, Static2D)}
|
781
|
*/
|
782
|
public long smooth_chroma(Dynamic1D blend, Static3D color, Static4D region, Static2D center)
|
783
|
{
|
784
|
return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
|
785
|
}
|
786
|
|
787
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
788
|
/**
|
789
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
790
|
*
|
791
|
* See {@link #chroma(float, Static3D, Static4D, Dynamic2D)}
|
792
|
*/
|
793
|
public long smooth_chroma(float blend, Static3D color, Static4D region, Dynamic2D center)
|
794
|
{
|
795
|
return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
|
796
|
}
|
797
|
|
798
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
799
|
/**
|
800
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
801
|
*
|
802
|
* See {@link #chroma(float, Static3D, Static4D, Static2D)}
|
803
|
*/
|
804
|
public long smooth_chroma(float blend, Static3D color, Static4D region, Static2D center)
|
805
|
{
|
806
|
return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, region, center);
|
807
|
}
|
808
|
|
809
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
810
|
/**
|
811
|
* Makes a certain sub-region of the Object smoothly change all three of its RGB components.
|
812
|
*
|
813
|
* See {@link #chroma(float, Static3D)}
|
814
|
*/
|
815
|
public long smooth_chroma(float blend, Static3D color)
|
816
|
{
|
817
|
return mF.add(EffectNames.SMOOTH_CHROMA, blend, color, null, mZero2D);
|
818
|
}
|
819
|
|
820
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
821
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
822
|
// ALPHA
|
823
|
/**
|
824
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
825
|
*
|
826
|
* @param alpha 1-dimensional Dynamic that returns the level of transparency we want to have at any given
|
827
|
* moment.
|
828
|
* @param region Region this Effect is limited to.
|
829
|
* Null here means 'apply the Effect to the whole Object'.
|
830
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing the
|
831
|
* current center of the effect.
|
832
|
* @return ID of the effect added, or -1 if we failed to add one.
|
833
|
*/
|
834
|
public long alpha(Dynamic1D alpha, Static4D region, Dynamic2D center)
|
835
|
{
|
836
|
return mF.add(EffectNames.ALPHA, alpha, region, center);
|
837
|
}
|
838
|
|
839
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
840
|
/**
|
841
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
842
|
* <p>
|
843
|
* Here the center of the Effect stays constant.
|
844
|
*
|
845
|
* @param alpha 1-dimensional Dynamic that returns the level of transparency we want to have at any given
|
846
|
* moment.
|
847
|
* @param region Region this Effect is limited to.
|
848
|
* Null here means 'apply the Effect to the whole Object'.
|
849
|
* @param center Center of the Effect.
|
850
|
* @return ID of the effect added, or -1 if we failed to add one.
|
851
|
*/
|
852
|
public long alpha(Dynamic1D alpha, Static4D region, Static2D center)
|
853
|
{
|
854
|
return mF.add(EffectNames.ALPHA, alpha, region, center);
|
855
|
}
|
856
|
|
857
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
858
|
/**
|
859
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
860
|
*
|
861
|
* @param alpha Level of Alpha (between 0 and 1) we want to interpolate to.
|
862
|
* @param region Region this Effect is limited to.
|
863
|
* Null here means 'apply the Effect to the whole Object'.
|
864
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing the
|
865
|
* current center of the effect.
|
866
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
867
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
868
|
* @return ID of the effect added, or -1 if we failed to add one.
|
869
|
*/
|
870
|
public long alpha(float alpha, Static4D region, Dynamic2D center, int duration, float count)
|
871
|
{
|
872
|
Dynamic1D di = new Dynamic1D();
|
873
|
di.setCount(count);
|
874
|
di.setDuration(duration);
|
875
|
di.add(new Static1D(1));
|
876
|
di.add(new Static1D(alpha));
|
877
|
|
878
|
return mF.add(EffectNames.ALPHA, di, region, center);
|
879
|
}
|
880
|
|
881
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
882
|
/**
|
883
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
884
|
* <p>
|
885
|
* Here the center of the Effect stays constant.
|
886
|
*
|
887
|
* @param alpha Level of Alpha (between 0 and 1) we want to interpolate to.
|
888
|
* @param region Region this Effect is limited to.
|
889
|
* Null here means 'apply the Effect to the whole Object'.
|
890
|
* @param center Center of the Effect.
|
891
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
892
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
893
|
* @return ID of the effect added, or -1 if we failed to add one.
|
894
|
*/
|
895
|
public long alpha(float alpha, Static4D region, Static2D center, int duration, float count)
|
896
|
{
|
897
|
Dynamic1D di = new Dynamic1D();
|
898
|
di.setCount(count);
|
899
|
di.setDuration(duration);
|
900
|
di.add(new Static1D(1));
|
901
|
di.add(new Static1D(alpha));
|
902
|
|
903
|
return mF.add(EffectNames.ALPHA, di, region, center);
|
904
|
}
|
905
|
|
906
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
907
|
/**
|
908
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
909
|
* <p>
|
910
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
911
|
*
|
912
|
* @param alpha Level of Alpha (between 0 and 1) we want to interpolate to.
|
913
|
* @param region Region this Effect is limited to.
|
914
|
* Null here means 'apply the Effect to the whole Object'.
|
915
|
* @param center Center of the Effect.
|
916
|
* @return ID of the effect added, or -1 if we failed to add one.
|
917
|
*/
|
918
|
public long alpha(float alpha, Static4D region, Static2D center)
|
919
|
{
|
920
|
Dynamic1D di = new Dynamic1D();
|
921
|
di.setCount(0.5f);
|
922
|
di.setDuration(0);
|
923
|
di.add(new Static1D(1));
|
924
|
di.add(new Static1D(alpha));
|
925
|
|
926
|
return mF.add(EffectNames.ALPHA, di, region, center);
|
927
|
}
|
928
|
|
929
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
930
|
/**
|
931
|
* Makes the whole Object change its transparency level.
|
932
|
*
|
933
|
* @param alpha Level of Alpha (between 0 and 1) we want to interpolate to.
|
934
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
935
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
936
|
* @return ID of the effect added, or -1 if we failed to add one.
|
937
|
*/
|
938
|
public long alpha(float alpha, int duration, float count)
|
939
|
{
|
940
|
Dynamic1D di = new Dynamic1D();
|
941
|
di.setCount(count);
|
942
|
di.setDuration(duration);
|
943
|
di.add(new Static1D(1));
|
944
|
di.add(new Static1D(alpha));
|
945
|
|
946
|
return mF.add(EffectNames.ALPHA, di,null, mZero2D);
|
947
|
}
|
948
|
|
949
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
950
|
/**
|
951
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
952
|
*
|
953
|
* See {@link #alpha(Dynamic1D, Static4D, Dynamic2D)}
|
954
|
*/
|
955
|
public long smooth_alpha(Dynamic1D alpha, Static4D region, Dynamic2D center)
|
956
|
{
|
957
|
return mF.add(EffectNames.SMOOTH_ALPHA, alpha, region, center);
|
958
|
}
|
959
|
|
960
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
961
|
/**
|
962
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
963
|
*
|
964
|
* See {@link #alpha(Dynamic1D, Static4D, Static2D)}
|
965
|
*/
|
966
|
public long smooth_alpha(Dynamic1D alpha, Static4D region, Static2D center)
|
967
|
{
|
968
|
return mF.add(EffectNames.SMOOTH_ALPHA, alpha, region, center);
|
969
|
}
|
970
|
|
971
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
972
|
/**
|
973
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
974
|
*
|
975
|
* See {@link #alpha(float, Static4D, Dynamic2D, int, float)}
|
976
|
*/
|
977
|
public long smooth_alpha(float alpha, Static4D region, Dynamic2D center, int duration, float count)
|
978
|
{
|
979
|
Dynamic1D di = new Dynamic1D();
|
980
|
di.setCount(count);
|
981
|
di.setDuration(duration);
|
982
|
di.add(new Static1D(1));
|
983
|
di.add(new Static1D(alpha));
|
984
|
|
985
|
return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
|
986
|
}
|
987
|
|
988
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
989
|
/**
|
990
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
991
|
*
|
992
|
* See {@link #alpha(float, Static4D, Static2D, int, float)}
|
993
|
*/
|
994
|
public long smooth_alpha(float alpha, Static4D region, Static2D center, int duration, float count)
|
995
|
{
|
996
|
Dynamic1D di = new Dynamic1D();
|
997
|
di.setCount(count);
|
998
|
di.setDuration(duration);
|
999
|
di.add(new Static1D(1));
|
1000
|
di.add(new Static1D(alpha));
|
1001
|
|
1002
|
return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
|
1003
|
}
|
1004
|
|
1005
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1006
|
/**
|
1007
|
* Makes a certain sub-region of the Object smoothly change its transparency level.
|
1008
|
*
|
1009
|
* See {@link #alpha(float, Static4D, Static2D)}
|
1010
|
*/
|
1011
|
public long smooth_alpha(float alpha, Static4D region, Static2D center)
|
1012
|
{
|
1013
|
Dynamic1D di = new Dynamic1D();
|
1014
|
di.setCount(0.5f);
|
1015
|
di.setDuration(0);
|
1016
|
di.add(new Static1D(1));
|
1017
|
di.add(new Static1D(alpha));
|
1018
|
|
1019
|
return mF.add(EffectNames.SMOOTH_ALPHA, di, region, center);
|
1020
|
}
|
1021
|
|
1022
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1023
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1024
|
// BRIGHTNESS
|
1025
|
/**
|
1026
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1027
|
*
|
1028
|
* @param brightness 1-dimensional Dynamic that returns the level of brightness we want to have
|
1029
|
* at any given moment.
|
1030
|
* @param region Region this Effect is limited to.
|
1031
|
* Null here means 'apply the Effect to the whole Object'.
|
1032
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D representing
|
1033
|
* the current center of the effect.
|
1034
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1035
|
*/
|
1036
|
public long brightness(Dynamic1D brightness, Static4D region, Dynamic2D center)
|
1037
|
{
|
1038
|
return mF.add(EffectNames.BRIGHTNESS, brightness, region, center);
|
1039
|
}
|
1040
|
|
1041
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1042
|
/**
|
1043
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1044
|
* <p>
|
1045
|
* Here the center of the Effect stays constant.
|
1046
|
*
|
1047
|
* @param brightness 1-dimensional Dynamic that returns the level of brightness we want to have
|
1048
|
* at any given moment.
|
1049
|
* @param region Region this Effect is limited to.
|
1050
|
* Null here means 'apply the Effect to the whole Object'.
|
1051
|
* @param center Center of the Effect.
|
1052
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1053
|
*/
|
1054
|
public long brightness(Dynamic1D brightness, Static4D region, Static2D center)
|
1055
|
{
|
1056
|
return mF.add(EffectNames.BRIGHTNESS, brightness, region, center);
|
1057
|
}
|
1058
|
|
1059
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1060
|
/**
|
1061
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1062
|
*
|
1063
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1064
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1065
|
* anything more than 1- lighten it up.
|
1066
|
* @param region Region this Effect is limited to.
|
1067
|
* Null here means 'apply the Effect to the whole Object'.
|
1068
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1069
|
* representing the current center of the effect.
|
1070
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1071
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1072
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1073
|
*/
|
1074
|
public long brightness(float brightness, Static4D region, Dynamic2D center, int duration, float count)
|
1075
|
{
|
1076
|
Dynamic1D di = new Dynamic1D();
|
1077
|
di.setCount(count);
|
1078
|
di.setDuration(duration);
|
1079
|
di.add(new Static1D(1));
|
1080
|
di.add(new Static1D(brightness));
|
1081
|
|
1082
|
return mF.add(EffectNames.BRIGHTNESS, di, region, center);
|
1083
|
}
|
1084
|
|
1085
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1086
|
/**
|
1087
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1088
|
* <p>
|
1089
|
* Here the center of the Effect stays constant.
|
1090
|
*
|
1091
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1092
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1093
|
* anything more than 1 - lighten it up.
|
1094
|
* @param region Region this Effect is limited to.
|
1095
|
* Null here means 'apply the Effect to the whole Object'.
|
1096
|
* @param center Center of the Effect.
|
1097
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1098
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1099
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1100
|
*/
|
1101
|
public long brightness(float brightness, Static4D region, Static2D center, int duration, float count)
|
1102
|
{
|
1103
|
Dynamic1D di = new Dynamic1D();
|
1104
|
di.setCount(count);
|
1105
|
di.setDuration(duration);
|
1106
|
di.add(new Static1D(1));
|
1107
|
di.add(new Static1D(brightness));
|
1108
|
|
1109
|
return mF.add(EffectNames.BRIGHTNESS, di, region, center);
|
1110
|
}
|
1111
|
|
1112
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1113
|
/**
|
1114
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1115
|
* <p>
|
1116
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1117
|
*
|
1118
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1119
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1120
|
* anything more than 1 - lighten it up.
|
1121
|
* @param region Region this Effect is limited to.
|
1122
|
* Null here means 'apply the Effect to the whole Object'.
|
1123
|
* @param center Center of the Effect.
|
1124
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1125
|
*/
|
1126
|
public long brightness(float brightness, Static4D region, Static2D center)
|
1127
|
{
|
1128
|
Dynamic1D di = new Dynamic1D();
|
1129
|
di.setCount(0.5f);
|
1130
|
di.setDuration(0);
|
1131
|
di.add(new Static1D(1));
|
1132
|
di.add(new Static1D(brightness));
|
1133
|
|
1134
|
return mF.add(EffectNames.BRIGHTNESS, di, region, center);
|
1135
|
}
|
1136
|
|
1137
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1138
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1139
|
// SMOOTH BRIGHTNESS
|
1140
|
/**
|
1141
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1142
|
*
|
1143
|
* @param brightness 1-dimensional Dynamic that returns the level of brightness we want to have
|
1144
|
* at any given moment.
|
1145
|
* @param region Region this Effect is limited to.
|
1146
|
* Null here means 'apply the Effect to the whole Object'.
|
1147
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1148
|
* representing the current center of the effect.
|
1149
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1150
|
*/
|
1151
|
public long smooth_brightness(Dynamic1D brightness, Static4D region, Dynamic2D center)
|
1152
|
{
|
1153
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, brightness, region, center);
|
1154
|
}
|
1155
|
|
1156
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1157
|
/**
|
1158
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1159
|
* <p>
|
1160
|
* Here the center of the Effect stays constant.
|
1161
|
*
|
1162
|
* @param brightness 1-dimensional Dynamic that returns the level of brightness we want to have
|
1163
|
* at any given moment.
|
1164
|
* @param region Region this Effect is limited to.
|
1165
|
* Null here means 'apply the Effect to the whole Object'.
|
1166
|
* @param center Center of the Effect.
|
1167
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1168
|
*/
|
1169
|
public long smooth_brightness(Dynamic1D brightness, Static4D region, Static2D center)
|
1170
|
{
|
1171
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, brightness, region, center);
|
1172
|
}
|
1173
|
|
1174
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1175
|
/**
|
1176
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1177
|
*
|
1178
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1179
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1180
|
* anything more than 1 - lighten it up.
|
1181
|
* @param region Region this Effect is limited to.
|
1182
|
* Null here means 'apply the Effect to the whole Object'.
|
1183
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1184
|
* represention the current center of the effect.
|
1185
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1186
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1187
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1188
|
*/
|
1189
|
public long smooth_brightness(float brightness, Static4D region, Dynamic2D center, int duration, float count)
|
1190
|
{
|
1191
|
Dynamic1D di = new Dynamic1D();
|
1192
|
di.setCount(count);
|
1193
|
di.setDuration(duration);
|
1194
|
di.add(new Static1D(1));
|
1195
|
di.add(new Static1D(brightness));
|
1196
|
|
1197
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
|
1198
|
}
|
1199
|
|
1200
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1201
|
/**
|
1202
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1203
|
* <p>
|
1204
|
* Here the center of the Effect stays constant.
|
1205
|
*
|
1206
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1207
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1208
|
* anything more than 1 - lighten it up.
|
1209
|
* @param region Region this Effect is limited to.
|
1210
|
* Null here means 'apply the Effect to the whole Object'.
|
1211
|
* @param center Center of the Effect.
|
1212
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1213
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1214
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1215
|
*/
|
1216
|
public long smooth_brightness(float brightness, Static4D region, Static2D center, int duration, float count)
|
1217
|
{
|
1218
|
Dynamic1D di = new Dynamic1D();
|
1219
|
di.setCount(count);
|
1220
|
di.setDuration(duration);
|
1221
|
di.add(new Static1D(1));
|
1222
|
di.add(new Static1D(brightness));
|
1223
|
|
1224
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
|
1225
|
}
|
1226
|
|
1227
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1228
|
/**
|
1229
|
* Makes a certain sub-region of the Object smoothly change its brightness level.
|
1230
|
* <p>
|
1231
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1232
|
*
|
1233
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1234
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1235
|
* anything more than 1 - lighten it up.
|
1236
|
* @param region Region this Effect is limited to.
|
1237
|
* Null here means 'apply the Effect to the whole Object'.
|
1238
|
* @param center Center of the Effect.
|
1239
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1240
|
*/
|
1241
|
public long smooth_brightness(float brightness, Static4D region, Static2D center)
|
1242
|
{
|
1243
|
Dynamic1D di = new Dynamic1D();
|
1244
|
di.setCount(0.5f);
|
1245
|
di.setDuration(0);
|
1246
|
di.add(new Static1D(1));
|
1247
|
di.add(new Static1D(brightness));
|
1248
|
|
1249
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di, region, center);
|
1250
|
}
|
1251
|
|
1252
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1253
|
/**
|
1254
|
* Makes the whole Object change its brightness level.
|
1255
|
*
|
1256
|
* @param brightness Level of Brightness (between 0 and infinity) we want to interpolate to.
|
1257
|
* 1 - level of brightness unchanged, anything less than 1 - 'darken the image',
|
1258
|
* anything more than 1- lighten it up.
|
1259
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1260
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1261
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1262
|
*/
|
1263
|
public long smooth_brightness(float brightness, int duration, float count)
|
1264
|
{
|
1265
|
Dynamic1D di = new Dynamic1D();
|
1266
|
di.setCount(count);
|
1267
|
di.setDuration(duration);
|
1268
|
di.add(new Static1D(1));
|
1269
|
di.add(new Static1D(brightness));
|
1270
|
|
1271
|
return mF.add(EffectNames.SMOOTH_BRIGHTNESS, di,null, mZero2D);
|
1272
|
}
|
1273
|
|
1274
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1275
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1276
|
// CONTRAST
|
1277
|
/**
|
1278
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1279
|
*
|
1280
|
* @param contrast 1-dimensional Dynamic that returns the level of contrast we want to have
|
1281
|
* at any given moment.
|
1282
|
* @param region Region this Effect is limited to.
|
1283
|
* Null here means 'apply the Effect to the whole Object'.
|
1284
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1285
|
* representing the current center of the effect.
|
1286
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1287
|
*/
|
1288
|
public long contrast(Dynamic1D contrast, Static4D region, Dynamic2D center)
|
1289
|
{
|
1290
|
return mF.add(EffectNames.CONTRAST, contrast, region, center);
|
1291
|
}
|
1292
|
|
1293
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1294
|
/**
|
1295
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1296
|
* <p>
|
1297
|
* Here the center of the Effect stays constant.
|
1298
|
*
|
1299
|
* @param contrast 1-dimensional Dynamic that returns the level of contrast we want to have
|
1300
|
* at any given moment.
|
1301
|
* @param region Region this Effect is limited to.
|
1302
|
* Null here means 'apply the Effect to the whole Object'.
|
1303
|
* @param center Center of the Effect.
|
1304
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1305
|
*/
|
1306
|
public long contrast(Dynamic1D contrast, Static4D region, Static2D center)
|
1307
|
{
|
1308
|
return mF.add(EffectNames.CONTRAST, contrast, region, center);
|
1309
|
}
|
1310
|
|
1311
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1312
|
/**
|
1313
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1314
|
*
|
1315
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1316
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1317
|
* anything more than 1 - increase the contrast.
|
1318
|
* @param region Region this Effect is limited to.
|
1319
|
* Null here means 'apply the Effect to the whole Object'.
|
1320
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1321
|
* represention the current center of the effect.
|
1322
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1323
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1324
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1325
|
*/
|
1326
|
public long contrast(float contrast, Static4D region, Dynamic2D center, int duration, float count)
|
1327
|
{
|
1328
|
Dynamic1D di = new Dynamic1D();
|
1329
|
di.setCount(count);
|
1330
|
di.setDuration(duration);
|
1331
|
di.add(new Static1D(1));
|
1332
|
di.add(new Static1D(contrast));
|
1333
|
|
1334
|
return mF.add(EffectNames.CONTRAST, di, region, center);
|
1335
|
}
|
1336
|
|
1337
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1338
|
/**
|
1339
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1340
|
* <p>
|
1341
|
* Here the center of the Effect stays constant.
|
1342
|
*
|
1343
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1344
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1345
|
* anything more than 1 -increase the contrast.
|
1346
|
* @param region Region this Effect is limited to.
|
1347
|
* Null here means 'apply the Effect to the whole Object'.
|
1348
|
* @param center Center of the Effect.
|
1349
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1350
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1351
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1352
|
*/
|
1353
|
public long contrast(float contrast, Static4D region, Static2D center, int duration, float count)
|
1354
|
{
|
1355
|
Dynamic1D di = new Dynamic1D();
|
1356
|
di.setCount(count);
|
1357
|
di.setDuration(duration);
|
1358
|
di.add(new Static1D(1));
|
1359
|
di.add(new Static1D(contrast));
|
1360
|
|
1361
|
return mF.add(EffectNames.CONTRAST, di, region, center);
|
1362
|
}
|
1363
|
|
1364
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1365
|
/**
|
1366
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1367
|
* <p>
|
1368
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1369
|
*
|
1370
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1371
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1372
|
* anything more than 1 - increase the contrast.
|
1373
|
* @param region Region this Effect is limited to.
|
1374
|
* Null here means 'apply the Effect to the whole Object'.
|
1375
|
* @param center Center of the Effect.
|
1376
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1377
|
*/
|
1378
|
public long contrast(float contrast, Static4D region, Static2D center)
|
1379
|
{
|
1380
|
Dynamic1D di = new Dynamic1D();
|
1381
|
di.setCount(0.5f);
|
1382
|
di.setDuration(0);
|
1383
|
di.add(new Static1D(1));
|
1384
|
di.add(new Static1D(contrast));
|
1385
|
|
1386
|
return mF.add(EffectNames.CONTRAST, di, region, center);
|
1387
|
}
|
1388
|
|
1389
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1390
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1391
|
// SMOOTH CONTRAST
|
1392
|
/**
|
1393
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1394
|
*
|
1395
|
* @param contrast 1-dimensional Dynamic that returns the level of contrast we want to have
|
1396
|
* at any given moment.
|
1397
|
* @param region Region this Effect is limited to.
|
1398
|
* Null here means 'apply the Effect to the whole Object'.
|
1399
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1400
|
* representing the current center of the effect.
|
1401
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1402
|
*/
|
1403
|
public long smooth_contrast(Dynamic1D contrast, Static4D region, Dynamic2D center)
|
1404
|
{
|
1405
|
return mF.add(EffectNames.SMOOTH_CONTRAST, contrast, region, center);
|
1406
|
}
|
1407
|
|
1408
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1409
|
/**
|
1410
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1411
|
* <p>
|
1412
|
* Here the center of the Effect stays constant.
|
1413
|
*
|
1414
|
* @param contrast 1-dimensional Dynamic that returns the level of contrast we want to have
|
1415
|
* at any given moment.
|
1416
|
* @param region Region this Effect is limited to.
|
1417
|
* Null here means 'apply the Effect to the whole Object'.
|
1418
|
* @param center Center of the Effect.
|
1419
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1420
|
*/
|
1421
|
public long smooth_contrast(Dynamic1D contrast, Static4D region, Static2D center)
|
1422
|
{
|
1423
|
return mF.add(EffectNames.SMOOTH_CONTRAST, contrast, region, center);
|
1424
|
}
|
1425
|
|
1426
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1427
|
/**
|
1428
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1429
|
*
|
1430
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1431
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1432
|
* anything more than 1 - increase the contrast.
|
1433
|
* @param region Region this Effect is limited to.
|
1434
|
* Null here means 'apply the Effect to the whole Object'.
|
1435
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1436
|
* representing the current center of the effect.
|
1437
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1438
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1439
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1440
|
*/
|
1441
|
public long smooth_contrast(float contrast, Static4D region, Dynamic2D center, int duration, float count)
|
1442
|
{
|
1443
|
Dynamic1D di = new Dynamic1D();
|
1444
|
di.setCount(count);
|
1445
|
di.setDuration(duration);
|
1446
|
di.add(new Static1D(1));
|
1447
|
di.add(new Static1D(contrast));
|
1448
|
|
1449
|
return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
|
1450
|
}
|
1451
|
|
1452
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1453
|
/**
|
1454
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1455
|
* <p>
|
1456
|
* Here the center of the Effect stays constant.
|
1457
|
*
|
1458
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1459
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1460
|
* anything more than 1 - increase the contrast.
|
1461
|
* @param region Region this Effect is limited to.
|
1462
|
* Null here means 'apply the Effect to the whole Object'.
|
1463
|
* @param center Center of the Effect.
|
1464
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1465
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1466
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1467
|
*/
|
1468
|
public long smooth_contrast(float contrast, Static4D region, Static2D center, int duration, float count)
|
1469
|
{
|
1470
|
Dynamic1D di = new Dynamic1D();
|
1471
|
di.setCount(count);
|
1472
|
di.setDuration(duration);
|
1473
|
di.add(new Static1D(1));
|
1474
|
di.add(new Static1D(contrast));
|
1475
|
|
1476
|
return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
|
1477
|
}
|
1478
|
|
1479
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1480
|
/**
|
1481
|
* Makes a certain sub-region of the Object smoothly change its contrast level.
|
1482
|
* <p>
|
1483
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1484
|
*
|
1485
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1486
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1487
|
* anything more than 1 - increase the contrast.
|
1488
|
* @param region Region this Effect is limited to.
|
1489
|
* Null here means 'apply the Effect to the whole Object'.
|
1490
|
* @param center Center of the Effect.
|
1491
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1492
|
*/
|
1493
|
public long smooth_contrast(float contrast, Static4D region, Static2D center)
|
1494
|
{
|
1495
|
Dynamic1D di = new Dynamic1D();
|
1496
|
di.setCount(0.5f);
|
1497
|
di.setDuration(0);
|
1498
|
di.add(new Static1D(1));
|
1499
|
di.add(new Static1D(contrast));
|
1500
|
|
1501
|
return mF.add(EffectNames.SMOOTH_CONTRAST, di, region, center);
|
1502
|
}
|
1503
|
|
1504
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1505
|
/**
|
1506
|
* Makes the whole Object change its contrast level.
|
1507
|
*
|
1508
|
* @param contrast Level of contrast (between 0 and infinity) we want to interpolate to.
|
1509
|
* 1 - level of contrast unchanged, anything less than 1 - reduce contrast,
|
1510
|
* anything more than 1 - increase the contrast.
|
1511
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1512
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1513
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1514
|
*/
|
1515
|
public long smooth_contrast(float contrast, int duration, float count)
|
1516
|
{
|
1517
|
Dynamic1D di = new Dynamic1D();
|
1518
|
di.setCount(count);
|
1519
|
di.setDuration(duration);
|
1520
|
di.add(new Static1D(1));
|
1521
|
di.add(new Static1D(contrast));
|
1522
|
|
1523
|
return mF.add(EffectNames.SMOOTH_CONTRAST, di,null, mZero2D);
|
1524
|
}
|
1525
|
|
1526
|
|
1527
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1528
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1529
|
// SATURATION
|
1530
|
/**
|
1531
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1532
|
*
|
1533
|
* @param saturation 1-dimensional Dynamic that returns the level of saturation we want to have
|
1534
|
* at any given moment.
|
1535
|
* @param region Region this Effect is limited to.
|
1536
|
* Null here means 'apply the Effect to the whole Object'.
|
1537
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1538
|
* representing the current center of the effect.
|
1539
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1540
|
*/
|
1541
|
public long saturation(Dynamic1D saturation, Static4D region, Dynamic2D center)
|
1542
|
{
|
1543
|
return mF.add(EffectNames.SATURATION, saturation, region, center);
|
1544
|
}
|
1545
|
|
1546
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1547
|
/**
|
1548
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1549
|
* <p>
|
1550
|
* Here the center of the Effect stays constant.
|
1551
|
*
|
1552
|
* @param saturation 1-dimensional Dynamic that returns the level of saturation we want to have
|
1553
|
* at any given moment.
|
1554
|
* @param region Region this Effect is limited to.
|
1555
|
* Null here means 'apply the Effect to the whole Object'.
|
1556
|
* @param center Center of the Effect.
|
1557
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1558
|
*/
|
1559
|
public long saturation(Dynamic1D saturation, Static4D region, Static2D center)
|
1560
|
{
|
1561
|
return mF.add(EffectNames.SATURATION, saturation, region, center);
|
1562
|
}
|
1563
|
|
1564
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1565
|
/**
|
1566
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1567
|
*
|
1568
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1569
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1570
|
* anything more than 1 - increase the saturation.
|
1571
|
* @param region Region this Effect is limited to.
|
1572
|
* Null here means 'apply the Effect to the whole Object'.
|
1573
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1574
|
* representing the current center of the effect.
|
1575
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1576
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1577
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1578
|
*/
|
1579
|
public long saturation(float saturation, Static4D region, Dynamic2D center, int duration, float count)
|
1580
|
{
|
1581
|
Dynamic1D di = new Dynamic1D();
|
1582
|
di.setCount(count);
|
1583
|
di.setDuration(duration);
|
1584
|
di.add(new Static1D(1));
|
1585
|
di.add(new Static1D(saturation));
|
1586
|
|
1587
|
return mF.add(EffectNames.SATURATION, di, region, center);
|
1588
|
}
|
1589
|
|
1590
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1591
|
/**
|
1592
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1593
|
* <p>
|
1594
|
* Here the center of the Effect stays constant.
|
1595
|
*
|
1596
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1597
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1598
|
* anything more than 1 - increase the saturation.
|
1599
|
* @param region Region this Effect is limited to.
|
1600
|
* Null here means 'apply the Effect to the whole Object'.
|
1601
|
* @param center Center of the Effect.
|
1602
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1603
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1604
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1605
|
*/
|
1606
|
public long saturation(float saturation, Static4D region, Static2D center, int duration, float count)
|
1607
|
{
|
1608
|
Dynamic1D di = new Dynamic1D();
|
1609
|
di.setCount(count);
|
1610
|
di.setDuration(duration);
|
1611
|
di.add(new Static1D(1));
|
1612
|
di.add(new Static1D(saturation));
|
1613
|
|
1614
|
return mF.add(EffectNames.SATURATION, di, region, center);
|
1615
|
}
|
1616
|
|
1617
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1618
|
/**
|
1619
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1620
|
* <p>
|
1621
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1622
|
*
|
1623
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1624
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1625
|
* anything more than 1- increase the saturation.
|
1626
|
* @param region Region this Effect is limited to.
|
1627
|
* Null here means 'apply the Effect to the whole Object'.
|
1628
|
* @param center Center of the Effect.
|
1629
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1630
|
*/
|
1631
|
public long saturation(float saturation, Static4D region, Static2D center)
|
1632
|
{
|
1633
|
Dynamic1D di = new Dynamic1D();
|
1634
|
di.setCount(0.5f);
|
1635
|
di.setDuration(0);
|
1636
|
di.add(new Static1D(1));
|
1637
|
di.add(new Static1D(saturation));
|
1638
|
|
1639
|
return mF.add(EffectNames.SATURATION, di, region, center);
|
1640
|
}
|
1641
|
|
1642
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1643
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1644
|
// SMOOTH_SATURATION
|
1645
|
/**
|
1646
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1647
|
*
|
1648
|
* @param saturation 1-dimensional Dynamic that returns the level of saturation we want to have
|
1649
|
* at any given moment.
|
1650
|
* @param region Region this Effect is limited to.
|
1651
|
* Null here means 'apply the Effect to the whole Object'.
|
1652
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1653
|
* representing the current center of the effect.
|
1654
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1655
|
*/
|
1656
|
public long smooth_saturation(Dynamic1D saturation, Static4D region, Dynamic2D center)
|
1657
|
{
|
1658
|
return mF.add(EffectNames.SMOOTH_SATURATION, saturation, region, center);
|
1659
|
}
|
1660
|
|
1661
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1662
|
/**
|
1663
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1664
|
* <p>
|
1665
|
* Here the center of the Effect stays constant.
|
1666
|
*
|
1667
|
* @param saturation 1-dimensional Dynamic that returns the level of saturation we want to have
|
1668
|
* at any given moment.
|
1669
|
* @param region Region this Effect is limited to.
|
1670
|
* Null here means 'apply the Effect to the whole Object'.
|
1671
|
* @param center Center of the Effect.
|
1672
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1673
|
*/
|
1674
|
public long smooth_saturation(Dynamic1D saturation, Static4D region, Static2D center)
|
1675
|
{
|
1676
|
return mF.add(EffectNames.SMOOTH_SATURATION, saturation, region, center);
|
1677
|
}
|
1678
|
|
1679
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1680
|
/**
|
1681
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1682
|
*
|
1683
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1684
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1685
|
* anything more than 1 -increase the saturation.
|
1686
|
* @param region Region this Effect is limited to.
|
1687
|
* Null here means 'apply the Effect to the whole Object'.
|
1688
|
* @param center 2-dimensional Dynamic which, at any given time, returns a Static2D
|
1689
|
* representing the current center of the effect.
|
1690
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1691
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1692
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1693
|
*/
|
1694
|
public long smooth_saturation(float saturation, Static4D region, Dynamic2D center, int duration, float count)
|
1695
|
{
|
1696
|
Dynamic1D di = new Dynamic1D();
|
1697
|
di.setCount(count);
|
1698
|
di.setDuration(duration);
|
1699
|
di.add(new Static1D(1));
|
1700
|
di.add(new Static1D(saturation));
|
1701
|
|
1702
|
return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
|
1703
|
}
|
1704
|
|
1705
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1706
|
/**
|
1707
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1708
|
* <p>
|
1709
|
* Here the center of the Effect stays constant.
|
1710
|
*
|
1711
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1712
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1713
|
* anything more than 1 - increase the saturation.
|
1714
|
* @param region Region this Effect is limited to.
|
1715
|
* Null here means 'apply the Effect to the whole Object'.
|
1716
|
* @param center Center of the Effect.
|
1717
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1718
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1719
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1720
|
*/
|
1721
|
public long smooth_saturation(float saturation, Static4D region, Static2D center, int duration, float count)
|
1722
|
{
|
1723
|
Dynamic1D di = new Dynamic1D();
|
1724
|
di.setCount(count);
|
1725
|
di.setDuration(duration);
|
1726
|
di.add(new Static1D(1));
|
1727
|
di.add(new Static1D(saturation));
|
1728
|
|
1729
|
return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
|
1730
|
}
|
1731
|
|
1732
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1733
|
/**
|
1734
|
* Makes a certain sub-region of the Object smoothly change its saturation level.
|
1735
|
* <p>
|
1736
|
* Here the center of the Effect stays constant and the effect for now change in time.
|
1737
|
*
|
1738
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1739
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1740
|
* anything more than 1 - increase the saturation.
|
1741
|
* @param region Region this Effect is limited to.
|
1742
|
* Null here means 'apply the Effect to the whole Object'.
|
1743
|
* @param center Center of the Effect.
|
1744
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1745
|
*/
|
1746
|
public long smooth_saturation(float saturation, Static4D region, Static2D center)
|
1747
|
{
|
1748
|
Dynamic1D di = new Dynamic1D();
|
1749
|
di.setCount(0.5f);
|
1750
|
di.setDuration(0);
|
1751
|
di.add(new Static1D(1));
|
1752
|
di.add(new Static1D(saturation));
|
1753
|
|
1754
|
return mF.add(EffectNames.SMOOTH_SATURATION, di, region, center);
|
1755
|
}
|
1756
|
|
1757
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1758
|
/**
|
1759
|
* Makes the whole Object change its saturation level.
|
1760
|
*
|
1761
|
* @param saturation Level of saturation (between 0 and infinity) we want to interpolate to.
|
1762
|
* 1 - level of saturation unchanged, anything less than 1 - reduce saturation,
|
1763
|
* anything more than 1 - increase the saturation.
|
1764
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1765
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1766
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1767
|
*/
|
1768
|
public long smooth_saturation(float saturation, int duration, float count)
|
1769
|
{
|
1770
|
Dynamic1D di = new Dynamic1D();
|
1771
|
di.setCount(count);
|
1772
|
di.setDuration(duration);
|
1773
|
di.add(new Static1D(1));
|
1774
|
di.add(new Static1D(saturation));
|
1775
|
|
1776
|
return mF.add(EffectNames.SMOOTH_SATURATION, di,null, mZero2D);
|
1777
|
}
|
1778
|
|
1779
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1780
|
// Vertex-based effects
|
1781
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1782
|
// DISTORT
|
1783
|
/**
|
1784
|
* Distort a (possibly changing in time) part of the Object by a (possibly changing in time) vector of force.
|
1785
|
*
|
1786
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
1787
|
* represents the vector the Center of the Effect is currently being dragged with.
|
1788
|
* @param region Region that masks the effect of the Distortion.
|
1789
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1790
|
* the Center of the Effect.
|
1791
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1792
|
*/
|
1793
|
public long distort(Dynamic vector, Static4D region, Dynamic2D center)
|
1794
|
{
|
1795
|
return mV.add(EffectNames.DISTORT, vector, region, center);
|
1796
|
}
|
1797
|
|
1798
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1799
|
/**
|
1800
|
* Distort part of the Object by a (possibly changing in time) vector of force.
|
1801
|
* <p>
|
1802
|
* Difference between this and the previous method is that here the center of the Effect stays constant.
|
1803
|
*
|
1804
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
1805
|
* represents the vector the Center of the Effect is currently being dragged with.
|
1806
|
* @param region Region that masks the effect of the Distortion.
|
1807
|
* @param center Center of the Effect.
|
1808
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1809
|
*/
|
1810
|
public long distort(Dynamic vector, Static4D region, Static2D center)
|
1811
|
{
|
1812
|
return mV.add(EffectNames.DISTORT, vector, region, center);
|
1813
|
}
|
1814
|
|
1815
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1816
|
/**
|
1817
|
* Distort the whole Object by a (possibly changing in time) vector of force.
|
1818
|
*
|
1819
|
* @param vector 2- or 3-dimensional Dynamic that returns a 2- or 3-dimensional Point which
|
1820
|
* represents the vector the Center of the Effect is currently being dragged with.
|
1821
|
* @param center Center of the Effect.
|
1822
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1823
|
*/
|
1824
|
public long distort(Dynamic vector, Static2D center)
|
1825
|
{
|
1826
|
return mV.add(EffectNames.DISTORT, vector, null, center);
|
1827
|
}
|
1828
|
|
1829
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1830
|
/**
|
1831
|
* Distort part of the Object by a vector of force that changes from (0,0,0) to v.
|
1832
|
*
|
1833
|
* @param vector Maximum vector of force.
|
1834
|
* @param region Region that masks the effect of the Distortion.
|
1835
|
* @param center Center of the Effect.
|
1836
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1837
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1838
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1839
|
*/
|
1840
|
public long distort(Static3D vector, Static4D region, Static2D center, int duration, float count)
|
1841
|
{
|
1842
|
Dynamic3D di = new Dynamic3D();
|
1843
|
di.setCount(count);
|
1844
|
di.setDuration(duration);
|
1845
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1846
|
di.add(vector);
|
1847
|
|
1848
|
return mV.add(EffectNames.DISTORT, di, region, center);
|
1849
|
}
|
1850
|
|
1851
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1852
|
/**
|
1853
|
* Distort the whole Object by a vector of force that changes from (0,0,0) to v.
|
1854
|
*
|
1855
|
* @param vector Maximum vector of force.
|
1856
|
* @param center Center of the Effect.
|
1857
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1858
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1859
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1860
|
*/
|
1861
|
public long distort(Static3D vector, Static2D center, int duration, float count)
|
1862
|
{
|
1863
|
Dynamic3D di = new Dynamic3D();
|
1864
|
di.setCount(count);
|
1865
|
di.setDuration(duration);
|
1866
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1867
|
di.add(vector);
|
1868
|
|
1869
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
1870
|
}
|
1871
|
|
1872
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1873
|
/**
|
1874
|
* Distort the whole Object by a vector of force that changes from (0,0,0) to v.
|
1875
|
* <p>
|
1876
|
* Difference between this and the previous method is that here the vector of force will get interpolated
|
1877
|
* to the maximum v and the effect will end. We are thus limited to count=0.5.
|
1878
|
*
|
1879
|
* @param vector Maximum, final vector of force.
|
1880
|
* @param center Center of the Effect.
|
1881
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1882
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1883
|
*/
|
1884
|
public long distort(Static3D vector, Static2D center, int duration)
|
1885
|
{
|
1886
|
Dynamic3D di = new Dynamic3D();
|
1887
|
di.setCount(0.5f);
|
1888
|
di.setDuration(duration);
|
1889
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1890
|
di.add(vector);
|
1891
|
|
1892
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
1893
|
}
|
1894
|
|
1895
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1896
|
/**
|
1897
|
* Distort the whole Object by a vector of force v.
|
1898
|
* <p>
|
1899
|
* Here we apply a constant vector of force.
|
1900
|
*
|
1901
|
* @param vector Vector of force.
|
1902
|
* @param center Center of the Effect.
|
1903
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1904
|
*/
|
1905
|
public long distort(Static3D vector, Static2D center )
|
1906
|
{
|
1907
|
Dynamic3D di = new Dynamic3D();
|
1908
|
di.setCount(0.5f);
|
1909
|
di.setDuration(0);
|
1910
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1911
|
di.add(vector);
|
1912
|
|
1913
|
return mV.add(EffectNames.DISTORT, di, null, center);
|
1914
|
}
|
1915
|
|
1916
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1917
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1918
|
// DEFORM
|
1919
|
/**
|
1920
|
* Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
|
1921
|
* a (possibly changing in time) point on the Object.
|
1922
|
*
|
1923
|
* @param vector Dynamic that, at any given time, returns a Static2D representing vector of
|
1924
|
* force that deforms the shape of the whole Object.
|
1925
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
1926
|
* the Center of the Effect.
|
1927
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1928
|
*/
|
1929
|
public long deform(Dynamic vector, Dynamic2D center)
|
1930
|
{
|
1931
|
return mV.add(EffectNames.DEFORM, vector, null, center);
|
1932
|
}
|
1933
|
|
1934
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1935
|
/**
|
1936
|
* Deform the shape of the whole Object with a (possibly changing in time) vector of force applied to
|
1937
|
* a constant point on the Object.
|
1938
|
*
|
1939
|
* @param vector Dynamic that, at any given time, returns a Static2D representing
|
1940
|
* vector of force that deforms the shape of the whole Object.
|
1941
|
* @param center Center of the Effect.
|
1942
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1943
|
*/
|
1944
|
public long deform(Dynamic vector, Static2D center)
|
1945
|
{
|
1946
|
return mV.add(EffectNames.DEFORM, vector, null, center);
|
1947
|
}
|
1948
|
|
1949
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1950
|
/**
|
1951
|
* Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
|
1952
|
* applied to a constant point on the Object.
|
1953
|
*
|
1954
|
* @param vector Vector of force.
|
1955
|
* @param center Center of the Effect.
|
1956
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1957
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
1958
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1959
|
*/
|
1960
|
public long deform(Static3D vector, Static2D center, int duration, float count)
|
1961
|
{
|
1962
|
Dynamic3D di = new Dynamic3D();
|
1963
|
di.setCount(count);
|
1964
|
di.setDuration(duration);
|
1965
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1966
|
di.add(vector);
|
1967
|
|
1968
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
1969
|
}
|
1970
|
|
1971
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1972
|
/**
|
1973
|
* Deform the shape of the whole Object with a vector of force smoothly changing from (0,0,0) to v
|
1974
|
* applied to a constant point on the Object.
|
1975
|
* <p>
|
1976
|
* Identical to calling the previous method with count=0.5.
|
1977
|
*
|
1978
|
* @param vector Final vector of force.
|
1979
|
* @param center Center of the Effect.
|
1980
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
1981
|
* @return ID of the effect added, or -1 if we failed to add one.
|
1982
|
*/
|
1983
|
public long deform(Static3D vector, Static2D center, int duration)
|
1984
|
{
|
1985
|
Dynamic3D di = new Dynamic3D();
|
1986
|
di.setCount(0.5f);
|
1987
|
di.setDuration(duration);
|
1988
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
1989
|
di.add(vector);
|
1990
|
|
1991
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
1992
|
}
|
1993
|
|
1994
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
1995
|
/**
|
1996
|
* Deform the shape of the whole Object with a constant vector of force applied to a constant
|
1997
|
* point on the Object.
|
1998
|
*
|
1999
|
* @param vector Vector of force.
|
2000
|
* @param center Center of the Effect.
|
2001
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2002
|
*/
|
2003
|
public long deform(Static3D vector, Static2D center )
|
2004
|
{
|
2005
|
Dynamic3D di = new Dynamic3D();
|
2006
|
di.setCount(0.5f);
|
2007
|
di.setDuration(0);
|
2008
|
di.add(new Static3D(0.0f,0.0f,0.0f));
|
2009
|
di.add(vector);
|
2010
|
|
2011
|
return mV.add(EffectNames.DEFORM, di, null, center);
|
2012
|
}
|
2013
|
|
2014
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2015
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2016
|
// SINK
|
2017
|
/**
|
2018
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
2019
|
* away from the center (degree<=1)
|
2020
|
*
|
2021
|
* @param sink 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
2022
|
* the current degree of the effect.
|
2023
|
* @param region Region that masks the effect of the Sink.
|
2024
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
2025
|
* the Center of the Effect.
|
2026
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2027
|
*/
|
2028
|
public long sink(Dynamic1D sink, Static4D region, Dynamic2D center)
|
2029
|
{
|
2030
|
return mV.add(EffectNames.SINK, sink, region, center);
|
2031
|
}
|
2032
|
|
2033
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2034
|
/**
|
2035
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
2036
|
* away from the center (degree<=1).
|
2037
|
* <p>
|
2038
|
* Here the Center stays constant.
|
2039
|
*
|
2040
|
* @param sink 1-dimensional Dynamic which, at any given time, returns a Point1D
|
2041
|
* representing the current degree of the effect.
|
2042
|
* @param region Region that masks the effect of the Sink.
|
2043
|
* @param center Center of the Effect.
|
2044
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2045
|
*/
|
2046
|
public long sink(Dynamic1D sink, Static4D region, Static2D center)
|
2047
|
{
|
2048
|
return mV.add(EffectNames.SINK, sink, region, center);
|
2049
|
}
|
2050
|
|
2051
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2052
|
/**
|
2053
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
2054
|
* away from the center (degree<=1).
|
2055
|
* <p>
|
2056
|
* Here we can only interpolate between 1 and degree.
|
2057
|
*
|
2058
|
* @param sink How much to push or pull. Between 0 and infinity.
|
2059
|
* @param region Region that masks the effect of the Sink.
|
2060
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
2061
|
* the Center of the Effect.
|
2062
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2063
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
2064
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2065
|
*/
|
2066
|
public long sink(float sink, Static4D region, Dynamic2D center, int duration, float count)
|
2067
|
{
|
2068
|
Dynamic1D di = new Dynamic1D();
|
2069
|
di.setCount(count);
|
2070
|
di.setDuration(duration);
|
2071
|
di.add(new Static1D(1));
|
2072
|
di.add(new Static1D(sink));
|
2073
|
|
2074
|
return mV.add(EffectNames.SINK, di, region, center);
|
2075
|
}
|
2076
|
|
2077
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2078
|
/**
|
2079
|
* Pull all points around the center of the effect towards the center (if degree>=1) or push them
|
2080
|
* away from the center (degree<=1).
|
2081
|
*
|
2082
|
* @param sink How much to push or pull. Between 0 and infinity.
|
2083
|
* @param region Region that masks the effect of the Sink.
|
2084
|
* @param center Center of the Effect.
|
2085
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2086
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
2087
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2088
|
*/
|
2089
|
public long sink(float sink, Static4D region, Static2D center, int duration, float count)
|
2090
|
{
|
2091
|
Dynamic1D di = new Dynamic1D();
|
2092
|
di.setCount(count);
|
2093
|
di.setDuration(duration);
|
2094
|
di.add(new Static1D(1));
|
2095
|
di.add(new Static1D(sink));
|
2096
|
|
2097
|
return mV.add(EffectNames.SINK, di, region, center);
|
2098
|
}
|
2099
|
|
2100
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2101
|
/**
|
2102
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
2103
|
* away from the center (degree<=1).
|
2104
|
*
|
2105
|
* @param sink How much to push or pull. Between 0 and infinity.
|
2106
|
* @param center Center of the Effect.
|
2107
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2108
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
2109
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2110
|
*/
|
2111
|
public long sink(float sink, Static2D center, int duration, float count)
|
2112
|
{
|
2113
|
Dynamic1D di = new Dynamic1D();
|
2114
|
di.setCount(count);
|
2115
|
di.setDuration(duration);
|
2116
|
di.add(new Static1D(1));
|
2117
|
di.add(new Static1D(sink));
|
2118
|
|
2119
|
return mV.add(EffectNames.SINK, di, null, center);
|
2120
|
}
|
2121
|
|
2122
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2123
|
/**
|
2124
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
2125
|
* away from the center (degree<=1).
|
2126
|
* <p>
|
2127
|
* Equivalent to calling the previous method with count=0.5.
|
2128
|
*
|
2129
|
* @param sink How much to push or pull. Between 0 and infinity.
|
2130
|
* @param center Center of the Effect.
|
2131
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2132
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2133
|
*/
|
2134
|
public long sink(float sink, Static2D center, int duration)
|
2135
|
{
|
2136
|
Dynamic1D di = new Dynamic1D();
|
2137
|
di.setCount(0.5f);
|
2138
|
di.setDuration(duration);
|
2139
|
di.add(new Static1D(1));
|
2140
|
di.add(new Static1D(sink));
|
2141
|
|
2142
|
return mV.add(EffectNames.SINK, di, null, center);
|
2143
|
}
|
2144
|
|
2145
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2146
|
/**
|
2147
|
* Pull all points of the Object towards the center of the Effect (if degree>=1) or push them
|
2148
|
* away from the center (degree<=1).
|
2149
|
* <p>
|
2150
|
* Equivalent of calling the previous method with duration=0; i.e. we pull immediately.
|
2151
|
*
|
2152
|
* @param sink How much to push or pull. Between 0 and infinity.
|
2153
|
* @param center Center of the Effect.
|
2154
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2155
|
*/
|
2156
|
public long sink(float sink, Static2D center)
|
2157
|
{
|
2158
|
Dynamic1D di = new Dynamic1D();
|
2159
|
di.setCount(0.5f);
|
2160
|
di.setDuration(0);
|
2161
|
di.add(new Static1D(1));
|
2162
|
di.add(new Static1D(sink));
|
2163
|
|
2164
|
return mV.add(EffectNames.SINK, di, null, center);
|
2165
|
}
|
2166
|
|
2167
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2168
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2169
|
// SWIRL
|
2170
|
/**
|
2171
|
* Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
|
2172
|
* Dynamic).
|
2173
|
*
|
2174
|
* @param swirl 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
2175
|
* the degree of Swirl.
|
2176
|
* @param region Region that masks the effect of the Swirl.
|
2177
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
2178
|
* the Center of the Effect.
|
2179
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2180
|
*/
|
2181
|
public long swirl(Dynamic1D swirl, Static4D region, Dynamic2D center)
|
2182
|
{
|
2183
|
return mV.add(EffectNames.SWIRL, swirl, region, center);
|
2184
|
}
|
2185
|
|
2186
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2187
|
/**
|
2188
|
* Rotate part of the Object around the Center of the Effect by a certain angle (as returned by the
|
2189
|
* Dynamic).
|
2190
|
* <p>
|
2191
|
* Here the Center stays constant.
|
2192
|
*
|
2193
|
* @param swirl 1-dimensional Dynamic which, at any given time, returns a Point1D representing
|
2194
|
* the degree of Swirl.
|
2195
|
* @param region Region that masks the effect of the Swirl.
|
2196
|
* @param center Center of the Effect.
|
2197
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2198
|
*/
|
2199
|
public long swirl(Dynamic1D swirl, Static4D region, Static2D center)
|
2200
|
{
|
2201
|
return mV.add(EffectNames.SWIRL, swirl, region, center);
|
2202
|
}
|
2203
|
|
2204
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2205
|
/**
|
2206
|
* Rotate part of the Object around the Center of the Effect by 'degree' angle.
|
2207
|
*
|
2208
|
* @param swirl Angle of rotation. Unit: degrees.
|
2209
|
* @param region Region that masks the effect of the Swirl.
|
2210
|
* @param center 2-dimensional Dynamic that, at any given time, returns a Point2D representing
|
2211
|
* the Center of the Effect.
|
2212
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2213
|
*/
|
2214
|
public long swirl(int swirl, Static4D region, Dynamic2D center)
|
2215
|
{
|
2216
|
Dynamic1D di = new Dynamic1D();
|
2217
|
di.setCount(0.5f);
|
2218
|
di.setDuration(0);
|
2219
|
di.add(new Static1D(0));
|
2220
|
di.add(new Static1D(swirl));
|
2221
|
|
2222
|
return mV.add(EffectNames.SWIRL, di, region, center);
|
2223
|
}
|
2224
|
|
2225
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2226
|
/**
|
2227
|
* Rotate part of the Object around the Center of the Effect by 'degree' angle.
|
2228
|
* <p>
|
2229
|
* Here the Center stays constant.
|
2230
|
*
|
2231
|
* @param swirl Angle of rotation. Unit: degrees.
|
2232
|
* @param region Region that masks the effect of the Swirl.
|
2233
|
* @param center Center of the Effect.
|
2234
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2235
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
2236
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2237
|
*/
|
2238
|
public long swirl(int swirl, Static4D region, Static2D center, int duration, float count)
|
2239
|
{
|
2240
|
Dynamic1D di = new Dynamic1D();
|
2241
|
di.setCount(count);
|
2242
|
di.setDuration(duration);
|
2243
|
di.add(new Static1D(0));
|
2244
|
di.add(new Static1D(swirl));
|
2245
|
|
2246
|
return mV.add(EffectNames.SWIRL, di, region, center);
|
2247
|
}
|
2248
|
|
2249
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2250
|
/**
|
2251
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
2252
|
*
|
2253
|
* @param swirl Angle of rotation. Unit: degrees.
|
2254
|
* @param center Center of the Effect.
|
2255
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2256
|
* @param count Controls how many interpolations we want to do. See {@link Dynamic#setCount(float)}
|
2257
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2258
|
*/
|
2259
|
public long swirl(int swirl, Static2D center, int duration, float count)
|
2260
|
{
|
2261
|
Dynamic1D di = new Dynamic1D();
|
2262
|
di.setCount(count);
|
2263
|
di.setDuration(duration);
|
2264
|
di.add(new Static1D(0));
|
2265
|
di.add(new Static1D(swirl));
|
2266
|
|
2267
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
2268
|
}
|
2269
|
|
2270
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2271
|
/**
|
2272
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
2273
|
* <p>
|
2274
|
* Equivalent to calling the previous method with count=0.5.
|
2275
|
*
|
2276
|
* @param swirl Angle of rotation. Unit: degrees.
|
2277
|
* @param center Center of the Effect.
|
2278
|
* @param duration Time, in milliseconds, it takes to do one full interpolation.
|
2279
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2280
|
*/
|
2281
|
public long swirl(int swirl, Static2D center, int duration)
|
2282
|
{
|
2283
|
Dynamic1D di = new Dynamic1D();
|
2284
|
di.setCount(0.5f);
|
2285
|
di.setDuration(duration);
|
2286
|
di.add(new Static1D(0));
|
2287
|
di.add(new Static1D(swirl));
|
2288
|
|
2289
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
2290
|
}
|
2291
|
|
2292
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2293
|
/**
|
2294
|
* Rotate the whole Object around the Center of the Effect by 'degree' angle.
|
2295
|
* <p>
|
2296
|
* Equivalent to calling the previous method with duration=0.
|
2297
|
*
|
2298
|
* @param swirl Angle of rotation. Unit: degrees.
|
2299
|
* @param center Center of the Effect.
|
2300
|
* @return ID of the effect added, or -1 if we failed to add one.
|
2301
|
*/
|
2302
|
public long swirl(int swirl, Static2D center)
|
2303
|
{
|
2304
|
Dynamic1D di = new Dynamic1D();
|
2305
|
di.setCount(0.5f);
|
2306
|
di.setDuration(0);
|
2307
|
di.add(new Static1D(0));
|
2308
|
di.add(new Static1D(swirl));
|
2309
|
|
2310
|
return mV.add(EffectNames.SWIRL, di, null, center);
|
2311
|
}
|
2312
|
|
2313
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2314
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2315
|
// WAVE
|
2316
|
|
2317
|
}
|