OpenMW
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
MWRender::LocalMap Class Reference

Local map rendering. More...

#include <localmap.hpp>

List of all members.

Public Member Functions

 LocalMap (OEngine::Render::OgreRenderer *, MWRender::RenderingManager *rendering)
 ~LocalMap ()
void requestMap (MWWorld::CellStore *cell, float zMin, float zMax)
void requestMap (MWWorld::CellStore *cell, Ogre::AxisAlignedBox bounds)
void updatePlayer (const Ogre::Vector3 &position, const Ogre::Quaternion &orientation)
void saveFogOfWar (MWWorld::CellStore *cell)
void getInteriorMapPosition (Ogre::Vector2 pos, float &nX, float &nY, int &x, int &y)
bool isPositionExplored (float nX, float nY, int x, int y, bool interior)

Private Member Functions

const Ogre::Vector2 rotatePoint (const Ogre::Vector2 &p, const Ogre::Vector2 &c, const float angle)
void render (const float x, const float y, const float zlow, const float zhigh, const float xw, const float yw, const std::string &texture)
void saveTexture (const std::string &texname, const std::string &filename)
std::string coordStr (const int x, const int y)
void deleteBuffers ()

Private Attributes

OEngine::Render::OgreRenderermRendering
MWRender::RenderingManagermRenderingManager
Ogre::Camera * mCellCamera
Ogre::SceneNode * mCameraNode
Ogre::SceneNode * mCameraPosNode
Ogre::SceneNode * mCameraRotNode
Ogre::Light * mLight
float mAngle
std::map< std::string,
std::vector< Ogre::uint32 > > 
mBuffers
bool mInterior
int mCellX
int mCellY
Ogre::AxisAlignedBox mBounds
std::string mInteriorName

Static Private Attributes

static const int sMapResolution = 512
static const int sFogOfWarResolution = 32
static const int sFogOfWarSkip = 2
static const int sSize = 8192

Detailed Description

Local map rendering.


Constructor & Destructor Documentation


Member Function Documentation

std::string LocalMap::coordStr ( const int  x,
const int  y 
) [private]
void LocalMap::deleteBuffers ( ) [private]
void LocalMap::getInteriorMapPosition ( Ogre::Vector2  pos,
float &  nX,
float &  nY,
int &  x,
int &  y 
)

Get the interior map texture index and normalized position on this texture, given a world position (in ogre coordinates)

bool LocalMap::isPositionExplored ( float  nX,
float  nY,
int  x,
int  y,
bool  interior 
)

Check if a given position is explored by the player (i.e. not obscured by fog of war)

void LocalMap::render ( const float  x,
const float  y,
const float  zlow,
const float  zhigh,
const float  xw,
const float  yw,
const std::string &  texture 
) [private]
void LocalMap::requestMap ( MWWorld::CellStore cell,
float  zMin,
float  zMax 
)

Request the local map for an exterior cell.

Remarks:
It will either be loaded from a disk cache, or rendered if it is not already cached.
Parameters:
cellexterior cell
zMinmin height of objects or terrain in cell
zMaxmax height of objects or terrain in cell
void MWRender::LocalMap::requestMap ( MWWorld::CellStore cell,
Ogre::AxisAlignedBox  bounds 
)

Request the local map for an interior cell.

Remarks:
It will either be loaded from a disk cache, or rendered if it is not already cached.
Parameters:
cellinterior cell
boundsbounding box of the cell
const Ogre::Vector2 LocalMap::rotatePoint ( const Ogre::Vector2 &  p,
const Ogre::Vector2 &  c,
const float  angle 
) [private]

Save the fog of war for the current cell to disk.

Remarks:
This should be called before loading a new cell, as well as when the game is quit.
Parameters:
currentcell
void LocalMap::saveTexture ( const std::string &  texname,
const std::string &  filename 
) [private]
void LocalMap::updatePlayer ( const Ogre::Vector3 &  position,
const Ogre::Quaternion &  orientation 
)

Set the position & direction of the player.

Remarks:
This is used to draw a "fog of war" effect to hide areas on the map the player has not discovered yet.
Parameters:
position(OGRE coordinates)
cameraorientation (OGRE coordinates)

Member Data Documentation

float MWRender::LocalMap::mAngle [private]
Ogre::AxisAlignedBox MWRender::LocalMap::mBounds [private]
std::map<std::string, std::vector<Ogre::uint32> > MWRender::LocalMap::mBuffers [private]
Ogre::SceneNode* MWRender::LocalMap::mCameraNode [private]
Ogre::SceneNode* MWRender::LocalMap::mCameraPosNode [private]
Ogre::SceneNode* MWRender::LocalMap::mCameraRotNode [private]
Ogre::Camera* MWRender::LocalMap::mCellCamera [private]
std::string MWRender::LocalMap::mInteriorName [private]
Ogre::Light* MWRender::LocalMap::mLight [private]
const int MWRender::LocalMap::sFogOfWarResolution = 32 [static, private]
const int MWRender::LocalMap::sFogOfWarSkip = 2 [static, private]
const int MWRender::LocalMap::sMapResolution = 512 [static, private]
const int MWRender::LocalMap::sSize = 8192 [static, private]

The documentation for this class was generated from the following files: