Project

General

Profile

« Previous | Next » 

Revision a595ee16

Added by Leszek Koltunski over 8 years ago

New API tested.

View differences:

src/main/java/org/distorted/library/EffectQueue.java
234 234
    for(int j=effect; j<mNumEffects; j++ ) 
235 235
      {
236 236
      mType[j]            = mType[j+1];
237
      mInter[0][j]          = mInter[0][j+1];
238
      mInter[1][j]          = mInter[1][j+1];
239
      mInter[2][j]          = mInter[2][j+1];
237
      mInter[0][j]        = mInter[0][j+1];
238
      mInter[1][j]        = mInter[1][j+1];
239
      mInter[2][j]        = mInter[2][j+1];
240 240
      mCurrentDuration[j] = mCurrentDuration[j+1];
241 241
      mID[j]              = mID[j+1];
242 242
    
src/main/java/org/distorted/library/EffectQueueFragment.java
72 72
   
73 73
    for(int i=0; i<mNumEffects; i++)
74 74
      {
75
      if( mInter[0][i]==null ) continue;
76
      
77
      if( mInter[1][i]!=null ) mInter[1][i].interpolateMain(mBuf, 4*i, mCurrentDuration[i]);
78
        
79
      if( mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i, mCurrentDuration[i], step) )
75
      if( mInter[0][i]!=null && mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i, mCurrentDuration[i], step) )
80 76
        {
81 77
        for(int j=0; j<mNumListeners; j++)   
82 78
          EffectMessageSender.newMessage( mListeners.elementAt(j),
......
93 89
          continue;
94 90
          }
95 91
        }
96
           
92

  
93
      if( mInter[1][i]!=null ) mInter[1][i].interpolateMain(mBuf, 4*i, mCurrentDuration[i]);
94

  
97 95
      mCurrentDuration[i] += step;
98 96
      }
99 97
   
src/main/java/org/distorted/library/EffectQueueMatrix.java
105 105
   
106 106
    for(int i=0; i<mNumEffects; i++)
107 107
      {
108
      if( mInter[0][i]==null ) continue;
109
           
110
      if( mInter[1][i]!=null )
108
      if( mInter[0][i]!=null && mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i+3, mCurrentDuration[i], step) )
111 109
        {
112
        mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i]);
113
        }
114
        
115
      if( mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i+3, mCurrentDuration[i], step) )
116
        {   
117
        for(int j=0; j<mNumListeners; j++)   
110
        for(int j=0; j<mNumListeners; j++)
118 111
          EffectMessageSender.newMessage( mListeners.elementAt(j),
119 112
                                          EffectMessage.EFFECT_FINISHED,
120 113
                                         (mID[i]<<EffectTypes.LENGTH)+EffectTypes.MATRIX.type,
121
                                          mType[i], 
114
                                          mType[i],
122 115
                                          mBitmapID,
123 116
                                          null);
124
       
117

  
125 118
        if( EffectNames.isUnity(mType[i], mUniforms, NUM_UNIFORMS*i+3) )
126
          {  
119
          {
127 120
          remove(i);
128 121
          i--;
129 122
          continue;
130 123
          }
131 124
        }
132
    
125

  
126
      if( mInter[1][i]!=null )
127
        {
128
        mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i, mCurrentDuration[i]);
129
        }
130

  
133 131
      mCurrentDuration[i] += step;
134 132
      }
135 133
     
......
157 155
    Matrix.setIdentityM(viewMatrix, 0);
158 156
    Matrix.translateM(viewMatrix, 0, -dp.width/2, dp.height/2, -dp.distance);
159 157
    
160
    float x,y,z, sx,sy,sz=1.0f;
158
    float x,y,z, sx,sy,sz;
161 159
   
162 160
    for(int i=0; i<mNumEffects; i++)
163 161
      {
src/main/java/org/distorted/library/EffectQueueVertex.java
71 71
   
72 72
    for(int i=0; i<mNumEffects; i++)
73 73
      {
74
      if( mInter[0][i]==null ) continue;
75
      
76
      if( mInter[1][i]!=null )
77
        {
78
        mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+7, mCurrentDuration[i]);
79
      
80
        mUniforms[NUM_UNIFORMS*i+7] = mUniforms[NUM_UNIFORMS*i+7]-mObjHalfX;
81
        mUniforms[NUM_UNIFORMS*i+8] =-mUniforms[NUM_UNIFORMS*i+8]+mObjHalfY;
82
        }
83

  
84
      if( mInter[2][i]!=null )
85
        {
86
        mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+3, mCurrentDuration[i]);
87
        }
