Commits

John Marsden committed dcef998

0.0.4 Final

Comments (0)

Files changed (5)

                     <argLine>-Djava.library.path=${project.basedir}/target/natives</argLine>
                 </configuration>
             </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-javadoc-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>attach-javadocs</id>
+                        <goals>
+                            <goal>jar</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
     <dependencies>

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

  */
 package cc.plural.ecs.provider;
 
-import cc.plural.ecs.renderer.ShaderDefaults;
 import cc.plural.ecs.runtime.ApplicationInterface;
-import java.io.File;
 import org.lwjgl.Sys;
 
 public class LWJGLApplication {
                 }
                 applicationInterface.render(renderer);
             }
-            renderer.display.update();
             renderer.display.sync(renderer.frameRate);
+            renderer.display.update();
+            
 
             updateFPS();
         }

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

 import cc.plural.graphics.Vertex;
 import cc.plural.math.Matrix4f;
 import cc.plural.utils.Color;
-import java.nio.ByteBuffer;
 import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.lwjgl.BufferUtils;
-import org.lwjgl.opengl.GL15;
 
 /**
  *

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

 import cc.plural.ecs.renderer.Shader;
 import cc.plural.ecs.renderer.ShaderDefaults;
 import cc.plural.ecs.renderer.Texture;
-import cc.plural.ecs.renderer.Uniform;
-import cc.plural.graphics.Vertex;
 import cc.plural.math.Transformation;
-import cc.plural.utils.ArrayPrinter;
-import cc.plural.utils.MatrixPrinter;
-import cc.plural.utils.PNGDecoder;
-import java.io.IOException;
 import java.net.URL;
-import java.nio.ByteBuffer;
-import java.nio.FloatBuffer;
-import java.nio.ShortBuffer;
-import org.lwjgl.BufferUtils;
 import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL13;
-import org.lwjgl.opengl.GL15;
-import org.lwjgl.opengl.GL20;
-import org.lwjgl.opengl.GL30;
-import org.lwjgl.util.vector.Vector3f;
 
 public class LWJGLRendererGL2 extends LWJGLRenderer {
 
         if (defaultShader.inError()) {
             throw new RuntimeException("Default Shader No Compile: " + defaultShader.getVertexCompileError() + " " + defaultShader.getFragmentCompileError() + " " + defaultShader.getLinkError());
         }
-
-//        ecsProjectionMatrix = new Matrix4f();
-//        ecsViewMatrix = Matrix4f.identity();
-//        ecsModelMatrix = Matrix4f.identity();
-
-        /* **
-         * Debug
-         */
-        //setupShaders();
-        //shader = getDefaultShader();
-        //setupTextures();
-        //setupQuad();
     }
 
     public StringLWJGLShader createShader(String vertexSource, String fragmentSource) {
     }
 
     public StringLWJGLShader createShader(URL vertexURL, URL fragmentURL) {
-        return new StringLWJGLShader(ClassLoader.class.getResource("/assets/shaders/vertexDefault130.glsl"),
-                ClassLoader.class.getResource("/assets/shaders/fragmentDefault130.glsl"));
+        return new StringLWJGLShader(vertexURL, fragmentURL);
     }
 
     public void releaseShader(Shader shader) {

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

 /**
  * Copyright (C) 2012 J.W.Marsden <jmarsden@plural.cc>
  *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- * 
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 public class QuickMath {
 
     /**
-     * TODO:
-     * Implement this correctly.
+     * TODO: Implement this correctly.
      *
-     * angles that should be hard coded, 0, 30, 45, 90, 120, 180, 240, 360 (360 should reduce to 0 anyway)
+     * angles that should be hard coded, 0, 30, 45, 90, 120, 180, 240, 360 (360
+     * should reduce to 0 anyway)
      */
-
     float[] quickSin = null;
     float[] quickCos = null;
     float[] quickTan = null;
 
     static {
         PI = (float) Math.PI;
-        TWO_PI = (float) (2F*Math.PI);
+        TWO_PI = (float) (2F * Math.PI);
         E = (float) Math.E;
         DEFAULT_QUICK_TRIG_SIZE = 360;
     }
         quickSin = new float[DEFAULT_QUICK_TRIG_SIZE];
         quickCos = new float[DEFAULT_QUICK_TRIG_SIZE];
         quickTan = new float[DEFAULT_QUICK_TRIG_SIZE];
-        double chunk = 2D*Math.PI/DEFAULT_QUICK_TRIG_SIZE;
+        double chunk = 2D * Math.PI / DEFAULT_QUICK_TRIG_SIZE;
         double chunkStep;
-        for(int i=0;i<DEFAULT_QUICK_TRIG_SIZE;i++) {
+        for (int i = 0; i < DEFAULT_QUICK_TRIG_SIZE; i++) {
             chunkStep = chunk * (double) i;
             quickSin[i] = (float) Math.sin(chunkStep);
             quickCos[i] = (float) Math.cos(chunkStep);
         return random;
     }
 
-    public static double random() {
+    public static float random() {
+        return getInstance().mtf.nextFloat();
+    }
+
+    public static int randomInt() {
+        return getInstance().mtf.nextInt();
+    }
+
+    public static double randomDouble() {
         return getInstance().mtf.nextDouble();
     }
 
         }
         return r;
     }
-    
-	public static float toDegrees(float rotation) {
-		return (float) Math.toDegrees(rotation);
-	}
 
-	public static float toRadians(float rotation) {
-		return (float) Math.toRadians(rotation);
-	}
+    public static float toDegrees(float rotation) {
+        return (float) Math.toDegrees(rotation);
+    }
 
-	
-	public static boolean isPerfectSquare(int n) {
-		int t = (int) Math.floor( Math.sqrt((double) n) + 0.5);
-        return t*t == n;
-	}
+    public static float toRadians(float rotation) {
+        return (float) Math.toRadians(rotation);
+    }
+
+    public static boolean isPerfectSquare(int n) {
+        int t = (int) Math.floor(Math.sqrt((double) n) + 0.5);
+        return t * t == n;
+    }
 }