Richard Boegli's CnC_Generals_Zero_Hour Fork WIP
This is documentation of Richard Boegil's Zero Hour Fork
 
Loading...
Searching...
No Matches
W3DRoadBuffer Class Reference

#include <W3DRoadBuffer.h>

Public Member Functions

 W3DRoadBuffer (void)
 
 ~W3DRoadBuffer (void)
 
void loadRoads ()
 Loads the roads from the map objects list.
 
void clearAllRoads (void)
 Empties the road buffer.
 
void drawRoads (CameraClass *camera, TextureClass *cloudTexture, TextureClass *noiseTexture, Bool wireframe, Int minX, Int maxX, Int minY, Int maxY, RefRenderObjListIterator *pDynamicLightsIterator)
 Draws the roads. Uses terrain bounds for culling.
 
void setMap (WorldHeightMap *pMap)
 Sets the map pointer.
 
void updateLighting (void)
 Updates the diffuse lighting in the buffers.
 
void updateCenter (void)
 Notifies that the camera moved.
 

Protected Member Functions

void addMapObjects (void)
 
void addMapObject (RoadSegment *pRoad, Bool updateTheCounts)
 
void adjustStacking (Int topUniqueID, Int bottomUniqueID)
 
Int findCrossTypeJoinVector (Vector2 loc, Vector2 *joinVector, Int uniqueID)
 
void flipTheRoad (RoadSegment *pRoad)
 
void insertCurveSegmentAt (Int ndx1, Int ndx2)
 Flips the loc1 and loc2 info.
 
void insertCrossTypeJoins (void)
 
void insertJoinAt (Int ndx)
 
void miter (Int ndx1, Int ndx2)
 
void moveRoadSegTo (Int fromNdx, Int toNdx)
 
void checkLinkAfter (Int ndx)
 
void checkLinkBefore (Int ndx)
 
void updateCounts (RoadSegment *pRoad)
 
void updateCountsAndFlags (void)
 
void insertCurveSegments (void)
 
void insertTeeIntersections (void)
 
void insertTee (Vector2 loc, Int index1, Real scale)
 
Bool insertY (Vector2 loc, Int index1, Real scale)
 
void insert4Way (Vector2 loc, Int index1, Real scale)
 
void offset4Way (TRoadPt *pc1, TRoadPt *pc2, TRoadPt *pc3, TRoadPt *pr3, TRoadPt *pc4, Vector2 loc, Vector2 alignVector, Real widthInTexture)
 
void offset3Way (TRoadPt *pc1, TRoadPt *pc2, TRoadPt *pc3, Vector2 loc, Vector2 upVector, Vector2 teeVector, Real widthInTexture)
 
void offsetY (TRoadPt *pc1, TRoadPt *pc2, TRoadPt *pc3, Vector2 loc, Vector2 upVector, Real widthInTexture)
 
void offsetH (TRoadPt *pc1, TRoadPt *pc2, TRoadPt *pc3, Vector2 loc, Vector2 upVector, Vector2 teeVector, Bool flip, Bool mirror, Real widthInTexture)
 
void preloadRoadsInVertexAndIndexBuffers (void)
 Fills the index and vertex buffers for drawing.
 
void preloadRoadSegment (RoadSegment *pRoad)
 Fills the index and vertex buffers for drawing 1 segment.
 
void loadCurve (RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Real scale)
 Fills the index and vertex buffers for drawing 1 fade.
 
void loadTee (RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Bool is4way, Real scale)
 Fills the index and vertex buffers for drawing 1 tee intersection.
 
void loadY (RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Real scale)
 Fills the index and vertex buffers for drawing 1 Y intersection.
 
void loadAlphaJoin (RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Real scale)
 Fills the index and vertex buffers for drawing 1 alpha blend cap.
 
void loadH (RoadSegment *pRoad, Vector2 loc1, Vector2 loc2, Bool flip, Real scale)
 Fills the index and vertex buffers for drawing 1 h tee intersection.
 
