(PImage tex, PShapeOpenGL caller)
| 862 | |
| 863 | |
| 864 | protected void removeTexture(PImage tex, PShapeOpenGL caller) { |
| 865 | if (textures == null || !textures.contains(tex)) return; // Nothing to remove. |
| 866 | |
| 867 | // First check that none of the child shapes have texture tex... |
| 868 | boolean childHasTex = false; |
| 869 | for (int i = 0; i < childCount; i++) { |
| 870 | PShapeOpenGL child = (PShapeOpenGL) children[i]; |
| 871 | if (child == caller) continue; |
| 872 | if (child.hasTexture(tex)) { |
| 873 | childHasTex = true; |
| 874 | break; |
| 875 | } |
| 876 | } |
| 877 | |
| 878 | if (!childHasTex) { |
| 879 | // ...if not, it is safe to remove from this shape. |
| 880 | textures.remove(tex); |
| 881 | if (textures.size() == 0) { |
| 882 | textures = null; |
| 883 | } |
| 884 | } |
| 885 | |
| 886 | // Since this shape and all its child shapes don't contain |
| 887 | // tex anymore, we now can remove it from the parent. |
| 888 | if (parent != null) { |
| 889 | ((PShapeOpenGL)parent).removeTexture(tex, this); |
| 890 | } |
| 891 | } |
| 892 | |
| 893 | |
| 894 | protected void strokedTexture(boolean newValue) { |
no test coverage detected