aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-extras/src
diff options
context:
space:
mode:
authorJoshua Slack <[email protected]>2018-01-06 11:45:57 -0600
committerJoshua Slack <[email protected]>2018-01-06 11:45:57 -0600
commit7f712e9e1516547a9472d424ff8f47b726066358 (patch)
tree4eccdc7199a2604bf1362f3098b82ef56fe0ce04 /ardor3d-extras/src
parent4bb73c9195da5c8d095ea7cddef676f77851630c (diff)
Fixed a highlight bug when mouseover moves between multiple rings without mousedepart.
Changed RotateWidget mouseover blend effect to be more subtle.
Diffstat (limited to 'ardor3d-extras/src')
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java9
-rw-r--r--ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java16
2 files changed, 13 insertions, 12 deletions
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
index df23f4b..9d1797d 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/AbstractInteractWidget.java
@@ -113,8 +113,13 @@ public abstract class AbstractInteractWidget {
mouseDeparted(manager);
return;
}
- } else if (!_mouseOver) {
- mouseEntered(manager);
+ } else {
+ if (!_mouseOver) {
+ mouseEntered(manager);
+ } else if (_results.getPickData(0).getTarget() != _lastMouseOverSpatial) {
+ mouseDeparted(manager);
+ mouseEntered(manager);
+ }
}
}
diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java
index 0348887..3ddd7ac 100644
--- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java
+++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/widget/RotateWidget.java
@@ -32,6 +32,7 @@ import com.ardor3d.renderer.Camera;
import com.ardor3d.renderer.Renderer;
import com.ardor3d.renderer.queue.RenderBucketType;
import com.ardor3d.renderer.state.BlendState;
+import com.ardor3d.renderer.state.BlendState.SourceFunction;
import com.ardor3d.renderer.state.RenderState.StateType;
import com.ardor3d.renderer.state.ZBufferState;
import com.ardor3d.renderer.state.ZBufferState.TestFunction;
@@ -84,32 +85,27 @@ public class RotateWidget extends AbstractInteractWidget {
public void mouseEntered(final InteractManager manager) {
super.mouseEntered(manager);
if (_lastMouseOverSpatial != null) {
- cleanupBlendStates();
- final BlendState bs = (BlendState) _lastMouseOverSpatial.getLocalRenderState(StateType.Blend);
- if (bs != null) {
- bs.setBlendEnabled(false);
- }
- _handle.updateGeometricState(0);
+ updateBlendStates(_lastMouseOverSpatial);
}
}
@Override
public void mouseDeparted(final InteractManager manager) {
super.mouseDeparted(manager);
- cleanupBlendStates();
- _handle.updateGeometricState(0);
+ updateBlendStates(null);
}
- protected void cleanupBlendStates() {
+ protected void updateBlendStates(final Spatial highlight) {
_handle.acceptVisitor(new Visitor() {
@Override
public void visit(final Spatial spatial) {
final BlendState bs = (BlendState) spatial.getLocalRenderState(StateType.Blend);
if (bs != null) {
- bs.setBlendEnabled(true);
+ bs.setSourceFunction(spatial == highlight ? SourceFunction.One : SourceFunction.SourceAlpha);
}
}
}, true);
+ _handle.updateGeometricState(0);
}
public RotateWidget withXAxis() {