Revision 71887484
Added by Leszek Koltunski almost 8 years ago
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( EffectQueueVertex.getMax() > realMaxV )
|
|
111 |
if( getMaxVertex() > realMaxV )
|
|
112 | 112 |
{ |
113 | 113 |
throw new VertexUniformsException("Too many effects in the vertex shader, max is "+realMaxV, realMaxV); |
114 | 114 |
} |
115 |
if( EffectQueueFragment.getMax() > realMaxF )
|
|
115 |
if( getMaxFragment() > 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 " + EffectQueueVertex.getMax()+"\n");
|
|
207 |
case GLES20.GL_VERTEX_SHADER : header += ("#define NUM_VERTEX " + getMaxVertex()+"\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 "+ EffectQueueFragment.getMax()+"\n");
|
|
215 |
case GLES20.GL_FRAGMENT_SHADER: header += ("#define NUM_FRAGMENT "+ getMaxFragment()+"\n");
|
|
216 | 216 |
|
217 | 217 |
for(EffectNames name: EffectNames.values() ) |
218 | 218 |
{ |
... | ... | |
378 | 378 |
{ |
379 | 379 |
DistortedObjectList.release(); |
380 | 380 |
DistortedNode.release(); |
381 |
|
|
382 |
EffectQueueVertex.reset(); |
|
383 |
EffectQueueFragment.reset(); |
|
384 |
EffectQueueMatrix.reset(); // no need to reset Other EffectQueue |
|
385 |
|
|
381 |
EffectQueue.reset(); |
|
386 | 382 |
EffectMessageSender.stopSending(); |
387 | 383 |
|
388 | 384 |
mInitialized = false; |
... | ... | |
408 | 404 |
*/ |
409 | 405 |
public static int getMaxMatrix() |
410 | 406 |
{ |
411 |
return EffectQueueMatrix.getMax();
|
|
407 |
return EffectQueue.getMax(EffectTypes.MATRIX.ordinal());
|
|
412 | 408 |
} |
413 | 409 |
|
414 | 410 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
419 | 415 |
*/ |
420 | 416 |
public static int getMaxVertex() |
421 | 417 |
{ |
422 |
return EffectQueueVertex.getMax();
|
|
418 |
return EffectQueue.getMax(EffectTypes.VERTEX.ordinal());
|
|
423 | 419 |
} |
424 | 420 |
|
425 | 421 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
430 | 426 |
*/ |
431 | 427 |
public static int getMaxFragment() |
432 | 428 |
{ |
433 |
return EffectQueueFragment.getMax();
|
|
429 |
return EffectQueue.getMax(EffectTypes.FRAGMENT.ordinal());
|
|
434 | 430 |
} |
435 |
|
|
431 |
|
|
432 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
433 |
/** |
|
434 |
* Returns the maximum number of Other effects. |
|
435 |
* |
|
436 |
* @return The maximum number of Other effects |
|
437 |
*/ |
|
438 |
public static int getMaxOther() |
|
439 |
{ |
|
440 |
return EffectQueue.getMax(EffectTypes.OTHER.ordinal()); |
|
441 |
} |
|
442 |
|
|
436 | 443 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
437 | 444 |
/** |
438 |
* Sets the maximum number of Matrix effects that can be applied to a single DistortedBitmap at one time.
|
|
445 |
* Sets the maximum number of Matrix effects that can be applied to a single DistortedObject at one time.
|
|
439 | 446 |
* This can fail if the value of 'max' is outside permitted range. |
440 | 447 |
* |
441 | 448 |
* @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater |
... | ... | |
444 | 451 |
*/ |
445 | 452 |
public static boolean setMaxMatrix(int max) |
446 | 453 |
{ |
447 |
return EffectQueueMatrix.setMax(max);
|
|
454 |
return EffectQueue.setMax(EffectTypes.MATRIX.ordinal(),max);
|
|
448 | 455 |
} |
449 | 456 |
|
450 | 457 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
451 | 458 |
/** |
452 |
* Sets the maximum number of Vertex effects that can be applied to a single DistortedBitmap at one time.
|
|
459 |
* Sets the maximum number of Vertex effects that can be applied to a single DistortedObject at one time.
|
|
453 | 460 |
* This can fail if: |
454 | 461 |
* <ul> |
455 | 462 |
* <li>the value of 'max' is outside permitted range |
... | ... | |
464 | 471 |
*/ |
465 | 472 |
public static boolean setMaxVertex(int max) |
466 | 473 |
{ |
467 |
return EffectQueueVertex.setMax(max);
|
|
474 |
return EffectQueue.setMax(EffectTypes.VERTEX.ordinal(),max);
|
|
468 | 475 |
} |
469 | 476 |
|
470 | 477 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
471 | 478 |
/** |
472 |
* Sets the maximum number of Fragment effects that can be applied to a single DistortedBitmap at one time.
|
|
479 |
* Sets the maximum number of Fragment effects that can be applied to a single DistortedObject at one time.
|
|
473 | 480 |
* This can fail if: |
474 | 481 |
* <ul> |
475 | 482 |
* <li>the value of 'max' is outside permitted range |
... | ... | |
484 | 491 |
*/ |
485 | 492 |
public static boolean setMaxFragment(int max) |
486 | 493 |
{ |
487 |
return EffectQueueFragment.setMax(max);
|
|
494 |
return EffectQueue.setMax(EffectTypes.FRAGMENT.ordinal(),max);
|
|
488 | 495 |
} |
489 |
|
|
496 |
|
|
497 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
498 |
/** |
|
499 |
* Sets the maximum number of Other effects that can be applied to a single DistortedObject at one time. |
|
500 |
* This can fail if the value of 'max' is outside permitted range. |
|
501 |
* |
|
502 |
* @param max new maximum number of simultaneous Other Effects. Has to be a non-negative number not greater |
|
503 |
* than Byte.MAX_VALUE |
|
504 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
|
505 |
*/ |
|
506 |
public static boolean setMaxOther(int max) |
|
507 |
{ |
|
508 |
return EffectQueue.setMax(EffectTypes.OTHER.ordinal(),max); |
|
509 |
} |
|
510 |
|
|
490 | 511 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
491 | 512 |
//end of file |
492 | 513 |
} |
Also available in: Unified diff
abstract setMax and getMax to EffectQueue.