Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
Protos
Nomad 3D
nomad-3d-editor
Commits
5f11cc40
Commit
5f11cc40
authored
Jun 29, 2017
by
Ivan Dages
Browse files
camera controls : consitency between editor and viewer
parent
66c0f507
Changes
1
Show whitespace changes
Inline
Side-by-side
src/main/java/fr/ill/ics/n3d/gui/CameraControls.java
View file @
5f11cc40
...
...
@@ -5,6 +5,7 @@ import javafx.geometry.Point3D;
import
javafx.scene.Camera
;
import
javafx.scene.Node
;
import
javafx.scene.transform.Affine
;
import
javafx.scene.transform.NonInvertibleTransformException
;
import
javafx.scene.transform.Rotate
;
import
javafx.scene.transform.Translate
;
...
...
@@ -291,14 +292,28 @@ public class CameraControls {
public
void
translate
(
Point2D
delta
,
boolean
isControlDown
,
boolean
isShiftDown
,
boolean
isAltDown
)
{
double
modifier
=
modifier
(
isControlDown
,
isShiftDown
);
Point3D
translation
=
null
;
Point3D
xAxis
=
Rotate
.
X_AXIS
;
Point3D
yAxis
=
Rotate
.
Y_AXIS
;
try
{
xAxis
=
transform
.
inverseDeltaTransform
(
Rotate
.
X_AXIS
).
normalize
();
yAxis
=
transform
.
inverseDeltaTransform
(
Rotate
.
Y_AXIS
).
normalize
();
}
catch
(
NonInvertibleTransformException
e
)
{
// TODO Auto-generated catch block
e
.
printStackTrace
();
}
Point3D
translation
=
new
Point3D
(
0
,
0
,
0
);
translation
=
translation
.
add
(
xAxis
.
multiply
(-
translationSensitivity
*
delta
.
getX
()));
translation
=
translation
.
add
(
yAxis
.
multiply
(-
translationSensitivity
*
delta
.
getY
()));
/*
if (isAltDown) {
translation = new Point3D(0, translationSensitivity * delta.getY(), 0);
} else {
translation
=
new
Point3D
(
translationSensitivity
*
delta
.
getX
(),
0
,
translationSensitivity
*
delta
.
getY
());
translation = new Point3D(translationSensitivity * delta.getX(), translationSensitivity * delta.getY()
, 0
);
}
Rotate lonRot = new Rotate(longitude, Rotate.Y_AXIS);
translation = lonRot.transform(translation);
*/
center
=
center
.
add
(
translation
.
multiply
(
modifier
));
update
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment