Project

General

Profile

« Previous | Next » 

Revision f6d884d5

Added by Leszek Koltunski over 7 years ago

Complete the split DistortedObject -> (DistortedTexture,DistortedEffectQueue)

View differences:

src/main/java/org/distorted/examples/check/CheckRenderer.java
28 28
import org.distorted.examples.R;
29 29

  
30 30
import org.distorted.library.Distorted;
31
import org.distorted.library.DistortedObject;
31
import org.distorted.library.DistortedTexture;
32
import org.distorted.library.DistortedEffectQueues;
32 33
import org.distorted.library.GridFlat;
33 34
import org.distorted.library.EffectTypes;
34 35
import org.distorted.library.type.Dynamic3D;
......
54 55
    private static String compilationTitle;
55 56

  
56 57
    private GLSurfaceView mView;
57
    private DistortedObject mSuccess;
58
    private DistortedTexture mTexture;
59
    private DistortedEffectQueues mQueues;
58 60
    private GridFlat mGrid;
59 61
    private int bmpHeight, bmpWidth;
60 62

  
......
63 65
    CheckRenderer(GLSurfaceView view)
64 66
      { 
65 67
      mView = view;
68
      mQueues = new DistortedEffectQueues();
66 69

  
67 70
      CheckActivity act = (CheckActivity)mView.getContext();
68 71

  
......
75 78
    public void onDrawFrame(GL10 glUnused) 
76 79
      {
77 80
      GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
78
      mSuccess.draw(System.currentTimeMillis(), mGrid);
81
      mQueues.draw(System.currentTimeMillis(), mTexture, mGrid);
79 82
      }
80 83

  
81 84
///////////////////////////////////////////////////////////////////////////////////////////////////
82 85
    
83 86
    public void onSurfaceChanged(GL10 glUnused, int width, int height) 
84 87
      { 
85
      mSuccess.abortEffects(EffectTypes.MATRIX);
88
      mQueues.abortEffects(EffectTypes.MATRIX);
86 89
      
87 90
      if( (float)bmpHeight/bmpWidth > (float)height/width )
88 91
        {
89 92
        int w = (height*bmpWidth)/bmpHeight;
90 93
        float factor = (float)height/bmpHeight;
91 94

  
92
        mSuccess.move( new Static3D((width-w)/2,0,0) );
93
        mSuccess.scale(factor);
95
        mQueues.move( new Static3D((width-w)/2,0,0) );
96
        mQueues.scale(factor);
94 97
        }
95 98
      else
96 99
        {
97 100
        int h = (width*bmpHeight)/bmpWidth;
98 101
        float factor = (float)width/bmpWidth;
99 102

  
100
        mSuccess.move( new Static3D(0,(height-h)/2,0) );
101
        mSuccess.scale(factor);
103
        mQueues.move( new Static3D(0,(height-h)/2,0) );
104
        mQueues.scale(factor);
102 105
        }
103 106
      
104 107
      Distorted.onSurfaceChanged(width, height);
......
129 132
      bmpHeight = bitmap.getHeight();
130 133
      bmpWidth  = bitmap.getWidth();
131 134

  
132
      mSuccess = new DistortedObject(bmpWidth,bmpHeight,1);
133
      mSuccess.setTexture(bitmap);
135
      mTexture = new DistortedTexture(bmpWidth,bmpHeight,0);
136
      mTexture.setTexture(bitmap);
134 137
      mGrid = new GridFlat(30,30*bmpHeight/bmpWidth);
135 138

  
136 139
      // Try adding 2 Vertex Effects to the Bitmap.
......
143 146
      dSwirl.add(new Static3D(        0, bmpHeight/2, 0));
144 147
      dSwirl.add(new Static3D( bmpWidth, bmpHeight/2, 0));
145 148

  
146
      long swirlEffectID = mSuccess.swirl( new Static1D(30), dSwirl, new Static4D( 0,0,40,40) );
149
      long swirlEffectID = mQueues.swirl( new Static1D(30), dSwirl, new Static4D( 0,0,40,40) );
147 150

  
148 151
      if( swirlEffectID<0 )
149 152
        {
......
154 157
      dDeform.add(new Static3D( 0,         0,0));
155 158
      dDeform.add(new Static3D( 0,-bmpHeight,0));
156 159

  
157
      long deformEffectID = mSuccess.deform(dDeform, new Static3D(bmpWidth/2,0,0) );
160
      long deformEffectID = mQueues.deform(dDeform, new Static3D(bmpWidth/2,0,0) );
158 161

  
159 162
      if( deformEffectID<0 )
160 163
        {
......
167 170
      inter.add(new Static1D(0));
168 171
      inter.add(new Static1D(1));
169 172

  
170
      long chromaEffectID = mSuccess.chroma(inter, color);
173
      long chromaEffectID = mQueues.chroma(inter, color);
171 174

  
172 175
      if( chromaEffectID<0 )
173 176
        {

Also available in: Unified diff