diff options
author | Sven Gothel <[email protected]> | 2023-12-19 17:32:08 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2023-12-19 17:32:08 +0100 |
commit | b76f3c048fb93e7b2c66d7aca4f88f3cbf4b6046 (patch) | |
tree | 91bb089461c0240f57f276a32de825b05b636add | |
parent | 53c2891909941d0261c15e5679bb108f3c70fb82 (diff) |
GraphUI Shape: Unify 'resetState()' for clear and destroy, refine API doc
-rw-r--r-- | src/graphui/classes/com/jogamp/graph/ui/Shape.java | 38 |
1 files changed, 22 insertions, 16 deletions
diff --git a/src/graphui/classes/com/jogamp/graph/ui/Shape.java b/src/graphui/classes/com/jogamp/graph/ui/Shape.java index 408b416cc..99b9cd9b7 100644 --- a/src/graphui/classes/com/jogamp/graph/ui/Shape.java +++ b/src/graphui/classes/com/jogamp/graph/ui/Shape.java @@ -296,37 +296,41 @@ public abstract class Shape { /** * Clears all data and reset all states as if this instance was newly created - * @param gl TODO - * @param renderer TODO + * @param gl current {@link GL2ES2} instance used to release GPU resources + * @param renderer {@link RegionRenderer} used to release GPU resources */ public final void clear(final GL2ES2 gl, final RegionRenderer renderer) { synchronized ( dirtySync ) { clearImpl0(gl, renderer); - position.set(0f, 0f, 0f); - rotation.setIdentity(); - rotPivot = null; - scale.set(1f, 1f, 1f); - box.reset(); - markShapeDirty(); + resetState(); } } - - /** - * Destroys all data - * @param gl - * @param renderer - */ - public final void destroy(final GL2ES2 gl, final RegionRenderer renderer) { - destroyImpl0(gl, renderer); + private final void resetState() { position.set(0f, 0f, 0f); rotation.setIdentity(); rotPivot = null; scale.set(1f, 1f, 1f); box.reset(); + mouseListeners.clear(); + onInitListener = null; + onMoveListener = null; + onToggleListener = null; + onActivationListener = null; + onClickedListener = null; markShapeDirty(); } /** + * Destroys all data + * @param gl current {@link GL2ES2} instance used to release GPU resources + * @param renderer {@link RegionRenderer} used to release GPU resources + */ + public final void destroy(final GL2ES2 gl, final RegionRenderer renderer) { + destroyImpl0(gl, renderer); + resetState(); + } + + /** * Set a user one-shot initializer callback. * <p> * {@link ListenerBool#run(Shape)} will be called @@ -1701,8 +1705,10 @@ public abstract class Shape { */ protected abstract void drawImpl0(final GL2ES2 gl, final RegionRenderer renderer, final int[] sampleCount, Vec4f rgba); + /** Custom {@link #clear(GL2ES2, RegionRenderer)} task, called 1st. */ protected abstract void clearImpl0(final GL2ES2 gl, final RegionRenderer renderer); + /** Custom {@link #destroy(GL2ES2, RegionRenderer)} task, called 1st. */ protected abstract void destroyImpl0(final GL2ES2 gl, final RegionRenderer renderer); /** |