void loadFloatSection (RoadSegment *pRoad, Vector2 loc, Vector2 roadVector, Real height, Real left, Real right, Real uOffset, Real vOffset, Real scale)
 
void loadFloat4PtSection (RoadSegment *pRoad, Vector2 loc, Vector2 roadNormal, Vector2 roadVector, Vector2 *cornersP, Real uOffset, Real vOffset, Real uScale, Real vScale)
 
void loadLit4PtSection (RoadSegment *pRoad, UnsignedShort *ib, VertexFormatXYZDUV1 *vb, RefRenderObjListIterator *pDynamicLightsIterator)
 
void loadRoadsInVertexAndIndexBuffers (void)
 Fills the index and vertex buffers for drawing.
 
void loadLitRoadsInVertexAndIndexBuffers (RefRenderObjListIterator *pDynamicLightsIterator)
 Fills the index and vertex buffers for drawing.
 
void loadRoadSegment (UnsignedShort *ib, VertexFormatXYZDUV1 *vb, RoadSegment *pRoad)
 Fills the index and vertex buffers for drawing 1 segment.
 
void allocateRoadBuffers (void)
 Allocates the buffers.
 
void freeRoadBuffers (void)
 Frees the index and vertex buffers.
 
Bool visibilityChanged (const IRegion2D &bounds)
 Returns true if some roads are now visible that weren't, or vice versa.
 
void rotateAbout (Vector2 *ptP, Vector2 center, Real angle)
 

Protected Attributes

RoadTypem_roadTypes
 Roads texture.
 
RoadSegmentm_roads
 The road buffer. All roads are stored here.
 
Int m_numRoads
 Number of roads used in m_roads.
 
Bool m_initialized
 True if the subsystem initialized.
 
WorldHeightMapm_map
 Pointer to the height map data.
 
RefRenderObjListIteratorm_lightsIterator
 Lighting iterator.
 
Int m_curUniqueID
 Road type we are rendering at this pass.
 
Int m_curRoadType
 
Int m_maxRoadSegments
 Size of m_roads.
 
Int m_maxRoadVertex
 Size of m_vertexRoad.
 
Int m_maxRoadIndex
 Size of m_indexRoad.
 
Int m_maxRoadTypes
 Size of m_roadTypes.
 
Int m_curNumRoadVertices
 Number of vertices used in current road type.
 
Int m_curNumRoadIndices
 Number of indices used in current road type;.
 
Bool m_updateBuffers
 If true, update the vertex buffers.
 

Friends

class BaseHeightMapRenderObjClass
 

Detailed Description

Definition at line 195 of file W3DRoadBuffer.h.

Constructor & Destructor Documentation

◆ W3DRoadBuffer()

W3DRoadBuffer::W3DRoadBuffer ( void )

Constructor.

Definition at line 3081 of file W3DRoadBuffer.cpp.

◆ ~W3DRoadBuffer()

W3DRoadBuffer::~W3DRoadBuffer ( void )

Destructor. Releases w3d assets.

Definition at line 3070 of file W3DRoadBuffer.cpp.

Member Function Documentation

◆ addMapObject()

void W3DRoadBuffer::addMapObject ( RoadSegment * pRoad,
Bool updateTheCounts )
protected

Loads the roads from the map objects.

Definition at line 1519 of file W3DRoadBuffer.cpp.

◆ addMapObjects()

void W3DRoadBuffer::addMapObjects ( void )
protected

Loads the roads from the map objects.

Definition at line 1606 of file W3DRoadBuffer.cpp.

◆ adjustStacking()

void W3DRoadBuffer::adjustStacking ( Int topUniqueID,
Int bottomUniqueID )
protected

Adjusts the stacking order.

Definition at line 2712 of file W3DRoadBuffer.cpp.

◆ allocateRoadBuffers()

void W3DRoadBuffer::allocateRoadBuffers ( void )
protected

Allocates the buffers.

Allocates the index and vertex buffers.

Definition at line 3123 of file W3DRoadBuffer.cpp.

◆ checkLinkAfter()

