#include <W3DTreeBuffer.h>
Inherits Snapshot.
Public Member Functions | |
| W3DTreeBuffer (void) | |
| ~W3DTreeBuffer (void) | |
| void | addTree (DrawableID id, Coord3D location, Real scale, Real angle, Real randomScaleAmount, const W3DTreeDrawModuleData *data) |
| Add a tree at location. Name is the w3d model name. | |
| void | unitMoved (Object *unit) |
| Notify that an object moved, so check for collisions. | |
| Int | addTreeType (const W3DTreeDrawModuleData *data) |
| Add a type of tree. Name is the w3d model name. | |
| Bool | updateTreePosition (DrawableID id, Coord3D location, Real angle) |
| Updates a tree's location. | |
| void | pushAsideTree (DrawableID id, const Coord3D *pusherPos, const Coord3D *pusherDirection, ObjectID pusherID) |
| void | removeTree (DrawableID id) |
| Remove a tree. | |
| void | removeTreesForConstruction (const Coord3D *pos, const GeometryInfo &geom, Real angle) |
| Remove trees that would be under a building. | |
| void | setTextureLOD (Int lod) |
| void | clearAllTrees (void) |
| Empties the tree buffer. | |
| void | setBounds (const Region2D &bounds) |
| Empties the tree buffer. | |
| void | drawTrees (CameraClass *camera, RefRenderObjListIterator *pDynamicLightsIterator) |
| Draws the trees. Uses camera for culling. | |
| void | doFullUpdate (void) |
| void | setIsTerrain (void) |
| Bool | needToDraw (void) |
| Terrain calls this to tell trees to draw. | |
| Int | getNumTiles (void) |
| TileData * | getSourceTile (Int ndx) |
| void | allocateTreeBuffers (void) |
| Allocates the buffers. | |
| void | freeTreeBuffers (void) |
| Frees the index and vertex buffers. | |
Public Member Functions inherited from Snapshot | |
| Snapshot (void) | |
| ~Snapshot (void) | |
Protected Member Functions | |
| virtual void | crc (Xfer *xfer) |
| virtual void | xfer (Xfer *xfer) |
| virtual void | loadPostProcess (void) |
| void | updateSway (const BreezeInfo &info) |
| Updates the sway offsets. | |
| void | loadTreesInVertexAndIndexBuffers (RefRenderObjListIterator *pDynamicLightsIterator) |
| Fills the index and vertex buffers for drawing. | |
| void | updateVertexBuffer (void) |
| Fills the index and vertex buffers for drawing. | |
| void | cull (const CameraClass *camera) |
| Culls the trees. | |
| UnsignedInt | doLighting (const Vector3 *normal, const GlobalData::TerrainLighting *objectLighting, const Vector3 *emissive, UnsignedInt vertexDiffuse, Real scale) const |
| void | updateTexture (void) |
| Int | getPartitionBucket (const Coord3D &pos) const |
| void | updateTopplingTree (TTree *tree) |
| < Keep track of rotational fall distance, bounce and/or stop when needed. | |
| void | applyTopplingForce (TTree *tree, const Coord3D *toppleDirection, Real toppleSpeed, UnsignedInt options) |
| < Start the toppling process by giving a force vector | |
Definition at line 148 of file W3DTreeBuffer.h.
| W3DTreeBuffer::W3DTreeBuffer | ( | void | ) |
Constructor. Sets m_initialized to true if it finds the w3d models it needs for the trees.
Definition at line 1106 of file W3DTreeBuffer.cpp.
| W3DTreeBuffer::~W3DTreeBuffer | ( | void | ) |
Destructor. Releases w3d assets.
Definition at line 1086 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::addTree | ( | DrawableID | id, |
| Coord3D | location, | ||
| Real | scale, | ||
| Real | angle, | ||
| Real | randomScaleAmount, | ||
| const W3DTreeDrawModuleData * | data ) |
Add a tree at location. Name is the w3d model name.
Adds a tree. Name is the W3D model name, supported models are ALPINE, DECIDUOUS and SHRUB.
Definition at line 1405 of file W3DTreeBuffer.cpp.
| Int W3DTreeBuffer::addTreeType | ( | const W3DTreeDrawModuleData * | data | ) |
Add a type of tree. Name is the w3d model name.
Adds a type of tree (model & texture).
Definition at line 1346 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::allocateTreeBuffers | ( | void | ) |
Allocates the buffers.
Allocates the index and vertex buffers.
Definition at line 1236 of file W3DTreeBuffer.cpp.
|
protected |
< Start the toppling process by giving a force vector
Definition at line 1826 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::clearAllTrees | ( | void | ) |
|
protectedvirtual |
|
protected |
Culls the trees.
Culls the trees, marking the visible flag. If a tree becomes visible, it sets it's sortKey
Definition at line 301 of file W3DTreeBuffer.cpp.
|
inline |
Called when the view changes, and sort key needs to be recalculated. Normally sortKey gets calculated when a tree becomes visible.
Definition at line 204 of file W3DTreeBuffer.h.
|
protected |
Calculates the diffuse lighting as affected by dynamic lighting.
Definition at line 640 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::drawTrees | ( | CameraClass * | camera, |
| RefRenderObjListIterator * | pDynamicLightsIterator ) |
Draws the trees. Uses camera for culling.
Draws the trees. Uses camera to cull.
Definition at line 1545 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::freeTreeBuffers | ( | void | ) |
Frees the index and vertex buffers.
Frees the index and vertex buffers.
Definition at line 1135 of file W3DTreeBuffer.cpp.
|
inline |
Definition at line 208 of file W3DTreeBuffer.h.
Returns the bucket index into m_areaPartition for a given location.
Definition at line 337 of file W3DTreeBuffer.cpp.
Definition at line 209 of file W3DTreeBuffer.h.
|
protectedvirtual |
|
protected |
Fills the index and vertex buffers for drawing.
Loads the trees into the vertex buffer for drawing.
Definition at line 698 of file W3DTreeBuffer.cpp.
|
inline |
Terrain calls this to tell trees to draw.
Definition at line 206 of file W3DTreeBuffer.h.
| void W3DTreeBuffer::pushAsideTree | ( | DrawableID | id, |
| const Coord3D * | pusherPos, | ||
| const Coord3D * | pusherDirection, | ||
| ObjectID | pusherID ) |
Push sideways tree or grass.
Definition at line 1504 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::removeTree | ( | DrawableID | id | ) |
| void W3DTreeBuffer::removeTreesForConstruction | ( | const Coord3D * | pos, |
| const GeometryInfo & | geom, | ||
| Real | angle ) |
Remove trees that would be under a building.
Removes any trees that would be under a building.
Definition at line 1321 of file W3DTreeBuffer.cpp.
|
inline |
Empties the tree buffer.
Definition at line 199 of file W3DTreeBuffer.h.
|
inline |
Definition at line 205 of file W3DTreeBuffer.h.
| void W3DTreeBuffer::setTextureLOD | ( | Int | lod | ) |
used to adjust maximum mip level sent to hardware.
Adjust the resolution of tree texture uploaded to the video card. The system memory version always remains at full resolution. Someone should probably optimize this at some point since it wastes a lot of system memory on low-end systems. -MW
Definition at line 629 of file W3DTreeBuffer.cpp.
| void W3DTreeBuffer::unitMoved | ( | Object * | unit | ) |
Notify that an object moved, so check for collisions.
Check to see if a unit collided with a tree/grass/bush.
Definition at line 1157 of file W3DTreeBuffer.cpp.
|
protected |
Updates the sway offsets.
Culls the trees, marking the visible flag. If a tree becomes visible, it sets it's sortKey
Definition at line 357 of file W3DTreeBuffer.cpp.
|
protected |
Creates a new texture.
Definition at line 443 of file W3DTreeBuffer.cpp.
|
protected |
< Keep track of rotational fall distance, bounce and/or stop when needed.
Definition at line 1864 of file W3DTreeBuffer.cpp.
| Bool W3DTreeBuffer::updateTreePosition | ( | DrawableID | id, |
| Coord3D | location, | ||
| Real | angle ) |
Updates a tree's location.
Updates a tree's position
Definition at line 1479 of file W3DTreeBuffer.cpp.
|
protected |
Fills the index and vertex buffers for drawing.
Updates the push aside offset in vertex buffer.
Definition at line 993 of file W3DTreeBuffer.cpp.
|
protectedvirtual |
Xfer Version Info: 1: Initial version
< Scale at location.
< Sine of the rotation angle at location.
< Cosine of the rotation angle at location.
< Drawable this tree corresponds to.
< Velocity in degrees per frame (or is it radians per frame?)
< Acceleration angularVelocity is increasing
< Z-less direction we are toppling
< Stage this module is in.
< How much have I rotated so I know when to bounce.
< topple options
< Toppled trees sink into the terrain & disappear, how many frames left.
Implements Snapshot.
Definition at line 1952 of file W3DTreeBuffer.cpp.