Project

General

Profile

« Previous | Next » 

Revision 6646c476

Added by Leszek Koltunski over 7 years ago

Some progress with Effect classes.

12 apps compile now.

View differences:

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.effect.EffectName;
31
import org.distorted.library.effect.FragmentEffectChroma;
32
import org.distorted.library.effect.MatrixEffectMove;
33
import org.distorted.library.effect.MatrixEffectRotate;
34
import org.distorted.library.effect.MatrixEffectScale;
35
import org.distorted.library.effect.VertexEffectSink;
30 36
import org.distorted.library.main.DistortedEffects;
31 37
import org.distorted.library.main.DistortedFramebuffer;
32 38
import org.distorted.library.main.DistortedNode;
33 39
import org.distorted.library.main.DistortedScreen;
34 40
import org.distorted.library.main.Distorted;
35
import org.distorted.library.EffectNames;
36 41
import org.distorted.library.main.MeshCubes;
37 42
import org.distorted.library.main.MeshFlat;
38 43
import org.distorted.library.main.DistortedTexture;
39
import org.distorted.library.EffectTypes;
40 44
import org.distorted.library.type.Dynamic;
41 45
import org.distorted.library.type.Dynamic1D;
42 46
import org.distorted.library.type.Static1D;
......
60 64
   private MeshCubes mMeshCubes;
61 65
   private int lisaHeight, lisaWidth;
62 66
   private boolean mDepth;
67
   private Static3D mScale, mMove;
63 68

  
64 69
///////////////////////////////////////////////////////////////////////////////////////////////////
65 70

  
......
68 73
      mView   = v;
69 74
      mDepth  = true;
70 75
      mEffects= new DistortedEffects();
76
      mScale  = new Static3D(1,1,1);
77
      mMove   = new Static3D(0,0,0);
78
      mEffects.apply(new MatrixEffectMove(mMove));
79
      mEffects.apply(new MatrixEffectScale(mScale));
71 80
      mScreen = new DistortedScreen(mView);
72 81
      }
73 82

  
......
104 113
    
105 114
   public void onSurfaceChanged(GL10 glUnused, int width, int height)
106 115
      { 
107
      mEffects.abortEffects(EffectTypes.MATRIX);
108
         
109 116
      if( (float)lisaHeight/lisaWidth > (float)height/width )
110 117
        {
111 118
        int w = (height*lisaWidth)/lisaHeight;
112 119
        float factor = (float)height/lisaHeight;
113 120

  
114
        mEffects.move( new Static3D((width-w)/2,0,0) );
115
        mEffects.scale(factor);
121
        mMove.set((width-w)/2,0,0);
122
        mScale.set(factor,factor,factor);
116 123
        }
117 124
      else
118 125
        {
119 126
        int h = (width*lisaHeight)/lisaWidth;
120 127
        float factor = (float)width/lisaWidth;
121 128

  
122
        mEffects.move( new Static3D(0,(height-h)/2,0) );
123
        mEffects.scale(factor);
129
        mMove.set(0,(height-h)/2,0);
130
        mScale.set(factor,factor,factor);
124 131
        }
125 132
      
126 133
      mScreen.resize(width, height);
......
181 188
      mScreen.attach(mRoot);
182 189

  
183 190
      float factor = lisaWidth/(2.0f*gridWidth);
184

  
185
      gridEffects.move( new Static3D( (lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2, gridWidth/(2*GRID)) );
186
      gridEffects.scale(factor);
191
      MatrixEffectMove move = new MatrixEffectMove( new Static3D((lisaWidth-factor*gridWidth)/2,(lisaHeight-factor*gridHeight)/2, gridWidth/(2.0f*GRID)));
192
      MatrixEffectScale scale = new MatrixEffectScale( new Static3D(factor,factor,factor) );
193
      gridEffects.apply(move);
194
      gridEffects.apply(scale);
187 195

  
188 196
      Dynamic1D rotDyn = new Dynamic1D(12000,0.0f);
189 197
      rotDyn.add(new Static1D(  0));
190 198
      rotDyn.add(new Static1D(360));
191 199
      rotDyn.setMode(Dynamic.MODE_JUMP);
192

  
193
      gridEffects.rotate(rotDyn, new Static3D(1,0,0), new Static3D(gridWidth/2,gridHeight/2,gridWidth/(2*GRID)) );
200
      MatrixEffectRotate rotate = new MatrixEffectRotate(rotDyn, new Static3D(1,0,0), new Static3D(gridWidth/2,gridHeight/2,gridWidth/(2*GRID)));
201
      gridEffects.apply(rotate);
194 202

  
195 203
      Dynamic1D sinkDyn = new Dynamic1D(3000,0.0f);
196 204
      sinkDyn.add(new Static1D(1.0f));
197 205
      sinkDyn.add(new Static1D(0.3f));
198

  
199
      gridEffects.sink(sinkDyn, new Static3D(gridWidth/2,gridHeight/2, 0));
206
      VertexEffectSink sink = new VertexEffectSink(sinkDyn, new Static3D(gridWidth/2,gridHeight/2, 0));
207
      gridEffects.apply(sink);
200 208

  
201 209
      Dynamic1D chromaDyn = new Dynamic1D(5000,0.0f);
202 210
      chromaDyn.add(new Static1D(0.0f));
203 211
      chromaDyn.add(new Static1D(1.0f));
212
      FragmentEffectChroma chroma = new FragmentEffectChroma(chromaDyn, new Static3D(0,0,1));
213
      mEffects.apply(chroma);
204 214

  
205
      mEffects.chroma(chromaDyn, new Static3D(0,0,1) );
206

  
207
      DistortedEffects.enableEffect(EffectNames.SINK);
208
      DistortedEffects.enableEffect(EffectNames.CHROMA);
215
      DistortedEffects.enableEffect(EffectName.SINK);
216
      DistortedEffects.enableEffect(EffectName.CHROMA);
209 217

  
210 218
      try
211 219
        {
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.effect.EffectName;
27 28
import org.distorted.library.main.DistortedEffects;
28
import org.distorted.library.EffectNames;
29
import org.distorted.library.EffectTypes;
30 29
import org.distorted.library.type.Dynamic1D;
31 30
import org.distorted.library.type.Dynamic2D;
32 31
import org.distorted.library.type.Dynamic3D;
......
46 45
  {
47 46
  private WeakReference<Matrix3DActivity> mAct;
48 47

  
49
  private EffectNames mName;
48
  private EffectName mName;
50 49
  private int[] mInter;
51 50
  private int[] mInterRegion;
52 51
  private int[] mInterCenter;

Also available in: Unified diff