Project

General

Profile

« Previous | Next » 

Revision 01cef452

Added by Leszek Koltunski over 5 years ago

Change Distort to Deform in two apps - looks better.

View differences:

src/main/java/org/distorted/examples/movingeffects/MovingEffectsRenderer.java
30 30

  
31 31
import org.distorted.library.effect.FragmentEffectAlpha;
32 32
import org.distorted.library.effect.FragmentEffectChroma;
33
import org.distorted.library.effect.VertexEffectDistort;
33
import org.distorted.library.effect.VertexEffectDeform;
34 34
import org.distorted.library.effect.VertexEffectSink;
35 35
import org.distorted.library.effect.VertexEffectSwirl;
36 36
import org.distorted.library.main.DistortedScreen;
......
114 114
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
115 115
     {
116 116
     VertexEffectSwirl.enable();
117
     VertexEffectDistort.enable();
117
     VertexEffectDeform.enable();
118 118
     VertexEffectSink.enable();
119 119
     FragmentEffectChroma.enable();
120 120
     FragmentEffectAlpha.enable();
src/main/java/org/distorted/examples/movingeffects/MovingEffectsSurfaceView.java
32 32
import org.distorted.library.effect.EffectType;
33 33
import org.distorted.library.effect.FragmentEffectAlpha;
34 34
import org.distorted.library.effect.FragmentEffectChroma;
35
import org.distorted.library.effect.VertexEffectDistort;
35
import org.distorted.library.effect.VertexEffectDeform;
36 36
import org.distorted.library.effect.VertexEffectSink;
37 37
import org.distorted.library.effect.VertexEffectSwirl;
38 38
import org.distorted.library.main.DistortedEffects;
......
68 68
    
69 69
    private int mCurrEffect;
70 70
    private int mSize1, mSize2;
71
    private Static3D mDistort;
71
    private Static3D mDeform;
72 72

  
73 73
    private MovingEffectsRenderer mRenderer;
74 74

  
75
    private VertexEffectDistort mEffectDistort;
75
    private VertexEffectDeform mEffectDeform;
76 76
    private VertexEffectSink mEffectSink;
77 77
    private VertexEffectSwirl mEffectSwirl;
78 78
    private FragmentEffectChroma mEffectChroma;
......
92 92
      mCenter         = new Dynamic3D(LOOP_TIME,0.0f);
93 93
      mRegionFragment = new Static3D(0,0,0);
94 94
      mRegionVertex   = new Static4D(0,0,0,0);
95
      mDistort        = new Static3D(0,0,0);
95
      mDeform         = new Static3D(0,0,0);
96 96

  
97 97
      if(!isInEditMode())
98 98
        {
......
105 105
        setEGLContextClientVersion( (configurationInfo.reqGlEsVersion>>16) >= 3 ? 3:2 );
106 106
        setRenderer(mRenderer);
107 107

  
108
        mEffectDistort = new VertexEffectDistort ( mDistort         , mCenter, mRegionVertex);
108
        mEffectDeform  = new VertexEffectDeform  ( mDeform          , mCenter, mRegionVertex);
109 109
        mEffectSink    = new VertexEffectSink    (new Static1D(10)  , mCenter, mRegionVertex);
110 110
        mEffectSwirl   = new VertexEffectSwirl   (new Static1D(30)  , mCenter, mRegionVertex);
111 111
        mEffectAlpha   = new FragmentEffectAlpha (new Static1D(0.5f), mCenter, mRegionFragment, true);
......
127 127

  
128 128
      mRegionVertex.set(0,0,0,rad);
129 129
      mRegionFragment.set(rad,rad,rad);
130
      mDistort.set3(max/10);
130
      mDeform.set3(max/7);
131 131
      }
132 132

  
133 133
///////////////////////////////////////////////////////////////////////////////////////////////////
......
148 148
        DistortedEffects q = mRenderer.getEffects();
149 149
        q.abortByType(EffectType.VERTEX);
150 150
        q.abortByType(EffectType.FRAGMENT);
151
        q.apply(mEffectDistort);
151
        q.apply(mEffectDeform);
152 152
        mCurrEffect = EFFECT_BUBBLE;
153 153
        }
154 154
      }
......
291 291
                                        gx = dv.get1();
292 292
                                        gy = dv.get2();
293 293

  
294
                                        float Z = mDistort.get3()/10;
294
                                        float Z = mDeform.get3()/7;
295 295

  
296 296
                                        if( (xDown-gx)*(xDown-gx) + (yDown-gy)*(yDown-gy) < Z*Z )
297 297
                                          {
src/main/java/org/distorted/examples/projection/ProjectionRenderer.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.VertexEffectDistort;
25
import org.distorted.library.effect.VertexEffectDeform;
26 26
import org.distorted.library.main.Distorted;
27 27
import org.distorted.library.main.DistortedEffects;
28 28
import org.distorted.library.main.DistortedScreen;
......
66 66
      mPoint4 = new Static3D(0,0,0);
67 67
      mRegion = new Static4D(0,0,0,0);
68 68

  
69
      mEffects.apply( new VertexEffectDistort(mVector, mPoint1, mRegion) );
70
      mEffects.apply( new VertexEffectDistort(mVector, mPoint2, mRegion) );
71
      mEffects.apply( new VertexEffectDistort(mVector, mPoint3, mRegion) );
72
      mEffects.apply( new VertexEffectDistort(mVector, mPoint4, mRegion) );
69
      mEffects.apply( new VertexEffectDeform(mVector, mPoint1, mRegion) );
70
      mEffects.apply( new VertexEffectDeform(mVector, mPoint2, mRegion) );
71
      mEffects.apply( new VertexEffectDeform(mVector, mPoint3, mRegion) );
72
      mEffects.apply( new VertexEffectDeform(mVector, mPoint4, mRegion) );
73 73
      }
74 74

  
75 75
///////////////////////////////////////////////////////////////////////////////////////////////////
......
122 122

  
123 123
      int min = width<height ? width:height;
124 124

  
125
      mVector.set(0,0,min/5);
126
      mRegion.set(0,0,0,min/5);
125
      mVector.set(0,0,min/4);
126
      mRegion.set(0,0,0,min/4);
127 127

  
128 128
      mPoint1.set(  width/4,   height/4, 0);
129 129
      mPoint2.set(3*width/4,   height/4, 0);
......
151 151
    
152 152
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
153 153
      {
154
      VertexEffectDistort.enable();
154
      VertexEffectDeform.enable();
155 155

  
156 156
      try
157 157
        {

Also available in: Unified diff