com.threerings.tudey.data
Class TudeySceneModel

java.lang.Object
  extended by com.threerings.io.SimpleStreamableObject
      extended by com.threerings.whirled.data.SceneModel
          extended by com.threerings.tudey.data.TudeySceneModel
All Implemented Interfaces:
Exportable, Streamable, ActorAdvancer.Environment, Cloneable

public class TudeySceneModel
extends SceneModel
implements ActorAdvancer.Environment, Exportable

Contains a representation of a Tudey scene.


Nested Class Summary
static class TudeySceneModel.AreaEntry
          An area entry.
static class TudeySceneModel.Entry
          An entry in the scene.
protected static class TudeySceneModel.FloorPlaceableFilter
          Used to select sprites according to their floor flags.
static class TudeySceneModel.GlobalEntry
          A global entry.
static class TudeySceneModel.IdEntry
          An entry identified by an integer id.
static interface TudeySceneModel.LayerObserver
          An extended Observer interface for observers interested in layers.
static interface TudeySceneModel.Observer
          An interface for objects interested in changes to the scene model.
static class TudeySceneModel.Paint
          Contains information on a painted location.
protected static class TudeySceneModel.PaintConfigMapping
          Represents a type of paint identified by an integer id.
static class TudeySceneModel.PathEntry
          A path entry.
static class TudeySceneModel.PlaceableElement
          A placeable shape element.
static class TudeySceneModel.PlaceableEntry
          A placeable entry.
protected static class TudeySceneModel.TileConfigMapping
          Represents a type of tile identified by an integer id.
static class TudeySceneModel.TileEntry
          A tile entry.
static class TudeySceneModel.Vertex
          Represents a single vertex in a path or area.
 
Nested classes/interfaces inherited from interface com.threerings.io.Streamable
Streamable.Closure
 
Field Summary
protected  ConfigManager _cfgmgr
          The scene configuration manager.
protected  CoordIntMap _collisionFlags
          Collision flags for each location.
protected  SoftReference<byte[]> _data
          The cached exported representation of the scene model.
protected  boolean _dirty
          Flags the scene model as having changed since the dirty bit was last cleared.
protected  HashMap<Object,SpaceElement> _elements
          Maps entry keys to space elements.
protected  HashMap<Object,TudeySceneModel.Entry> _entries
          Scene entries mapped by key.
protected  boolean _exportLayers
          Do we want to export layers when we serialize?
protected  TudeySceneModel.FloorPlaceableFilter _floorPlaceableFilter
          Used to fine the floor.
protected  ArrayList<SpaceElement> _intersecting
          (Re)used to store intersecting elements.
protected  int _lastEntryId
          The last entry id assigned.
protected  Map<Integer,Integer> _layerMap
          Maps entry keys to their layer.
protected  List<String> _layerNamesView
          An unmodifiable list that represents the names of each layer.
protected  List<String> _layers
          The names of each layer.
protected  String _notes
          The notes regarding this scene.
protected  ObserverList<TudeySceneModel.Observer> _observers
          The scene model observers.
protected  CoordIntMap _paint
          Encoded paint data.
protected  Map<ConfigReference<? extends PaintableConfig>,Integer> _paintConfigIds
          Paint config ids mapped by reference.
protected  ArrayList<TudeySceneModel.PaintConfigMapping> _paintConfigs
          Paint config references by id.
protected  Vector2f _penetration
          Stores penetration vector during queries.
protected  TudeySceneConfig _placeConfig
          The place configuration.
protected  Point _point
          Used to find the floor.
protected  Polygon _quad
          Used to store tile shapes for intersecting testing.
protected  Rect _rect
          Bounds object to reuse.
