OSDN Git Service

Remove OrthogonalTiledMapRenderer2.
authorJustin Shapcott <support@mobidevelop.com>
Sun, 19 May 2013 14:26:08 +0000 (07:26 -0700)
committerJustin Shapcott <support@mobidevelop.com>
Sun, 19 May 2013 14:26:08 +0000 (07:26 -0700)
May add it back again after it is worked on, but it isn't currently in a
usable state.

gdx/src/com/badlogic/gdx/maps/tiled/renderers/OrthogonalTiledMapRenderer2.java [deleted file]

diff --git a/gdx/src/com/badlogic/gdx/maps/tiled/renderers/OrthogonalTiledMapRenderer2.java b/gdx/src/com/badlogic/gdx/maps/tiled/renderers/OrthogonalTiledMapRenderer2.java
deleted file mode 100755 (executable)
index 8ba4f99..0000000
+++ /dev/null
@@ -1,290 +0,0 @@
-package com.badlogic.gdx.maps.tiled.renderers;\r
-\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.C1;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.C2;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.C3;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.C4;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.U1;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.U2;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.U3;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.U4;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.V1;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.V2;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.V3;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.V4;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.X1;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.X2;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.X3;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.X4;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.Y1;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.Y2;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.Y3;\r
-import static com.badlogic.gdx.graphics.g2d.SpriteBatch.Y4;\r
-\r
-import com.badlogic.gdx.Gdx;\r
-import com.badlogic.gdx.graphics.Color;\r
-import com.badlogic.gdx.graphics.GL10;\r
-import com.badlogic.gdx.graphics.GL11;\r
-import com.badlogic.gdx.graphics.OrthographicCamera;\r
-import com.badlogic.gdx.graphics.g2d.SpriteCache;\r
-import com.badlogic.gdx.graphics.g2d.TextureRegion;\r
-import com.badlogic.gdx.maps.MapLayer;\r
-import com.badlogic.gdx.maps.MapObject;\r
-import com.badlogic.gdx.maps.tiled.TiledMap;\r
-import com.badlogic.gdx.maps.tiled.TiledMapRenderer;\r
-import com.badlogic.gdx.maps.tiled.TiledMapTile;\r
-import com.badlogic.gdx.maps.tiled.TiledMapTileLayer;\r
-import com.badlogic.gdx.maps.tiled.TiledMapTileLayer.Cell;\r
-import com.badlogic.gdx.math.Matrix4;\r
-import com.badlogic.gdx.math.Rectangle;\r
-import com.badlogic.gdx.utils.Disposable;\r
-\r
-public class OrthogonalTiledMapRenderer2 implements TiledMapRenderer, Disposable {\r
-\r
-       protected TiledMap map;\r
-\r
-       protected float unitScale;\r
-       \r
-       protected SpriteCache spriteCache;\r
-       \r
-       protected Rectangle viewBounds; \r
-       \r
-       private float[] vertices = new float[20];\r
-       \r
-       public boolean recache;\r
-       \r
-       public OrthogonalTiledMapRenderer2(TiledMap map) {\r
-               this.map = map;\r
-               this.unitScale = 1;\r
-               this.spriteCache = new SpriteCache(4000, true);\r
-               this.viewBounds = new Rectangle();\r
-       }\r
-       \r
-       public OrthogonalTiledMapRenderer2(TiledMap map, float unitScale) {\r
-               this.map = map;\r
-               this.unitScale = unitScale;\r
-               this.viewBounds = new Rectangle();\r
-               this.spriteCache = new SpriteCache(4000, true);\r
-       }\r
-       \r
-       @Override\r
-       public void setView(OrthographicCamera camera) {\r
-               spriteCache.setProjectionMatrix(camera.combined);\r
-               float width = camera.viewportWidth * camera.zoom;\r
-               float height = camera.viewportHeight * camera.zoom;\r
-               viewBounds.set(camera.position.x - width / 2, camera.position.y - height / 2, width, height);\r
-               recache = true;\r
-       }\r
-       \r
-       @Override\r
-       public void setView (Matrix4 projection, float x, float y, float width, float height) {\r
-               spriteCache.setProjectionMatrix(projection);\r
-               viewBounds.set(x, y, width, height);\r
-               recache = true;\r
-       }\r
-\r
-       public void begin () {\r
-               if (recache) {\r
-                       cached = false;\r
-                       recache = false;\r
-                       spriteCache.clear();\r
-               }\r
-               if (!cached) {\r
-                       spriteCache.beginCache();       \r
-               } else {\r
-                       Gdx.gl.glEnable(GL10.GL_BLEND);\r
-                       Gdx.gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);\r
-                       spriteCache.begin();\r
-               }\r
-               \r
-       }\r
-\r
-       public void end () {\r
-               if (!cached) {\r
-                       spriteCache.endCache();\r
-                       cached = true;\r
-                       Gdx.gl.glEnable(GL10.GL_BLEND);\r
-                       Gdx.gl.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);\r
-                       spriteCache.begin();\r
-                       spriteCache.draw(0);\r
-                       spriteCache.end();\r
-                       Gdx.gl.glDisable(GL10.GL_BLEND);\r
-               } else {\r
-                       spriteCache.end();\r
-                       Gdx.gl.glDisable(GL10.GL_BLEND);\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public void render () {\r
-               begin();\r
-               if (cached) {\r
-                       spriteCache.draw(0);\r
-               } else {\r
-                       for (MapLayer layer : map.getLayers()) {\r
-                               if (layer.isVisible()) {\r
-                                       if (layer instanceof TiledMapTileLayer) {\r
-                                               renderTileLayer((TiledMapTileLayer) layer);\r
-                                       } else {\r
-                                               for (MapObject object : layer.getObjects()) {\r
-                                                       renderObject(object);\r
-                                               }\r
-                                       }                                       \r
-                               }                               \r
-                       }                               \r
-               }\r
-               end();\r
-       }\r
-       \r
-       @Override\r
-       public void render (int[] layers) {\r
-               // FIXME not implemented\r
-               throw new UnsupportedOperationException("Not implemented");\r
-       }\r
-\r
-       @Override\r
-       public void renderObject (MapObject object) {\r
-               // TODO Auto-generated method stub\r
-               \r
-       }\r
-\r
-       boolean cached = false;\r
-       int count = 0;\r
-       @Override\r
-       public void renderTileLayer (TiledMapTileLayer layer) {\r
-               final float color = Color.toFloatBits(1, 1, 1, layer.getOpacity());\r
-       \r
-               final int layerWidth = layer.getWidth();\r
-               final int layerHeight = layer.getHeight();\r
-               \r
-               final float layerTileWidth = layer.getTileWidth() * unitScale;\r
-               final float layerTileHeight = layer.getTileHeight() * unitScale;\r
-               \r
-               final int col1 = Math.max(0, (int) (viewBounds.x / layerTileWidth));\r
-               final int col2 = Math.min(layerWidth, (int) ((viewBounds.x + viewBounds.width + layerTileWidth) / layerTileWidth));\r
-\r
-               final int row1 = Math.max(0, (int) (viewBounds.y / layerTileHeight));\r
-               final int row2 = Math.min(layerHeight, (int) ((viewBounds.y + viewBounds.height + layerTileHeight) / layerTileHeight));                         \r
-               \r
-               for (int row = row1; row < row2; row++) {\r
-                       for (int col = col1; col < col2; col++) {\r
-                               final TiledMapTileLayer.Cell cell = layer.getCell(col, row);\r
-                               if(cell == null) continue;\r
-                               final TiledMapTile tile = cell.getTile();\r
-                               if (tile != null) {\r
-                                       count++;\r
-                                       final boolean flipX = cell.getFlipHorizontally();\r
-                                       final boolean flipY = cell.getFlipVertically();\r
-                                       final int rotations = cell.getRotation();\r
-                                       \r
-                                       TextureRegion region = tile.getTextureRegion();\r
-                                       \r
-                                       float x1 = col * layerTileWidth;\r
-                                       float y1 = row * layerTileHeight;\r
-                                       float x2 = x1 + region.getRegionWidth() * unitScale;\r
-                                       float y2 = y1 + region.getRegionHeight() * unitScale;\r
-                                       \r
-                                       float u1 = region.getU();\r
-                                       float v1 = region.getV2();\r
-                                       float u2 = region.getU2();\r
-                                       float v2 = region.getV();\r
-                                       \r
-                                       vertices[X1] = x1;\r
-                                       vertices[Y1] = y1;\r
-                                       vertices[C1] = color;\r
-                                       vertices[U1] = u1;\r
-                                       vertices[V1] = v1;\r
-                                       \r
-                                       vertices[X2] = x1;\r
-                                       vertices[Y2] = y2;\r
-                                       vertices[C2] = color;\r
-                                       vertices[U2] = u1;\r
-                                       vertices[V2] = v2;\r
-                                       \r
-                                       vertices[X3] = x2;\r
-                                       vertices[Y3] = y2;\r
-                                       vertices[C3] = color;\r
-                                       vertices[U3] = u2;\r
-                                       vertices[V3] = v2;\r
-                                       \r
-                                       vertices[X4] = x2;\r
-                                       vertices[Y4] = y1;\r
-                                       vertices[C4] = color;\r
-                                       vertices[U4] = u2;\r
-                                       vertices[V4] = v1;                                                      \r
-                                       \r
-                                       if (flipX) {\r
-                                               float temp = vertices[U1];\r
-                                               vertices[U1] = vertices[U3];\r
-                                               vertices[U3] = temp;\r
-                                               temp = vertices[U2];\r
-                                               vertices[U2] = vertices[U4];\r
-                                               vertices[U4] = temp;\r
-                                       }\r
-                                       if (flipY) {\r
-                                               float temp = vertices[V1];\r
-                                               vertices[V1] = vertices[V3];\r
-                                               vertices[V3] = temp;\r
-                                               temp = vertices[V2];\r
-                                               vertices[V2] = vertices[V4];\r
-                                               vertices[V4] = temp;\r
-                                       }\r
-                                       if (rotations != 0) {\r
-                                               switch (rotations) {\r
-                                                       case Cell.ROTATE_90: {\r
-                                                               float tempV = vertices[V1];\r
-                                                               vertices[V1] = vertices[V2];\r
-                                                               vertices[V2] = vertices[V3];\r
-                                                               vertices[V3] = vertices[V4];\r
-                                                               vertices[V4] = tempV;\r
-\r
-                                                               float tempU = vertices[U1];\r
-                                                               vertices[U1] = vertices[U2];\r
-                                                               vertices[U2] = vertices[U3];\r
-                                                               vertices[U3] = vertices[U4];\r
-                                                               vertices[U4] = tempU;                                                                   \r
-                                                               break;\r
-                                                       }\r
-                                                       case Cell.ROTATE_180: {\r
-                                                               float tempU = vertices[U1];\r
-                                                               vertices[U1] = vertices[U3];\r
-                                                               vertices[U3] = tempU;\r
-                                                               tempU = vertices[U2];\r
-                                                               vertices[U2] = vertices[U4];\r
-                                                               vertices[U4] = tempU;                                                                   \r
-                                                               float tempV = vertices[V1];\r
-                                                               vertices[V1] = vertices[V3];\r
-                                                               vertices[V3] = tempV;\r
-                                                               tempV = vertices[V2];\r
-                                                               vertices[V2] = vertices[V4];\r
-                                                               vertices[V4] = tempV;\r
-                                                               break;\r
-                                                       }\r
-                                                       case Cell.ROTATE_270: {\r
-                                                               float tempV = vertices[V1];\r
-                                                               vertices[V1] = vertices[V4];\r
-                                                               vertices[V4] = vertices[V3];\r
-                                                               vertices[V3] = vertices[V2];\r
-                                                               vertices[V2] = tempV;\r
-\r
-                                                               float tempU = vertices[U1];\r
-                                                               vertices[U1] = vertices[U4];\r
-                                                               vertices[U4] = vertices[U3];\r
-                                                               vertices[U3] = vertices[U2];\r
-                                                               vertices[U2] = tempU;                                                                   \r
-                                                               break;\r
-                                                       }\r
-                                               }                                                               \r
-                                       }\r
-                                       spriteCache.add(region.getTexture(), vertices, 0, 20);\r
-                               }\r
-                       }\r
-               }\r
-       }\r
-\r
-       @Override\r
-       public void dispose () {\r
-               spriteCache.dispose();\r
-       }\r
-       \r
-}
\ No newline at end of file