Skip to content

Commit

Permalink
updated the camera in editors
Browse files Browse the repository at this point in the history
  • Loading branch information
JavaSaBr committed Jul 12, 2016
1 parent 4b6c902 commit 4955f9b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
4 changes: 2 additions & 2 deletions build-native.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
name="jME3-SpaceShift-Editor"
mainClass="com.ss.editor.Starter"
toolkit="fx"
version="0.7.1"
version="0.7.2"
/>

<mkdir dir="build/classes/META-INF"/>
Expand All @@ -130,7 +130,7 @@
<manifest>
<attribute name="Implementation-Vendor" value="spaceshift.ru"/>
<attribute name="Implementation-Title" value="jME3 SpaceShift Editor"/>
<attribute name="Implementation-Version" value="0.7.1"/>
<attribute name="Implementation-Version" value="0.7.2"/>
</manifest>
</fx:jar>

Expand Down
2 changes: 1 addition & 1 deletion build/package/linux/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: jme3-spaceshift-editor
Version: 0.7.1
Version: 0.7.2
Section: tool
Maintainer: spaceshift.ru <[email protected]>
Priority: optional
Expand Down
2 changes: 1 addition & 1 deletion src/com/ss/editor/Editor.java
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public void simpleInitApp() {
audioRenderer.setEnvironment(new Environment(Environment.Garage));

viewPort.setBackgroundColor(new ColorRGBA(50 / 255F, 50 / 255F, 50 / 255F, 1F));
cam.setFrustumPerspective(55, (float) cam.getWidth() / cam.getHeight(), 1f, 1000);
cam.setFrustumPerspective(55, (float) cam.getWidth() / cam.getHeight(), 1f, 10000);

final Node guiNode = getGuiNode();
guiNode.detachAllChildren();
Expand Down
2 changes: 1 addition & 1 deletion src/com/ss/editor/config/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public abstract class Config {
public static final String CONFIG_RESOURCE_PATH = "/com/ss/editor/config/config.xml";

public static final String TITLE = "jME3 SpaceShift Editor";
public static final String VERSION = "v.0.7.1";
public static final String VERSION = "v.0.7.2";

public static final String SS_FOLDER_IN_USER_HOME = ".jme3-spaceshift-editor";

Expand Down
6 changes: 5 additions & 1 deletion src/com/ss/editor/model/EditorCamera.java
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ protected void rotateCamera(float value) {
targetRotation += value * rotationSpeed;
}

public float getTargetDistance() {
return targetDistance;
}

//move the camera toward or away the target
protected void zoomCamera(float value) {

Expand All @@ -279,7 +283,7 @@ protected void zoomCamera(float value) {
}

zooming = true;
targetDistance += value * zoomSensitivity;
targetDistance += value * zoomSensitivity * Math.sqrt(targetDistance);

if (targetDistance > maxDistance) {
targetDistance = maxDistance;
Expand Down
11 changes: 6 additions & 5 deletions src/com/ss/editor/state/editor/impl/AbstractEditorState.java
Original file line number Diff line number Diff line change
Expand Up @@ -152,24 +152,25 @@ protected void onAnalogImpl(final String name, final float value, final float tp

protected void moveXCamera(final float value) {

final EditorCamera editorCamera = getEditorCamera();
final Camera camera = EDITOR.getCamera();
final Node nodeForCamera = getNodeForCamera();

final Vector3f left = camera.getLeft();
left.multLocal(value);
left.multLocal(value * (float) Math.sqrt(editorCamera.getTargetDistance()));
left.addLocal(nodeForCamera.getLocalTranslation());

nodeForCamera.setLocalTranslation(left);
final EditorCamera editorCamera = getEditorCamera();
}

protected void moveYCamera(final float value) {

final EditorCamera editorCamera = getEditorCamera();
final Camera camera = EDITOR.getCamera();
final Node nodeForCamera = getNodeForCamera();

final Vector3f up = camera.getUp();
up.multLocal(value);
up.multLocal(value * (float) Math.sqrt(editorCamera.getTargetDistance()));
up.addLocal(nodeForCamera.getLocalTranslation());

nodeForCamera.setLocalTranslation(up);
Expand Down Expand Up @@ -448,10 +449,10 @@ protected EditorCamera createEditorCamera() {

final EditorCamera editorCamera = new EditorCamera(camera, getNodeForCamera());
editorCamera.setMinVerticalRotation(-FastMath.HALF_PI);
editorCamera.setMaxDistance(1000);
editorCamera.setMaxDistance(10000);
editorCamera.setSmoothMotion(false);
editorCamera.setRotationSensitivity(1);
editorCamera.setZoomSensitivity(1);
editorCamera.setZoomSensitivity(0.5F);
editorCamera.setDownRotateOnCloseViewOnly(false);

return editorCamera;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import com.jme3.material.MatParam;
import com.jme3.material.Material;
import com.ss.editor.manager.ExecutorManager;
import com.ss.editor.model.undo.EditorOperation;
import com.ss.editor.ui.control.material.operation.IntegerMaterialParamOperation;
import com.ss.editor.ui.css.CSSClasses;
Expand All @@ -27,8 +26,6 @@ public class IntegerMaterialParamControl extends MaterialParamControl {

public static final Insets ELEMENT_OFFSET = new Insets(0, 0, 0, 3);

private static final ExecutorManager EXECUTOR_MANAGER = ExecutorManager.getInstance();

/**
* Контрол для установки целочисленного значения.
*/
Expand Down

0 comments on commit 4955f9b

Please sign in to comment.