Skip to content

Commit

Permalink
jse3d v1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Emery Ferrari committed May 16, 2020
1 parent 51d8cf6 commit ec59869
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/com/emeryferrari/jse3d/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public void paintComponent(Graphics graphics) {
} else {
graphics.setColor(backgroundColor);
}
graphics.fillRect(0, 0, frame.getWidth(), frame.getHeight());
graphics.fillRect(0, 0, this.getSize().width, this.getSize().height);
Point mouse;
if (mode == CameraMode.DRAG) {
if (mouseClicked) {
Expand All @@ -136,15 +136,15 @@ public void paintComponent(Graphics graphics) {
zAngle = 0;
}
double mag = Math.sqrt(Math.pow(scene.object[a].points[i].x, 2) + Math.pow(scene.object[a].points[i].z, 2));
viewAngleY = -(mouse.y-frame.getHeight()/2)/sensitivity;
if (Math.abs(mouse.y-frame.getHeight()/2)>Math.PI/2*sensitivity) {
viewAngleY = -(mouse.y-this.getSize().height/2)/sensitivity;
if (Math.abs(mouse.y-this.getSize().height/2)>Math.PI/2*sensitivity) {
if (viewAngleY < 0) {
viewAngleY = -Math.PI/2*sensitivity;
} else {
viewAngleY = Math.PI/2*sensitivity;
}
}
viewAngleX = -(mouse.x-frame.getWidth()/2)/sensitivity;
viewAngleX = -(mouse.x-this.getSize().width/2)/sensitivity;
if (scene.object[a].points[i].x < 0) {
xTransform = -mag*scale*Math.cos(viewAngleX+zAngle);
yTransform = -mag*scale*Math.sin(viewAngleX+zAngle)*Math.sin(viewAngleY)+(scene.object[a].points[i].y)*scale*Math.cos(viewAngleY);
Expand All @@ -159,7 +159,7 @@ public void paintComponent(Graphics graphics) {
distance.get(a).set(i, new Distance(Math.sqrt(Math.pow(camPosX-(scene.object[a].points[i].x), 2)+Math.pow(camPosY-scene.object[a].points[i].y, 2)+Math.pow(camPosZ-scene.object[a].points[i].z, 2)), i));
double theta = Math.asin((Math.sqrt(Math.pow(xTransform, 2)+Math.pow(yTransform, 2))/scale)/distance.get(a).get(i).distance);
camScale.get(a).set(i, distance.get(a).get(i).distance*Math.cos(theta)*Math.sin(scene.viewAngle/2));
points[i] = new Point((int)(frame.getWidth()/2+xTransform/camScale.get(a).get(i)), (int)(frame.getHeight()/2-yTransform/camScale.get(a).get(i)));
points[i] = new Point((int)(this.getSize().width/2+xTransform/camScale.get(a).get(i)), (int)(this.getSize().height/2-yTransform/camScale.get(a).get(i)));
}
// WRITTEN BY SAM END
if (renderPoints) {
Expand Down
2 changes: 1 addition & 1 deletion src/com/emeryferrari/jse3d/JSE3DConst.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
public class JSE3DConst {
private JSE3DConst() {}
public static final String NAME = "jse3d";
public static final String VERSION = "v1.5.1";
public static final String VERSION = "v1.5.2";
public static final String FULL_NAME = JSE3DConst.NAME + " " + JSE3DConst.VERSION;
}

0 comments on commit ec59869

Please sign in to comment.