summaryrefslogtreecommitdiffstats
path: root/src/graphui/classes/com
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-03-22 11:06:23 +0100
committerSven Gothel <[email protected]>2023-03-22 11:06:23 +0100
commit5bdc5f947353d59930609daad5e223764a1e12e4 (patch)
tree63066ad24fa6e266a8626068d5b14c1ab0619a86 /src/graphui/classes/com
parentfbbdf8b82e159078274475c5013f2f1147b0a4d8 (diff)
GraphUI Scene: Add removeShape*(GL2ES2..) variant w/ their destruction for convenience
Diffstat (limited to 'src/graphui/classes/com')
-rw-r--r--src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java22
1 files changed, 18 insertions, 4 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
index 5e7151076..038d1d877 100644
--- a/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
+++ b/src/graphui/classes/com/jogamp/graph/ui/gl/Scene.java
@@ -196,18 +196,32 @@ public final class Scene implements GLEventListener {
public ArrayList<Shape> getShapes() {
return shapes;
}
- public void addShape(final Shape b) {
- shapes.add(b);
+ public void addShape(final Shape s) {
+ shapes.add(s);
}
- public void removeShape(final Shape b) {
- shapes.remove(b);
+ /** Removes given shape, keeps it alive. */
+ public void removeShape(final Shape s) {
+ shapes.remove(s);
+ }
+ /** Removes all given shapes and destroys them. */
+ public void removeShape(final GL2ES2 gl, final Shape s) {
+ shapes.remove(s);
+ s.destroy(gl, renderer);
}
public void addShapes(final Collection<? extends Shape> shapes) {
this.shapes.addAll(shapes);
}
+ /** Removes all given shapes, keeps them alive. */
public void removeShapes(final Collection<? extends Shape> shapes) {
this.shapes.removeAll(shapes);
}
+ /** Removes all given shapes and destroys them. */
+ public void removeShapes(final GL2ES2 gl, final Collection<? extends Shape> shapes) {
+ this.shapes.removeAll(shapes);
+ for(final Shape s : shapes) {
+ s.destroy(gl, renderer);
+ }
+ }
public Shape getShapeByIdx(final int id) {
if( 0 > id ) {
return null;