#include <glisomath.h>
Public Methods | |
GlIsoMath (int tileWidth, int tileHeight) | |
A more useable transformation object. More... | |
void | SetScreenBaseToOrigin (int screenW, int screenH) |
Set the screen so that the bottom center of the screen is at tile 0,0. | |
void | SetScreenCenterToTile (int screenW, int screenH, int tileX, int tileY, int tileZ) |
Set the screen center so that it "looks" at the given tile. | |
void | SetScreenToTile (int screenX, int screenY, int tileX, int tileY, int tileZ) |
Set an arbitrary screen point to an arbitrary tile. | |
void | TileToScreen (GlFixed tileX, GlFixed tileY, GlFixed tileZ, int *screenX, int *screenY) const |
Coverts from tile coordinates to screen coordinates. | |
void | ScreenToFlatTile (int screenX, int screenY, GlFixed tileZ, GlFixed *tileX, GlFixed *tileY) const |
Converts from screen to map, for a known mapZ = worldZ. More... | |
Static Public Methods | |
void | TileToScreen (GlFixed tileX, GlFixed tileY, GlFixed tileZ, int tileWidth, int tileHeight, int screenOffsetX, int screenOffsetY, GlFixed *screenX, GlFixed *screenY) |
Transform tile to screen. | |
void | ScreenToFlatTile (GlFixed screenX, GlFixed screenY, GlFixed tileZ, int tileWidth, int tileHeight, int screenOffsetX, int screenOffsetY, GlFixed *tileX, GlFixed *tileY) |
Transform from screen coordinates to tile coordinates, if you know the tileZ of the transform, as input. | |
void | TileToWorld (GlFixed tileX, GlFixed tileY, GlFixed tileZ, GlFixed *worldX, GlFixed *worldY, GlFixed *worldZ) |
Tile to world. More... |
An Iso view is a quasi-3D view of tiles and cubes in 3-D space. In screen view, the cube is exactly twice as wide is it is high.
The coordinate spaces referenced are:
Tile: Cubic tile space, or map space. So a "10x10 map" would be equivalent to 10 by 10 "tiles". Tile space is true 3D and has fixed point coordinates.
World: An intermediate coordinate system. World coordinates are rotated 45 degrees from tile coordinates, but have the same dimensions.
View: An intermediate coordinate system. View coordinates are rotated to world, but aligned with the screen.
Screen: A 2-D coordinate system. Pixel coordinates.
The class can be used via its static functions, which provide general transforms. It is usually easier, however, to construct an isoMath object and use the "normal" methods.
|
A more useable transformation object. Should be followed by SetScreen... in order to view in a useful way. |
|
Converts from screen to map, for a known mapZ = worldZ. The map doesn't have to be flat, just the area of transformation. |
|
Tile to world. Generally an internal transformation. Note that this can introduct rounding errors! |