Project

General

Profile

« Previous | Next » 

Revision a595ee16

Added by Leszek Koltunski almost 8 years ago

New API tested.

View differences:

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