void W3DRoadBuffer::checkLinkAfter ( Int ndx)
protected

Checks to see if any segments need to link after this one.

Definition at line 1467 of file W3DRoadBuffer.cpp.

◆ checkLinkBefore()

void W3DRoadBuffer::checkLinkBefore ( Int ndx)
protected

Checks to see if any segments need to link before this one.

Definition at line 1408 of file W3DRoadBuffer.cpp.

◆ clearAllRoads()

void W3DRoadBuffer::clearAllRoads ( void )

Empties the road buffer.

Removes all roads.

Definition at line 3178 of file W3DRoadBuffer.cpp.

◆ drawRoads()

void W3DRoadBuffer::drawRoads ( CameraClass * camera,
TextureClass * cloudTexture,
TextureClass * noiseTexture,
Bool wireframe,
Int minX,
Int maxX,
Int minY,
Int maxY,
RefRenderObjListIterator * pDynamicLightsIterator )

Draws the roads. Uses terrain bounds for culling.

Draws the roads.

Definition at line 3287 of file W3DRoadBuffer.cpp.

◆ findCrossTypeJoinVector()

Int W3DRoadBuffer::findCrossTypeJoinVector ( Vector2 loc,
Vector2 * joinVector,
Int uniqueID )
protected

Finds a road segment of different type && sets the join vector.

Definition at line 2656 of file W3DRoadBuffer.cpp.

◆ flipTheRoad()

void W3DRoadBuffer::flipTheRoad ( RoadSegment * pRoad)
inlineprotected

Definition at line 243 of file W3DRoadBuffer.h.

◆ freeRoadBuffers()

void W3DRoadBuffer::freeRoadBuffers ( void )
protected

Frees the index and vertex buffers.

Frees the index and vertex buffers.

Definition at line 3106 of file W3DRoadBuffer.cpp.

◆ insert4Way()

void W3DRoadBuffer::insert4Way ( Vector2 loc,
Int index1,
Real scale )
protected

Inserts a 4 way intersection.

Definition at line 2427 of file W3DRoadBuffer.cpp.

◆ insertCrossTypeJoins()

void W3DRoadBuffer::insertCrossTypeJoins ( void )
protected

Inserts alpha blend type joins at open ends.

Definition at line 2746 of file W3DRoadBuffer.cpp.

◆ insertCurveSegmentAt()

void W3DRoadBuffer::insertCurveSegmentAt ( Int ndx1,
Int ndx2 )
protected

Flips the loc1 and loc2 info.

Insertes curves at the corner of 2 segments.

Definition at line 2881 of file W3DRoadBuffer.cpp.

◆ insertCurveSegments()

void W3DRoadBuffer::insertCurveSegments ( void )
protected

Inserts curved segments along connected segments.

Definition at line 2627 of file W3DRoadBuffer.cpp.

◆ insertJoinAt()

void W3DRoadBuffer::insertJoinAt ( Int ndx)
protected

◆ insertTee()

void W3DRoadBuffer::insertTee ( Vector2 loc,
Int index1,
Real scale )
protected

Inserts a Tee intersection.

Definition at line 1780 of file W3DRoadBuffer.cpp.

◆ insertTeeIntersections()

void W3DRoadBuffer::insertTeeIntersections ( void )
protected

Inserts Tee intersections at 3 way intersections.

Definition at line 2597 of file W3DRoadBuffer.cpp.

◆ insertY()

Bool W3DRoadBuffer::insertY ( Vector2 loc,
Int index1,
Real scale )
protected

Inserts a Y intersection if the corner meets "Y" criteria.

Definition at line 1979 of file W3DRoadBuffer.cpp.

◆ loadAlphaJoin()

void W3DRoadBuffer::loadAlphaJoin ( RoadSegment * pRoad,
Vector2 loc1,
Vector2 loc2,
Real scale )
protected

Fills the index and vertex buffers for drawing 1 alpha blend cap.

Loads an alpha join into the vertex buffer for a road join.