protected  WeakHashMap<ConfigReference,ConfigReference> _references
          The set of entry references (used to ensure that entries with equal references use the same instance.
protected  Rectangle _region
          Region object to reuse.
protected  HashSpace _space
          The space containing the (non-tile) entry shapes.
protected  Map<String,List<TudeySceneModel.Entry>> _tagged
          Maps tags to lists of tagged entries.
protected  Map<ConfigReference<TileConfig>,Integer> _tileConfigIds
          Tile config ids mapped by reference.
protected  ArrayList<TudeySceneModel.TileConfigMapping> _tileConfigs
          Tile config references by id.
protected  CoordIntMap _tileCoords
          Maps locations to the encoded coordinates of any tiles intersecting them.
protected  CoordIntMap _tiles
          The encoded tiles.
 
Fields inherited from class com.threerings.whirled.data.SceneModel
auxModels, name, sceneId, version
 
Constructor Summary
TudeySceneModel()
          Creates a new, empty scene model.
 
Method Summary
protected  TudeySceneModel.Entry add(TudeySceneModel.Entry entry)
          Performs the actual addition of the specified entry.
protected  void addElement(TudeySceneModel.Entry entry)
          Adds the entry's space element to the hash space and maps it by its tags.
 boolean addEntry(TudeySceneModel.Entry entry)
          Adds an entry to the scene, assigning it a unique id in the process if it is an TudeySceneModel.IdEntry.
 boolean addEntry(TudeySceneModel.Entry entry, boolean assignId)
          Adds an entry to the scene.
 int addLayer(String n)
          Deprecated. 
 int addLayer(String name, int position)
          Add a new layer to the model.
 void addObserver(TudeySceneModel.Observer observer)
          Adds an observer for scene changes.
protected  int addPaintConfig(ConfigReference<? extends PaintableConfig> paintable)
          Adds a reference to the specified paint config and returns the index assigned to the config.
protected  int addTileConfig(ConfigReference<TileConfig> tile)
          Adds a reference to the specified tile config and returns the index assigned to the config.
protected  void canonicalizeReference(TudeySceneModel.Entry entry)
          Ensures that the entry's reference, if non-null, points to one of the references in the _references set (that is, that all entries whose references are equal point to the same reference instance).
 void clearPaint()
          Clears all paint from the scene.
 TudeySceneModel clone()
           
 boolean collides(Actor actor, Shape shape)
          Checks the specified actor for a collision with the environment.
 boolean collides(int mask, Shape shape)
          Checks the specified mask for a collision with the environment.
 boolean containsEntry(Object key)
          Determines whether the scene contains an entry with the supplied key.
protected  void createShadow(TudeySceneModel.TileEntry entry)
          Creates the shadow data for the specified tile and maps it by its tags.
protected  TudeySceneModel.Paint decodePaint(int value)
          Decodes the specified paint value.
protected  TudeySceneModel.TileEntry decodeTileEntry(Coord coord, int value)
          Decodes the specified tile entry.
protected  TudeySceneModel.TileEntry decodeTileEntry(int x, int y, int value)
          Decodes the specified tile entry.
protected  void deleteShadow(TudeySceneModel.TileEntry entry)
          Deletes the shadow data for the supplied tile and removes its tag mappings.
 CoordIntMap getCollisionFlags()
          Returns a reference to the map containing the tile collision flags.
protected static int getConfigIndex(int value)
          Extracts the tile configuration index from the supplied encoded tile.
 ConfigManager getConfigManager()
          Returns a reference to the scene's configuration manager.
 byte[] getData()
          Returns the cached exported binary representation of the model.
 Map<Object,SpaceElement> getElements()
          Returns a reference to the map from entry key to space elements.
protected static int getElevation(int value)
          Extracts the tile elevation from the supplied encoded tile.
 Collection<TudeySceneModel.Entry> getEntries()
          Returns a reference to the collection of entries.
 void getEntries(Shape shape, Collection<TudeySceneModel.Entry> results)
          Retrieves all entries intersecting the supplied shape.
 void getEntries(Shape shape, com.google.common.base.Predicate<? super TudeySceneModel.Entry> pred, Collection<TudeySceneModel.Entry> results)
          Retrieves all entries intersecting the supplied shape and matching the predicate.
 TudeySceneModel.Entry getEntry(Object key)
          Looks up the entry with the supplied key.
 float getFloorZ(float x, float y, float defvalue)
          Returns the z coordinate of the floor at the provided coordinates, or the provided default if no floor is found.
 boolean getIntersection(Ray2D ray, float length, int mask, Vector2f intersection)
          Finds the intersection with the ray.
 int getLayer(Object key)
          Get the layer of the entry with the specified key.
 List<String> getLayers()
          Get the layer names.
 boolean getNearestPoint(Shape shape, int mask, Vector2f origin, Vector2f nearPoint)
          Finds the nearest point to the origin if the shape collides with the environment.
 String getNotes()
          Returns the scene notes.
 TudeySceneModel.Paint getPaint(int x, int y)
          Returns the paint at the specified coordinates, if any.
 boolean getPenetration(Actor actor, Shape shape, Vector2f result)
          Checks whether the actor is colliding with anything and, if it is, populates the provided object with the penetration vector (the minimum translation required to cancel the penetration).
 TudeySceneConfig getPlaceConfig()
          Returns a reference to the model's place config.
 void getPreloads(PreloadableSet preloads)
          Adds the resources to preload for this scene model to the supplied set.
 void getResources(Set<String> paths)
          Adds the resources referenced by this scene model to the supplied set.
 TudeySceneModel getSceneModel()
          Returns a reference to the scene model.
 Space getSpace()
          Returns a reference to the space containing the (non-tile) entry elements.
 List<TudeySceneModel.Entry> getTaggedEntries(String tag)
          Returns the list of all entries bearing the specified tag.
 TudeySceneModel.Entry getTaggedEntry(String tag)
          Returns the first entry bearing the specified tag, or null for none.
 int getTileElevation(int x, int y)
          Returns the tile elevation at the specified coordinates, or Integer.MIN_VALUE if there is no tile there.
 void getTileEntries(Rectangle region, Collection<TudeySceneModel.TileEntry> results)
          Retrieves all of the tile entries intersecting the supplied region.
protected  TudeySceneModel.TileEntry getTileEntry(int pair)
          Retrieves the tile entry identified by the provided encoded coordinate pair.
 TudeySceneModel.TileEntry getTileEntry(int x, int y)
          Returns the tile entry intersecting the specified coordinates, if any.
protected  int getTileValue(int pair)
          Returns the encoded tile value corresponding to the encoded coordinate pair given, logging a warning and returning -1 if no value exists at the coordinates.
 void init(ConfigManager cfgmgr)
          Initializes the model.
 void invalidate()
          Invalidates any cached data in the model, forcing it to be recreated (and sets the dirty flag).
 boolean isDirty()
          Returns the value of the dirty flag.
 boolean isLayerEmpty(int layer)
          Return true if the specified layer not 0 and is empty.
protected  void mapEntry(TudeySceneModel.Entry entry)
          Maps the specified entry according to its tags.
 void readFields(Importer in)
          Custom field read method.
 void readObject(ObjectInputStream in)
          Custom read method for streaming.
protected  TudeySceneModel.Entry remove(Object key)
          Performs the actual removal of the identified entry.
protected  void removeElement(TudeySceneModel.Entry entry)
          Removes the entry's space element from the hash space and removes its tag mappings.
 TudeySceneModel.Entry removeEntry(Object key)
          Removes an entry from the scene.
 void removeLayer(int layer)
          Remove the specified layer, moving anything present to the base layer.
 void removeObserver(TudeySceneModel.Observer observer)
          Removes a scene observer.
protected  void removePaintConfig(int idx)
          Removes a reference for the indexed paint config.
protected  void removeTileConfig(int idx)
          Removes a reference for the indexed tile config.
 void renameLayer(int layer, String name)
          Rename one of the layers.
 void setDirty(boolean dirty)
          Sets the value of the dirty flag.
 void setLayer(Object key, int layer)
          Set the layer of the entry with the specified key.
 void setName(String name)
          Sets the scene's name and invalidates.
 void setNotes(String notes)
          Sets the scene notes.
 TudeySceneModel.Paint setPaint(int x, int y, TudeySceneModel.Paint paint)
          Sets the paint at the specified coordinates.
 void setPlaceConfig(TudeySceneConfig config)
          Sets the place config for the model.
protected  void unmapEntry(TudeySceneModel.Entry entry)
          Unmaps the specified entry according to its tags.
protected  TudeySceneModel.Entry update(TudeySceneModel.Entry nentry)
          Performs the actual update of the specified entry.
 TudeySceneModel.Entry updateEntry(TudeySceneModel.Entry nentry)
          Updates an entry within the scene.
protected  int validateLayer(int layer)
          Validate that a layer value is valid.
 boolean validateReferences(String where, PrintStream out)
          Validates the references in the scene.
 void writeFields(Exporter out)
          Custom field write method.
 void writeObject(ObjectOutputStream out)
          Custom write method for streaming.
 
Methods inherited from class com.threerings.whirled.data.SceneModel
addAuxModel, blankSceneModel, populateBlankSceneModel
 
Methods inherited from class com.threerings.io.SimpleStreamableObject
toString, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

_notes

protected String _notes
The notes regarding this scene.


_placeConfig

protected TudeySceneConfig _placeConfig
The place configuration.


_cfgmgr

protected ConfigManager _cfgmgr
The scene configuration manager.


_tiles

@DeepOmit
protected CoordIntMap _tiles
The encoded tiles.


_tileConfigs

@DeepOmit
protected ArrayList<TudeySceneModel.TileConfigMapping> _tileConfigs
Tile config references by id.


_tileConfigIds

@DeepOmit
protected transient Map<ConfigReference<TileConfig>,Integer> _tileConfigIds
Tile config ids mapped by reference.


_entries

@DeepOmit
protected transient HashMap<Object,TudeySceneModel.Entry> _entries
Scene entries mapped by key.


_paint

@DeepOmit
protected CoordIntMap _paint
Encoded paint data.


_paintConfigs

@DeepOmit
protected ArrayList<TudeySceneModel.PaintConfigMapping> _paintConfigs
Paint config references by id.


_exportLayers

@DeepOmit
protected transient boolean _exportLayers
Do we want to export layers when we serialize?


_layers

@DeepOmit
protected transient List<String> _layers
The names of each layer. Layer n is at index n-1.


_layerNamesView

@DeepOmit
protected transient List<String> _layerNamesView
An unmodifiable list that represents the names of each layer.


_layerMap

@DeepOmit
protected transient Map<Integer,Integer> _layerMap
Maps entry keys to their layer. Entries are on layer 0 by default, as are all tiles.


_paintConfigIds

@DeepOmit
protected transient Map<ConfigReference<? extends PaintableConfig>,Integer> _paintConfigIds
Paint config ids mapped by reference.


_tagged

@DeepOmit
protected transient Map<String,List<TudeySceneModel.Entry>> _tagged
Maps tags to lists of tagged entries.


_lastEntryId

protected transient int _lastEntryId
The last entry id assigned.


_references

@DeepOmit
protected transient WeakHashMap<ConfigReference,ConfigReference> _references
The set of entry references (used to ensure that entries with equal references use the same instance.


_tileCoords

@DeepOmit
protected transient CoordIntMap _tileCoords
Maps locations to the encoded coordinates of any tiles intersecting them.


_collisionFlags

@DeepOmit
protected transient CoordIntMap _collisionFlags
Collision flags for each location.


_space

@DeepOmit
protected transient HashSpace _space
The space containing the (non-tile) entry shapes.


_elements

@DeepOmit
protected transient HashMap<Object,SpaceElement> _elements
Maps entry keys to space elements.


_observers

@DeepOmit
protected transient ObserverList<TudeySceneModel.Observer> _observers
The scene model observers.


_data

@DeepOmit
protected transient SoftReference<byte[]> _data
The cached exported representation of the scene model.


_dirty

@DeepOmit
protected transient boolean _dirty
Flags the scene model as having changed since the dirty bit was last cleared.


_region

@DeepOmit
protected transient Rectangle _region
Region object to reuse.


_rect

@DeepOmit
protected transient Rect _rect
Bounds object to reuse.


_quad

@DeepOmit
protected transient Polygon _quad
Used to store tile shapes for intersecting testing.


_intersecting

@DeepOmit
protected transient ArrayList<SpaceElement> _intersecting
(Re)used to store intersecting elements.


_penetration

@DeepOmit
protected transient Vector2f _penetration
Stores penetration vector during queries.


_point

@DeepOmit
protected transient Point _point
Used to find the floor.


_floorPlaceableFilter

@DeepOmit
protected transient TudeySceneModel.FloorPlaceableFilter _floorPlaceableFilter
Used to fine the floor.

Constructor Detail

TudeySceneModel

public TudeySceneModel()
Creates a new, empty scene model.

Method Detail

init

public void init(ConfigManager cfgmgr)
Initializes the model.


getConfigManager

public ConfigManager getConfigManager()
Returns a reference to the scene's configuration manager.


addObserver

public void addObserver(TudeySceneModel.Observer observer)
Adds an observer for scene changes.


removeObserver

public void removeObserver(TudeySceneModel.Observer observer)
Removes a scene observer.


setName

public void setName(String name)
Sets the scene's name and invalidates.


setNotes

public void setNotes(String notes)
Sets the scene notes.


getNotes

public String getNotes()
Returns the scene notes.


setPlaceConfig

public void setPlaceConfig(TudeySceneConfig config)
Sets the place config for the model.


getPlaceConfig

public TudeySceneConfig getPlaceConfig()
Returns a reference to the model's place config.


getCollisionFlags

public CoordIntMap getCollisionFlags()
Returns a reference to the map containing the tile collision flags.


getSpace

public Space getSpace()
Returns a reference to the space containing the (non-tile) entry elements.


getElements

public Map<Object,SpaceElement> getElements()
Returns a reference to the map from entry key to space elements.


addEntry

public boolean addEntry(TudeySceneModel.Entry entry)
Adds an entry to the scene, assigning it a unique id in the process if it is an TudeySceneModel.IdEntry.

Returns:
true if the entry was successfully added, false if there was already an entry with the same key (in which case a warning will be logged).

addEntry

public boolean addEntry(TudeySceneModel.Entry entry,
                        boolean assignId)
Adds an entry to the scene.

Parameters:
assignId - if true and the entry is an TudeySceneModel.IdEntry, assign a unique id to the entry.
Returns:
true if the entry was successfully added, false if there was already an entry with the same id (in which case a warning will be logged).

updateEntry

public TudeySceneModel.Entry updateEntry(TudeySceneModel.Entry nentry)
Updates an entry within the scene.

Returns:
a reference to the entry that was replaced, or null for none (in which case a warning will be logged).

removeEntry

public TudeySceneModel.Entry removeEntry(Object key)
Removes an entry from the scene.

Returns:
a reference to the entry that was removed, or null for none (in which case a warning will be logged).

containsEntry

public boolean containsEntry(Object key)
Determines whether the scene contains an entry with the supplied key.


getEntry

public TudeySceneModel.Entry getEntry(Object key)
Looks up the entry with the supplied key.

Returns:
a reference to the identified entry, or null if not found.

getTaggedEntry

public TudeySceneModel.Entry getTaggedEntry(String tag)
Returns the first entry bearing the specified tag, or null for none.


getTaggedEntries

public List<TudeySceneModel.Entry> getTaggedEntries(String tag)
Returns the list of all entries bearing the specified tag.


getEntries

public Collection<TudeySceneModel.Entry> getEntries()
Returns a reference to the collection of entries.


getEntries

public void getEntries(Shape shape,
                       Collection<TudeySceneModel.Entry> results)
Retrieves all entries intersecting the supplied shape.


getEntries

public void getEntries(Shape shape,
                       com.google.common.base.Predicate<? super TudeySceneModel.Entry> pred,
                       Collection<TudeySceneModel.Entry> results)
Retrieves all entries intersecting the supplied shape and matching the predicate.


getTileEntries

public void getTileEntries(Rectangle region,
                           Collection<TudeySceneModel.TileEntry> results)
Retrieves all of the tile entries intersecting the supplied region.


getTileEntry

public TudeySceneModel.TileEntry getTileEntry(int x,
                                              int y)
Returns the tile entry intersecting the specified coordinates, if any.


getTileElevation

public int getTileElevation(int x,
                            int y)
Returns the tile elevation at the specified coordinates, or Integer.MIN_VALUE if there is no tile there.


getFloorZ

public float getFloorZ(float x,
                       float y,
                       float defvalue)
Returns the z coordinate of the floor at the provided coordinates, or the provided default if no floor is found.

Parameters:
mask - the floor mask to use for the query.

addLayer

public int addLayer(String name,
                    int position)
Add a new layer to the model.


addLayer

@Deprecated
public int addLayer(String n)
Deprecated. 


renameLayer

public void renameLayer(int layer,
                        String name)
Rename one of the layers.


getLayers

public List<String> getLayers()
Get the layer names. Layer 0, always present, is named ""


isLayerEmpty

public boolean isLayerEmpty(int layer)
Return true if the specified layer not 0 and is empty.


removeLayer

public void removeLayer(int layer)
Remove the specified layer, moving anything present to the base layer.


getLayer

public int getLayer(Object key)
Get the layer of the entry with the specified key.


setLayer

public void setLayer(Object key,
                     int layer)
Set the layer of the entry with the specified key.


setPaint

public TudeySceneModel.Paint setPaint(int x,
                                      int y,
                                      TudeySceneModel.Paint paint)
Sets the paint at the specified coordinates.

Returns:
the previous paint at the coordinates, if any.

getPaint

public TudeySceneModel.Paint getPaint(int x,
                                      int y)
Returns the paint at the specified coordinates, if any.


clearPaint

public void clearPaint()
Clears all paint from the scene.


getPreloads

public void getPreloads(PreloadableSet preloads)
Adds the resources to preload for this scene model to the supplied set.


getResources

public void getResources(Set<String> paths)
Adds the resources referenced by this scene model to the supplied set.


validateReferences

public boolean validateReferences(String where,
                                  PrintStream out)
Validates the references in the scene.


writeFields

public void writeFields(Exporter out)
                 throws IOException
Custom field write method.

Throws:
IOException

readFields

public void readFields(Importer in)
                throws IOException
Custom field read method.

Throws:
IOException

writeObject

public void writeObject(ObjectOutputStream out)
                 throws IOException
Custom write method for streaming.

Throws:
IOException

readObject

public void readObject(ObjectInputStream in)
                throws IOException
Custom read method for streaming.

Throws:
IOException

getData

public byte[] getData()
Returns the cached exported binary representation of the model.


invalidate

public void invalidate()
Invalidates any cached data in the model, forcing it to be recreated (and sets the dirty flag).


setDirty

public void setDirty(boolean dirty)
Sets the value of the dirty flag.


isDirty

public boolean isDirty()
Returns the value of the dirty flag.


collides

public boolean collides(Actor actor,
                        Shape shape)
Checks the specified actor for a collision with the environment.

Specified by:
collides in interface ActorAdvancer.Environment

collides

public boolean collides(int mask,
                        Shape shape)
Checks the specified mask for a collision with the environment.


getNearestPoint

public boolean getNearestPoint(Shape shape,
                               int mask,
                               Vector2f origin,
                               Vector2f nearPoint)
Finds the nearest point to the origin if the shape collides with the environment.


getIntersection

public boolean getIntersection(Ray2D ray,
                               float length,
                               int mask,
                               Vector2f intersection)
Finds the intersection with the ray.


getSceneModel

public TudeySceneModel getSceneModel()
Description copied from interface: ActorAdvancer.Environment
Returns a reference to the scene model.

Specified by:
getSceneModel in interface ActorAdvancer.Environment

getPenetration

public boolean getPenetration(Actor actor,
                              Shape shape,
                              Vector2f result)
Description copied from interface: ActorAdvancer.Environment
Checks whether the actor is colliding with anything and, if it is, populates the provided object with the penetration vector (the minimum translation required to cancel the penetration).

Specified by:
getPenetration in interface ActorAdvancer.Environment
Returns:
true if a collision was detected (in which case the result vector will be populated), false otherwise.

clone

public TudeySceneModel clone()
Overrides:
clone in class SceneModel

add

protected TudeySceneModel.Entry add(TudeySceneModel.Entry entry)
Performs the actual addition of the specified entry.

Returns:
the replaced entry.

update

protected TudeySceneModel.Entry update(TudeySceneModel.Entry nentry)
Performs the actual update of the specified entry.

Returns:
the replaced entry.

remove

protected TudeySceneModel.Entry remove(Object key)
Performs the actual removal of the identified entry.

Returns:
the removed entry.

addElement

protected void addElement(TudeySceneModel.Entry entry)
Adds the entry's space element to the hash space and maps it by its tags.


removeElement

protected void removeElement(TudeySceneModel.Entry entry)
Removes the entry's space element from the hash space and removes its tag mappings.


createShadow

protected void createShadow(TudeySceneModel.TileEntry entry)
Creates the shadow data for the specified tile and maps it by its tags.


deleteShadow

protected void deleteShadow(TudeySceneModel.TileEntry entry)
Deletes the shadow data for the supplied tile and removes its tag mappings.


mapEntry

protected void mapEntry(TudeySceneModel.Entry entry)
Maps the specified entry according to its tags.


unmapEntry

protected void unmapEntry(TudeySceneModel.Entry entry)
Unmaps the specified entry according to its tags.


getTileEntry

protected TudeySceneModel.TileEntry getTileEntry(int pair)
Retrieves the tile entry identified by the provided encoded coordinate pair.


getTileValue

protected int getTileValue(int pair)
Returns the encoded tile value corresponding to the encoded coordinate pair given, logging a warning and returning -1 if no value exists at the coordinates.


canonicalizeReference

protected void canonicalizeReference(TudeySceneModel.Entry entry)
Ensures that the entry's reference, if non-null, points to one of the references in the _references set (that is, that all entries whose references are equal point to the same reference instance).


addTileConfig

protected int addTileConfig(ConfigReference<TileConfig> tile)
Adds a reference to the specified tile config and returns the index assigned to the config.


removeTileConfig

protected void removeTileConfig(int idx)
Removes a reference for the indexed tile config.


decodeTileEntry

protected TudeySceneModel.TileEntry decodeTileEntry(Coord coord,
                                                    int value)
Decodes the specified tile entry.


decodeTileEntry

protected TudeySceneModel.TileEntry decodeTileEntry(int x,
                                                    int y,
                                                    int value)
Decodes the specified tile entry.


addPaintConfig

protected int addPaintConfig(ConfigReference<? extends PaintableConfig> paintable)
Adds a reference to the specified paint config and returns the index assigned to the config.


removePaintConfig

protected void removePaintConfig(int idx)
Removes a reference for the indexed paint config.


decodePaint

protected TudeySceneModel.Paint decodePaint(int value)
Decodes the specified paint value.


validateLayer

protected int validateLayer(int layer)
Validate that a layer value is valid.


getConfigIndex

protected static int getConfigIndex(int value)
Extracts the tile configuration index from the supplied encoded tile.


getElevation

protected static int getElevation(int value)
Extracts the tile elevation from the supplied encoded tile.