Stg::Block Class Reference

#include <stage.hh>

List of all members.

Public Member Functions

void AppendTouchingModels (ModelPtrSet &touchers)
 Block (Model *mod, Worldfile *wf, int entity)
 Block (Model *mod, stg_point_t *pts, size_t pt_count, stg_meters_t zmin, stg_meters_t zmax, Color color, bool inherit_color)
double CenterX ()
double CenterY ()
void DrawFootPrint ()
void DrawSolid ()
void GenerateCandidateCells ()
const ColorGetColor ()
ModelGetModel ()
void Load (Worldfile *wf, int entity)
void Map ()
std::vector< stg_point_t > & Points ()
stg_point_tPoints (unsigned int *count)
void Rasterize (uint8_t *data, unsigned int width, unsigned int height, stg_meters_t cellwidth, stg_meters_t cellheight)
void RemoveFromCellArray (CellPtrVec *blocks)
void SetCenter (double x, double y)
void SetCenterX (double y)
void SetCenterY (double y)
void SetZ (double min, double max)
void SwitchToTestedCells ()
ModelTestCollision ()
void Translate (double x, double y)
void UnMap ()
 ~Block ()

Private Member Functions

stg_point_t BlockPointToModelMeters (const stg_point_t &bpt)
void DrawSides ()
void DrawTop ()
void InvalidateModelPointCache ()

Private Attributes

CellPtrVeccandidate_cells
Color color
Bounds global_z
double glow
PointIntVec gpts
bool inherit_color
std::vector< std::list< Block * >
::iterator > 
list_entries
Bounds local_z
 z extent in local coords
bool mapped
Modelmod
 model to which this block belongs
std::vector< stg_point_tmpts
 cache of this->pts in model coordindates
size_t pt_count
 the number of points
std::vector< stg_point_tpts
 points defining a polygonx
CellPtrVecrendered_cells
Size size

Friends

class BlockGroup
class Canvas
class Model
class SuperRegion
class World

Detailed Description

Definition at line 1038 of file stage.hh.


Constructor & Destructor Documentation

Stg::Block::Block ( Model mod,
stg_point_t pts,
size_t  pt_count,
stg_meters_t  zmin,
stg_meters_t  zmax,
Color  color,
bool  inherit_color 
)

Block Constructor. A model's body is a list of these blocks. The point data is copied, so pts can safely be freed after constructing the block.

Stg::Block::Block ( Model mod,
Worldfile *  wf,
int  entity 
)

A from-file constructor

Stg::Block::~Block (  ) 

Member Function Documentation

void Stg::Block::AppendTouchingModels ( ModelPtrSet touchers  ) 
stg_point_t Stg::Block::BlockPointToModelMeters ( const stg_point_t bpt  )  [private]

find the position of a block's point in model coordinates (m)

double Stg::Block::CenterX (  ) 

Return the center of the block on the X axis

double Stg::Block::CenterY (  ) 

Return the center of the block on the Y axis

void Stg::Block::DrawFootPrint (  ) 

draw the projection of the block onto the z=0 plane

void Stg::Block::DrawSides (  )  [private]
void Stg::Block::DrawSolid (  ) 

draw the block in OpenGL as a solid single color

void Stg::Block::DrawTop (  )  [private]
void Stg::Block::GenerateCandidateCells (  )  [inline]
const Color& Stg::Block::GetColor (  ) 
Model* Stg::Block::GetModel (  )  [inline]

Definition at line 1111 of file stage.hh.

void Stg::Block::InvalidateModelPointCache (  )  [private]

invalidate the cache of points in model coordinates

void Stg::Block::Load ( Worldfile *  wf,
int  entity 
)
void Stg::Block::Map (  ) 

render the block into the world's raytrace data structure

std::vector<stg_point_t>& Stg::Block::Points (  )  [inline]

Definition at line 1099 of file stage.hh.

stg_point_t* Stg::Block::Points ( unsigned int *  count  )  [inline]

Definition at line 1096 of file stage.hh.

void Stg::Block::Rasterize ( uint8_t *  data,
unsigned int  width,
unsigned int  height,
stg_meters_t  cellwidth,
stg_meters_t  cellheight 
)
void Stg::Block::RemoveFromCellArray ( CellPtrVec blocks  )  [inline]
void Stg::Block::SetCenter ( double  x,
double  y 
)

Set the center of the block

void Stg::Block::SetCenterX ( double  y  ) 

Set the center of the block on the X axis

void Stg::Block::SetCenterY ( double  y  ) 

Set the center of the block on the Y axis

void Stg::Block::SetZ ( double  min,
double  max 
)

Set the extent in Z of the block

void Stg::Block::SwitchToTestedCells (  ) 
Model* Stg::Block::TestCollision (  ) 

Returns the first model that shares a bitmap cell with this model

void Stg::Block::Translate ( double  x,
double  y 
)

Translate all points in the block by the indicated amounts

void Stg::Block::UnMap (  ) 

remove the block from the world's raytracing data structure


Friends And Related Function Documentation

friend class BlockGroup [friend]

Definition at line 1040 of file stage.hh.

friend class Canvas [friend]

Definition at line 1044 of file stage.hh.

friend class Model [friend]

Definition at line 1041 of file stage.hh.

friend class SuperRegion [friend]

Definition at line 1042 of file stage.hh.

friend class World [friend]

Definition at line 1043 of file stage.hh.


Member Data Documentation

When moving a model, we test for collisions by generating, for each block, a list of the cells in which it would be rendered if the move were to be successful. If no collision occurs, the move is allowed - the rendered cells are cleared, the potential cells are written, and the pointers to the rendered and potential cells are switched for next time (avoiding a memory copy).

Definition at line 1150 of file stage.hh.

Definition at line 1124 of file stage.hh.

z extent in global coordinates

Definition at line 1134 of file stage.hh.

double Stg::Block::glow [private]

experimental - range 0 - 1, render glowing

Definition at line 1128 of file stage.hh.

Definition at line 1152 of file stage.hh.

bool Stg::Block::inherit_color [private]

Definition at line 1125 of file stage.hh.

std::vector< std::list<Block*>::iterator > Stg::Block::list_entries [private]

record the list entries for the cells where this block is rendered

Definition at line 1138 of file stage.hh.

z extent in local coords

Definition at line 1123 of file stage.hh.

bool Stg::Block::mapped [private]

Definition at line 1135 of file stage.hh.

Model* Stg::Block::mod [private]

model to which this block belongs

Definition at line 1118 of file stage.hh.

std::vector<stg_point_t> Stg::Block::mpts [private]

cache of this->pts in model coordindates

Definition at line 1119 of file stage.hh.

size_t Stg::Block::pt_count [private]

the number of points

Definition at line 1120 of file stage.hh.

std::vector<stg_point_t> Stg::Block::pts [private]

points defining a polygonx

Definition at line 1121 of file stage.hh.

record the cells into which this block has been rendered to UnMapping them very quickly.

Definition at line 1142 of file stage.hh.

Definition at line 1122 of file stage.hh.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


stage
Author(s): Richard Vaughan, with contributions from many others. See web page for a full credits list.
autogenerated on Fri Jan 11 10:03:39 2013