Pyrogenesis trunk
Functions
SimRender Namespace Reference

Functions

void ConstructLineOnGround (const CSimContext &context, const std::vector< float > &xz, SOverlayLine &overlay, bool floating, float heightOffset=0.25f)
 Constructs overlay line from given points, conforming to terrain. More...
 
void ConstructCircleOnGround (const CSimContext &context, float x, float z, float radius, SOverlayLine &overlay, bool floating, float heightOffset=0.25f)
 Constructs overlay line as a circle with given center and radius, conforming to terrain. More...
 
void ConstructClosedArcOnGround (const CSimContext &context, float x, float z, float radius, float start, float end, SOverlayLine &overlay, bool floating, float heightOffset=0.25f)
 Constructs overlay line as an outlined circle sector (an arc with straight lines between the endpoints and the circle's center), conforming to terrain. More...
 
void ConstructSquareOnGround (const CSimContext &context, float x, float z, float w, float h, float a, SOverlayLine &overlay, bool floating, float heightOffset=0.25f)
 Constructs overlay line as rectangle with given center and dimensions, conforming to terrain. More...
 
void ConstructBoxOutline (const CBoundingBoxOriented &box, SOverlayLine &overlayLine)
 Constructs a solid outline of an arbitrarily-aligned bounding box. More...
 
void ConstructBoxOutline (const CBoundingBoxAligned &box, SOverlayLine &overlayLine)
 Constructs a solid outline of an axis-aligned bounding box. More...
 
void ConstructGimbal (const CVector3D &center, float radius, SOverlayLine &out, size_t numSteps=16)
 Constructs a simple gimbal outline with the given radius and center. More...
 
void ConstructAxesMarker (const CMatrix3D &coordSystem, SOverlayLine &outX, SOverlayLine &outY, SOverlayLine &outZ)
 Constructs 3D axis marker overlay lines for the given coordinate system. More...
 
void SmoothPointsAverage (std::vector< CVector2D > &points, bool closed)
 Updates the given points so each point is averaged with its neighbours, resulting in a somewhat smoother curve, assuming the points are roughly equally spaced. More...
 
void InterpolatePointsRNS (std::vector< CVector2D > &points, bool closed, float offset, int segmentSamples=4)
 Updates the given points to include intermediate points interpolating between the original control points, using a rounded nonuniform spline. More...
 
void ConstructDashedLine (const std::vector< CVector2D > &linePoints, SDashedLine &dashedLineOut, const float dashLength, const float blankLength)
 Creates a dashed line from the given line, dash length, and blank space between. More...
 
void SubdividePoints (std::vector< CVector2D > &points, float maxSegmentLength, bool closed)
 Subdivides a list of points into segments of maximum length maxSegmentLength that are of equal size between every two control points. More...
 
void ConstructTexturedLineBox (SOverlayTexturedLine &overlay, const CVector2D &origin, const CFixedVector3D &rotation, const float sizeX, const float sizeZ)
 Sets the coordinates of a rectangular textured overlay, for example used by selection rings of structures. More...
 
void ConstructTexturedLineCircle (SOverlayTexturedLine &overlay, const CVector2D &origin, const float overlay_radius)
 Sets the coordinates of a circular textured overlay, for example by selection rings of units or attack range visualization. More...
 

Function Documentation

◆ ConstructAxesMarker()

void SimRender::ConstructAxesMarker ( const CMatrix3D coordSystem,
SOverlayLine outX,
SOverlayLine outY,
SOverlayLine outZ 
)

Constructs 3D axis marker overlay lines for the given coordinate system.

The XYZ axes are colored RGB, respectively.

Parameters
[in]coordSystemSpecifies the coordinate system.
[out]outX,outY,outZConstructed overlay lines for each axes.

◆ ConstructBoxOutline() [1/2]

void SimRender::ConstructBoxOutline ( const CBoundingBoxAligned box,
SOverlayLine overlayLine 
)

Constructs a solid outline of an axis-aligned bounding box.

Parameters
[in]bound
[in,out]overlayLineUpdated overlay line representing the AABB.

◆ ConstructBoxOutline() [2/2]

void SimRender::ConstructBoxOutline ( const CBoundingBoxOriented box,
SOverlayLine overlayLine 
)

Constructs a solid outline of an arbitrarily-aligned bounding box.

Parameters
[in]box
[in,out]overlayLineUpdated overlay line representing the oriented box.

◆ ConstructCircleOnGround()

void SimRender::ConstructCircleOnGround ( const CSimContext context,
float  x,
float  z,
float  radius,
SOverlayLine overlay,
bool  floating,
float  heightOffset = 0.25f 
)

Constructs overlay line as a circle with given center and radius, conforming to terrain.

Parameters
[in]x,zCoordinates of center of circle.
[in]radiusRadius of circle to construct.
[in,out]overlayUpdated overlay line representing this circle.
[in]floatingIf true, the circle conforms to water as well.
[in]heightOffsetHeight above terrain to offset the circle.
heightOffsetThe vertical offset to apply to points, to raise the line off the terrain a bit.

◆ ConstructClosedArcOnGround()

void SimRender::ConstructClosedArcOnGround ( const CSimContext context,
float  x,
float  z,
float  radius,
float  start,
float  end,
SOverlayLine overlay,
bool  floating,
float  heightOffset = 0.25f 
)

Constructs overlay line as an outlined circle sector (an arc with straight lines between the endpoints and the circle's center), conforming to terrain.

◆ ConstructDashedLine()

void SimRender::ConstructDashedLine ( const std::vector< CVector2D > &  linePoints,
SDashedLine dashedLineOut,
const float  dashLength,
const float  blankLength 
)

Creates a dashed line from the given line, dash length, and blank space between.

Parameters
[in]linePointsList of points specifying the input line.
[out]dashedLineOutThe dashed line returned as a list of smaller lines
[in]dashLengthLength of a single dash. Must be strictly positive.
[in]blankLengthLength of a single blank between dashes. Must be strictly positive.

◆ ConstructGimbal()

void SimRender::ConstructGimbal ( const CVector3D center,
float  radius,
SOverlayLine out,
size_t  numSteps = 16 
)

Constructs a simple gimbal outline with the given radius and center.

Parameters
[in]center
[in]radius
[in,out]outUpdated overlay line representing the gimbal.
[in]numStepsThe amount of steps to trace a circle's complete outline. Must be a (strictly) positive multiple of four. For small radii, you can get away with small values; setting this to 4 will create a diamond shape.

◆ ConstructLineOnGround()

void SimRender::ConstructLineOnGround ( const CSimContext context,
const std::vector< float > &  xz,
SOverlayLine overlay,
bool  floating,
float  heightOffset = 0.25f 
)

Constructs overlay line from given points, conforming to terrain.

Parameters
[in]xzList of x,z coordinate pairs representing the line.
[in,out]overlayUpdated overlay line now conforming to terrain.
[in]floatingIf true, the line conforms to water as well.
[in]heightOffsetHeight above terrain to offset the line.

◆ ConstructSquareOnGround()

void SimRender::ConstructSquareOnGround ( const CSimContext context,
float  x,
float  z,
float  w,
float  h,
float  a,
SOverlayLine overlay,
bool  floating,
float  heightOffset = 0.25f 
)

Constructs overlay line as rectangle with given center and dimensions, conforming to terrain.

Parameters
[in]x,zCoordinates of center of rectangle.
[in]w,hWidth/height dimensions of the rectangle.
[in]aClockwise angle to orient the rectangle.
[in,out]overlayUpdated overlay line representing this rectangle.
[in]floatingIf true, the rectangle conforms to water as well.
[in]heightOffsetHeight above terrain to offset the rectangle.

◆ ConstructTexturedLineBox()

void SimRender::ConstructTexturedLineBox ( SOverlayTexturedLine overlay,
const CVector2D origin,
const CFixedVector3D rotation,
const float  sizeX,
const float  sizeZ 
)

Sets the coordinates of a rectangular textured overlay, for example used by selection rings of structures.

◆ ConstructTexturedLineCircle()

void SimRender::ConstructTexturedLineCircle ( SOverlayTexturedLine overlay,
const CVector2D origin,
const float  overlay_radius 
)

Sets the coordinates of a circular textured overlay, for example by selection rings of units or attack range visualization.

◆ InterpolatePointsRNS()

void SimRender::InterpolatePointsRNS ( std::vector< CVector2D > &  points,
bool  closed,
float  offset,
int  segmentSamples = 4 
)

Updates the given points to include intermediate points interpolating between the original control points, using a rounded nonuniform spline.

Parameters
[in,out]pointsList of points to interpolate.
[in]closedif true, then the points are treated as a closed path (the last is connected to the first).
[in]offsetThe points are shifted by this distance in a direction 90 degrees clockwise from the direction of the curve.
[in]segmentSamplesAmount of intermediate points to sample between every two control points.

◆ SmoothPointsAverage()

void SimRender::SmoothPointsAverage ( std::vector< CVector2D > &  points,
bool  closed 
)

Updates the given points so each point is averaged with its neighbours, resulting in a somewhat smoother curve, assuming the points are roughly equally spaced.

Parameters
[in,out]pointsList of points to smooth.
[in]closedif true, then the points are treated as a closed path (the last is connected to the first).

◆ SubdividePoints()

void SimRender::SubdividePoints ( std::vector< CVector2D > &  points,
float  maxSegmentLength,
bool  closed 
)

Subdivides a list of points into segments of maximum length maxSegmentLength that are of equal size between every two control points.

The resulting subdivided list of points is written back to points.

Parameters
pointsThe list of intermediate points to subdivide.
maxSegmentLengthThe maximum length of a single segment after subdivision. Must be strictly positive.
closedShould the provided list of points be treated as a closed shape? If true, the resulting list of points will include extra subdivided points between the last and the first point.