setOverCache(float). When the
view reaches the edge of the cached tiles, the cache is rebuilt at the new view position.
This class may have poor performance when tiles are often changed dynamically, since the cache must be rebuilt after each change.
| Modifier and Type | Field and Description |
|---|---|
| protected boolean | |
| protected final Rectangle | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected boolean | |
| protected int | |
| protected Rectangle | |
| protected final TiledMap | |
| protected float | |
| protected float | |
| protected static final int | |
| protected float | |
| protected final SpriteCache | |
| private static final float | |
| protected float | |
| protected final float[] | |
| protected final Rectangle |
| Access | Constructor and Description |
|---|---|
| public | OrthoCachedTiledMapRenderer(TiledMap map)
Creates a renderer with a unit scale of 1 and cache size of 2000. |
| public | OrthoCachedTiledMapRenderer(TiledMap map, float unitScale)
Creates a renderer with a cache size of 2000. |
| public | OrthoCachedTiledMapRenderer(TiledMap map, float unitScale, int
The maximum number of tiles that can be cached. cacheSize)
|
| Modifier and Type | Method and Description |
|---|---|
| public void | dispose()
Implements com. Releases all resources of this object. |
| public SpriteCache | |
| public void | |
| public boolean | |
| public void | |
| public void | render(int[] layers)
Implements com. Renders the given layers of a map. |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | |
| public void | setMaxTileSize(float maxPixelWidth, float maxPixelHeight)
Expands the view size in each direction, ensuring that tiles of this size or smaller are never culled from the visible portion of the view. |
| public void | |
| public void | setView(OrthographicCamera camera)
Implements com. Sets the projection matrix and viewbounds from the given camera. |
| public void | setView(Matrix4 projection, float x, float y, float width, float height)
Implements com. Sets the projection matrix for rendering, as well as the bounds of the map which should be rendered. |
| blending | back to summary |
|---|---|
| protected boolean blending | |
| cacheBounds | back to summary |
|---|---|
| protected final Rectangle cacheBounds | |
| cached | back to summary |
|---|---|
| protected boolean cached | |
| canCacheMoreE | back to summary |
|---|---|
| protected boolean canCacheMoreE | |
| canCacheMoreN | back to summary |
|---|---|
| protected boolean canCacheMoreN | |
| canCacheMoreS | back to summary |
|---|---|
| protected boolean canCacheMoreS | |
| canCacheMoreW | back to summary |
|---|---|
| protected boolean canCacheMoreW | |
| count | back to summary |
|---|---|
| protected int count | |
| imageBounds | back to summary |
|---|---|
| protected Rectangle imageBounds | |
| map | back to summary |
|---|---|
| protected final TiledMap map | |
| maxTileHeight | back to summary |
|---|---|
| protected float maxTileHeight | |
| maxTileWidth | back to summary |
|---|---|
| protected float maxTileWidth | |
| NUM_VERTICES | back to summary |
|---|---|
| protected static final int NUM_VERTICES | |
| overCache | back to summary |
|---|---|
| protected float overCache | |
| spriteCache | back to summary |
|---|---|
| protected final SpriteCache spriteCache | |
| tolerance | back to summary |
|---|---|
| private static final float tolerance | |
| unitScale | back to summary |
|---|---|
| protected float unitScale | |
| vertices | back to summary |
|---|---|
| protected final float[] vertices | |
| viewBounds | back to summary |
|---|---|
| protected final Rectangle viewBounds | |
| OrthoCachedTiledMapRenderer | back to summary |
|---|---|
| public OrthoCachedTiledMapRenderer(TiledMap map) Creates a renderer with a unit scale of 1 and cache size of 2000. | |
| OrthoCachedTiledMapRenderer | back to summary |
|---|---|
| public OrthoCachedTiledMapRenderer(TiledMap map, float unitScale) Creates a renderer with a cache size of 2000. | |
| OrthoCachedTiledMapRenderer | back to summary |
|---|---|
public OrthoCachedTiledMapRenderer(TiledMap map, float unitScale, int cacheSize)
| |
| dispose | back to summary |
|---|---|
| public void dispose() Implements com. Doc from com. Releases all resources of this object.
| |
| getSpriteCache | back to summary |
|---|---|
| public SpriteCache getSpriteCache() | |
| invalidateCache | back to summary |
|---|---|
| public void invalidateCache() Causes the cache to be rebuilt the next time it is rendered. | |
| isCached | back to summary |
|---|---|
| public boolean isCached() Returns true if tiles are currently cached. | |
| render | back to summary |
|---|---|
| public void render() Implements com. Doc from com. Renders all the layers of a map.
| |
| render | back to summary |
|---|---|
| public void render(int[] layers) Implements com. Doc from com. Renders the given layers of a map.
| |
| renderImageLayer | back to summary |
|---|---|
| public void renderImageLayer(TiledMapImageLayer layer) Implements com.
| |
| renderObject | back to summary |
|---|---|
| public void renderObject(MapObject object) Implements com.
| |
| renderObjects | back to summary |
|---|---|
| public void renderObjects(MapLayer layer) Implements com.
| |
| renderTileLayer | back to summary |
|---|---|
| public void renderTileLayer(TiledMapTileLayer layer) Implements com.
| |
| setBlending | back to summary |
|---|---|
| public void setBlending(boolean blending) | |
| setMaxTileSize | back to summary |
|---|---|
| public void setMaxTileSize(float maxPixelWidth, float maxPixelHeight) Expands the view size in each direction, ensuring that tiles of this size or smaller are never culled from the visible portion of the view. Default is 0,0.
The amount of tiles cached is computed using
If the view size and | |
| setOverCache | back to summary |
|---|---|
| public void setOverCache(float overCache) Sets the percentage of the view that is cached in each direction. Default is 0.5. Eg, 0.75 will cache 75% of the width of the view to the left and right of the view, and 75% of the height of the view above and below the view. | |
| setView | back to summary |
|---|---|
| public void setView(OrthographicCamera camera) Implements com. Doc from com. Sets the projection matrix and viewbounds from the given camera. If the camera changes, you have to call this method again. The viewbounds are taken from the camera's position and viewport size as well as the scale. This method will only work if the camera's direction vector is (0,0,-1) and its up vector is (0, 1, 0), which are the defaults.
| |
| setView | back to summary |
|---|---|
| public void setView(Matrix4 projection, float x, float y, float width, float height) Implements com. Doc from com. Sets the projection matrix for rendering, as well as the bounds of the map which should be rendered. Make sure that the frustum spanned by the projection matrix coincides with the viewbounds.
| |