|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.tudey.client.util.SceneMap
public class SceneMap
Maintains a simple map of the scene than can be rendered to the UI.
| Field Summary | |
|---|---|
protected SoftReference<ByteBuffer> |
_buf
Buffer to reuse. |
protected Coord |
_coord
Reusable coordinate object. |
protected TudeyContext |
_ctx
The application context. |
protected List<SpaceElement> |
_elements
Holds elements during intersection testing. |
protected byte[] |
_floorColor
The RGBA color to use for floors. |
protected TextureUnit[] |
_masked
Reusable texture unit array for masked rendering. |
protected Polygon |
_quad
Used to store tile shapes for intersecting testing. |
protected Rectangle |
_region
Region object to reuse. |
protected TudeySceneModel |
_sceneModel
The scene model. |
protected Map<Coord,Texture2D> |
_textures
The map textures. |
protected CoordIntMap |
_types
Stores the "type" of each location (empty, floor, wall, etc). |
protected TextureUnit[] |
_unmasked
Reusable texture unit array for unmasked rendering. |
protected TudeySceneView |
_view
The scene view. |
protected byte[] |
_wallColor
The RGBA color to use for walls. |
protected static byte[] |
EMPTY_COLOR
The color to use for empty locations. |
protected static int |
TEXTURE_MASK
The mask for texture locations. |
protected static int |
TEXTURE_POT
The size of the map textures as a power of two. |
protected static int |
TEXTURE_SIZE
The size of the map textures. |
| Constructor Summary | |
|---|---|
SceneMap(TudeyContext ctx,
TudeySceneView view)
Creates a new scene map. |
|
| Method Summary | |
|---|---|
protected void |
addEntry(TudeySceneModel.Entry entry,
boolean retexture)
Adds the specified entry to the map. |
protected void |
build()
Builds the map. |
protected void |
buildTexture(int tx,
int ty)
Builds and maps the texture at the specified coordinates. |
void |
didLeavePlace(PlaceObject plobj)
|
void |
entryAdded(TudeySceneModel.Entry entry)
Notes that an entry has been added to the scene. |
void |
entryRemoved(TudeySceneModel.Entry oentry)
Notes that an entry has been removed from the scene. |
void |
entryUpdated(TudeySceneModel.Entry oentry,
TudeySceneModel.Entry nentry)
Notes that an entry has been updated within the scene. |
protected ByteBuffer |
getBuffer(int size)
Retrieves/creates a byte buffer of the requested size. |
protected static byte[] |
getBytes(Color4f color)
Converts the specified color into a byte array. |
protected void |
putColor(ByteBuffer buf,
int type)
Puts the color corresponding to the specified type into the supplied buffer. |
protected void |
removeEntry(TudeySceneModel.Entry entry,
boolean retexture)
Removes the specified entry from the map. |
void |
render(float sx,
float sy,
float swidth,
float sheight,
int tx,
int ty,
int twidth,
int theight,
float alpha,
Image mask)
Renders a section of the map. |
void |
setColors(Color4f floor,
Color4f wall)
Sets the colors to use to represent floors and walls. |
protected void |
update(int x,
int y,
boolean retexture)
Updates the specified location. |
protected void |
updateQuad(int x,
int y)
Updates the coordinates of the quad to encompass the specified grid cell. |
protected void |
updateTexture(int x,
int y,
int type)
Updates the texture at the specified coordinates. |
void |
willEnterPlace(PlaceObject plobj)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected TudeyContext _ctx
protected TudeySceneView _view
protected TudeySceneModel _sceneModel
protected CoordIntMap _types
protected Map<Coord,Texture2D> _textures
protected byte[] _floorColor
protected byte[] _wallColor
protected TextureUnit[] _unmasked
protected TextureUnit[] _masked
protected Coord _coord
protected Rectangle _region
protected Polygon _quad
protected SoftReference<ByteBuffer> _buf
protected List<SpaceElement> _elements
protected static final int TEXTURE_POT
protected static final int TEXTURE_SIZE
protected static final int TEXTURE_MASK
protected static final byte[] EMPTY_COLOR
| Constructor Detail |
|---|
public SceneMap(TudeyContext ctx,
TudeySceneView view)
| Method Detail |
|---|
public void setColors(Color4f floor,
Color4f wall)
public void render(float sx,
float sy,
float swidth,
float sheight,
int tx,
int ty,
int twidth,
int theight,
float alpha,
Image mask)
public void willEnterPlace(PlaceObject plobj)
willEnterPlace in interface PlaceViewpublic void didLeavePlace(PlaceObject plobj)
didLeavePlace in interface PlaceViewpublic void entryAdded(TudeySceneModel.Entry entry)
TudeySceneModel.Observer
entryAdded in interface TudeySceneModel.Observer
public void entryUpdated(TudeySceneModel.Entry oentry,
TudeySceneModel.Entry nentry)
TudeySceneModel.Observer
entryUpdated in interface TudeySceneModel.Observerpublic void entryRemoved(TudeySceneModel.Entry oentry)
TudeySceneModel.Observer
entryRemoved in interface TudeySceneModel.Observerprotected void build()
protected void addEntry(TudeySceneModel.Entry entry,
boolean retexture)
retexture - if true, update the texture as well.
protected void removeEntry(TudeySceneModel.Entry entry,
boolean retexture)
retexture - if true, update the texture as well.
protected void update(int x,
int y,
boolean retexture)
retexture - if true, update the texture as well.
protected void updateQuad(int x,
int y)
protected void updateTexture(int x,
int y,
int type)
protected void buildTexture(int tx,
int ty)
protected void putColor(ByteBuffer buf,
int type)
protected ByteBuffer getBuffer(int size)
protected static byte[] getBytes(Color4f color)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||