Revision fe6fe99a
Added by Leszek Koltunski almost 7 years ago
src/main/java/org/distorted/library/main/DistortedEffects.java | ||
---|---|---|
150 | 150 |
} |
151 | 151 |
} |
152 | 152 |
|
153 |
mainVertHeader += ("#define NUM_VERTEX " + ( foundV ? getMaxVertex() : 0 ) + "\n");
|
|
154 |
mainFragHeader += ("#define NUM_FRAGMENT " + ( foundF ? getMaxFragment() : 0 ) + "\n");
|
|
153 |
mainVertHeader += ("#define NUM_VERTEX " + ( foundV ? getMax(EffectType.VERTEX ) : 0 ) + "\n");
|
|
154 |
mainFragHeader += ("#define NUM_FRAGMENT " + ( foundF ? getMax(EffectType.FRAGMENT) : 0 ) + "\n");
|
|
155 | 155 |
|
156 | 156 |
//android.util.Log.e("Effects", "vertHeader= "+mainVertHeader); |
157 | 157 |
//android.util.Log.e("Effects", "fragHeader= "+mainFragHeader); |
... | ... | |
629 | 629 |
|
630 | 630 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
631 | 631 |
/** |
632 |
* Returns the maximum number of Matrix effects.
|
|
632 |
* Returns the maximum number of effects of a given type.
|
|
633 | 633 |
* |
634 |
* @return The maximum number of Matrix effects |
|
634 |
* @param type {@link EffectType} |
|
635 |
* @return The maximum number of effects of a given type. |
|
635 | 636 |
*/ |
636 | 637 |
@SuppressWarnings("unused") |
637 |
public static int getMaxMatrix()
|
|
638 |
public static int getMax(EffectType type)
|
|
638 | 639 |
{ |
639 |
return EffectQueue.getMax(EffectType.MATRIX.ordinal());
|
|
640 |
return EffectQueue.getMax(type.ordinal());
|
|
640 | 641 |
} |
641 | 642 |
|
642 | 643 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
643 | 644 |
/** |
644 |
* Returns the maximum number of Vertex effects. |
|
645 |
* |
|
646 |
* @return The maximum number of Vertex effects |
|
647 |
*/ |
|
648 |
@SuppressWarnings("unused") |
|
649 |
public static int getMaxVertex() |
|
650 |
{ |
|
651 |
return EffectQueue.getMax(EffectType.VERTEX.ordinal()); |
|
652 |
} |
|
653 |
|
|
654 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
655 |
/** |
|
656 |
* Returns the maximum number of Fragment effects. |
|
657 |
* |
|
658 |
* @return The maximum number of Fragment effects |
|
659 |
*/ |
|
660 |
@SuppressWarnings("unused") |
|
661 |
public static int getMaxFragment() |
|
662 |
{ |
|
663 |
return EffectQueue.getMax(EffectType.FRAGMENT.ordinal()); |
|
664 |
} |
|
665 |
|
|
666 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
667 |
/** |
|
668 |
* Returns the maximum number of Postprocess effects. |
|
669 |
* |
|
670 |
* @return The maximum number of Postprocess effects |
|
671 |
*/ |
|
672 |
@SuppressWarnings("unused") |
|
673 |
public static int getMaxPostprocess() |
|
674 |
{ |
|
675 |
return EffectQueue.getMax(EffectType.POSTPROCESS.ordinal()); |
|
676 |
} |
|
677 |
|
|
678 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
679 |
/** |
|
680 |
* Sets the maximum number of Matrix effects that can be stored in a single EffectQueue at one time. |
|
645 |
* Sets the maximum number of effects that can be stored in a single EffectQueue at one time. |
|
681 | 646 |
* This can fail if: |
682 | 647 |
* <ul> |
683 | 648 |
* <li>the value of 'max' is outside permitted range (0 ≤ max ≤ Byte.MAX_VALUE) |
... | ... | |
687 | 652 |
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created. |
688 | 653 |
* </ul> |
689 | 654 |
* |
690 |
* @param max new maximum number of simultaneous Matrix Effects. Has to be a non-negative number not greater |
|
691 |
* than Byte.MAX_VALUE |
|
692 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
|
693 |
*/ |
|
694 |
@SuppressWarnings("unused") |
|
695 |
public static boolean setMaxMatrix(int max) |
|
696 |
{ |
|
697 |
return EffectQueue.setMax(EffectType.MATRIX.ordinal(),max); |
|
698 |
} |
|
699 |
|
|
700 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
701 |
/** |
|
702 |
* Sets the maximum number of Vertex effects that can be stored in a single EffectQueue at one time. |
|
703 |
* This can fail if: |
|
704 |
* <ul> |
|
705 |
* <li>the value of 'max' is outside permitted range (0 ≤ max ≤ Byte.MAX_VALUE) |
|
706 |
* <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called |
|
707 |
* before the Vertex Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this |
|
708 |
* time only decreasing the value of 'max' is permitted. |
|
709 |
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created. |
|
710 |
* </ul> |
|
711 |
* |
|
712 |
* @param max new maximum number of simultaneous Vertex Effects. Has to be a non-negative number not greater |
|
713 |
* than Byte.MAX_VALUE |
|
714 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
|
715 |
*/ |
|
716 |
@SuppressWarnings("unused") |
|
717 |
public static boolean setMaxVertex(int max) |
|
718 |
{ |
|
719 |
return EffectQueue.setMax(EffectType.VERTEX.ordinal(),max); |
|
720 |
} |
|
721 |
|
|
722 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
723 |
/** |
|
724 |
* Sets the maximum number of Fragment effects that can be stored in a single EffectQueue at one time. |
|
725 |
* This can fail if: |
|
726 |
* <ul> |
|
727 |
* <li>the value of 'max' is outside permitted range (0 ≤ max ≤ Byte.MAX_VALUE) |
|
728 |
* <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called |
|
729 |
* before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this |
|
730 |
* time only decreasing the value of 'max' is permitted. |
|
731 |
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created. |
|
732 |
* </ul> |
|
733 |
* |
|
734 |
* @param max new maximum number of simultaneous Fragment Effects. Has to be a non-negative number not greater |
|
735 |
* than Byte.MAX_VALUE |
|
736 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
|
737 |
*/ |
|
738 |
@SuppressWarnings("unused") |
|
739 |
public static boolean setMaxFragment(int max) |
|
740 |
{ |
|
741 |
return EffectQueue.setMax(EffectType.FRAGMENT.ordinal(),max); |
|
742 |
} |
|
743 |
|
|
744 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
745 |
/** |
|
746 |
* Sets the maximum number of Postprocess effects that can be stored in a single EffectQueue at one time. |
|
747 |
* This can fail if: |
|
748 |
* <ul> |
|
749 |
* <li>the value of 'max' is outside permitted range (0 ≤ max ≤ Byte.MAX_VALUE) |
|
750 |
* <li>We try to increase the value of 'max' when it is too late to do so already. It needs to be called |
|
751 |
* before the Fragment Shader gets compiled, i.e. before the call to {@link Distorted#onCreate}. After this |
|
752 |
* time only decreasing the value of 'max' is permitted. |
|
753 |
* <li>Furthermore, this needs to be called before any instances of the DistortedEffects class get created. |
|
754 |
* </ul> |
|
755 |
* |
|
756 |
* @param max new maximum number of simultaneous Postprocess Effects. Has to be a non-negative number not greater |
|
655 |
* @param type {@link EffectType} |
|
656 |
* @param max new maximum number of simultaneous effects. Has to be a non-negative number not greater |
|
757 | 657 |
* than Byte.MAX_VALUE |
758 | 658 |
* @return <code>true</code> if operation was successful, <code>false</code> otherwise. |
759 | 659 |
*/ |
760 | 660 |
@SuppressWarnings("unused") |
761 |
public static boolean setMaxPostprocess(int max)
|
|
661 |
public static boolean setMax(EffectType type, int max)
|
|
762 | 662 |
{ |
763 |
return EffectQueue.setMax(EffectType.POSTPROCESS.ordinal(),max);
|
|
663 |
return EffectQueue.setMax(type.ordinal(),max);
|
|
764 | 664 |
} |
765 | 665 |
|
766 | 666 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Small API simplification.