Definition at line 396 of file W3DRoadBuffer.cpp.

◆ loadCurve()

void W3DRoadBuffer::loadCurve ( RoadSegment * pRoad,
Vector2 loc1,
Vector2 loc2,
Real scale )
protected

Fills the index and vertex buffers for drawing 1 fade.

Loads a curve segment into the vertex buffer for a road end cap or join.

Definition at line 1065 of file W3DRoadBuffer.cpp.

◆ loadFloat4PtSection()

void W3DRoadBuffer::loadFloat4PtSection ( RoadSegment * pRoad,
Vector2 loc,
Vector2 roadNormal,
Vector2 roadVector,
Vector2 * cornersP,
Real uOffset,
Real vOffset,
Real uScale,
Real vScale )
protected

Loads a section of road using a mesh that floats a little above the terrain. The road is loaded into the quadrilateral defined by the 4 corners points. loc specifies the point where u==uOffset && v==vOffset, and the road vector gives the direction of the road, and the road normal is perpendicular to the road normal.

Definition at line 567 of file W3DRoadBuffer.cpp.

◆ loadFloatSection()

void W3DRoadBuffer::loadFloatSection ( RoadSegment * pRoad,
Vector2 loc,
Vector2 roadVector,
Real halfHeight,
Real left,
Real right,
Real uOffset,
Real vOffset,
Real scale )
protected

Loads a section of road using a mesh that floats a little above the terrain.

Definition at line 521 of file W3DRoadBuffer.cpp.

◆ loadH()

void W3DRoadBuffer::loadH ( RoadSegment * pRoad,
Vector2 loc1,
Vector2 loc2,
Bool flip,
Real scale )
protected

Fills the index and vertex buffers for drawing 1 h tee intersection.

Loads a h shaped tee into the vertex buffer for a road join.

Definition at line 474 of file W3DRoadBuffer.cpp.

◆ loadLit4PtSection()

void W3DRoadBuffer::loadLit4PtSection ( RoadSegment * pRoad,
UnsignedShort * ib,
VertexFormatXYZDUV1 * vb,
RefRenderObjListIterator * pDynamicLightsIterator )
protected

Loads a section of road using a mesh that floats a little above the terrain. The road is loaded into the quadrilateral defined by the 4 corners points. loc specifies the point where u==uOffset && v==vOffset, and the road vector gives the direction of the road, and the road normal is perpendicular to the road normal.

Definition at line 789 of file W3DRoadBuffer.cpp.

◆ loadLitRoadsInVertexAndIndexBuffers()

void W3DRoadBuffer::loadLitRoadsInVertexAndIndexBuffers ( RefRenderObjListIterator * pDynamicLightsIterator)
protected

Fills the index and vertex buffers for drawing.

Loads the roads into the vertex buffer for drawing.

Definition at line 1316 of file W3DRoadBuffer.cpp.

◆ loadRoads()

void W3DRoadBuffer::loadRoads ( )

Loads the roads from the map objects list.

Loads the roads from the map objects.

Definition at line 3209 of file W3DRoadBuffer.cpp.

◆ loadRoadSegment()

void W3DRoadBuffer::loadRoadSegment ( UnsignedShort * ib,
VertexFormatXYZDUV1 * vb,
RoadSegment * pRoad )
protected

Fills the index and vertex buffers for drawing 1 segment.

Loads a road segment into the vertex buffer for drawing.

Definition at line 1358 of file W3DRoadBuffer.cpp.

◆ loadRoadsInVertexAndIndexBuffers()

void W3DRoadBuffer::loadRoadsInVertexAndIndexBuffers ( void )
protected

Fills the index and vertex buffers for drawing.

Loads the roads into the vertex buffer for drawing.

Definition at line 1227 of file W3DRoadBuffer.cpp.

◆ loadTee()

void W3DRoadBuffer::loadTee ( RoadSegment * pRoad,
Vector2 loc1,
Vector2 loc2,
Bool is4Way,
Real scale )
protected

Fills the index and vertex buffers for drawing 1 tee intersection.

