fix SceneEditTool :

- axis pick is now available
experimental
Maselbas 10 years ago
parent 684c923632
commit b27f86a3ae
  1. 11
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/SceneEditTool.java

@ -285,7 +285,7 @@ public abstract class SceneEditTool {
* what part of the axis was selected. * what part of the axis was selected.
* For example if (1,0,0) is returned, then the X-axis pole was selected. * For example if (1,0,0) is returned, then the X-axis pole was selected.
* If (0,1,1) is returned, then the Y-Z plane was selected. * If (0,1,1) is returned, then the Y-Z plane was selected.
* *
* @return null if it did not intersect the marker * @return null if it did not intersect the marker
*/ */
protected Vector3f pickAxisMarker(Camera cam, Vector2f mouseLoc, AxisMarkerPickType pickType) { protected Vector3f pickAxisMarker(Camera cam, Vector2f mouseLoc, AxisMarkerPickType pickType) {
@ -336,7 +336,7 @@ public abstract class SceneEditTool {
CollisionResults results = new CollisionResults(); CollisionResults results = new CollisionResults();
Ray ray = new Ray(); Ray ray = new Ray();
Vector3f pos = cam.getWorldCoordinates(mouseLoc, 0).clone(); Vector3f pos = cam.getWorldCoordinates(mouseLoc, 0).clone();
Vector3f dir = cam.getWorldCoordinates(mouseLoc, 0.1f).clone(); Vector3f dir = cam.getWorldCoordinates(mouseLoc, 0.125f).clone();
dir.subtractLocal(pos).normalizeLocal(); dir.subtractLocal(pos).normalizeLocal();
ray.setOrigin(pos); ray.setOrigin(pos);
ray.setDirection(dir); ray.setDirection(dir);
@ -347,7 +347,7 @@ public abstract class SceneEditTool {
/** /**
* Show what axis or plane the mouse is currently over and will affect. * Show what axis or plane the mouse is currently over and will affect.
* @param axisMarkerPickType * @param axisMarkerPickType
*/ */
protected void highlightAxisMarker(Camera camera, Vector2f screenCoord, AxisMarkerPickType axisMarkerPickType) { protected void highlightAxisMarker(Camera camera, Vector2f screenCoord, AxisMarkerPickType axisMarkerPickType) {
highlightAxisMarker(camera, screenCoord, axisMarkerPickType, false); highlightAxisMarker(camera, screenCoord, axisMarkerPickType, false);
@ -355,12 +355,12 @@ public abstract class SceneEditTool {
/** /**
* Show what axis or plane the mouse is currently over and will affect. * Show what axis or plane the mouse is currently over and will affect.
* @param axisMarkerPickType * @param axisMarkerPickType
* @param colorAll highlight all parts of the marker when only one is selected * @param colorAll highlight all parts of the marker when only one is selected
*/ */
protected void highlightAxisMarker(Camera camera, Vector2f screenCoord, AxisMarkerPickType axisMarkerPickType, boolean colorAll) { protected void highlightAxisMarker(Camera camera, Vector2f screenCoord, AxisMarkerPickType axisMarkerPickType, boolean colorAll) {
setDefaultAxisMarkerColors(); setDefaultAxisMarkerColors();
Vector3f picked = pickAxisMarker(camera, screenCoord, axisPickType); Vector3f picked = pickAxisMarker(camera, screenCoord, axisMarkerPickType);
if (picked == null) { if (picked == null) {
return; return;
} }
@ -453,6 +453,7 @@ public abstract class SceneEditTool {
// axis.attachChild(quadYZ); // axis.attachChild(quadYZ);
axis.setModelBound(new BoundingBox()); axis.setModelBound(new BoundingBox());
axis.updateModelBound();
return axis; return axis;
} }

Loading…
Cancel
Save