1. John Marsden
  2. EntityComponentSystem

Commits

John Marsden  committed a04e8b0

Start of Camera

  • Participants
  • Parent commits 759112e
  • Branches develop

Comments (0)

Files changed (4)

File src/main/java/cc/plural/ecs/provider/LWJGLRenderer.java

View file
 import cc.plural.ecs.renderer.RenderState;
 import cc.plural.ecs.renderer.Renderer;
 import cc.plural.ecs.renderer.Shader;
-import cc.plural.ecs.renderer.SimpleCamera;
+import cc.plural.ecs.renderer.AxisCamera;
+import cc.plural.ecs.renderer.PerspectiveProjection;
 import cc.plural.ecs.renderer.Texture;
 import cc.plural.graphics.Vertex;
 import cc.plural.math.Matrix4f;
         this.display = display;
         this.frameRate = 60;
 
-        this.camera = new SimpleCamera();
+        this.camera = new AxisCamera();
 
         lock = false;
         batch = new RenderBatch();
 
     public void setOrthoProjection(float left, float right, float top, float bottom, float near, float far) {
         projection = new OrthogonalProjection(left, right, top, bottom, near, far);
-        projection.load(projectionMatrix);
+    }
+
+    public void setPerspectiveProjection(float near, float far, float fov, float aspectRatio) {
+        projection = new PerspectiveProjection(near, far, fov, aspectRatio);
     }
 
     public Color getBackgroundColor() {
         LWJGLInMemoryMeshVAO mesh = new LWJGLInMemoryMeshVAO(vertices, indicies);
         return mesh;
     }
-    
+
     public Mesh createStaticMesh(Shader shader, Vertex[] vertices, short[] indicies) {
         LWJGLInMemoryMeshVAO mesh = new LWJGLInMemoryMeshVAO(vertices, indicies);
         return mesh;

File src/main/java/cc/plural/ecs/renderer/AxisCamera.java

View file
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+package cc.plural.ecs.renderer;
+
+import cc.plural.math.Matrix3f;
+import cc.plural.math.Vector3f;
+
+/**
+ *
+ * @author jmarsden
+ */
+public class AxisCamera extends Camera {
+    
+    public Vector3f forward;
+    public Vector3f right;
+    public Vector3f up;
+    
+    public AxisCamera() {
+        forward = new Vector3f(0,0,1);
+        right = new Vector3f(1,0,0);
+        up = new Vector3f(0,1,0);
+       
+    }
+
+
+
+    
+}

File src/main/java/cc/plural/ecs/renderer/Renderer.java

View file
      */
     public void setOrthoProjection(float left, float right, float top, float bottom, float near, float far);
     
+    public void setPerspectiveProjection(float near, float far, float fov, float aspectRatio);
+    
     /**
      * Accessors
      */

File src/main/java/cc/plural/ecs/renderer/SimpleCamera.java

-/*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
-package cc.plural.ecs.renderer;
-
-import cc.plural.math.Matrix3f;
-import cc.plural.math.Vector3f;
-
-/**
- *
- * @author jmarsden
- */
-public class SimpleCamera extends Camera {
-    
-
-    public SimpleCamera() {
-
-    }
-
-
-
-    
-}