Project

General

Profile

« Previous | Next » 

Revision 1f218177

Added by Leszek Koltunski almost 7 years ago

Further progress with Apps: 18 (out of 30) compile now.

View differences:

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.EffectName;
26
import org.distorted.library.effect.VertexEffectDistort;
25 27
import org.distorted.library.main.Distorted;
26 28
import org.distorted.library.main.DistortedEffects;
27 29
import org.distorted.library.main.DistortedScreen;
28
import org.distorted.library.EffectNames;
29 30
import org.distorted.library.main.MeshFlat;
30 31
import org.distorted.library.main.DistortedTexture;
31 32
import org.distorted.library.type.Static3D;
......
48 49
   private DistortedTexture mTexture;
49 50
   private float mF, mNear;
50 51

  
52
   private Static3D mVector, mPoint1, mPoint2, mPoint3, mPoint4;
53
   private Static4D mRegion;
54

  
51 55
///////////////////////////////////////////////////////////////////////////////////////////////////
52 56

  
53 57
   ProjectionRenderer(GLSurfaceView view)
......
55 59
      mView   = view;
56 60
      mEffects= new DistortedEffects();
57 61
      mScreen = new DistortedScreen(mView);
62

  
63
      mVector = new Static3D(0,0,0);
64
      mPoint1 = new Static3D(0,0,0);
65
      mPoint2 = new Static3D(0,0,0);
66
      mPoint3 = new Static3D(0,0,0);
67
      mPoint4 = new Static3D(0,0,0);
68
      mRegion = new Static4D(0,0,0,0);
69

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

  
60 76
///////////////////////////////////////////////////////////////////////////////////////////////////
......
108 124

  
109 125
      int min = width<height ? width:height;
110 126

  
111
      Static3D vector = new Static3D(0,0,min/5);
112
      Static4D region = new Static4D(0,0,min/5,min/5);
127
      mVector.set(0,0,min/5);
128
      mRegion.set(0,0,min/5,min/5);
113 129

  
114
      mEffects.distort(vector, new Static3D(  width/4,   height/4, 0), region);
115
      mEffects.distort(vector, new Static3D(3*width/4,   height/4, 0), region);
116
      mEffects.distort(vector, new Static3D(  width/4, 3*height/4, 0), region);
117
      mEffects.distort(vector, new Static3D(3*width/4, 3*height/4, 0), region);
130
      mPoint1.set(  width/4,   height/4, 0);
131
      mPoint2.set(3*width/4,   height/4, 0);
132
      mPoint3.set(  width/4, 3*height/4, 0);
133
      mPoint4.set(3*width/4, 3*height/4, 0);
118 134

  
119 135
      // Avoid memory leaks: delete old texture if it exists (it might if we
120 136
      // got here after a brief amount of time spent in the background)
......
137 153
    
138 154
   public void onSurfaceCreated(GL10 glUnused, EGLConfig config) 
139 155
      {
140
      DistortedEffects.enableEffect(EffectNames.DISTORT);
156
      DistortedEffects.enableEffect(EffectName.DISTORT);
141 157

  
142 158
      try
143 159
        {

Also available in: Unified diff