Commits

John Marsden  committed fbcd88f

Updates

  • Participants
  • Parent commits 9c316c4
  • Branches develop

Comments (0)

Files changed (4)

File src/main/java/cc/plural/test/FullPipelineECS3MatrixProjectionShader130.java

 
         // Upload matrices to the uniform variables
         shader.enable();
-        shader.setUniform(projectionMatrixLocation, ecsProjectionMatrix);
-        shader.setUniform(viewMatrixLocation, ecsViewMatrix);
-        shader.setUniform(modelMatrixLocation, ecsModelMatrix);
+        shader.loadUniform(projectionMatrixLocation, ecsProjectionMatrix);
+        shader.loadUniform(viewMatrixLocation, ecsViewMatrix);
+        shader.loadUniform(modelMatrixLocation, ecsModelMatrix);
         shader.disable();
 
         this.exitOnGLError("logicCycle");

File src/main/java/cc/plural/test/ecs/TestECSBasic.java

 import cc.plural.ecs.renderer.Renderer;
 import cc.plural.ecs.runtime.ApplicationInterface;
 import cc.plural.graphics.Vertex;
+import cc.plural.math.Matrix3f;
 import cc.plural.math.QuickMath;
 import cc.plural.math.Transformation;
 import cc.plural.utils.Color;
     public class RotateGameObject extends Component {
 
         float rotation;
+        
+        Matrix3f matrix3f;
 
+        public RotateGameObject() {
+            rotation = 0;
+            this.matrix3f = Matrix3f.identity();
+        }
+        
         @Override
         public void init() {
             super.init();
         public void update(float delta) {
             super.update(delta);
             this.rotation = rotation + (delta * 0.001f);
-            gameObject.spatial.setRotation(Transformation.createZRotationMatrix(QuickMath.PI * rotation));
+            gameObject.spatial.setRotation(Transformation.storeZRotationMatrix(matrix3f, QuickMath.PI * rotation));
         }
     }
 }

File src/main/java/cc/plural/test/ecs/TestECSManyBasic.java

 import cc.plural.ecs.engine.GameObject;
 import cc.plural.ecs.provider.LWJGLApplication;
 import cc.plural.ecs.provider.LWJGLApplicationConfiguration;
-import cc.plural.ecs.renderer.Mesh;
 import cc.plural.ecs.renderer.Platform;
 import cc.plural.ecs.renderer.Renderer;
-import cc.plural.ecs.renderer.Shader;
 import cc.plural.ecs.renderer.Texture;
 import cc.plural.ecs.runtime.ApplicationInterface;
 import cc.plural.graphics.Vertex;
+import cc.plural.math.Matrix3f;
 import cc.plural.math.QuickMath;
 import cc.plural.math.Transformation;
 import cc.plural.utils.Color;
 
         engine = new Engine();
 
-        for (int i = 0; i < 100; i++) {
+        for (int i = 0; i < 200; i++) {
             v0.setRGB(QuickMath.random(), QuickMath.random(), QuickMath.random());
             v1.setRGB(QuickMath.random(), QuickMath.random(), QuickMath.random());
             v2.setRGB(QuickMath.random(), QuickMath.random(), QuickMath.random());
 
         float rotation;
         float speed;
+        Matrix3f matrix3f;
 
         public RotateGameObject(float rotation, float speed) {
             this.rotation = rotation;
             this.speed = speed;
+            this.matrix3f = Matrix3f.identity();
         }
 
         @Override
             super.update(delta);
             //System.out.println("Delta:" + delta);
             this.rotation = rotation + (delta * speed);
-            gameObject.spatial.setRotation(Transformation.createZRotationMatrix(QuickMath.PI * rotation));
+            gameObject.spatial.setRotation(Transformation.storeZRotationMatrix(matrix3f, QuickMath.PI * rotation));
         }
     }
 }

File src/main/java/cc/plural/test/provider/TestRenderer.java

                         firstRenderCycle = false;
                     }
 
-                    shader.setUniform(shader.getUniformLocation("projectionMatrix"), projectionMatrix);
-                    shader.setUniform(shader.getUniformLocation("viewMatrix"), viewMatrix);
-                    shader.setUniform(shader.getUniformLocation("modelMatrix"), modelMatrix);
+                    shader.loadUniform(shader.getUniformLocation("projectionMatrix"), projectionMatrix);
+                    shader.loadUniform(shader.getUniformLocation("viewMatrix"), viewMatrix);
+                    shader.loadUniform(shader.getUniformLocation("modelMatrix"), modelMatrix);
 
                     mesh.enable(shader);
                     GL11.glDrawElements(GL11.GL_TRIANGLES, mesh.getIndicesCount(), GL11.GL_UNSIGNED_SHORT, 0);