Loads a tee into the vertex buffer for a road join.

Definition at line 366 of file W3DRoadBuffer.cpp.

◆ loadY()

void W3DRoadBuffer::loadY ( RoadSegment * pRoad,
Vector2 loc1,
Vector2 loc2,
Real scale )
protected

Fills the index and vertex buffers for drawing 1 Y intersection.

Loads a Y into the vertex buffer for a road join.

Definition at line 435 of file W3DRoadBuffer.cpp.

◆ miter()

void W3DRoadBuffer::miter ( Int ndx1,
Int ndx2 )
protected

Adjusts the end points to create a smooth miter join between road segments.

Definition at line 2845 of file W3DRoadBuffer.cpp.

◆ moveRoadSegTo()

void W3DRoadBuffer::moveRoadSegTo ( Int fromNdx,
Int toNdx )
protected

Moves a road segment.

Definition at line 1380 of file W3DRoadBuffer.cpp.

◆ offset3Way()

void W3DRoadBuffer::offset3Way ( TRoadPt * pc1,
TRoadPt * pc2,
TRoadPt * pc3,
Vector2 loc,
Vector2 upVector,
Vector2 teeVector,
Real widthInTexture )
protected

Offsets the points coming into a 3 way intersection so that they move to the join points of the 3 way intersection.

Definition at line 2184 of file W3DRoadBuffer.cpp.

◆ offset4Way()

void W3DRoadBuffer::offset4Way ( TRoadPt * pc1,
TRoadPt * pc2,
TRoadPt * pc3,
TRoadPt * pr3,
TRoadPt * pc4,
Vector2 loc,
Vector2 alignVector,
Real widthInTexture )
protected

Offsets the points coming into a 4 way intersection so that they move to the join points of the 4 way intersection.

Definition at line 2353 of file W3DRoadBuffer.cpp.

◆ offsetH()

void W3DRoadBuffer::offsetH ( TRoadPt * pc1,
TRoadPt * pc2,
TRoadPt * pc3,
Vector2 loc,
Vector2 upVector,
Vector2 teeVector,
Bool flip,
Bool mirror,
Real widthInTexture )
protected

Offsets the points coming into a 3 way intersection so that they move to the join points of the 3 way intersection.

Definition at line 2235 of file W3DRoadBuffer.cpp.

◆ offsetY()

void W3DRoadBuffer::offsetY ( TRoadPt * pc1,
TRoadPt * pc2,
TRoadPt * pc3,
Vector2 loc,
Vector2 upVector,
Real widthInTexture )
protected

Offsets the points coming into a 3 way intersection so that they move to the join points of the 3 way intersection.

Definition at line 2307 of file W3DRoadBuffer.cpp.

◆ preloadRoadSegment()

void W3DRoadBuffer::preloadRoadSegment ( RoadSegment * pRoad)
protected

Fills the index and vertex buffers for drawing 1 segment.

Loads a road segment into the vertex buffer for drawing.

Definition at line 1142 of file W3DRoadBuffer.cpp.

◆ preloadRoadsInVertexAndIndexBuffers()

void W3DRoadBuffer::preloadRoadsInVertexAndIndexBuffers ( void )
protected

Fills the index and vertex buffers for drawing.

Loads the roads into the vertex buffer for drawing.

Definition at line 1171 of file W3DRoadBuffer.cpp.

◆ rotateAbout()

void W3DRoadBuffer::rotateAbout ( Vector2 * ptP,
Vector2 center,
Real angle )
protected

Rotates ptP about center.

Definition at line 3049 of file W3DRoadBuffer.cpp.

◆ setMap()

void W3DRoadBuffer::setMap ( WorldHeightMap * pMap)

Sets the map pointer.

Sets the height map.

Definition at line 3199 of file W3DRoadBuffer.cpp.

◆ updateCenter()

void W3DRoadBuffer::updateCenter ( void )

Notifies that the camera moved.

Sets the flag to reload the vertex buffer.

Definition at line 3277 of file W3DRoadBuffer.cpp.

