Skip to content

Commit

Permalink
Update Readme, add more Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
GhostFoxSledgehammer committed Jun 4, 2021
1 parent f3e1ca6 commit 19761ca
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
OpenGL based Image Viewer for 360 degrees Panoramic Images.
LICENSE : GPL
LICENSE : GPL

Minimum Requirements
Java Version 8+
OpenGL version 4.0+

To run the jar file pass the path of an Image as argument.
Example - `java -jar PanoViewer.jar <Path To File>`
14 changes: 9 additions & 5 deletions src/main/java/PanoViewer/gui/PhotoSphere.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ public class PhotoSphere extends GLCanvas implements GLEventListener {
private int rendering_program;
private final Camera camera;
private final FloatBuffer vals = Buffers.newDirectFloatBuffer(16);
private Matrix4f pMat = new Matrix4f();
private Matrix4f vMat = new Matrix4f();
private final Matrix4f pMat = new Matrix4f();
private final Matrix4f vMat = new Matrix4f();
private final Matrix4f mvMat = new Matrix4f();
private final Matrix4f mMat = new Matrix4f();
private int mvLoc, projLoc;
Expand Down Expand Up @@ -97,7 +97,7 @@ public void init(GLAutoDrawable glad) {
setupVertices(glad.getGL().getGL4());
aspect = (float) getWidth() / (float) getHeight();
pMat.setPerspective((float) Math.toRadians(fov), aspect, 0.1f, 1000.0f);
vMat = camera.getViewMatrix();
vMat.set(camera.getViewMatrix());
mMat.translation(sphereLoc);
texture = new Texture(GL_TEXTURE_2D);
}
Expand Down Expand Up @@ -141,7 +141,6 @@ public void display(GLAutoDrawable glad) {

gl.glEnable(GL_DEPTH_TEST);
gl.glDepthFunc(GL_LEQUAL);
// gl.glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);

gl.glActiveTexture(GL_TEXTURE0);
texture.enable(gl);
Expand Down Expand Up @@ -205,11 +204,16 @@ private void disableZoomPan() {
this.removeMouseWheelListener(listener);
}

/**
* Rotates the camera.
* @param yaw Yaw angle in radian.
* @param pitch Pitch angle in radian.
*/
public void rotateCamera(double yaw, double pitch) {
float newYaw = (float) (yaw * fov / IDEAL_FOV);
float newPitch = (float) (pitch * fov / IDEAL_FOV);
camera.rotate(newYaw, newPitch);
vMat = camera.getViewMatrix();
vMat.set(camera.getViewMatrix());
repaint();
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/PanoViewer/settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class settings {
private static int wheelSenstivity = 5;
private static int precision = 90;
private static GLProfile gl;
/* Whether or not to flip the image when creating texture data. */
private static boolean invertImage;

private settings() {
Expand Down

0 comments on commit 19761ca

Please sign in to comment.