Commit b3da6958 authored by Matthias Betz's avatar Matthias Betz
Browse files

fix scrolling

invert y rotation
parent 8b2c68c5
......@@ -71,7 +71,7 @@ public class Camera {
public void rotate(double dragDiffX, double dragDiffY) {
float rotationX = (float) (-dragDiffX / 500f);
float rotationZ = (float) (dragDiffY / 500f);
float rotationZ = (float) (-dragDiffY / 500f);
float tempRotationValue = rotateAroundZ + rotationZ;
if (tempRotationValue < -Math.PI / 2 + 0.0001 || tempRotationValue > Math.PI / 2 - 0.0001) {
// to close to 90 degree, stop rotation
......@@ -94,8 +94,8 @@ public class Camera {
public void setDistance(float distance) {
this.distance = distance;
Vector3f res = new Vector3f();
eyePos.sub(centerPos, res);
res.normalize().mul(distance);
centerPos.sub(eyePos, res);
res.normalize().mul(this.distance);
centerPos.add(res, eyePos);
updateMatrix();
}
......
......@@ -403,7 +403,7 @@ public class CityGMLViewer {
double translateZ = -d;
camera.setDistance((float) translateZ);
cameraViewDistance = (float) longestSide * 20f;
camera.rotate(0, -300);
camera.rotate(0, 300);
clearColor = MemoryUtil.memAllocFloat(4);
clearColor.put(0, 0.9411765f).put(1, 1f).put(2, 1f).put(3, 1f);
......@@ -428,16 +428,10 @@ public class CityGMLViewer {
} catch (InterruptedException e) {
e.printStackTrace();
Thread.currentThread().interrupt();
} catch (CityGMLContextException e) {
e.printStackTrace();
} catch (CityGMLReadException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (SAXException e) {
showErrorDialog(e.getClass().getSimpleName() + ": " + e.getMessage());
} catch (CityGMLContextException | CityGMLReadException | IOException | ParserConfigurationException | SAXException e) {
e.printStackTrace();
showErrorDialog(e.getClass().getSimpleName() + ": " + e.getMessage());
} finally {
MemoryUtil.memFree(clearColor);
MemoryUtil.memFree(clearDepth);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment