|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.io.SimpleStreamableObject
com.threerings.miso.data.MisoSceneModel
com.threerings.miso.data.SimpleMisoSceneModel
public class SimpleMisoSceneModel
Contains miso scene data for a scene that is assumed to be reasonably simple and small, such that all base tile data for the entire scene can be stored in a single contiguous array.
Additionally, it makes the assumption that the single model will be
used to display a scene on a rectangular screen (dimensions defined by
vwidth and vheight) and further optimizes the base
tile array to obviate the need to store tile data for things that fall
outside the bounds of the screen.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface com.threerings.io.Streamable |
|---|
com.threerings.io.Streamable.Closure |
| Field Summary | |
|---|---|
int[] |
baseTileIds
The combined tile ids (tile set id and tile id) in compressed format. |
short |
height
The height of this scene in tiles. |
ObjectInfo[] |
objectInfo
Information records for the "interesting" objects in the object layer. |
int[] |
objectTileIds
The combined tile ids (tile set id and tile id) of the "uninteresting" tiles in the object layer. |
short[] |
objectXs
The x coordinate of the "uninteresting" tiles in the object layer. |
short[] |
objectYs
The y coordinate of the "uninteresting" tiles in the object layer. |
int |
vheight
The viewport height in tiles. |
int |
vwidth
The viewport width in tiles. |
short |
width
The width of this scene in tiles. |
| Constructor Summary | |
|---|---|
SimpleMisoSceneModel()
Creates a completely uninitialized model suitable for little more than unserialization. |
|
SimpleMisoSceneModel(int width,
int height,
int vwidth,
int vheight)
Creates a blank scene model with the specified dimensions. |
|
| Method Summary | |
|---|---|
boolean |
addObject(ObjectInfo info)
Adds an object to this scene. |
protected void |
allocateBaseTileArray()
Allocate the base tile array. |
SimpleMisoSceneModel |
clone()
|
int |
getBaseTileId(int col,
int row)
Returns the fully qualified tile id of the base tile at the specified coordinates. |
protected int |
getIndex(int x,
int y)
Get the index into the baseTileIds[] for the specified x and y coordinates, or return -1 if the specified coordinates are outside of the viewable area. |
void |
getObjects(Rectangle region,
ObjectSet set)
Populates the supplied object set with info on all objects whose origin falls in the requested region. |
static void |
populateObjects(SimpleMisoSceneModel model,
List<ObjectInfo> ilist,
List<ObjectInfo> ulist)
Populates the interesting and uninteresting parts of a miso scene model given lists of ObjectInfo records for each. |
boolean |
removeObject(ObjectInfo info)
Removes the specified object from the scene. |
boolean |
setBaseTile(int fqBaseTileId,
int col,
int row)
Updates the tile at the specified location in the base layer. |
void |
updateObject(ObjectInfo info)
Updates an object in this scene. |
| Methods inherited from class com.threerings.miso.data.MisoSceneModel |
|---|
getDefaultBaseTileSet, setDefaultBaseTileSet |
| 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 |
|---|
public short width
public short height
public int vwidth
public int vheight
public int[] baseTileIds
public int[] objectTileIds
public short[] objectXs
public short[] objectYs
public ObjectInfo[] objectInfo
| Constructor Detail |
|---|
public SimpleMisoSceneModel()
public SimpleMisoSceneModel(int width,
int height,
int vwidth,
int vheight)
| Method Detail |
|---|
public int getBaseTileId(int col,
int row)
MisoSceneModel-1 will be returned if there is
no tile at the specified coordinate.
getBaseTileId in class MisoSceneModel
public boolean setBaseTile(int fqBaseTileId,
int col,
int row)
MisoSceneModelNote that if there are fringe tiles associated with this scene, calling this method may result in the surrounding fringe tiles being cleared and subsequently recalculated. This should not be called on a displaying scene unless you know what you are doing.
setBaseTile in class MisoSceneModelfqBaseTileId - the fully-qualified tile id (@see
TileUtil#getFQTileId}) of the tile to set.col - the x-coordinate of the tile to set.row - the y-coordinate of the tile to set.
public void getObjects(Rectangle region,
ObjectSet set)
MisoSceneModel
getObjects in class MisoSceneModelpublic boolean addObject(ObjectInfo info)
MisoSceneModel
addObject in class MisoSceneModelpublic void updateObject(ObjectInfo info)
MisoSceneModel
updateObject in class MisoSceneModelpublic boolean removeObject(ObjectInfo info)
MisoSceneModel
removeObject in class MisoSceneModelpublic SimpleMisoSceneModel clone()
clone in class MisoSceneModel
protected int getIndex(int x,
int y)
protected void allocateBaseTileArray()
public static void populateObjects(SimpleMisoSceneModel model,
List<ObjectInfo> ilist,
List<ObjectInfo> ulist)
ObjectInfo records for each.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||