Project

General

Profile

« Previous | Next » 

Revision 8dfa45c4

Added by Leszek Koltunski almost 7 years ago

Some progress with Effect classes.

10 apps compile now.

View differences:

src/main/java/org/distorted/examples/effectqueue/EffectQueueRenderer.java
28 28
import android.graphics.Paint.Style;
29 29
import android.opengl.GLSurfaceView;
30 30

  
31
import org.distorted.library.effect.EffectName;
32
import org.distorted.library.effect.MatrixEffectScale;
31 33
import org.distorted.library.main.DistortedEffects;
32 34
import org.distorted.library.main.DistortedScreen;
33 35
import org.distorted.library.main.MeshFlat;
34 36
import org.distorted.library.main.DistortedTexture;
35 37
import org.distorted.library.main.Distorted;
36
import org.distorted.library.EffectNames;
37
import org.distorted.library.EffectTypes;
38 38
import org.distorted.library.message.EffectListener;
39 39
import org.distorted.library.message.EffectMessage;
40 40
import org.distorted.library.type.Static3D;
......
50 50
  private EffectQueueSurfaceView mView;
51 51
  private Paint mPaint;
52 52
  private int texWidth, texHeight;
53
  private Static3D mScale;
53 54

  
54 55
  private DistortedTexture mTexture;
55 56
  private MeshFlat mMesh;
......
69 70
      
70 71
    texWidth = BWID;
71 72
    texHeight= BHEI;
73
    mScale = new Static3D(1,1,1);
74
    MatrixEffectScale scaleEffect = new MatrixEffectScale(mScale);
72 75

  
73 76
    mMesh = new MeshFlat(80,80*texHeight/texWidth);
74 77
    mTexture = new DistortedTexture(texWidth,texHeight);
75 78
    mEffects = new DistortedEffects();
76

  
79
    mEffects.apply(scaleEffect);
77 80
    mEffects.registerForMessages(this);
78 81

  
79 82
    mScreen = new DistortedScreen(mView);
......
107 110
    mScreen.detachAll();
108 111
    mScreen.attach(mTexture,mEffects,mMesh);
109 112

  
110
    DistortedEffects.enableEffect(EffectNames.DISTORT);
111
    DistortedEffects.enableEffect(EffectNames.SINK);
112
    DistortedEffects.enableEffect(EffectNames.SMOOTH_ALPHA);
113
    DistortedEffects.enableEffect(EffectNames.SATURATION);
114
    DistortedEffects.enableEffect(EffectNames.SMOOTH_CHROMA);
113
    DistortedEffects.enableEffect(EffectName.DISTORT);
114
    DistortedEffects.enableEffect(EffectName.SINK);
115
    DistortedEffects.enableEffect(EffectName.SMOOTH_ALPHA);
116
    DistortedEffects.enableEffect(EffectName.SATURATION);
117
    DistortedEffects.enableEffect(EffectName.SMOOTH_CHROMA);
115 118

  
116 119
    try
117 120
      {
......
127 130

  
128 131
  public void onSurfaceChanged(GL10 glUnused, int width, int height)
129 132
    {
130
    mEffects.abortEffects(EffectTypes.MATRIX);
131
    mEffects.scale( new Static3D((float)width/texWidth,(float)height/texHeight,1) );
133
    mScale.set((float)width/texWidth,(float)height/texHeight,1);
132 134
    mScreen.resize(width,height);
133 135
    mView.setScreenSize(width,height);
134 136
    }
......
143 145
///////////////////////////////////////////////////////////////////////////////////////////////////
144 146
// the library sending messages to us. This is running on a library 'MessageSender' thread.
145 147

  
146
  public void effectMessage(final EffectMessage em, final long effectID, final EffectNames effectName, final long objectID)
148
  public void effectMessage(final EffectMessage em, final long effectID, final long objectID)
147 149
    {
148 150
    EffectQueueActivity act = (EffectQueueActivity)mView.getContext();
149 151

  

Also available in: Unified diff