Project

General

Profile

« Previous | Next » 

Revision d07f2950

Added by Leszek Koltunski almost 8 years ago

Improve aborting Effects.

View differences:

src/main/java/org/distorted/library/Distorted.java
108 108
      int realMaxV = (maxV-11)/4;   // adjust this in case of changes to the shaders...
109 109
      int realMaxF = (maxF- 2)/4;   //
110 110
    
111
      if( EffectListVertex.getMax() > realMaxV )
111
      if( EffectQueueVertex.getMax() > realMaxV )
112 112
        {
113 113
        throw new VertexUniformsException("Too many effects in the vertex shader, max is "+realMaxV, realMaxV);
114 114
        }
115
      if( EffectListFragment.getMax() > realMaxF )
115
      if( EffectQueueFragment.getMax() > realMaxF )
116 116
        {
117 117
        throw new FragmentUniformsException("Too many effects in the fragment shader, max is "+realMaxF, realMaxF);
118 118
        }
......
204 204
   
205 205
    switch(type)
206 206
      {
207
      case GLES20.GL_VERTEX_SHADER  : header += ("#define NUM_VERTEX "  +EffectListVertex.getMax()+"\n");
207
      case GLES20.GL_VERTEX_SHADER  : header += ("#define NUM_VERTEX "  + EffectQueueVertex.getMax()+"\n");
208 208
     
209 209
                                      for(EffectNames name: EffectNames.values() )
210 210
                                        {
......
212 212
                                        header += ("#define "+name.name()+" "+name.ordinal()+"\n");  
213 213
                                        }
214 214
                                      break;
215
      case GLES20.GL_FRAGMENT_SHADER: header += ("#define NUM_FRAGMENT "+EffectListFragment.getMax()+"\n");
215
      case GLES20.GL_FRAGMENT_SHADER: header += ("#define NUM_FRAGMENT "+ EffectQueueFragment.getMax()+"\n");
216 216
     
217 217
                                      for(EffectNames name: EffectNames.values() )
218 218
                                        {
......
342 342
    mNormalH         = GLES20.glGetAttribLocation( mProgramH, "a_Normal"); 
343 343
    mTextureCoordH   = GLES20.glGetAttribLocation( mProgramH, "a_TexCoordinate");
344 344
    
345
    EffectListFragment.getUniforms(mProgramH);
346
    EffectListVertex.getUniforms(mProgramH);
347
    EffectListMatrix.getUniforms(mProgramH);
345
    EffectQueueFragment.getUniforms(mProgramH);
346
    EffectQueueVertex.getUniforms(mProgramH);
347
    EffectQueueMatrix.getUniforms(mProgramH);
348 348
    
349 349
    GLES20.glEnableVertexAttribArray(mPositionH);        
350 350
    GLES20.glEnableVertexAttribArray(mColorH);
......
379 379
    DistortedObjectList.release();
380 380
    DistortedNode.release();
381 381

  
382
    EffectListVertex.reset();
383
    EffectListFragment.reset();
384
    EffectListMatrix.reset();  // no need to reset Other EffectList
382
    EffectQueueVertex.reset();
383
    EffectQueueFragment.reset();
384
    EffectQueueMatrix.reset();  // no need to reset Other EffectQueue
385 385

  
386 386
    EffectMessageSender.stopSending();
387 387
   
......
408 408
 */
409 409
  public static int getMaxMatrix()
410 410
    {
411
    return EffectListMatrix.getMax();
411
    return EffectQueueMatrix.getMax();
412 412
    }
413 413
 
414 414
///////////////////////////////////////////////////////////////////////////////////////////////////
......
419 419
 */  
420 420
  public static int getMaxVertex()
421 421
    {
422
    return EffectListVertex.getMax();  
422
    return EffectQueueVertex.getMax();
423 423
    }
424 424
  
425 425
///////////////////////////////////////////////////////////////////////////////////////////////////
......
430 430
 */  
431 431
  public static int getMaxFragment()
432 432
    {
433
    return EffectListFragment.getMax();  
433
    return EffectQueueFragment.getMax();
434 434
    }
435 435
  
436 436
///////////////////////////////////////////////////////////////////////////////////////////////////
......
444 444
 */
445 445
  public static boolean setMaxMatrix(int max)
446 446
    {
447
    return EffectListMatrix.setMax(max);
447
    return EffectQueueMatrix.setMax(max);
448 448
    }
449 449
  
450 450
///////////////////////////////////////////////////////////////////////////////////////////////////
......
464 464
 */
465 465
  public static boolean setMaxVertex(int max)
466 466
    {
467
    return EffectListVertex.setMax(max);  
467
    return EffectQueueVertex.setMax(max);
468 468
    }
469 469

  
470 470
///////////////////////////////////////////////////////////////////////////////////////////////////
......
484 484
 */
485 485
  public static boolean setMaxFragment(int max)
486 486
    {
487
    return EffectListFragment.setMax(max);  
487
    return EffectQueueFragment.setMax(max);
488 488
    }
489 489
    
490 490
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff