Revision d04a4886
Added by Leszek Koltunski almost 9 years ago
| src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldEffectsManager.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 23 | 23 |
|
| 24 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 24 |
import org.distorted.library.DistortedEffects; |
|
| 25 | 25 |
import org.distorted.library.type.Dynamic1D; |
| 26 | 26 |
import org.distorted.library.type.Dynamic2D; |
| 27 | 27 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 255 | 255 |
|
| 256 | 256 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 257 | 257 |
|
| 258 |
synchronized void apply(DistortedEffectQueues queues)
|
|
| 258 |
synchronized void apply(DistortedEffects effects)
|
|
| 259 | 259 |
{
|
| 260 | 260 |
setRace(mBlackness, mAsianness); |
| 261 | 261 |
|
| 262 | 262 |
// WHITENESS |
| 263 |
queues.sink(wLipsDyn, wLipsCenter, wLipsRegion);
|
|
| 263 |
effects.sink(wLipsDyn, wLipsCenter, wLipsRegion);
|
|
| 264 | 264 |
|
| 265 | 265 |
// ASIANNESS |
| 266 |
queues.distort(aLipsNoseDyn, aLipsNoseCenter, aLipsNoseRegion);
|
|
| 267 |
queues.pinch(aNoseBroaderDyn, aNoseBroaderCenter, aNoseBroaderRegion);
|
|
| 268 |
queues.distort(aNostrilsDyn, aNostrilsCenter, aNostrilsRegion);
|
|
| 269 |
queues.swirl(aLEyeDyn, aLEyeCenter, aEyesRegion);
|
|
| 270 |
queues.swirl(aREyeDyn, aREyeCenter, aEyesRegion);
|
|
| 271 |
queues.distort(aEyebrowsDyn, aEyebrowsCenter, aEyebrowsRegion);
|
|
| 266 |
effects.distort(aLipsNoseDyn, aLipsNoseCenter, aLipsNoseRegion);
|
|
| 267 |
effects.pinch(aNoseBroaderDyn, aNoseBroaderCenter, aNoseBroaderRegion);
|
|
| 268 |
effects.distort(aNostrilsDyn, aNostrilsCenter, aNostrilsRegion);
|
|
| 269 |
effects.swirl(aLEyeDyn, aLEyeCenter, aEyesRegion);
|
|
| 270 |
effects.swirl(aREyeDyn, aREyeCenter, aEyesRegion);
|
|
| 271 |
effects.distort(aEyebrowsDyn, aEyebrowsCenter, aEyebrowsRegion);
|
|
| 272 | 272 |
|
| 273 |
queues.chroma(aChromaSkinDyn, aChromaSkin, aSkinColorRegion, false);
|
|
| 274 |
queues.chroma(aChromaEyesDyn, aChromaEyes, aLEyeColorRegion, true);
|
|
| 275 |
queues.chroma(aChromaEyesDyn, aChromaEyes, aREyeColorRegion, true);
|
|
| 273 |
effects.chroma(aChromaSkinDyn, aChromaSkin, aSkinColorRegion, false);
|
|
| 274 |
effects.chroma(aChromaEyesDyn, aChromaEyes, aLEyeColorRegion, true);
|
|
| 275 |
effects.chroma(aChromaEyesDyn, aChromaEyes, aREyeColorRegion, true);
|
|
| 276 | 276 |
|
| 277 | 277 |
// BLACKNESS |
| 278 |
queues.pinch(bFaceDyn, bFaceCenter, bFaceRegion);
|
|
| 279 |
queues.distort(bTipLowerDyn, bTipLowerCenter, bTipLowerRegion);
|
|
| 280 |
queues.pinch(bWholeNoseDyn, bWholeNoseCenter, bWholeNoseRegion);
|
|
| 281 |
queues.pinch(bNoseBroaderDyn, bNoseBroaderCenter, bNoseBroaderRegion);
|
|
| 282 |
queues.pinch(bLipsDyn, bLipsCenter, bLipsRegion);
|
|
| 283 |
|
|
| 284 |
queues.chroma(bChromaSkinDyn, bChromaSkin, bSkinColorRegion, false);
|
|
| 285 |
queues.chroma(bChromaEyesDyn, bChromaEyes, bLEyeColorRegion, true);
|
|
| 286 |
queues.chroma(bChromaEyesDyn, bChromaEyes, bREyeColorRegion, true);
|
|
| 287 |
queues.chroma(bChromaPupilDyn, bChromaPupil, bLPupilColorRegion, true);
|
|
| 288 |
queues.chroma(bChromaPupilDyn, bChromaPupil, bRPupilColorRegion, true);
|
|
| 289 |
|
|
| 290 |
queues.contrast(bContrastDyn);
|
|
| 278 |
effects.pinch(bFaceDyn, bFaceCenter, bFaceRegion);
|
|
| 279 |
effects.distort(bTipLowerDyn, bTipLowerCenter, bTipLowerRegion);
|
|
| 280 |
effects.pinch(bWholeNoseDyn, bWholeNoseCenter, bWholeNoseRegion);
|
|
| 281 |
effects.pinch(bNoseBroaderDyn, bNoseBroaderCenter, bNoseBroaderRegion);
|
|
| 282 |
effects.pinch(bLipsDyn, bLipsCenter, bLipsRegion);
|
|
| 283 |
|
|
| 284 |
effects.chroma(bChromaSkinDyn, bChromaSkin, bSkinColorRegion, false);
|
|
| 285 |
effects.chroma(bChromaEyesDyn, bChromaEyes, bLEyeColorRegion, true);
|
|
| 286 |
effects.chroma(bChromaEyesDyn, bChromaEyes, bREyeColorRegion, true);
|
|
| 287 |
effects.chroma(bChromaPupilDyn, bChromaPupil, bLPupilColorRegion, true);
|
|
| 288 |
effects.chroma(bChromaPupilDyn, bChromaPupil, bRPupilColorRegion, true);
|
|
| 289 |
|
|
| 290 |
effects.contrast(bContrastDyn);
|
|
| 291 | 291 |
} |
| 292 | 292 |
|
| 293 | 293 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/examples/aroundtheworld/AroundTheWorldRenderer.java | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
import org.distorted.examples.R; |
| 28 | 28 |
import org.distorted.library.Distorted; |
| 29 |
import org.distorted.library.DistortedEffects; |
|
| 29 | 30 |
import org.distorted.library.DistortedFramebuffer; |
| 30 | 31 |
import org.distorted.library.GridFlat; |
| 31 |
import org.distorted.library.DistortedEffectQueues; |
|
| 32 | 32 |
import org.distorted.library.DistortedTexture; |
| 33 | 33 |
import org.distorted.library.EffectTypes; |
| 34 | 34 |
import org.distorted.library.type.Static3D; |
| ... | ... | |
| 44 | 44 |
class AroundTheWorldRenderer implements GLSurfaceView.Renderer |
| 45 | 45 |
{
|
| 46 | 46 |
private GLSurfaceView mView; |
| 47 |
private DistortedEffectQueues mEffects;
|
|
| 47 |
private DistortedEffects mEffects; |
|
| 48 | 48 |
private DistortedTexture mTexture; |
| 49 | 49 |
private GridFlat mGrid; |
| 50 | 50 |
private DistortedFramebuffer mScreen; |
| ... | ... | |
| 60 | 60 |
|
| 61 | 61 |
mView = view; |
| 62 | 62 |
mManager = new AroundTheWorldEffectsManager(); |
| 63 |
mEffects = new DistortedEffectQueues();
|
|
| 63 |
mEffects = new DistortedEffects(); |
|
| 64 | 64 |
mManager.apply(mEffects); |
| 65 | 65 |
mScreen = new DistortedFramebuffer(0); |
| 66 | 66 |
} |
| src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 31 | 32 |
import org.distorted.library.EffectTypes; |
| 32 | 33 |
import org.distorted.library.Distorted; |
| 33 | 34 |
import org.distorted.library.DistortedTexture; |
| 34 |
import org.distorted.library.DistortedEffectQueues; |
|
| 35 | 35 |
import org.distorted.library.GridFlat; |
| 36 | 36 |
import org.distorted.library.type.Dynamic3D; |
| 37 | 37 |
import org.distorted.library.type.Static3D; |
| ... | ... | |
| 48 | 48 |
{
|
| 49 | 49 |
private GLSurfaceView mView; |
| 50 | 50 |
private DistortedTexture mTexture; |
| 51 |
private DistortedEffectQueues mEffects;
|
|
| 51 |
private DistortedEffects mEffects; |
|
| 52 | 52 |
private DistortedFramebuffer mScreen; |
| 53 | 53 |
private GridFlat mGrid; |
| 54 | 54 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 85 | 85 |
dRight.add(p1); |
| 86 | 86 |
dRight.add(p1); |
| 87 | 87 |
|
| 88 |
mEffects = new DistortedEffectQueues();
|
|
| 88 |
mEffects = new DistortedEffects(); |
|
| 89 | 89 |
mEffects.distort(dLeft , pLeft , rLeft ); |
| 90 | 90 |
mEffects.distort(dRight, pRight, rRight); |
| 91 | 91 |
|
| src/main/java/org/distorted/examples/catanddog/CatAndDogRenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
import org.distorted.library.Distorted; |
| 30 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 32 |
import org.distorted.library.DistortedTexture; |
| 33 | 33 |
import org.distorted.library.GridFlat; |
| ... | ... | |
| 48 | 48 |
class CatAndDogRenderer implements GLSurfaceView.Renderer |
| 49 | 49 |
{
|
| 50 | 50 |
private GLSurfaceView mView; |
| 51 |
private DistortedEffectQueues mEffects;
|
|
| 51 |
private DistortedEffects mEffects; |
|
| 52 | 52 |
private DistortedTexture mTexture; |
| 53 | 53 |
private GridFlat mGrid; |
| 54 | 54 |
private DistortedFramebuffer mScreen; |
| ... | ... | |
| 61 | 61 |
mView = v; |
| 62 | 62 |
|
| 63 | 63 |
mGrid = new GridFlat(1,1); // no vertex effects, grid can be a (1x1) quad. |
| 64 |
mEffects = new DistortedEffectQueues();
|
|
| 64 |
mEffects = new DistortedEffects(); |
|
| 65 | 65 |
|
| 66 | 66 |
Static4D chromaRegion= new Static4D( 530, 200,100,100); |
| 67 | 67 |
Static4D alphaRegion = new Static4D( 230, 200,100,100); |
| src/main/java/org/distorted/examples/check/CheckRenderer.java | ||
|---|---|---|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 | 30 |
import org.distorted.library.Distorted; |
| 31 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 33 |
import org.distorted.library.DistortedTexture; |
| 33 |
import org.distorted.library.DistortedEffectQueues; |
|
| 34 | 34 |
import org.distorted.library.GridFlat; |
| 35 | 35 |
import org.distorted.library.EffectTypes; |
| 36 | 36 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 57 | 57 |
|
| 58 | 58 |
private GLSurfaceView mView; |
| 59 | 59 |
private DistortedTexture mTexture; |
| 60 |
private DistortedEffectQueues mEffects;
|
|
| 60 |
private DistortedEffects mEffects; |
|
| 61 | 61 |
private GridFlat mGrid; |
| 62 | 62 |
private DistortedFramebuffer mScreen; |
| 63 | 63 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 67 | 67 |
CheckRenderer(GLSurfaceView view) |
| 68 | 68 |
{
|
| 69 | 69 |
mView = view; |
| 70 |
mEffects = new DistortedEffectQueues();
|
|
| 70 |
mEffects = new DistortedEffects(); |
|
| 71 | 71 |
|
| 72 | 72 |
CheckActivity act = (CheckActivity)mView.getContext(); |
| 73 | 73 |
|
| src/main/java/org/distorted/examples/cubes/CubesRenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 31 | 32 |
import org.distorted.library.DistortedTexture; |
| 32 |
import org.distorted.library.DistortedEffectQueues; |
|
| 33 | 33 |
import org.distorted.library.GridObject; |
| 34 | 34 |
import org.distorted.library.EffectTypes; |
| 35 | 35 |
import org.distorted.library.type.DynamicQuat; |
| ... | ... | |
| 48 | 48 |
{
|
| 49 | 49 |
private GLSurfaceView mView; |
| 50 | 50 |
private DistortedTexture mTexture; |
| 51 |
private DistortedEffectQueues mEffects;
|
|
| 51 |
private DistortedEffects mEffects; |
|
| 52 | 52 |
private GridObject mGrid; |
| 53 | 53 |
private DistortedFramebuffer mScreen; |
| 54 | 54 |
private DynamicQuat mQuatInt1, mQuatInt2; |
| ... | ... | |
| 65 | 65 |
|
| 66 | 66 |
CubesActivity act = (CubesActivity)v.getContext(); |
| 67 | 67 |
|
| 68 |
mEffects = new DistortedEffectQueues();
|
|
| 68 |
mEffects = new DistortedEffects(); |
|
| 69 | 69 |
mTexture = act.getTexture(); |
| 70 | 70 |
mGrid = act.getGrid(); |
| 71 | 71 |
|
| src/main/java/org/distorted/examples/deform/DeformRenderer.java | ||
|---|---|---|
| 23 | 23 |
import javax.microedition.khronos.opengles.GL10; |
| 24 | 24 |
|
| 25 | 25 |
import org.distorted.library.Distorted; |
| 26 |
import org.distorted.library.DistortedEffects; |
|
| 26 | 27 |
import org.distorted.library.DistortedFramebuffer; |
| 27 | 28 |
import org.distorted.library.DistortedTexture; |
| 28 |
import org.distorted.library.DistortedEffectQueues; |
|
| 29 | 29 |
import org.distorted.library.GridObject; |
| 30 | 30 |
import org.distorted.library.GridFlat; |
| 31 | 31 |
|
| ... | ... | |
| 52 | 52 |
|
| 53 | 53 |
private GLSurfaceView mView; |
| 54 | 54 |
private DistortedTexture fpsTexture, stretchTexture; |
| 55 |
private DistortedEffectQueues fpsEffects, stretchEffects;
|
|
| 55 |
private DistortedEffects fpsEffects, stretchEffects; |
|
| 56 | 56 |
private GridObject fpsGrid, stretchGrid; |
| 57 | 57 |
private DistortedFramebuffer mScreen; |
| 58 | 58 |
private Static3D touchPoint; |
| ... | ... | |
| 92 | 92 |
mPaint.setAntiAlias(true); |
| 93 | 93 |
mPaint.setTextAlign(Paint.Align.CENTER); |
| 94 | 94 |
|
| 95 |
fpsEffects = new DistortedEffectQueues();
|
|
| 96 |
stretchEffects = new DistortedEffectQueues();
|
|
| 95 |
fpsEffects = new DistortedEffects(); |
|
| 96 |
stretchEffects = new DistortedEffects(); |
|
| 97 | 97 |
|
| 98 | 98 |
mRegion = new Static4D(0,0,50,50); |
| 99 | 99 |
|
| src/main/java/org/distorted/examples/differentbitmaps/DifferentBitmapsRenderer.java | ||
|---|---|---|
| 30 | 30 |
import org.distorted.library.Distorted; |
| 31 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 32 |
import org.distorted.library.DistortedTexture; |
| 33 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 33 |
import org.distorted.library.DistortedEffects; |
|
| 34 | 34 |
import org.distorted.library.GridFlat; |
| 35 | 35 |
import org.distorted.library.EffectTypes; |
| 36 | 36 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 51 | 51 |
|
| 52 | 52 |
private GLSurfaceView mView; |
| 53 | 53 |
private DistortedTexture[] mTexture; |
| 54 |
private DistortedEffectQueues[] mEffects;
|
|
| 54 |
private DistortedEffects[] mEffects; |
|
| 55 | 55 |
private GridFlat mGrid; |
| 56 | 56 |
private DistortedFramebuffer mScreen; |
| 57 | 57 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 67 | 67 |
dDistort.add(new Static3D(-25,0,0)); |
| 68 | 68 |
Static3D mPoint = new Static3D(305, 380, 0); |
| 69 | 69 |
|
| 70 |
mEffects = new DistortedEffectQueues[NUM];
|
|
| 71 |
mEffects[0] = new DistortedEffectQueues();
|
|
| 70 |
mEffects = new DistortedEffects[NUM]; |
|
| 71 |
mEffects[0] = new DistortedEffects(); |
|
| 72 | 72 |
for(int i=1; i<NUM; i++) |
| 73 |
mEffects[i] = new DistortedEffectQueues(mEffects[0], Distorted.CLONE_VERTEX|Distorted.CLONE_FRAGMENT);
|
|
| 73 |
mEffects[i] = new DistortedEffects(mEffects[0], Distorted.CLONE_VERTEX|Distorted.CLONE_FRAGMENT); |
|
| 74 | 74 |
|
| 75 | 75 |
// Add the effects only to the first queue - all VERTEX and FRAGMENT effects are shared! |
| 76 | 76 |
// (Matrix effect cannot be shared as we have to display each Texture in a different location) |
| src/main/java/org/distorted/examples/differenteffects/DifferentEffectsRenderer.java | ||
|---|---|---|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 | 30 |
import org.distorted.library.Distorted; |
| 31 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 33 |
import org.distorted.library.GridFlat; |
| 33 | 34 |
import org.distorted.library.DistortedTexture; |
| 34 |
import org.distorted.library.DistortedEffectQueues; |
|
| 35 | 35 |
import org.distorted.library.EffectTypes; |
| 36 | 36 |
import org.distorted.library.type.Dynamic1D; |
| 37 | 37 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 51 | 51 |
private static final int NUM = 3; |
| 52 | 52 |
|
| 53 | 53 |
private GLSurfaceView mView; |
| 54 |
private DistortedEffectQueues[] mEffects;
|
|
| 54 |
private DistortedEffects[] mEffects; |
|
| 55 | 55 |
private DistortedTexture mTexture; |
| 56 | 56 |
private GridFlat mGrid; |
| 57 | 57 |
private DistortedFramebuffer mScreen; |
| ... | ... | |
| 76 | 76 |
|
| 77 | 77 |
// we don't need to prepare anything for mEffects[2] effects |
| 78 | 78 |
|
| 79 |
mEffects = new DistortedEffectQueues[NUM];
|
|
| 79 |
mEffects = new DistortedEffects[NUM]; |
|
| 80 | 80 |
|
| 81 |
for(int i=0; i<NUM; i++) mEffects[i] = new DistortedEffectQueues();
|
|
| 81 |
for(int i=0; i<NUM; i++) mEffects[i] = new DistortedEffects(); |
|
| 82 | 82 |
|
| 83 | 83 |
Dynamic1D sink = new Dynamic1D(2000,0.0f); |
| 84 | 84 |
sink.add(new Static1D( 1)); |
| src/main/java/org/distorted/examples/dynamic/DynamicRenderer.java | ||
|---|---|---|
| 29 | 29 |
import android.opengl.GLES20; |
| 30 | 30 |
import android.opengl.GLSurfaceView; |
| 31 | 31 |
|
| 32 |
import org.distorted.library.DistortedEffects; |
|
| 32 | 33 |
import org.distorted.library.DistortedFramebuffer; |
| 33 | 34 |
import org.distorted.library.GridFlat; |
| 34 |
import org.distorted.library.DistortedEffectQueues; |
|
| 35 | 35 |
import org.distorted.library.DistortedTexture; |
| 36 | 36 |
import org.distorted.library.Distorted; |
| 37 | 37 |
|
| ... | ... | |
| 41 | 41 |
{
|
| 42 | 42 |
private DynamicSurfaceView mView; |
| 43 | 43 |
private DistortedTexture mTexture; |
| 44 |
private DistortedEffectQueues mEffects;
|
|
| 44 |
private DistortedEffects mEffects; |
|
| 45 | 45 |
private DistortedFramebuffer mScreen; |
| 46 | 46 |
private GridFlat mGrid; |
| 47 | 47 |
private Canvas mCanvas; |
| ... | ... | |
| 62 | 62 |
|
| 63 | 63 |
mView = v; |
| 64 | 64 |
mGrid = new GridFlat(1,1); |
| 65 |
mEffects = new DistortedEffectQueues();
|
|
| 65 |
mEffects = new DistortedEffects(); |
|
| 66 | 66 |
mScreen = new DistortedFramebuffer(0); |
| 67 | 67 |
} |
| 68 | 68 |
|
| src/main/java/org/distorted/examples/effectqueue/EffectQueueActivity.java | ||
|---|---|---|
| 170 | 170 |
{
|
| 171 | 171 |
Long currID = (Long)mID.getItemAtPosition(mPosID); |
| 172 | 172 |
EffectQueueSurfaceView v = (EffectQueueSurfaceView) this.findViewById(R.id.effects2dSurfaceView); |
| 173 |
v.getRenderer().getQueues().abortEffect(currID);
|
|
| 173 |
v.getRenderer().getEffects().abortEffect(currID);
|
|
| 174 | 174 |
} |
| 175 | 175 |
catch(IndexOutOfBoundsException ex) |
| 176 | 176 |
{
|
| ... | ... | |
| 195 | 195 |
} |
| 196 | 196 |
|
| 197 | 197 |
EffectQueueSurfaceView v = (EffectQueueSurfaceView) this.findViewById(R.id.effects2dSurfaceView); |
| 198 |
v.getRenderer().getQueues().abortEffects(name);
|
|
| 198 |
v.getRenderer().getEffects().abortEffects(name);
|
|
| 199 | 199 |
} |
| 200 | 200 |
|
| 201 | 201 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 212 | 212 |
} |
| 213 | 213 |
|
| 214 | 214 |
EffectQueueSurfaceView v = (EffectQueueSurfaceView) this.findViewById(R.id.effects2dSurfaceView); |
| 215 |
v.getRenderer().getQueues().abortEffects(type);
|
|
| 215 |
v.getRenderer().getEffects().abortEffects(type);
|
|
| 216 | 216 |
} |
| 217 | 217 |
|
| 218 | 218 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java | ||
|---|---|---|
| 29 | 29 |
import android.opengl.GLES20; |
| 30 | 30 |
import android.opengl.GLSurfaceView; |
| 31 | 31 |
|
| 32 |
import org.distorted.library.DistortedEffects; |
|
| 32 | 33 |
import org.distorted.library.DistortedFramebuffer; |
| 33 | 34 |
import org.distorted.library.GridFlat; |
| 34 | 35 |
import org.distorted.library.DistortedTexture; |
| 35 |
import org.distorted.library.DistortedEffectQueues; |
|
| 36 | 36 |
import org.distorted.library.Distorted; |
| 37 | 37 |
import org.distorted.library.EffectNames; |
| 38 | 38 |
import org.distorted.library.EffectTypes; |
| ... | ... | |
| 54 | 54 |
|
| 55 | 55 |
private DistortedTexture mTexture; |
| 56 | 56 |
private GridFlat mGrid; |
| 57 |
private DistortedEffectQueues mEffects;
|
|
| 57 |
private DistortedEffects mEffects; |
|
| 58 | 58 |
private DistortedFramebuffer mScreen; |
| 59 | 59 |
|
| 60 | 60 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 73 | 73 |
|
| 74 | 74 |
mGrid = new GridFlat(80,80*texHeight/texWidth); |
| 75 | 75 |
mTexture = new DistortedTexture(texWidth,texHeight); |
| 76 |
mEffects = new DistortedEffectQueues();
|
|
| 76 |
mEffects = new DistortedEffects(); |
|
| 77 | 77 |
|
| 78 | 78 |
mEffects.registerForMessages(this); |
| 79 | 79 |
|
| ... | ... | |
| 82 | 82 |
|
| 83 | 83 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 84 | 84 |
|
| 85 |
DistortedEffectQueues getQueues()
|
|
| 85 |
DistortedEffects getEffects()
|
|
| 86 | 86 |
{
|
| 87 | 87 |
return mEffects; |
| 88 | 88 |
} |
| src/main/java/org/distorted/examples/effectqueue/EffectQueueSurfaceView.java | ||
|---|---|---|
| 21 | 21 |
|
| 22 | 22 |
import android.content.Context; |
| 23 | 23 |
import android.opengl.GLSurfaceView; |
| 24 |
import android.os.Build; |
|
| 25 | 24 |
import android.view.MotionEvent; |
| 26 | 25 |
import android.util.AttributeSet; |
| 27 | 26 |
|
| ... | ... | |
| 29 | 28 |
import org.distorted.library.EffectTypes; |
| 30 | 29 |
import org.distorted.library.type.Dynamic1D; |
| 31 | 30 |
import org.distorted.library.type.Static1D; |
| 32 |
import org.distorted.library.type.Static2D; |
|
| 33 | 31 |
import org.distorted.library.type.Static3D; |
| 34 | 32 |
import org.distorted.library.type.Static4D; |
| 35 | 33 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 140 | 138 |
|
| 141 | 139 |
switch(mCurrentEffect) |
| 142 | 140 |
{
|
| 143 |
case 0: id = mRenderer.getQueues().distort(mInterD, mPoint, mRegionV);
|
|
| 141 |
case 0: id = mRenderer.getEffects().distort(mInterD, mPoint, mRegionV);
|
|
| 144 | 142 |
act.effectAdded(id, EffectNames.DISTORT, EffectTypes.VERTEX); |
| 145 | 143 |
break; |
| 146 |
case 1: id = mRenderer.getQueues().sink(mInterS, mPoint, mRegionV);
|
|
| 144 |
case 1: id = mRenderer.getEffects().sink(mInterS, mPoint, mRegionV);
|
|
| 147 | 145 |
act.effectAdded(id, EffectNames.SINK, EffectTypes.VERTEX); |
| 148 | 146 |
break; |
| 149 |
case 2: id = mRenderer.getQueues().alpha(mInterA, mRegionF, true);
|
|
| 147 |
case 2: id = mRenderer.getEffects().alpha(mInterA, mRegionF, true);
|
|
| 150 | 148 |
act.effectAdded(id, EffectNames.ALPHA, EffectTypes.FRAGMENT); |
| 151 | 149 |
break; |
| 152 |
case 3: id = mRenderer.getQueues().saturation(mInterB, mRegionF, false);
|
|
| 150 |
case 3: id = mRenderer.getEffects().saturation(mInterB, mRegionF, false);
|
|
| 153 | 151 |
act.effectAdded(id, EffectNames.SATURATION, EffectTypes.FRAGMENT); |
| 154 | 152 |
break; |
| 155 |
case 4: id = mRenderer.getQueues().chroma(mInterC, mRED, mRegionF, true);
|
|
| 153 |
case 4: id = mRenderer.getEffects().chroma(mInterC, mRED, mRegionF, true);
|
|
| 156 | 154 |
act.effectAdded(id, EffectNames.CHROMA, EffectTypes.FRAGMENT); |
| 157 | 155 |
break; |
| 158 | 156 |
} |
| src/main/java/org/distorted/examples/effects3d/Effects3DActivity.java | ||
|---|---|---|
| 42 | 42 |
import org.distorted.library.GridCubes; |
| 43 | 43 |
import org.distorted.library.GridObject; |
| 44 | 44 |
import org.distorted.library.DistortedTexture; |
| 45 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 45 |
import org.distorted.library.DistortedEffects; |
|
| 46 | 46 |
import org.distorted.library.EffectNames; |
| 47 | 47 |
import org.distorted.library.EffectTypes; |
| 48 | 48 |
|
| ... | ... | |
| 68 | 68 |
private NumberPicker mColsPicker, mRowsPicker; |
| 69 | 69 |
private boolean[] mShape; |
| 70 | 70 |
private DistortedTexture mTexture; |
| 71 |
private DistortedEffectQueues mQueues;
|
|
| 71 |
private DistortedEffects mEffects;
|
|
| 72 | 72 |
private GridObject mGrid; |
| 73 | 73 |
private int mObjectType; |
| 74 | 74 |
private int mBitmapID; |
| 75 | 75 |
private Bitmap mBitmap; |
| 76 | 76 |
|
| 77 |
private ArrayList<Effects3DEffect> mEffects;
|
|
| 77 |
private ArrayList<Effects3DEffect> mList;
|
|
| 78 | 78 |
private int mEffectAdd; |
| 79 | 79 |
private float mCenterX, mCenterY, mCenterZ; |
| 80 | 80 |
private float mRegionX, mRegionY, mRegionR; |
| ... | ... | |
| 91 | 91 |
{
|
| 92 | 92 |
super.onCreate(savedState); |
| 93 | 93 |
|
| 94 |
mEffects = new ArrayList<>();
|
|
| 94 |
mList = new ArrayList<>();
|
|
| 95 | 95 |
|
| 96 | 96 |
createEffectNames(); |
| 97 | 97 |
|
| ... | ... | |
| 226 | 226 |
|
| 227 | 227 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 228 | 228 |
|
| 229 |
public DistortedEffectQueues getQueues()
|
|
| 229 |
public DistortedEffects getEffects()
|
|
| 230 | 230 |
{
|
| 231 |
return mQueues;
|
|
| 231 |
return mEffects;
|
|
| 232 | 232 |
} |
| 233 | 233 |
|
| 234 | 234 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 410 | 410 |
int w = mBitmap.getWidth(); |
| 411 | 411 |
int h = mBitmap.getHeight(); |
| 412 | 412 |
|
| 413 |
mQueues = new DistortedEffectQueues();
|
|
| 413 |
mEffects = new DistortedEffects();
|
|
| 414 | 414 |
mTexture= new DistortedTexture(w,h); |
| 415 | 415 |
mGrid = new GridFlat(mNumCols,mNumCols*h/w); |
| 416 | 416 |
setEffectView(); |
| ... | ... | |
| 441 | 441 |
for(int i=0; i<mNumRows*mNumCols; i++) |
| 442 | 442 |
str += mShape[i] ? "1" : "0"; |
| 443 | 443 |
|
| 444 |
mQueues = new DistortedEffectQueues();
|
|
| 444 |
mEffects = new DistortedEffects();
|
|
| 445 | 445 |
mTexture= new DistortedTexture(mNumCols,mNumRows); |
| 446 | 446 |
mGrid = new GridCubes(mNumCols, str, false); |
| 447 | 447 |
|
| ... | ... | |
| 557 | 557 |
public void newEffect(View v) |
| 558 | 558 |
{
|
| 559 | 559 |
Effects3DEffect eff = new Effects3DEffect(mEffectNames[mEffectAdd], this); |
| 560 |
mEffects.add(eff);
|
|
| 560 |
mList.add(eff);
|
|
| 561 | 561 |
|
| 562 | 562 |
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout); |
| 563 | 563 |
View view = eff.createView(); |
| ... | ... | |
| 575 | 575 |
layout.addView(region); |
| 576 | 576 |
} |
| 577 | 577 |
|
| 578 |
eff.apply(mQueues);
|
|
| 578 |
eff.apply(mEffects);
|
|
| 579 | 579 |
} |
| 580 | 580 |
|
| 581 | 581 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 582 | 582 |
|
| 583 | 583 |
public void removeAll(View v) |
| 584 | 584 |
{
|
| 585 |
mEffects.clear();
|
|
| 585 |
mList.clear();
|
|
| 586 | 586 |
LinearLayout layout = (LinearLayout)findViewById(R.id.effects3dlayout); |
| 587 | 587 |
layout.removeAllViews(); |
| 588 |
mQueues.abortEffects(EffectTypes.VERTEX);
|
|
| 589 |
mQueues.abortEffects(EffectTypes.FRAGMENT);
|
|
| 588 |
mEffects.abortEffects(EffectTypes.VERTEX);
|
|
| 589 |
mEffects.abortEffects(EffectTypes.FRAGMENT);
|
|
| 590 | 590 |
|
| 591 | 591 |
resetData(); |
| 592 | 592 |
|
| ... | ... | |
| 603 | 603 |
|
| 604 | 604 |
public void remove(View v) |
| 605 | 605 |
{
|
| 606 |
for(Effects3DEffect effect: mEffects)
|
|
| 606 |
for(Effects3DEffect effect: mList)
|
|
| 607 | 607 |
{
|
| 608 | 608 |
if( effect.thisView(v) ) |
| 609 | 609 |
{
|
| ... | ... | |
| 617 | 617 |
view = effect.getRegion(); |
| 618 | 618 |
if( view!=null ) layout.removeView(view); |
| 619 | 619 |
|
| 620 |
mQueues.abortEffect(effect.getId());
|
|
| 621 |
mEffects.remove(effect);
|
|
| 620 |
mEffects.abortEffect(effect.getId());
|
|
| 621 |
mList.remove(effect);
|
|
| 622 | 622 |
|
| 623 | 623 |
resetData(); |
| 624 | 624 |
|
| src/main/java/org/distorted/examples/effects3d/Effects3DEffect.java | ||
|---|---|---|
| 24 | 24 |
import android.widget.TextView; |
| 25 | 25 |
|
| 26 | 26 |
import org.distorted.examples.R; |
| 27 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 27 |
import org.distorted.library.DistortedEffects; |
|
| 28 | 28 |
import org.distorted.library.EffectNames; |
| 29 | 29 |
import org.distorted.library.EffectTypes; |
| 30 | 30 |
import org.distorted.library.type.Dynamic1D; |
| ... | ... | |
| 77 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 78 | 78 |
// requires knowledge about effect nature |
| 79 | 79 |
|
| 80 |
void apply(DistortedEffectQueues queues)
|
|
| 80 |
void apply(DistortedEffects effects)
|
|
| 81 | 81 |
{
|
| 82 | 82 |
switch(mName) |
| 83 | 83 |
{
|
| 84 |
case ROTATE : mId = queues.rotate (mDyn4, mCenterDyn); break;
|
|
| 85 |
case QUATERNION : mId = queues.quaternion(mDyn4, mCenterDyn); break;
|
|
| 86 |
case MOVE : mId = queues.move (mDyn3) ; break;
|
|
| 87 |
case SCALE : mId = queues.scale (mDyn3) ; break;
|
|
| 88 |
case SHEAR : mId = queues.shear (mDyn3, mCenterDyn); break;
|
|
| 89 |
|
|
| 90 |
case DISTORT : mId = queues.distort (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 91 |
case DEFORM : mId = queues.deform (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 92 |
case SINK : mId = queues.sink (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 93 |
case PINCH : mId = queues.pinch (mDyn2, mCenterDyn, mRegionDyn); break;
|
|
| 94 |
case SWIRL : mId = queues.swirl (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 95 |
case WAVE : mId = queues.wave (mDyn5, mCenterDyn, mRegionDyn); break;
|
|
| 96 |
|
|
| 97 |
case ALPHA : mId = queues.alpha (mDyn1, mRegionDyn, false); break;
|
|
| 98 |
case SMOOTH_ALPHA : mId = queues.alpha (mDyn1, mRegionDyn, true ); break;
|
|
| 99 |
case CHROMA : mId = queues.chroma (mDyn1, mDyn3, mRegionDyn, false); break;
|
|
| 100 |
case SMOOTH_CHROMA : mId = queues.chroma (mDyn1, mDyn3, mRegionDyn, true ); break;
|
|
| 101 |
case BRIGHTNESS : mId = queues.brightness(mDyn1, mRegionDyn, false); break;
|
|
| 102 |
case SMOOTH_BRIGHTNESS: mId = queues.brightness(mDyn1, mRegionDyn, true ); break;
|
|
| 103 |
case SATURATION : mId = queues.saturation(mDyn1, mRegionDyn, false); break;
|
|
| 104 |
case SMOOTH_SATURATION: mId = queues.saturation(mDyn1, mRegionDyn, true ); break;
|
|
| 105 |
case CONTRAST : mId = queues.contrast (mDyn1, mRegionDyn, false); break;
|
|
| 106 |
case SMOOTH_CONTRAST : mId = queues.contrast (mDyn1, mRegionDyn, true ); break;
|
|
| 84 |
case ROTATE : mId = effects.rotate (mDyn4, mCenterDyn); break;
|
|
| 85 |
case QUATERNION : mId = effects.quaternion(mDyn4, mCenterDyn); break;
|
|
| 86 |
case MOVE : mId = effects.move (mDyn3) ; break;
|
|
| 87 |
case SCALE : mId = effects.scale (mDyn3) ; break;
|
|
| 88 |
case SHEAR : mId = effects.shear (mDyn3, mCenterDyn); break;
|
|
| 89 |
|
|
| 90 |
case DISTORT : mId = effects.distort (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 91 |
case DEFORM : mId = effects.deform (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 92 |
case SINK : mId = effects.sink (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 93 |
case PINCH : mId = effects.pinch (mDyn2, mCenterDyn, mRegionDyn); break;
|
|
| 94 |
case SWIRL : mId = effects.swirl (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 95 |
case WAVE : mId = effects.wave (mDyn5, mCenterDyn, mRegionDyn); break;
|
|
| 96 |
|
|
| 97 |
case ALPHA : mId = effects.alpha (mDyn1, mRegionDyn, false); break;
|
|
| 98 |
case SMOOTH_ALPHA : mId = effects.alpha (mDyn1, mRegionDyn, true ); break;
|
|
| 99 |
case CHROMA : mId = effects.chroma (mDyn1, mDyn3, mRegionDyn, false); break;
|
|
| 100 |
case SMOOTH_CHROMA : mId = effects.chroma (mDyn1, mDyn3, mRegionDyn, true ); break;
|
|
| 101 |
case BRIGHTNESS : mId = effects.brightness(mDyn1, mRegionDyn, false); break;
|
|
| 102 |
case SMOOTH_BRIGHTNESS: mId = effects.brightness(mDyn1, mRegionDyn, true ); break;
|
|
| 103 |
case SATURATION : mId = effects.saturation(mDyn1, mRegionDyn, false); break;
|
|
| 104 |
case SMOOTH_SATURATION: mId = effects.saturation(mDyn1, mRegionDyn, true ); break;
|
|
| 105 |
case CONTRAST : mId = effects.contrast (mDyn1, mRegionDyn, false); break;
|
|
| 106 |
case SMOOTH_CONTRAST : mId = effects.contrast (mDyn1, mRegionDyn, true ); break;
|
|
| 107 | 107 |
|
| 108 | 108 |
default: mId = -1; |
| 109 | 109 |
} |
| src/main/java/org/distorted/examples/effects3d/Effects3DRenderer.java | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
import org.distorted.examples.R; |
| 28 | 28 |
import org.distorted.library.Distorted; |
| 29 |
import org.distorted.library.DistortedEffects; |
|
| 29 | 30 |
import org.distorted.library.DistortedFramebuffer; |
| 30 | 31 |
import org.distorted.library.DistortedTexture; |
| 31 | 32 |
import org.distorted.library.GridFlat; |
| 32 |
import org.distorted.library.DistortedEffectQueues; |
|
| 33 | 33 |
import org.distorted.library.GridObject; |
| 34 | 34 |
import org.distorted.library.EffectTypes; |
| 35 | 35 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 49 | 49 |
{
|
| 50 | 50 |
private GLSurfaceView mView; |
| 51 | 51 |
private DistortedTexture mObjectTexture, mBackgroundTexture, mCenterTexture, mRegionTexture; |
| 52 |
private DistortedEffectQueues mObjectEffects, mBackgroundEffects, mCenterEffects, mRegionEffects;
|
|
| 52 |
private DistortedEffects mObjectEffects, mBackgroundEffects, mCenterEffects, mRegionEffects; |
|
| 53 | 53 |
private DistortedFramebuffer mScreen; |
| 54 | 54 |
private GridFlat mQuad; |
| 55 | 55 |
private GridObject mObjectGrid; |
| ... | ... | |
| 76 | 76 |
|
| 77 | 77 |
mObjectTexture = act.getTexture(); |
| 78 | 78 |
mObjectGrid = act.getGrid(); |
| 79 |
mObjectEffects = act.getQueues();
|
|
| 79 |
mObjectEffects = act.getEffects();
|
|
| 80 | 80 |
mBackgroundTexture = new DistortedTexture(100,100); |
| 81 | 81 |
mCenterTexture = new DistortedTexture(100,100); |
| 82 | 82 |
mRegionTexture = new DistortedTexture(100,100); |
| 83 | 83 |
mQuad = new GridFlat(1,1); |
| 84 |
mBackgroundEffects = new DistortedEffectQueues();
|
|
| 85 |
mCenterEffects = new DistortedEffectQueues();
|
|
| 86 |
mRegionEffects = new DistortedEffectQueues();
|
|
| 84 |
mBackgroundEffects = new DistortedEffects(); |
|
| 85 |
mCenterEffects = new DistortedEffects();
|
|
| 86 |
mRegionEffects = new DistortedEffects();
|
|
| 87 | 87 |
|
| 88 | 88 |
mObjWidth = mObjectTexture.getWidth(); |
| 89 | 89 |
mObjHeight= mObjectTexture.getHeight(); |
| src/main/java/org/distorted/examples/fbo/FBORenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 31 |
import org.distorted.library.DistortedObjectTree;
|
|
| 32 |
import org.distorted.library.DistortedTree; |
|
| 32 | 33 |
import org.distorted.library.Distorted; |
| 33 | 34 |
import org.distorted.library.GridCubes; |
| 34 | 35 |
import org.distorted.library.GridFlat; |
| 35 | 36 |
import org.distorted.library.DistortedTexture; |
| 36 |
import org.distorted.library.DistortedEffectQueues; |
|
| 37 | 37 |
import org.distorted.library.EffectTypes; |
| 38 | 38 |
import org.distorted.library.type.Dynamic; |
| 39 | 39 |
import org.distorted.library.type.Dynamic1D; |
| ... | ... | |
| 50 | 50 |
class FBORenderer implements GLSurfaceView.Renderer |
| 51 | 51 |
{
|
| 52 | 52 |
private GLSurfaceView mView; |
| 53 |
private DistortedEffectQueues mEffects;
|
|
| 53 |
private DistortedEffects mEffects; |
|
| 54 | 54 |
private DistortedFramebuffer mScreen; |
| 55 |
private DistortedObjectTree mRoot;
|
|
| 55 |
private DistortedTree mRoot; |
|
| 56 | 56 |
private int lisaHeight, lisaWidth; |
| 57 | 57 |
|
| 58 | 58 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 60 | 60 |
FBORenderer(GLSurfaceView v) |
| 61 | 61 |
{
|
| 62 | 62 |
mView = v; |
| 63 |
mEffects= new DistortedEffectQueues();
|
|
| 63 |
mEffects= new DistortedEffects(); |
|
| 64 | 64 |
mScreen = new DistortedFramebuffer(0); |
| 65 | 65 |
} |
| 66 | 66 |
|
| ... | ... | |
| 133 | 133 |
DistortedTexture text = new DistortedTexture(textWidth,textHeight); |
| 134 | 134 |
lisa.setTexture(bitmap1); |
| 135 | 135 |
text.setTexture(bitmap2); |
| 136 |
DistortedEffectQueues textQueues = new DistortedEffectQueues();
|
|
| 136 |
DistortedEffects textEffects = new DistortedEffects();
|
|
| 137 | 137 |
|
| 138 | 138 |
mEffects.abortAllEffects(); |
| 139 | 139 |
|
| 140 |
mRoot = new DistortedObjectTree(lisa, mEffects,new GridFlat(1,1));
|
|
| 141 |
mRoot.attach(text,textQueues,new GridCubes(20,5,false));
|
|
| 140 |
mRoot = new DistortedTree(lisa, mEffects,new GridFlat(1,1)); |
|
| 141 |
mRoot.attach(text,textEffects,new GridCubes(20,5,false));
|
|
| 142 | 142 |
|
| 143 | 143 |
float factor = lisaWidth/(2.0f*textWidth); |
| 144 | 144 |
|
| 145 |
textQueues.move( new Static3D( (lisaWidth-factor*textWidth)/2,(lisaHeight-factor*textHeight)/2,0) );
|
|
| 146 |
textQueues.scale(factor);
|
|
| 145 |
textEffects.move( new Static3D( (lisaWidth-factor*textWidth)/2,(lisaHeight-factor*textHeight)/2,0) );
|
|
| 146 |
textEffects.scale(factor);
|
|
| 147 | 147 |
|
| 148 | 148 |
Dynamic1D rotDyn = new Dynamic1D(12000,0.0f); |
| 149 | 149 |
rotDyn.add(new Static1D( 0)); |
| 150 | 150 |
rotDyn.add(new Static1D(360)); |
| 151 | 151 |
rotDyn.setMode(Dynamic.MODE_JUMP); |
| 152 | 152 |
|
| 153 |
textQueues.rotate(rotDyn, new Static3D(1,0,0), new Static3D(textWidth/2,textHeight/2,textHeight/10) );
|
|
| 153 |
textEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(textWidth/2,textHeight/2,textHeight/10) );
|
|
| 154 | 154 |
|
| 155 | 155 |
Dynamic1D sinkDyn = new Dynamic1D(3000,0.0f); |
| 156 | 156 |
sinkDyn.add(new Static1D(1.0f)); |
| 157 | 157 |
sinkDyn.add(new Static1D(0.3f)); |
| 158 | 158 |
|
| 159 |
textQueues.sink(sinkDyn, new Static3D(textWidth/2,textHeight/2, 0));
|
|
| 159 |
textEffects.sink(sinkDyn, new Static3D(textWidth/2,textHeight/2, 0));
|
|
| 160 | 160 |
|
| 161 | 161 |
Dynamic1D chromaDyn = new Dynamic1D(5000,0.0f); |
| 162 | 162 |
chromaDyn.add(new Static1D(0.0f)); |
| src/main/java/org/distorted/examples/flag/FlagRenderer.java | ||
|---|---|---|
| 26 | 26 |
|
| 27 | 27 |
import org.distorted.examples.R; |
| 28 | 28 |
import org.distorted.library.Distorted; |
| 29 |
import org.distorted.library.DistortedEffects; |
|
| 29 | 30 |
import org.distorted.library.DistortedFramebuffer; |
| 30 | 31 |
import org.distorted.library.GridCubes; |
| 31 |
import org.distorted.library.DistortedEffectQueues; |
|
| 32 | 32 |
import org.distorted.library.DistortedTexture; |
| 33 | 33 |
import org.distorted.library.EffectTypes; |
| 34 | 34 |
import org.distorted.library.type.Dynamic; |
| ... | ... | |
| 49 | 49 |
class FlagRenderer implements GLSurfaceView.Renderer |
| 50 | 50 |
{
|
| 51 | 51 |
private GLSurfaceView mView; |
| 52 |
private DistortedEffectQueues mEffects;
|
|
| 52 |
private DistortedEffects mEffects; |
|
| 53 | 53 |
private DistortedTexture mTexture; |
| 54 | 54 |
private DistortedFramebuffer mScreen; |
| 55 | 55 |
private GridCubes mGrid; |
| ... | ... | |
| 67 | 67 |
{
|
| 68 | 68 |
mView = v; |
| 69 | 69 |
|
| 70 |
mEffects = new DistortedEffectQueues();
|
|
| 70 |
mEffects = new DistortedEffects(); |
|
| 71 | 71 |
mGrid = new GridCubes(50,30,false); |
| 72 | 72 |
mTexture = new DistortedTexture(500,300); |
| 73 | 73 |
|
| src/main/java/org/distorted/examples/girl/GirlRenderer.java | ||
|---|---|---|
| 31 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 32 |
import org.distorted.library.GridFlat; |
| 33 | 33 |
import org.distorted.library.DistortedTexture; |
| 34 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 34 |
import org.distorted.library.DistortedEffects; |
|
| 35 | 35 |
import org.distorted.library.EffectTypes; |
| 36 | 36 |
import org.distorted.library.type.Dynamic1D; |
| 37 | 37 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 50 | 50 |
{
|
| 51 | 51 |
private GLSurfaceView mView; |
| 52 | 52 |
private DistortedTexture mTexture; |
| 53 |
private DistortedEffectQueues mEffects;
|
|
| 53 |
private DistortedEffects mEffects; |
|
| 54 | 54 |
private DistortedFramebuffer mScreen; |
| 55 | 55 |
private GridFlat mGrid; |
| 56 | 56 |
private Static3D v0,v1,v2,v3; |
| ... | ... | |
| 111 | 111 |
diHips.add(dMiddle); |
| 112 | 112 |
diHips.add(dBegin); |
| 113 | 113 |
|
| 114 |
mEffects = new DistortedEffectQueues();
|
|
| 114 |
mEffects = new DistortedEffects(); |
|
| 115 | 115 |
|
| 116 | 116 |
mEffects.sink( diSink, pLeft, sinkRegion ); |
| 117 | 117 |
mEffects.sink( diSink, pRight,sinkRegion ); |
| src/main/java/org/distorted/examples/listener/ListenerRenderer.java | ||
|---|---|---|
| 32 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 33 | 33 |
import org.distorted.library.GridFlat; |
| 34 | 34 |
import org.distorted.library.DistortedTexture; |
| 35 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 35 |
import org.distorted.library.DistortedEffects; |
|
| 36 | 36 |
import org.distorted.library.EffectNames; |
| 37 | 37 |
import org.distorted.library.EffectTypes; |
| 38 | 38 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 54 | 54 |
|
| 55 | 55 |
private GLSurfaceView mView; |
| 56 | 56 |
private DistortedTexture mTexture; |
| 57 |
private DistortedEffectQueues mEffects;
|
|
| 57 |
private DistortedEffects mEffects; |
|
| 58 | 58 |
private DistortedFramebuffer mScreen; |
| 59 | 59 |
private GridFlat mGrid; |
| 60 | 60 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 66 | 66 |
{
|
| 67 | 67 |
Distorted.setMaxVertex(NUM_BUBBLES); |
| 68 | 68 |
mView = v; |
| 69 |
mEffects = new DistortedEffectQueues();
|
|
| 69 |
mEffects = new DistortedEffects(); |
|
| 70 | 70 |
mEffects.registerForMessages(this); |
| 71 | 71 |
mScreen = new DistortedFramebuffer(0); |
| 72 | 72 |
mRnd = new Random(0); |
| src/main/java/org/distorted/examples/matrix3d/Matrix3DActivity.java | ||
|---|---|---|
| 32 | 32 |
|
| 33 | 33 |
import org.distorted.examples.R; |
| 34 | 34 |
import org.distorted.library.Distorted; |
| 35 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 35 |
import org.distorted.library.DistortedEffects; |
|
| 36 | 36 |
import org.distorted.library.GridObject; |
| 37 | 37 |
import org.distorted.library.GridCubes; |
| 38 | 38 |
import org.distorted.library.DistortedTexture; |
| ... | ... | |
| 49 | 49 |
{
|
| 50 | 50 |
private DistortedTexture mTexture; |
| 51 | 51 |
private GridObject mGrid; |
| 52 |
private DistortedEffectQueues mQueues;
|
|
| 52 |
private DistortedEffects mEffects;
|
|
| 53 | 53 |
|
| 54 |
private ArrayList<Matrix3DEffect> mEffects;
|
|
| 54 |
private ArrayList<Matrix3DEffect> mList;
|
|
| 55 | 55 |
private int mEffectAdd; |
| 56 | 56 |
|
| 57 | 57 |
private EffectNames[] mEffectNames; |
| ... | ... | |
| 65 | 65 |
{
|
| 66 | 66 |
super.onCreate(savedState); |
| 67 | 67 |
|
| 68 |
mEffects = new ArrayList<>();
|
|
| 68 |
mList = new ArrayList<>();
|
|
| 69 | 69 |
|
| 70 | 70 |
createEffectNames(); |
| 71 | 71 |
|
| 72 |
mQueues = new DistortedEffectQueues();
|
|
| 72 |
mEffects = new DistortedEffects();
|
|
| 73 | 73 |
mGrid = new GridCubes(1,1,false); |
| 74 | 74 |
mTexture= new DistortedTexture(100,100); |
| 75 | 75 |
|
| ... | ... | |
| 102 | 102 |
|
| 103 | 103 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 104 | 104 |
|
| 105 |
public DistortedEffectQueues getQueues()
|
|
| 105 |
public DistortedEffects getEffects()
|
|
| 106 | 106 |
{
|
| 107 |
return mQueues;
|
|
| 107 |
return mEffects;
|
|
| 108 | 108 |
} |
| 109 | 109 |
|
| 110 | 110 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| ... | ... | |
| 277 | 277 |
public void newEffect(View v) |
| 278 | 278 |
{
|
| 279 | 279 |
Matrix3DEffect eff = new Matrix3DEffect(mEffectNames[mEffectAdd], this); |
| 280 |
mEffects.add(eff);
|
|
| 280 |
mList.add(eff);
|
|
| 281 | 281 |
|
| 282 | 282 |
LinearLayout layout = (LinearLayout)findViewById(R.id.matrix3dlayout); |
| 283 | 283 |
View view = eff.createView(); |
| ... | ... | |
| 289 | 289 |
layout.addView(center); |
| 290 | 290 |
} |
| 291 | 291 |
|
| 292 |
eff.apply(mQueues);
|
|
| 292 |
eff.apply(mEffects);
|
|
| 293 | 293 |
} |
| 294 | 294 |
|
| 295 | 295 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 296 | 296 |
|
| 297 | 297 |
public void removeAll(View v) |
| 298 | 298 |
{
|
| 299 |
mEffects.clear();
|
|
| 299 |
mList.clear();
|
|
| 300 | 300 |
LinearLayout layout = (LinearLayout)findViewById(R.id.matrix3dlayout); |
| 301 | 301 |
layout.removeAllViews(); |
| 302 |
mQueues.abortEffects(EffectTypes.MATRIX);
|
|
| 302 |
mEffects.abortEffects(EffectTypes.MATRIX);
|
|
| 303 | 303 |
|
| 304 | 304 |
resetData(); |
| 305 | 305 |
} |
| ... | ... | |
| 308 | 308 |
|
| 309 | 309 |
public void remove(View v) |
| 310 | 310 |
{
|
| 311 |
for(Matrix3DEffect effect: mEffects)
|
|
| 311 |
for(Matrix3DEffect effect: mList)
|
|
| 312 | 312 |
{
|
| 313 | 313 |
if( effect.thisView(v) ) |
| 314 | 314 |
{
|
| ... | ... | |
| 322 | 322 |
view = effect.getRegion(); |
| 323 | 323 |
if( view!=null ) layout.removeView(view); |
| 324 | 324 |
|
| 325 |
mQueues.abortEffect(effect.getId());
|
|
| 326 |
mEffects.remove(effect);
|
|
| 325 |
mEffects.abortEffect(effect.getId());
|
|
| 326 |
mList.remove(effect);
|
|
| 327 | 327 |
|
| 328 | 328 |
resetData(); |
| 329 | 329 |
|
| src/main/java/org/distorted/examples/matrix3d/Matrix3DEffect.java | ||
|---|---|---|
| 24 | 24 |
import android.widget.TextView; |
| 25 | 25 |
|
| 26 | 26 |
import org.distorted.examples.R; |
| 27 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 27 |
import org.distorted.library.DistortedEffects; |
|
| 28 | 28 |
import org.distorted.library.EffectNames; |
| 29 | 29 |
import org.distorted.library.EffectTypes; |
| 30 | 30 |
import org.distorted.library.type.Dynamic1D; |
| ... | ... | |
| 77 | 77 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 78 | 78 |
// requires knowledge about effect nature |
| 79 | 79 |
|
| 80 |
void apply(DistortedEffectQueues queues)
|
|
| 80 |
void apply(DistortedEffects effects)
|
|
| 81 | 81 |
{
|
| 82 | 82 |
switch(mName) |
| 83 | 83 |
{
|
| 84 |
case ROTATE : mId = queues.rotate (mDyn4, mCenterDyn); break;
|
|
| 85 |
case QUATERNION : mId = queues.quaternion(mDyn4, mCenterDyn); break;
|
|
| 86 |
case MOVE : mId = queues.move (mDyn3) ; break;
|
|
| 87 |
case SCALE : mId = queues.scale (mDyn3) ; break;
|
|
| 88 |
case SHEAR : mId = queues.shear (mDyn3, mCenterDyn); break;
|
|
| 89 |
|
|
| 90 |
case DISTORT : mId = queues.distort (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 91 |
case DEFORM : mId = queues.deform (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 92 |
case SINK : mId = queues.sink (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 93 |
case PINCH : mId = queues.pinch (mDyn2, mCenterDyn, mRegionDyn); break;
|
|
| 94 |
case SWIRL : mId = queues.swirl (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 95 |
case WAVE : mId = queues.wave (mDyn5, mCenterDyn, mRegionDyn); break;
|
|
| 96 |
|
|
| 97 |
case ALPHA : mId = queues.alpha (mDyn1, mRegionDyn, false); break;
|
|
| 98 |
case SMOOTH_ALPHA : mId = queues.alpha (mDyn1, mRegionDyn, true ); break;
|
|
| 99 |
case CHROMA : mId = queues.chroma (mDyn1, mDyn3, mRegionDyn, false); break;
|
|
| 100 |
case SMOOTH_CHROMA : mId = queues.chroma (mDyn1, mDyn3, mRegionDyn, true ); break;
|
|
| 101 |
case BRIGHTNESS : mId = queues.brightness(mDyn1, mRegionDyn, false); break;
|
|
| 102 |
case SMOOTH_BRIGHTNESS: mId = queues.brightness(mDyn1, mRegionDyn, true ); break;
|
|
| 103 |
case SATURATION : mId = queues.saturation(mDyn1, mRegionDyn, false); break;
|
|
| 104 |
case SMOOTH_SATURATION: mId = queues.saturation(mDyn1, mRegionDyn, true ); break;
|
|
| 105 |
case CONTRAST : mId = queues.contrast (mDyn1, mRegionDyn, false); break;
|
|
| 106 |
case SMOOTH_CONTRAST : mId = queues.contrast (mDyn1, mRegionDyn, true ); break;
|
|
| 84 |
case ROTATE : mId = effects.rotate (mDyn4, mCenterDyn); break;
|
|
| 85 |
case QUATERNION : mId = effects.quaternion(mDyn4, mCenterDyn); break;
|
|
| 86 |
case MOVE : mId = effects.move (mDyn3) ; break;
|
|
| 87 |
case SCALE : mId = effects.scale (mDyn3) ; break;
|
|
| 88 |
case SHEAR : mId = effects.shear (mDyn3, mCenterDyn); break;
|
|
| 89 |
|
|
| 90 |
case DISTORT : mId = effects.distort (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 91 |
case DEFORM : mId = effects.deform (mDyn3, mCenterDyn, mRegionDyn); break;
|
|
| 92 |
case SINK : mId = effects.sink (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 93 |
case PINCH : mId = effects.pinch (mDyn2, mCenterDyn, mRegionDyn); break;
|
|
| 94 |
case SWIRL : mId = effects.swirl (mDyn1, mCenterDyn, mRegionDyn); break;
|
|
| 95 |
case WAVE : mId = effects.wave (mDyn5, mCenterDyn, mRegionDyn); break;
|
|
| 96 |
|
|
| 97 |
case ALPHA : mId = effects.alpha (mDyn1, mRegionDyn, false); break;
|
|
| 98 |
case SMOOTH_ALPHA : mId = effects.alpha (mDyn1, mRegionDyn, true ); break;
|
|
| 99 |
case CHROMA : mId = effects.chroma (mDyn1, mDyn3, mRegionDyn, false); break;
|
|
| 100 |
case SMOOTH_CHROMA : mId = effects.chroma (mDyn1, mDyn3, mRegionDyn, true ); break;
|
|
| 101 |
case BRIGHTNESS : mId = effects.brightness(mDyn1, mRegionDyn, false); break;
|
|
| 102 |
case SMOOTH_BRIGHTNESS: mId = effects.brightness(mDyn1, mRegionDyn, true ); break;
|
|
| 103 |
case SATURATION : mId = effects.saturation(mDyn1, mRegionDyn, false); break;
|
|
| 104 |
case SMOOTH_SATURATION: mId = effects.saturation(mDyn1, mRegionDyn, true ); break;
|
|
| 105 |
case CONTRAST : mId = effects.contrast (mDyn1, mRegionDyn, false); break;
|
|
| 106 |
case SMOOTH_CONTRAST : mId = effects.contrast (mDyn1, mRegionDyn, true ); break;
|
|
| 107 | 107 |
|
| 108 | 108 |
default: mId = -1; |
| 109 | 109 |
} |
| src/main/java/org/distorted/examples/matrix3d/Matrix3DRenderer.java | ||
|---|---|---|
| 23 | 23 |
import android.opengl.GLSurfaceView; |
| 24 | 24 |
|
| 25 | 25 |
import org.distorted.library.Distorted; |
| 26 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 26 |
import org.distorted.library.DistortedEffects; |
|
| 27 | 27 |
import org.distorted.library.DistortedFramebuffer; |
| 28 | 28 |
import org.distorted.library.GridObject; |
| 29 | 29 |
import org.distorted.library.DistortedTexture; |
| ... | ... | |
| 37 | 37 |
{
|
| 38 | 38 |
private GLSurfaceView mView; |
| 39 | 39 |
private DistortedTexture mTexture; |
| 40 |
private DistortedEffectQueues mEffects;
|
|
| 40 |
private DistortedEffects mEffects; |
|
| 41 | 41 |
private DistortedFramebuffer mScreen; |
| 42 | 42 |
private GridObject mGrid; |
| 43 | 43 |
|
| ... | ... | |
| 51 | 51 |
|
| 52 | 52 |
Matrix3DActivity act = (Matrix3DActivity)v.getContext(); |
| 53 | 53 |
|
| 54 |
mEffects = act.getQueues();
|
|
| 54 |
mEffects= act.getEffects();
|
|
| 55 | 55 |
mTexture= act.getTexture(); |
| 56 | 56 |
mGrid = act.getGrid(); |
| 57 | 57 |
mScreen = new DistortedFramebuffer(0); |
| src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
import org.distorted.library.Distorted; |
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 31 | 32 |
import org.distorted.library.DistortedTexture; |
| 32 |
import org.distorted.library.DistortedEffectQueues; |
|
| 33 | 33 |
import org.distorted.library.GridFlat; |
| 34 | 34 |
import org.distorted.library.EffectTypes; |
| 35 | 35 |
import org.distorted.library.type.Dynamic3D; |
| ... | ... | |
| 47 | 47 |
{
|
| 48 | 48 |
private GLSurfaceView mView; |
| 49 | 49 |
private DistortedTexture mTexture; |
| 50 |
private DistortedEffectQueues mEffects;
|
|
| 50 |
private DistortedEffects mEffects; |
|
| 51 | 51 |
private DistortedFramebuffer mScreen; |
| 52 | 52 |
private GridFlat mGrid; |
| 53 | 53 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 70 | 70 |
dRight.add( new Static3D( 0, 0,0) ); |
| 71 | 71 |
dRight.add( new Static3D( 20,-10,0) ); |
| 72 | 72 |
|
| 73 |
mEffects = new DistortedEffectQueues();
|
|
| 73 |
mEffects = new DistortedEffects(); |
|
| 74 | 74 |
mEffects.distort( dLeft, pLeft , rLeft ); |
| 75 | 75 |
mEffects.distort(dRight, pRight, rRight); |
| 76 | 76 |
|
| src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java | ||
|---|---|---|
| 31 | 31 |
|
| 32 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 33 | 33 |
import org.distorted.library.DistortedTexture; |
| 34 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 34 |
import org.distorted.library.DistortedEffects; |
|
| 35 | 35 |
import org.distorted.library.GridFlat; |
| 36 | 36 |
import org.distorted.library.Distorted; |
| 37 | 37 |
|
| ... | ... | |
| 46 | 46 |
private int texW, texH; |
| 47 | 47 |
|
| 48 | 48 |
private GridFlat mGrid; |
| 49 |
private DistortedEffectQueues mEffects;
|
|
| 49 |
private DistortedEffects mEffects; |
|
| 50 | 50 |
private DistortedTexture mTexture; |
| 51 | 51 |
private DistortedFramebuffer mScreen; |
| 52 | 52 |
private boolean mRefresh; |
| ... | ... | |
| 61 | 61 |
mPaint.setStyle(Style.FILL); |
| 62 | 62 |
|
| 63 | 63 |
mView = v; |
| 64 |
mEffects= new DistortedEffectQueues();
|
|
| 64 |
mEffects= new DistortedEffects(); |
|
| 65 | 65 |
mScreen = new DistortedFramebuffer(0); |
| 66 | 66 |
mRefresh= true; |
| 67 | 67 |
} |
| ... | ... | |
| 93 | 93 |
|
| 94 | 94 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
| 95 | 95 |
|
| 96 |
DistortedEffectQueues getQueues()
|
|
| 96 |
DistortedEffects getEffects()
|
|
| 97 | 97 |
{
|
| 98 | 98 |
return mEffects; |
| 99 | 99 |
} |
| src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java | ||
|---|---|---|
| 27 | 27 |
import android.view.MotionEvent; |
| 28 | 28 |
import android.util.AttributeSet; |
| 29 | 29 |
|
| 30 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 31 |
import org.distorted.library.EffectTypes; |
| 32 | 32 |
import org.distorted.library.type.Dynamic3D; |
| 33 | 33 |
import org.distorted.library.type.Dynamic4D; |
| ... | ... | |
| 119 | 119 |
|
| 120 | 120 |
synchronized(lock) |
| 121 | 121 |
{
|
| 122 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 122 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 123 | 123 |
q.abortEffects(EffectTypes.VERTEX); |
| 124 | 124 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 125 | 125 |
q.distort( new Static3D(0,0,mMax/10) , di3D, dr); |
| ... | ... | |
| 135 | 135 |
|
| 136 | 136 |
synchronized(lock) |
| 137 | 137 |
{
|
| 138 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 138 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 139 | 139 |
q.abortEffects(EffectTypes.VERTEX); |
| 140 | 140 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 141 | 141 |
q.sink(new Static1D(10), di3D, dr); |
| ... | ... | |
| 151 | 151 |
|
| 152 | 152 |
synchronized(lock) |
| 153 | 153 |
{
|
| 154 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 154 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 155 | 155 |
q.abortEffects(EffectTypes.VERTEX); |
| 156 | 156 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 157 | 157 |
q.chroma(new Static1D(0.5f), new Static3D(1,0,0), mRegion, true); |
| ... | ... | |
| 167 | 167 |
|
| 168 | 168 |
synchronized(lock) |
| 169 | 169 |
{
|
| 170 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 170 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 171 | 171 |
q.abortEffects(EffectTypes.VERTEX); |
| 172 | 172 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 173 | 173 |
q.alpha(new Static1D(0.5f), mRegion, true); |
| ... | ... | |
| 183 | 183 |
|
| 184 | 184 |
synchronized(lock) |
| 185 | 185 |
{
|
| 186 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 186 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 187 | 187 |
q.abortEffects(EffectTypes.VERTEX); |
| 188 | 188 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 189 | 189 |
q.swirl( new Static1D(30), di3D, dr); |
| ... | ... | |
| 197 | 197 |
{
|
| 198 | 198 |
synchronized(lock) |
| 199 | 199 |
{
|
| 200 |
DistortedEffectQueues q = mRenderer.getQueues();
|
|
| 200 |
DistortedEffects q = mRenderer.getEffects();
|
|
| 201 | 201 |
q.abortEffects(EffectTypes.VERTEX); |
| 202 | 202 |
q.abortEffects(EffectTypes.FRAGMENT); |
| 203 | 203 |
di3D.removeAll(); |
| src/main/java/org/distorted/examples/olimpic/OlimpicRenderer.java | ||
|---|---|---|
| 27 | 27 |
|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 |
import org.distorted.library.DistortedEffects; |
|
| 30 | 31 |
import org.distorted.library.DistortedFramebuffer; |
| 31 |
import org.distorted.library.DistortedObjectTree;
|
|
| 32 |
import org.distorted.library.DistortedTree; |
|
| 32 | 33 |
import org.distorted.library.EffectTypes; |
| 33 | 34 |
import org.distorted.library.type.Dynamic1D; |
| 34 | 35 |
import org.distorted.library.type.Static3D; |
| 35 | 36 |
import org.distorted.library.type.Static1D; |
| 36 | 37 |
import org.distorted.library.Distorted; |
| 37 | 38 |
import org.distorted.library.GridFlat; |
| 38 |
import org.distorted.library.DistortedEffectQueues; |
|
| 39 | 39 |
import org.distorted.library.DistortedTexture; |
| 40 | 40 |
|
| 41 | 41 |
import android.graphics.Bitmap; |
| ... | ... | |
| 52 | 52 |
private static final int NUM_LEAVES = 8; |
| 53 | 53 |
|
| 54 | 54 |
private GLSurfaceView mView; |
| 55 |
private DistortedObjectTree mRoot;
|
|
| 55 |
private DistortedTree mRoot; |
|
| 56 | 56 |
private DistortedTexture mLeaf; |
| 57 | 57 |
private DistortedFramebuffer mScreen; |
| 58 | 58 |
private int mScreenW, mScreenH; |
| ... | ... | |
| 65 | 65 |
|
| 66 | 66 |
mLeaf = new DistortedTexture(LEAF_SIZE,LEAF_SIZE); |
| 67 | 67 |
GridFlat grid = new GridFlat(1,1); |
| 68 |
DistortedEffectQueues effects = new DistortedEffectQueues();
|
|
| 68 |
DistortedEffects effects = new DistortedEffects();
|
|
| 69 | 69 |
|
| 70 | 70 |
mScreenW = 9*LEAF_SIZE; |
| 71 | 71 |
mScreenH = 9*LEAF_SIZE; |
| 72 |
mRoot = new DistortedObjectTree(new DistortedTexture(mScreenW,mScreenH), effects, grid);
|
|
| 72 |
mRoot = new DistortedTree(new DistortedTexture(mScreenW,mScreenH), effects, grid); |
|
| 73 | 73 |
|
| 74 | 74 |
Dynamic1D rot = new Dynamic1D(5000,0.0f); |
| 75 | 75 |
rot.setMode(Dynamic1D.MODE_JUMP); |
| 76 | 76 |
rot.add(new Static1D( 0)); |
| 77 | 77 |
rot.add(new Static1D(360)); |
| 78 | 78 |
|
| 79 |
DistortedObjectTree[] mCircleNode = new DistortedObjectTree[NUM_CIRCLES];
|
|
| 79 |
DistortedTree[] mCircleNode = new DistortedTree[NUM_CIRCLES];
|
|
| 80 | 80 |
|
| 81 | 81 |
int[] colors = new int[] {0,0,1, 0,0,0, 1,0,0, 1,1,0, 0,1,0}; // blue, black, red, yellow, green
|
| 82 | 82 |
int[] positions = new int[] {0,2*LEAF_SIZE, 3*LEAF_SIZE,2*LEAF_SIZE, 6*LEAF_SIZE,2*LEAF_SIZE, 3*LEAF_SIZE/2,9*LEAF_SIZE/2, 9*LEAF_SIZE/2,9*LEAF_SIZE/2};
|
| ... | ... | |
| 89 | 89 |
{
|
| 90 | 90 |
if( i<=1 ) |
| 91 | 91 |
{
|
| 92 |
effects = new DistortedEffectQueues();
|
|
| 93 |
mCircleNode[i] = new DistortedObjectTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), effects, grid);
|
|
| 92 |
effects = new DistortedEffects(); |
|
| 93 |
mCircleNode[i] = new DistortedTree(new DistortedTexture(3*LEAF_SIZE,3*LEAF_SIZE), effects, grid); |
|
| 94 | 94 |
|
| 95 | 95 |
for(int j=0; j<NUM_LEAVES-i; j++) |
| 96 | 96 |
{
|
| 97 |
effects = new DistortedEffectQueues();
|
|
| 97 |
effects = new DistortedEffects(); |
|
| 98 | 98 |
mCircleNode[i].attach(mLeaf, effects, grid); |
| 99 | 99 |
effects.rotate( new Static1D(j*(360/NUM_LEAVES)), axis, center ); |
| 100 | 100 |
effects.move(moveVector); |
| ... | ... | |
| 102 | 102 |
} |
| 103 | 103 |
else |
| 104 | 104 |
{
|
| 105 |
mCircleNode[i] = new DistortedObjectTree(mCircleNode[0], Distorted.CLONE_BITMAP|Distorted.CLONE_CHILDREN);
|
|
| 105 |
mCircleNode[i] = new DistortedTree(mCircleNode[0], Distorted.CLONE_BITMAP|Distorted.CLONE_CHILDREN); |
|
| 106 | 106 |
} |
| 107 | 107 |
|
| 108 | 108 |
mRoot.attach(mCircleNode[i]); |
| 109 |
effects = mCircleNode[i].getQueues();
|
|
| 109 |
effects = mCircleNode[i].getEffects();
|
|
| 110 | 110 |
effects.move( new Static3D(positions[2*i], positions[2*i+1], 0) ); |
| 111 | 111 |
effects.rotate( rot, axis, center ); |
| 112 | 112 |
effects.chroma( new Static1D(0.5f), new Static3D(colors[3*i],colors[3*i+1], colors[3*i+2]) ); |
| ... | ... | |
| 127 | 127 |
|
| 128 | 128 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
| 129 | 129 |
{
|
| 130 |
DistortedEffectQueues effects = mRoot.getQueues();
|
|
| 130 |
DistortedEffects effects = mRoot.getEffects();
|
|
| 131 | 131 |
|
| 132 | 132 |
effects.abortEffects(EffectTypes.MATRIX); |
| 133 | 133 |
|
| src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java | ||
|---|---|---|
| 31 | 31 |
import android.view.SurfaceView; |
| 32 | 32 |
|
| 33 | 33 |
import org.distorted.library.Distorted; |
| 34 |
import org.distorted.library.DistortedEffects; |
|
| 34 | 35 |
import org.distorted.library.DistortedFramebuffer; |
| 35 | 36 |
import org.distorted.library.GridFlat; |
| 36 | 37 |
import org.distorted.library.DistortedTexture; |
| 37 |
import org.distorted.library.DistortedEffectQueues; |
|
| 38 | 38 |
import org.distorted.library.EffectTypes; |
| 39 | 39 |
import org.distorted.library.type.Dynamic3D; |
| 40 | 40 |
import org.distorted.library.type.Static3D; |
| ... | ... | |
| 63 | 63 |
private EGLSurface eglSurface; |
| 64 | 64 |
|
| 65 | 65 |
private DistortedTexture mTexture; |
| 66 |
private DistortedEffectQueues mEffects;
|
|
| 66 |
private DistortedEffects mEffects; |
|
| 67 | 67 |
private DistortedFramebuffer mScreen; |
| 68 | 68 |
private GridFlat mGrid; |
| 69 | 69 |
private int bmpHeight, bmpWidth; |
| ... | ... | |
| 91 | 91 |
dRight.add( new Static3D( 0, 0,0) ); |
| 92 | 92 |
dRight.add( new Static3D( 20,-10,0) ); |
| 93 | 93 |
|
| 94 |
mEffects = new DistortedEffectQueues();
|
|
| 94 |
mEffects = new DistortedEffects(); |
|
| 95 | 95 |
mEffects.distort( dLeft, pLeft , rLeft ); |
| 96 | 96 |
mEffects.distort(dRight, pRight, rRight); |
| 97 | 97 |
|
| src/main/java/org/distorted/examples/projection/ProjectionRenderer.java | ||
|---|---|---|
| 23 | 23 |
import javax.microedition.khronos.opengles.GL10; |
| 24 | 24 |
|
| 25 | 25 |
import org.distorted.library.Distorted; |
| 26 |
import org.distorted.library.DistortedEffects; |
|
| 26 | 27 |
import org.distorted.library.DistortedFramebuffer; |
| 27 | 28 |
import org.distorted.library.GridFlat; |
| 28 | 29 |
import org.distorted.library.DistortedTexture; |
| 29 |
import org.distorted.library.DistortedEffectQueues; |
|
| 30 | 30 |
import org.distorted.library.type.Static3D; |
| 31 | 31 |
import org.distorted.library.type.Static4D; |
| 32 | 32 |
|
| ... | ... | |
| 43 | 43 |
{
|
| 44 | 44 |
private GLSurfaceView mView; |
| 45 | 45 |
private DistortedTexture mTexture; |
| 46 |
private DistortedEffectQueues mEffects;
|
|
| 46 |
private DistortedEffects mEffects; |
|
| 47 | 47 |
private DistortedFramebuffer mScreen; |
| 48 | 48 |
private GridFlat mGrid; |
| 49 | 49 |
|
| ... | ... | |
| 55 | 55 |
ProjectionRenderer(GLSurfaceView view) |
| 56 | 56 |
{
|
| 57 | 57 |
mView = view; |
| 58 |
mEffects= new DistortedEffectQueues();
|
|
| 58 |
mEffects= new DistortedEffects(); |
|
| 59 | 59 |
mScreen = new DistortedFramebuffer(0); |
| 60 | 60 |
} |
| 61 | 61 |
|
| src/main/java/org/distorted/examples/quaternion/QuaternionRenderer.java | ||
|---|---|---|
| 28 | 28 |
|
| 29 | 29 |
import org.distorted.examples.R; |
| 30 | 30 |
|
| 31 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 33 |
import org.distorted.library.EffectTypes; |
| 33 | 34 |
import org.distorted.library.type.Dynamic; |
| 34 | 35 |
import org.distorted.library.type.DynamicQuat; |
| 35 | 36 |
import org.distorted.library.GridCubes; |
| 36 | 37 |
import org.distorted.library.DistortedTexture; |
| 37 |
import org.distorted.library.DistortedEffectQueues; |
|
| 38 | 38 |
import org.distorted.library.type.Static4D; |
| 39 | 39 |
import org.distorted.library.type.Static3D; |
| 40 | 40 |
import org.distorted.library.Distorted; |
| ... | ... | |
| 52 | 52 |
|
| 53 | 53 |
private GLSurfaceView mView; |
| 54 | 54 |
private DistortedTexture mTexture; |
| 55 |
private DistortedEffectQueues mEffects;
|
|
| 55 |
private DistortedEffects mEffects; |
|
| 56 | 56 |
private DistortedFramebuffer mScreen; |
| 57 | 57 |
private GridCubes mGrid; |
| 58 | 58 |
private DynamicQuat mRot; |
| ... | ... | |
| 64 | 64 |
mView = v; |
| 65 | 65 |
mGrid = new GridCubes(1,1,false); |
| 66 | 66 |
mTexture = new DistortedTexture(1,1); |
| 67 |
mEffects = new DistortedEffectQueues();
|
|
| 67 |
mEffects = new DistortedEffects(); |
|
| 68 | 68 |
mRot = new DynamicQuat(); |
| 69 | 69 |
|
| 70 | 70 |
Random rnd = new Random(System.currentTimeMillis()); |
| src/main/java/org/distorted/examples/save/SaveRenderer.java | ||
|---|---|---|
| 31 | 31 |
import org.distorted.examples.R; |
| 32 | 32 |
|
| 33 | 33 |
import org.distorted.library.Distorted; |
| 34 |
import org.distorted.library.DistortedEffectQueues;
|
|
| 34 |
import org.distorted.library.DistortedEffects; |
|
| 35 | 35 |
import org.distorted.library.DistortedTexture; |
| 36 | 36 |
import org.distorted.library.GridFlat; |
| 37 | 37 |
import org.distorted.library.DistortedFramebuffer; |
| ... | ... | |
| 54 | 54 |
{
|
| 55 | 55 |
private GLSurfaceView mView; |
| 56 | 56 |
private DistortedTexture mGirl; |
| 57 |
private DistortedEffectQueues mEffects;
|
|
| 57 |
private DistortedEffects mEffects; |
|
| 58 | 58 |
private GridFlat mGrid; |
| 59 | 59 |
private DistortedFramebuffer mScreen, mOffscreen; |
| 60 | 60 |
private Static1D s0; |
| ... | ... | |
| 91 | 91 |
mScaleFactor = new Static3D(mScale,mScale,1.0f); |
| 92 | 92 |
mScaleDyn.add(mScaleFactor); |
| 93 | 93 |
|
| 94 |
mEffects = new DistortedEffectQueues();
|
|
| 94 |
mEffects = new DistortedEffects(); |
|
| 95 | 95 |
mEffects.sink( diSink, pLeft , sinkRegion); |
| 96 | 96 |
mEffects.sink( diSink, pRight, sinkRegion); |
| 97 | 97 |
|
| src/main/java/org/distorted/examples/sink/SinkRenderer.java | ||
|---|---|---|
| 28 | 28 |
import org.distorted.examples.R; |
| 29 | 29 |
|
| 30 | 30 |
import org.distorted.library.Distorted; |
| 31 |
import org.distorted.library.DistortedEffects; |
|
| 31 | 32 |
import org.distorted.library.DistortedFramebuffer; |
| 32 | 33 |
import org.distorted.library.GridFlat; |
| 33 | 34 |
import org.distorted.library.DistortedTexture; |
| 34 |
import org.distorted.library.DistortedEffectQueues; |
|
Also available in: Unified diff
Change of names.