Ver código fonte

NOW SUPPORT TEXTURE SIZES OTHER THAN SQUARE !

____tbvns____ 6 meses atrás
pai
commit
97a6dbb474

+ 7 - 4
PowerGDEditor/src/main/java/xyz/tbvns/GeometryDash/LevelUtils.java

@@ -1,5 +1,6 @@
 package xyz.tbvns.GeometryDash;
 
+import com.badlogic.gdx.graphics.Texture;
 import com.badlogic.gdx.graphics.VertexAttributes;
 import com.badlogic.gdx.graphics.g3d.Model;
 import com.badlogic.gdx.graphics.g3d.ModelCache;
@@ -27,13 +28,15 @@ public class LevelUtils {
         modelCache.begin();
         for (Object object : Object.fromLevel(level)) {
             try {
+                Texture texture = TexturesManager.idTextureMap.get(Integer.parseInt(object.getProperties().get("1")));
                 System.out.println(object.getProperties());
+                float factor = 120f;
                 Model model = new ModelBuilder().createRect(
                         0f, 0f, 0f,
-                        1f, 0f, 0f,
-                        1f, 1f, 0f,
-                        0, 1, 0f,
-                        0, 0, 0,
+                        texture.getWidth() / factor, 0f, 0f,
+                        texture.getWidth() / factor, texture.getHeight() / factor, 0f,
+                        0f, texture.getHeight() / factor, 0f,
+                        0f, 0f, 0f,
                         TexturesManager.idMaterialMap.get(Integer.parseInt(object.getProperties().get("1"))),
                         VertexAttributes.Usage.Position | VertexAttributes.Usage.TextureCoordinates
                 );