fixed terrain camera controller to use the changes to AbstractCameraController

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@7881 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
bre..ns 14 years ago
parent 381764a0ec
commit 4b57b7187a
  1. 3
      sdk/jme3-core/src/com/jme3/gde/core/scene/controller/AbstractCameraController.java
  2. 1
      sdk/jme3-scenecomposer/src/com/jme3/gde/scenecomposer/ComposerCameraController.java
  3. 64
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainCameraController.java
  4. 4
      sdk/jme3-terrain-editor/src/com/jme3/gde/terraineditor/TerrainToolController.java

@ -44,11 +44,8 @@ import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.renderer.Camera;
import com.jme3.renderer.RenderManager;
import java.awt.FocusTraversalPolicy;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.logging.Logger;
import org.openide.util.Exceptions;
/**

@ -27,7 +27,6 @@ package com.jme3.gde.scenecomposer;
import com.jme3.gde.core.scene.SceneApplication;
import com.jme3.gde.core.scene.controller.AbstractCameraController;
import com.jme3.gde.core.sceneexplorer.nodes.JmeNode;
import com.jme3.gde.core.sceneviewer.SceneViewerTopComponent;
import com.jme3.input.KeyInput;
import com.jme3.input.event.KeyInputEvent;
import com.jme3.math.Vector2f;

@ -57,6 +57,7 @@ public class TerrainCameraController extends AbstractCameraController {
private TerrainToolController toolController;
private TerrainEditorController editorController;
private boolean forceCameraControls = false; // when user holds shift, this is true
private boolean useCameraControls = true; // based on what a tool specifies
private boolean terrainEditToolActivated = false;
protected Application app;
@ -101,60 +102,44 @@ public class TerrainCameraController extends AbstractCameraController {
if ("MouseAxisX".equals(string)) {
moved = true;
movedR = true;
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
if (leftMouse)
terrainEditToolActivated = true;
}
else {
if (leftMouse) {
if (useCameraControls || forceCameraControls) {
if (buttonDownL) {
rotateCamera(Vector3f.UNIT_Y, -f1 * 2.5f);
}
if (rightMouse) {
if (buttonDownR) {
panCamera(f1 * 2.5f, 0);
}
}
} else if ("MouseAxisY".equals(string)) {
moved = true;
movedR = true;
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
if (leftMouse)
terrainEditToolActivated = true;
}
else {
if (leftMouse) {
if (useCameraControls || forceCameraControls) {
if (buttonDownL) {
rotateCamera(cam.getLeft(), -f1 * 2.5f);
}
if (rightMouse) {
if (buttonDownR) {
panCamera(0, -f1 * 2.5f);
}
}
} else if ("MouseAxisX-".equals(string)) {
moved = true;
movedR = true;
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
if (leftMouse)
terrainEditToolActivated = true;
}
else {
if (leftMouse) {
if (useCameraControls || forceCameraControls) {
if (buttonDownL) {
rotateCamera(Vector3f.UNIT_Y, f1 * 2.5f);
}
if (rightMouse) {
if (buttonDownR) {
panCamera(-f1 * 2.5f, 0);
}
}
} else if ("MouseAxisY-".equals(string)) {
moved = true;
movedR = true;
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
if (leftMouse)
terrainEditToolActivated = true;
}
else {
if (leftMouse) {
if (useCameraControls || forceCameraControls) {
if (buttonDownL) {
rotateCamera(cam.getLeft(), f1 * 2.5f);
}
if (rightMouse) {
if (buttonDownR) {
panCamera(0, f1 * 2.5f);
}
}
@ -174,18 +159,34 @@ public class TerrainCameraController extends AbstractCameraController {
@Override
protected void checkClick(int button, boolean pressed) {
if (button == 0) {
/*if (button == 0) {
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
if (leftMouse)
terrainEditToolActivated = true;
}
}
if (button == 1) {
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
toolController.doTerrainEditToolAlternateActivated();
}
}*/
if (button == 1) {
if (isTerrainEditButtonEnabled() && !forceCameraControls) {
toolController.doTerrainEditToolAlternateActivated();
}
}
}
@Override
protected void checkDragged(int button, boolean pressed) {
terrainEditToolActivated = true;
}
@Override
protected void checkMoved() {
}
/**
* Update the terrain if it has had any editing done on it.
@ -221,6 +222,7 @@ public class TerrainCameraController extends AbstractCameraController {
}
}
/**
* Find where on the terrain the mouse intersects.
*/
@ -246,6 +248,10 @@ public class TerrainCameraController extends AbstractCameraController {
return result.getContactPoint();
}
public void setUseCameraControls(boolean useCameraControls) {
this.useCameraControls = useCameraControls;
}

@ -125,7 +125,9 @@ public class TerrainToolController extends SceneToolController {
terrainTool.radiusChanged(toolRadius);
terrainTool.weightChanged(toolWeight);
terrainTool.activate(manager, toolsNode);
}
cameraController.setUseCameraControls(false);
} else
cameraController.setUseCameraControls(true);
}
public void setEditToolSize(final float size) {

Loading…
Cancel
Save