Project

General

Profile

« Previous | Next » 

Revision bdb341bc

Added by Leszek Koltunski over 7 years ago

Dynamics: Introduce 2 Modes of operation:

- 'random access' mode, where we are able to call a single Dynamic from multiple thread simultaneously.
- 'sequential' mode, which only permits sequential interpolation from one client.

The second mode has an advantage when one needs to change mDuration: it keeps on interpolating smoothly. In the first mode, this is not possible.

View differences:

src/main/java/org/distorted/library/EffectQueueMatrix.java
126 126

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

  
132 132
      mCurrentDuration[i] += step;
......
260 260
      {
261 261
      mInter[1][mNumEffects] = null;
262 262

  
263
           if( vector instanceof Dynamic3D) mInter[0][mNumEffects] = (Dynamic3D)vector;
263
      if( vector instanceof Dynamic3D)
264
        {
265
        mInter[0][mNumEffects] = (Dynamic3D)vector;
266
        }
264 267
      else if( vector instanceof Static3D )
265 268
        {
266 269
        mInter[0][mNumEffects] = null;
......
283 286
    {
284 287
    if( mMax[INDEX]>mNumEffects )
285 288
      {
286
           if( angle instanceof Dynamic1D) mInter[0][mNumEffects] = (Dynamic1D)angle;
289
      if( angle instanceof Dynamic1D)
290
        {
291
        mInter[0][mNumEffects] = (Dynamic1D)angle;
292
        }
287 293
      else if( angle instanceof Static1D)
288 294
        {
289 295
        mInter[0][mNumEffects] = null;
......
295 301
      mUniforms[NUM_UNIFORMS*mNumEffects+2] = axis.getY();
296 302
      mUniforms[NUM_UNIFORMS*mNumEffects+3] = axis.getZ();
297 303

  
298
      if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center;
304
      if( center instanceof Dynamic3D)
305
        {
306
        mInter[1][mNumEffects] = (Dynamic3D)center;
307
        }
299 308
      else if( center instanceof Static3D )
300 309
        {
301 310
        mInter[1][mNumEffects] = null;
......
318 327
    {
319 328
    if( mMax[INDEX]>mNumEffects )
320 329
      {
321
           if( data instanceof Dynamic4D  ) mInter[0][mNumEffects] = (Dynamic4D)data;
322
      else if( data instanceof DynamicQuat) mInter[0][mNumEffects] = (DynamicQuat)data;
330
      if( data instanceof Dynamic4D  )
331
        {
332
        mInter[0][mNumEffects] = (Dynamic4D)data;
333
        }
334
      else if( data instanceof DynamicQuat)
335
        {
336
        mInter[0][mNumEffects] = (DynamicQuat)data;
337
        }
323 338
      else if( data instanceof Static4D   )
324 339
        {
325 340
        mInter[0][mNumEffects] = null;
......
330 345
        }
331 346
      else return -1;
332 347

  
333
      if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center;
348
      if( center instanceof Dynamic3D)
349
        {
350
        mInter[1][mNumEffects] = (Dynamic3D)center;
351
        }
334 352
      else if( center instanceof Static3D )
335 353
        {
336 354
        mInter[1][mNumEffects] = null;
......
353 371
    {
354 372
    if( mMax[INDEX]>mNumEffects )
355 373
      {
356
           if( shear instanceof Dynamic3D) mInter[0][mNumEffects] = (Dynamic3D)shear;
374
      if( shear instanceof Dynamic3D)
375
        {
376
        mInter[0][mNumEffects] = (Dynamic3D)shear;
377
        }
357 378
      else if( shear instanceof Static3D )
358 379
        {
359 380
        mInter[0][mNumEffects] = null;
......
363 384
        }
364 385
      else return -1;
365 386

  
366
      if( center instanceof Dynamic3D) mInter[1][mNumEffects] = (Dynamic3D)center;
387
      if( center instanceof Dynamic3D)
388
        {
389
        mInter[1][mNumEffects] = (Dynamic3D)center;
390
        }
367 391
      else if( center instanceof Static3D )
368 392
        {
369 393
        mInter[1][mNumEffects] = null;

Also available in: Unified diff