Ver Fonte

Why is perspective projection so hard ?

tbvns há 5 meses atrás
pai
commit
230bec3513

+ 3 - 3
PowerGDEditor/src/main/java/xyz/tbvns/GeometryDash/Render.java

@@ -39,7 +39,7 @@ public class Render {
 
             Vector3f cameraTranslation = new Vector3f((float) (currentPercent * LevelInfo.getLevel().getMaxPos()), 0, 5); //TODO: make that move with the player
             camera.translation(cameraTranslation); //TODO: make that follow a new camera path editor
-            builder.add(1, 1, X_PROPERTY_ID, projectPoint(camera, new Vector4f(cameraTranslation.x, cameraTranslation.y, cameraTranslation.z - 1, 1)).x, Y_PROPERTY_ID,projectPoint(camera, new Vector4f(cameraTranslation.x, cameraTranslation.y, cameraTranslation.z - 1, 1)).y);
+            builder.add(1, 1, X_PROPERTY_ID, projectPoint(camera, new Vector4f(cameraTranslation.x, cameraTranslation.y, cameraTranslation.z - 1, 1)).x * 16 * 30, Y_PROPERTY_ID,projectPoint(camera, new Vector4f(cameraTranslation.x, cameraTranslation.y, cameraTranslation.z - 1, 1)).y * 9 * 30);
 
             System.out.println(currentPercent * 100);
 
@@ -54,9 +54,9 @@ public class Render {
                         for (Face face : gdModel.getFaces()) {
                             for (Vector4f point : face.points) {
                                 Vector3 translation = instance.getInstance().transform.getTranslation(Vector3.Zero);
-                                point = point.add(translation.x * 30, translation.y * 30, translation.z * 30, 0);
+                                point = point.add(translation.x, translation.y, translation.z, 0);
                                 Vector4f projected = projectPoint(camera, point);
-                                builder.add(1, POINT_OBJECT_ID, X_PROPERTY_ID, projected.x, Y_PROPERTY_ID, projected.y);
+                                builder.add(1, POINT_OBJECT_ID, X_PROPERTY_ID, projected.x * 16 * 30, Y_PROPERTY_ID, projected.y * 9 * 30);
                             }
                         }
                     } else {