• R/O
  • SSH

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãoffafa8196549289b527373318f567a2b95194e0a (tree)
Hora2021-06-15 00:05:19
Autorsebastian_bugiu
Commitersebastian_bugiu

Mensagem de Log

Node rotation now seems to be working. More testing needed.

Mudança Sumário

Diff

diff -r 24caf8381845 -r ffafa8196549 HotshotEditor/src/com/javafx/experiments/jfx3dviewer/ContentModel.java
--- a/HotshotEditor/src/com/javafx/experiments/jfx3dviewer/ContentModel.java Mon Jun 14 16:50:26 2021 +0300
+++ b/HotshotEditor/src/com/javafx/experiments/jfx3dviewer/ContentModel.java Mon Jun 14 18:05:19 2021 +0300
@@ -102,7 +102,7 @@
102102 private AutoScalingGroup autoScalingGroup = new AutoScalingGroup(2);
103103 private SubdivisionMesh.BoundaryMode boundaryMode = SubdivisionMesh.BoundaryMode.CREASE_EDGES;
104104 private final PerspectiveCamera camera = new PerspectiveCamera(true);
105- public static final double cameraDistance = 100;
105+ public static final double cameraDistance = 20;
106106 private final Rotate cameraLookXRotate = new Rotate(0, 0, 0, 0, Rotate.X_AXIS);
107107 private final Rotate cameraLookZRotate = new Rotate(0, 0, 0, 0, Rotate.Z_AXIS);
108108 // private final Translate cameraPosition = new Translate(0, 0,0);
@@ -549,11 +549,12 @@
549549 }
550550 } else if (currentModifier == Modifier.ROTATION) {
551551 if (mouseDeltaX != 0 || mouseDeltaY != 0) {
552- Point3D zVec = new Point3D(0, 0, 1);
553- Point3D mouseVec = new Point3D(flip * mouseDeltaX, yFlip * mouseDeltaY, 0);
554- Point3D rotAxis = mouseVec.crossProduct(zVec);
555- rotAxis = rotAxis.normalize();
556- ENG_Quaternion currentRot = ENG_Quaternion.fromAngleAxisDegRet(3.0, new ENG_Vector4D(rotAxis.getX(), rotAxis.getY(), rotAxis.getZ(), 1.0));
552+ ENG_Vector3D zVec = new ENG_Vector3D(0, 0, 1);
553+ ENG_Vector3D mouseVec = new ENG_Vector3D(mouseDeltaX, mouseDeltaY, 0);
554+ ENG_Vector3D rotAxis = mouseVec.crossProduct(zVec);
555+ rotAxis.normalize();
556+ rotAxis = cameraTransform.getOrientation().mul(rotAxis);
557+ ENG_Quaternion currentRot = ENG_Quaternion.fromAngleAxisDegRet(3.0, new ENG_Vector4D(rotAxis.x, rotAxis.y, rotAxis.z, 1.0));
557558 currentRot.normalize();
558559 ENG_Quaternion nodeRotation = nodeData.getNodeRotation();
559560 ENG_Quaternion currentOrientationCopy = new ENG_Quaternion(nodeRotation);
@@ -952,8 +953,8 @@
952953 root3D.addEventHandler(KeyEvent.ANY, keyEventHandler);
953954 root3D.setFocusTraversable(true);
954955
955- subScene.setOnKeyPressed(event -> System.out.println("subScene keyPressed"));
956- root3D.setOnKeyPressed(event -> System.out.println("root3d key pressed"));
956+// subScene.setOnKeyPressed(event -> System.out.println("subScene keyPressed"));
957+// root3D.setOnKeyPressed(event -> System.out.println("root3d key pressed"));
957958
958959 // Scene scene = subScene.getScene();
959960 // scene.addEventHandler(KeyEvent.ANY, keyEventHandler);