Commits

John Marsden committed 759112e

Updates

Comments (0)

Files changed (3)

src/main/java/cc/plural/ecs/provider/LWJGLRendererGL2.java

         if (defaultShader.inError()) {
             throw new RuntimeException("Default Shader No Compile: " + defaultShader.getVertexCompileError() + " " + defaultShader.getFragmentCompileError() + " " + defaultShader.getLinkError());
         }
+
+        GL11.glEnable(GL11.GL_CULL_FACE);
+        GL11.glCullFace(GL11.GL_BACK);
     }
 
     public StringLWJGLShader createShader(String vertexSource, String fragmentSource) {

src/main/java/cc/plural/ecs/renderer/Camera.java

     public Vector3f scale;
     public Matrix3f rotation;
     public float[] mat4x4;
+    public Matrix4f storage;
+    
 
     public Camera() {
         translation = new Vector3f();
         scale = new Vector3f(1f, 1f, 1f);
         rotation = Matrix3f.identity();
 
+        storage = Matrix4f.identity();
+        
         mat4x4 = new float[16];
 
-        get(mat4x4);
+        load(mat4x4);
         dirty = false;
     }
 
         dirty = true;
     }
 
-    public float[] get(float[] mat4x4) {
+    public float[] load(float[] mat4x4) {
 
         if (mat4x4 == null || mat4x4.length != 16) {
             throw new NullPointerException("Need a better error here");
 
     public synchronized float[] get() {
         if (dirty) {
-            get(mat4x4);
+            load(mat4x4);
             dirty = false;
         }
         return mat4x4;

src/main/java/cc/plural/math/Transformation.java

         translation = new Vector3f();
         scale = new Vector3f(1f, 1f, 1f);
         rotation = Matrix3f.identity();
+        
     }
 
     public float[] load(float[] mat4x4) {
         translation.multiply3f(parent.scale);
         parent.rotation.transformVector3f(translation).add3f(parent.translation);
     }
-    
-    public static Matrix3f createZRotationMatrix(float angle) {
-        
-        Matrix3f output = Matrix3f.identity();
-        
-        output.setData(0, 0, QuickMath.cos(angle));
-        output.setData(1, 0, -QuickMath.sin(angle));
-        
-        output.setData(0, 1, QuickMath.sin(angle));
-        output.setData(1, 1, QuickMath.cos(angle));
-        return output;
-        
+
+    /**
+     * Create a Z Axis Rotation Matrix3f.
+     * 
+     * @param angle The angle to rotate to (degrees I think)
+     * @param matrix3f The output matrix as input
+     * @return The Matrix
+     */
+    public static Matrix3f storeZRotationMatrix(Matrix3f matrix3f, float angle) {
+        matrix3f.setData(0, 0, QuickMath.cos(angle));
+        matrix3f.setData(1, 0, -QuickMath.sin(angle));
+        matrix3f.setData(0, 1, QuickMath.sin(angle));
+        matrix3f.setData(1, 1, QuickMath.cos(angle));
+        return matrix3f;
+
     }
 }