|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.stage.util.StageSceneUtil
public class StageSceneUtil
Provides scene related utility functions.
| Field Summary | |
|---|---|
protected static com.threerings.miso.util.MisoSceneMetrics |
_metrics
Our default scene metrics. |
protected static double[] |
CLUSTER_METRICS
Contains the starting offset from zero radians for the first occupant and the radial distance between occupants. |
protected static int |
MAX_OBJECT_SIZE
The maximum footprint width or height for which we will account in getIntersectedObjects(com.threerings.media.tile.TileManager, com.threerings.stage.data.StageSceneModel, java.awt.Rectangle). |
static int |
OBJECT_ORIENTATION
Value to pass to locationForObject(TileManager, ObjectInfo, int) and
locationForObject(TileManager, int, int, int, int)for orientation to indicate it
should use the object's orientation. |
| Constructor Summary | |
|---|---|
StageSceneUtil()
|
|
| Method Summary | |
|---|---|
static void |
coordsToLocation(int cx,
int cy,
Point loc)
Converts Cartesian coordinates back to full coordinates. |
static StageLocation |
findStandingSpot(Rectangle foot,
int dist,
com.threerings.media.util.AStarPathUtil.TraversalPred pred,
Object traverser,
Point nearto,
int orient)
Locates a spot to stand near the supplied rectangular footprint. |
static List<SceneLocation> |
getClusterLocs(Cluster cluster)
Computes a list of the valid locations in this cluster. |
static com.threerings.miso.data.ObjectInfo[] |
getIntersectedObjects(com.threerings.media.tile.TileManager tmgr,
StageSceneModel model,
Rectangle rect)
Returns an array of the objects intersected by the supplied tile coordinate rectangle. |
static com.threerings.miso.util.MisoSceneMetrics |
getMetrics()
Returns the scene metrics we use to do our calculations. |
static Rectangle |
getObjectFootprint(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int ox,
int oy)
Returns the footprint, in absolute tile coordinates, for the specified object with origin as specified. |
static boolean |
getObjectFootprint(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int ox,
int oy,
Rectangle foot)
Fills in the footprint, in absolute tile coordinates, for the specified object with origin as specified. |
static boolean |
isPassable(com.threerings.media.tile.TileManager tilemgr,
int tileId)
Looks up the base tile set for the specified fully qualified tile identifier and returns true if the associated tile is passable. |
static StageLocation |
locationForObject(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int tx,
int ty)
Does the necessary jiggery pokery to figure out where the specified object's associated location is. |
static StageLocation |
locationForObject(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int tx,
int ty,
int orient)
Does the necessary jiggery pokery to figure out where the specified object's associated location is. |
static StageLocation |
locationForObject(com.threerings.media.tile.TileManager tilemgr,
com.threerings.miso.data.ObjectInfo info)
Does the necessary jiggery pokery to figure out where the specified object's associated location is. |
static StageLocation |
locationForObject(com.threerings.media.tile.TileManager tilemgr,
com.threerings.miso.data.ObjectInfo info,
int orient)
Does the necessary jiggery pokery to figure out where the specified object's associated location is. |
static void |
locationToCoords(int lx,
int ly,
Point coords)
Converts full coordinates to Cartesian coordinates. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int OBJECT_ORIENTATION
locationForObject(TileManager, ObjectInfo, int) and
locationForObject(TileManager, int, int, int, int)for orientation to indicate it
should use the object's orientation.
protected static com.threerings.miso.util.MisoSceneMetrics _metrics
protected static final double[] CLUSTER_METRICS
protected static final int MAX_OBJECT_SIZE
getIntersectedObjects(com.threerings.media.tile.TileManager, com.threerings.stage.data.StageSceneModel, java.awt.Rectangle).
| Constructor Detail |
|---|
public StageSceneUtil()
| Method Detail |
|---|
public static com.threerings.miso.util.MisoSceneMetrics getMetrics()
public static StageLocation locationForObject(com.threerings.media.tile.TileManager tilemgr,
com.threerings.miso.data.ObjectInfo info)
public static StageLocation locationForObject(com.threerings.media.tile.TileManager tilemgr,
com.threerings.miso.data.ObjectInfo info,
int orient)
orient - - the orientation to use in the returned location, or
OBJECT_ORIENTATION if the object's orientation should be used
public static StageLocation locationForObject(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int tx,
int ty)
tilemgr - a tile manager that can be used to look up the tile information.tileId - the fully qualified tile id of the object tile.tx - the object's x tile coordinate.ty - the object's y tile coordinate.
public static StageLocation locationForObject(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int tx,
int ty,
int orient)
tilemgr - a tile manager that can be used to look up the tile information.tileId - the fully qualified tile id of the object tile.tx - the object's x tile coordinate.ty - the object's y tile coordinate.orient - - the orientation to use in the returned location, or
OBJECT_ORIENTATION if the tile's orientation should be used
public static void locationToCoords(int lx,
int ly,
Point coords)
public static void coordsToLocation(int cx,
int cy,
Point loc)
public static Rectangle getObjectFootprint(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int ox,
int oy)
public static boolean getObjectFootprint(com.threerings.media.tile.TileManager tilemgr,
int tileId,
int ox,
int oy,
Rectangle foot)
public static boolean isPassable(com.threerings.media.tile.TileManager tilemgr,
int tileId)
public static List<SceneLocation> getClusterLocs(Cluster cluster)
public static StageLocation findStandingSpot(Rectangle foot,
int dist,
com.threerings.media.util.AStarPathUtil.TraversalPred pred,
Object traverser,
Point nearto,
int orient)
dist.
foot - the tile coordinate footprint around which we are
attempting to stand.dist - the maximum number of tiles away from the footprint to
search before giving up.pred - a predicate that will be used to determine whether a
particular spot can be stood upon (we're hijacking the meaning of
"traverse" in this case, but the interface is otherwise so nice).traverser - the object that will be passed to the traversal
predicate.nearto - a point (in tile coordinates) which will be used to
select from among the valid standing spots, the one nearest to the
supplied point will be returned.orient - if not DirectionCodes.NONE this orientation
will be used to override the "natural" orientation of the spot
which is facing toward the footprint.
public static com.threerings.miso.data.ObjectInfo[] getIntersectedObjects(com.threerings.media.tile.TileManager tmgr,
StageSceneModel model,
Rectangle rect)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||