From cbc61566689660d39f469efe4c429f8adf5b239e Mon Sep 17 00:00:00 2001 From: Joshua Slack Date: Fri, 2 Jun 2017 19:02:23 -0500 Subject: Updates to allow overriding SpatialState in InteractManager. Updates to allow easier overriding of input flow in UIHud. Added new example tying together UI and Interact --- .../java/com/ardor3d/extension/interact/InteractManager.java | 8 +++++++- .../com/ardor3d/extension/interact/data/SpatialState.java | 12 ------------ 2 files changed, 7 insertions(+), 13 deletions(-) (limited to 'ardor3d-extras') diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java index f855cb3..447a226 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/InteractManager.java @@ -61,7 +61,7 @@ public class InteractManager { /** * Spatial state tracking. */ - protected SpatialState _state = new SpatialState(); + protected final SpatialState _state; /** * List of filters to modify state prior to applying to a Spatial target. @@ -69,6 +69,12 @@ public class InteractManager { protected List _filters = Lists.newArrayList(); public InteractManager() { + _state = new SpatialState(); + setupLogicalLayer(); + } + + public InteractManager(final SpatialState stateTracking) { + _state = stateTracking; setupLogicalLayer(); } diff --git a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java index 2364e25..e3918d1 100644 --- a/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java +++ b/ardor3d-extras/src/main/java/com/ardor3d/extension/interact/data/SpatialState.java @@ -16,36 +16,24 @@ import com.ardor3d.scenegraph.Spatial; public class SpatialState { protected Transform _transform = new Transform(); - protected Object _userData = null; public SpatialState() {} /** copy constructor */ public SpatialState(final SpatialState toCopy) { _transform.set(toCopy._transform); - _userData = toCopy._userData; } public Transform getTransform() { return _transform; } - public Object getUserData() { - return _userData; - } - - public void setUserData(final Object userData) { - _userData = userData; - } - public void copyState(final Spatial source) { _transform.set(source.getTransform()); - _userData = source.getUserData(); } public void applyState(final Spatial target) { target.setTransform(_transform); - target.setUserData(_userData); } } -- cgit v1.2.3