◆ updateCounts()

void W3DRoadBuffer::updateCounts ( RoadSegment * pRoad)
protected

Updates the count and last fields.

Definition at line 1688 of file W3DRoadBuffer.cpp.

◆ updateCountsAndFlags()

void W3DRoadBuffer::updateCountsAndFlags ( void )
protected

Updates the count and last fields.

Definition at line 1733 of file W3DRoadBuffer.cpp.

◆ updateLighting()

void W3DRoadBuffer::updateLighting ( void )

Updates the diffuse lighting in the buffers.

Draws the roads. Uses terrain bounds to cull.

Definition at line 3235 of file W3DRoadBuffer.cpp.

◆ visibilityChanged()

Bool W3DRoadBuffer::visibilityChanged ( const IRegion2D & bounds)
protected

Returns true if some roads are now visible that weren't, or vice versa.

Returns true if any road segment's visibility changed.

Definition at line 1273 of file W3DRoadBuffer.cpp.

Friends And Related Symbol Documentation

◆ BaseHeightMapRenderObjClass

friend class BaseHeightMapRenderObjClass
friend

Definition at line 197 of file W3DRoadBuffer.h.

Member Data Documentation

◆ m_curNumRoadIndices

Int W3DRoadBuffer::m_curNumRoadIndices
protected

Number of indices used in current road type;.

Definition at line 235 of file W3DRoadBuffer.h.

◆ m_curNumRoadVertices

Int W3DRoadBuffer::m_curNumRoadVertices
protected

Number of vertices used in current road type.

Definition at line 234 of file W3DRoadBuffer.h.

◆ m_curRoadType

Int W3DRoadBuffer::m_curRoadType
protected

Definition at line 224 of file W3DRoadBuffer.h.

◆ m_curUniqueID

Int W3DRoadBuffer::m_curUniqueID
protected

Road type we are rendering at this pass.

Definition at line 223 of file W3DRoadBuffer.h.

◆ m_initialized

Bool W3DRoadBuffer::m_initialized
protected

True if the subsystem initialized.

Definition at line 220 of file W3DRoadBuffer.h.

◆ m_lightsIterator

RefRenderObjListIterator* W3DRoadBuffer::m_lightsIterator
protected

Lighting iterator.

Definition at line 222 of file W3DRoadBuffer.h.

◆ m_map

WorldHeightMap* W3DRoadBuffer::m_map
protected

Pointer to the height map data.

Definition at line 221 of file W3DRoadBuffer.h.

◆ m_maxRoadIndex

Int W3DRoadBuffer::m_maxRoadIndex
protected

Size of m_indexRoad.

Definition at line 232 of file W3DRoadBuffer.h.

◆ m_maxRoadSegments

Int W3DRoadBuffer::m_maxRoadSegments
protected

Size of m_roads.

Definition at line 230 of file W3DRoadBuffer.h.

◆ m_maxRoadTypes

Int W3DRoadBuffer::m_maxRoadTypes
protected

Size of m_roadTypes.

Definition at line 233 of file W3DRoadBuffer.h.

◆ m_maxRoadVertex

Int W3DRoadBuffer::m_maxRoadVertex
protected

Size of m_vertexRoad.

Definition at line 231 of file W3DRoadBuffer.h.

◆ m_numRoads

Int W3DRoadBuffer::m_numRoads
protected

Number of roads used in m_roads.

Definition at line 219 of file W3DRoadBuffer.h.

◆ m_roads

RoadSegment* W3DRoadBuffer::m_roads
protected

The road buffer. All roads are stored here.

Definition at line 218 of file W3DRoadBuffer.h.

◆ m_roadTypes

RoadType* W3DRoadBuffer::m_roadTypes
protected

Roads texture.

Definition at line 217 of file W3DRoadBuffer.h.

◆ m_updateBuffers

Bool W3DRoadBuffer::m_updateBuffers
protected

If true, update the vertex buffers.

Definition at line 237 of file W3DRoadBuffer.h.


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