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