88

  
89
      if( mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i, mCurrentDuration[i], step) )
74
      if( mInter[0][i]!=null && mInter[0][i].interpolateMain(mUniforms ,NUM_UNIFORMS*i, mCurrentDuration[i], step) )
90 75
        {
91
        for(int j=0; j<mNumListeners; j++)   
76
        for(int j=0; j<mNumListeners; j++)
92 77
          EffectMessageSender.newMessage( mListeners.elementAt(j),
93 78
                                          EffectMessage.EFFECT_FINISHED,
94 79
                                         (mID[i]<<EffectTypes.LENGTH)+EffectTypes.VERTEX.type,
95
                                          mType[i], 
80
                                          mType[i],
96 81
                                          mBitmapID,
97 82
                                          null);
98
      
83

  
99 84
        if( EffectNames.isUnity(mType[i], mUniforms, NUM_UNIFORMS*i) )
100 85
          {
101 86
          remove(i);
......
103 88
          continue;
104 89
          }
105 90
        }
106
     
91

  
92
      if( mInter[1][i]!=null )
93
        {
94
        mInter[1][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+3, mCurrentDuration[i]);
95
        }
96

  
97
      if( mInter[2][i]!=null )
98
        {
99
        mInter[2][i].interpolateMain(mUniforms, NUM_UNIFORMS*i+7, mCurrentDuration[i]);
100

  
101
        mUniforms[NUM_UNIFORMS*i+7] = mUniforms[NUM_UNIFORMS*i+7]-mObjHalfX;
102
        mUniforms[NUM_UNIFORMS*i+8] =-mUniforms[NUM_UNIFORMS*i+8]+mObjHalfY;
103

  
104
        //android.util.Log.e("queue", "computing dynamic center, x="+(mUniforms[NUM_UNIFORMS*i+7]));
105
        }
106

  
107 107
      mCurrentDuration[i] += step;
108 108
      }
109 109
     
......
265 265
  
266 266
  private long addPriv(EffectNames eln, Data2D center, Data4D region)
267 267
    {
268
    if( center instanceof Dynamic2D)
269
      mInter[1][mNumEffects] = (Dynamic2D)center;
270
    else if( center instanceof Static2D)
271
      {
272
      mInter[1][mNumEffects] = null;
273
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = ((Static2D)center).getX()-mObjHalfX;
274
      mUniforms[NUM_UNIFORMS*mNumEffects+8] =-((Static2D)center).getY()+mObjHalfY;
275
      }
276

  
277 268
    if( region!=null )
278 269
      {
279 270
      if( region instanceof Dynamic4D)
280 271
        {
281
        mInter[2][mNumEffects] = (Dynamic4D)region;
272
        mInter[1][mNumEffects] = (Dynamic4D)region;
282 273
        }
283 274
      else if ( region instanceof Static4D)
284 275
        {
......
290 281
        mUniforms[NUM_UNIFORMS*mNumEffects+4] =-tmp.getY();   // invert y already
291 282
        mUniforms[NUM_UNIFORMS*mNumEffects+5] = z<=0.0f ? 1000*mObjHalfX : z;
292 283
        mUniforms[NUM_UNIFORMS*mNumEffects+6] = tmp.getW();
293
        mInter[2][mNumEffects] = null;
284
        mInter[1][mNumEffects] = null;
294 285
        }
295 286
      else return -1;
296 287
      }
......
300 291
      mUniforms[NUM_UNIFORMS*mNumEffects+4] = 0.0f;
301 292
      mUniforms[NUM_UNIFORMS*mNumEffects+5] = 1000*mObjHalfX;
302 293
      mUniforms[NUM_UNIFORMS*mNumEffects+6] = 0.0f;
294
      mInter[1][mNumEffects] = null;
295
      }
296

  
297
    if( center instanceof Dynamic2D)
298
      mInter[2][mNumEffects] = (Dynamic2D)center;
299
    else if( center instanceof Static2D)
300
      {
303 301
      mInter[2][mNumEffects] = null;
302
      mUniforms[NUM_UNIFORMS*mNumEffects+7] = ((Static2D)center).getX()-mObjHalfX;
303
      mUniforms[NUM_UNIFORMS*mNumEffects+8] =-((Static2D)center).getY()+mObjHalfY;
304 304
      }
305
    
305

  
306 306
    return addBase(eln);
307 307
    }
308 308

  

Also available in: Unified diff