Project

General

Profile

« Previous | Next » 

Revision 42f65cb4

Added by Leszek Koltunski over 7 years ago

Further progress with Apps.

View differences:

src/main/java/org/distorted/examples/deform/DeformActivity.java
21 21

  
22 22
import org.distorted.library.main.Distorted;
23 23
import org.distorted.examples.R;
24
import org.distorted.library.EffectNames;
24
import org.distorted.library.effect.EffectName;
25 25

  
26 26
import android.app.Activity;
27 27
import android.opengl.GLSurfaceView;
......
37 37
public class DeformActivity extends Activity implements OnSeekBarChangeListener
38 38
{
39 39
    private TextView textR;
40
    private EffectNames mCurrEffect;
40
    private EffectName mCurrEffect;
41 41

  
42 42
///////////////////////////////////////////////////////////////////////////////////////////////////
43 43
    
......
98 98
    public void Distort(View v)
99 99
      {
100 100
      DeformSurfaceView view = (DeformSurfaceView) this.findViewById(R.id.deformSurfaceView);
101
      view.getRenderer().setMode(EffectNames.DISTORT);
102
      mCurrEffect = EffectNames.DISTORT;
101
      view.getRenderer().setMode(EffectName.DISTORT);
102
      mCurrEffect = EffectName.DISTORT;
103 103
      }     
104 104
    
105 105
///////////////////////////////////////////////////////////////////////////////////////////////////
......
107 107
    public void Deform(View v)
108 108
      {
109 109
      DeformSurfaceView view = (DeformSurfaceView) this.findViewById(R.id.deformSurfaceView);
110
      view.getRenderer().setMode(EffectNames.DEFORM);
111
      mCurrEffect = EffectNames.DEFORM;
110
      view.getRenderer().setMode(EffectName.DEFORM);
111
      mCurrEffect = EffectName.DEFORM;
112 112
      }       
113 113

  
114 114
///////////////////////////////////////////////////////////////////////////////////////////////////
......
116 116
    public void Shear(View v)
117 117
      {
118 118
      DeformSurfaceView view = (DeformSurfaceView) this.findViewById(R.id.deformSurfaceView);
119
      view.getRenderer().setMode(EffectNames.SHEAR);
120
      mCurrEffect = EffectNames.SHEAR;
119
      view.getRenderer().setMode(EffectName.SHEAR);
120
      mCurrEffect = EffectName.SHEAR;
121 121
      }       
122 122

  
123 123
///////////////////////////////////////////////////////////////////////////////////////////////////
......
138 138

  
139 139
      int effect = savedInstanceState.getInt("effect");
140 140

  
141
      if( effect == EffectNames.DISTORT.ordinal() ) Distort(null);
142
      if( effect == EffectNames.DEFORM.ordinal()  ) Deform(null);
143
      if( effect == EffectNames.SHEAR.ordinal()   ) Shear(null);
141
      if( effect == EffectName.DISTORT.ordinal() ) Distort(null);
142
      if( effect == EffectName.DEFORM.ordinal()  ) Deform(null);
143
      if( effect == EffectName.SHEAR.ordinal()   ) Shear(null);
144 144
      }
145 145

  
146 146
///////////////////////////////////////////////////////////////////////////////////////////////////
src/main/java/org/distorted/examples/deform/DeformRenderer.java
22 22
import javax.microedition.khronos.egl.EGLConfig;
23 23
import javax.microedition.khronos.opengles.GL10;
24 24

  
25
import org.distorted.library.effect.EffectName;
25 26
import org.distorted.library.main.Distorted;
26 27
import org.distorted.library.main.DistortedEffects;
27 28
import org.distorted.library.main.DistortedScreen;
......
29 30
import org.distorted.library.main.MeshObject;
30 31
import org.distorted.library.main.MeshFlat;
31 32

  
32
import org.distorted.library.EffectNames;
33 33
import org.distorted.library.type.Dynamic3D;
34 34
import org.distorted.library.type.Static3D;
35 35
import org.distorted.library.type.Static4D;
......
68 68
   private int scrHeight, scrWidth;
69 69
   private float mRadius;
70 70

  
71
   private EffectNames mMode = EffectNames.DISTORT;
72
   private long mLastEffect = -1;
71
   private EffectName mMode = EffectName.DISTORT;
72
   private EffectName mLastEffect = EffectName.DISTORT;
73 73

  
74 74
///////////////////////////////////////////////////////////////////////////////////////////////////
75 75

  
......
134 134

  
135 135
///////////////////////////////////////////////////////////////////////////////////////////////////
136 136

  
137
   void setMode(EffectNames mode)
137
   void setMode(EffectName mode)
138 138
      {
139 139
      mMode = mode;  
140 140
      }
......
203 203
    
204 204
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config)
205 205
     {
206
     DistortedEffects.enableEffect(EffectNames.DISTORT);
207
     DistortedEffects.enableEffect(EffectNames.DEFORM);
206
     DistortedEffects.enableEffect(EffectName.DISTORT);
207
     DistortedEffects.enableEffect(EffectName.DEFORM);
208 208

  
209 209
     try
210 210
       {
......
263 263

  
264 264
   void up()
265 265
     {
266
     stretchEffects.abortEffect(mLastEffect);
266
     stretchEffects.abortByName(mLastEffect);
267 267

  
268 268
     float damp = -0.65f;
269 269

  

Also available in: Unified diff