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 Color & | GetColor () |
Model * | GetModel () |
void | Load (Worldfile *wf, int entity) |
void | Map () |
std::vector< stg_point_t > & | Points () |
stg_point_t * | Points (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 () |
Model * | TestCollision () |
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 |
CellPtrVec * | candidate_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 |
Model * | mod |
| model to which this block belongs
|
std::vector< stg_point_t > | mpts |
| cache of this->pts in model coordindates
|
size_t | pt_count |
| the number of points
|
std::vector< stg_point_t > | pts |
| points defining a polygonx
|
CellPtrVec * | rendered_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
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 | |
|
) |
| | |
Member Function Documentation
void Stg::Block::AppendTouchingModels |
( |
ModelPtrSet & |
touchers |
) |
|
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] |
void Stg::Block::InvalidateModelPointCache |
( |
|
) |
[private] |
invalidate the cache of points in model coordinates
void Stg::Block::Load |
( |
Worldfile * |
wf, |
|
|
int |
entity | |
|
) |
| | |
render the block into the world's raytrace data structure
std::vector<stg_point_t>& Stg::Block::Points |
( |
|
) |
[inline] |
stg_point_t* Stg::Block::Points |
( |
unsigned int * |
count |
) |
[inline] |
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 Canvas [friend] |
friend class Model [friend] |
friend class SuperRegion [friend] |
friend class World [friend] |
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.
z extent in global coordinates
Definition at line 1134 of file stage.hh.
experimental - range 0 - 1, render glowing
Definition at line 1128 of file stage.hh.
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.
model to which this block belongs
Definition at line 1118 of file stage.hh.
cache of this->pts in model coordindates
Definition at line 1119 of file stage.hh.
the number of points
Definition at line 1120 of file stage.hh.
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.
The documentation for this class was generated from the following file: