Trax3 3.1.0
trax track library
Loading...
Searching...
No Matches
trax::TrackPainter Class Referenceabstract

Base class for painting tracks as a series of short straight pieces. More...

#include <C:/Trend/Development/Trax3/Code/trax/TrackPainter.h>

Inheritance diagram for trax::TrackPainter:

Public Types

enum  Mode {
  mode_none = 0x00 , mode_leftHandedFaces = 0x01 , mode_constantSegmentLength = 0x02 , mode_SegmentLength = 0x04 ,
  mode_checkedSegmentLength = 0x04 , mode_totallycheckedSegmentLength = 0x08 , mode_ignoreCuvesTorsion = 0x10 , mode_localFrame = 0x20 ,
  mode_startFrame = 0x40 , mode_default = mode_none
}

Public Member Functions

TrackPainter & operator= (const TrackPainter &)=default
TrackPainter & operator= (TrackPainter &&)=default
TrackPainter & operator() (const SectionTrack &track)
int GetMode () const noexcept
int GetCountSegments () const noexcept
Construction

Creates the track painter.

To make for a constant segment length, have segmentLimits.Near() == segmentLimits.Far(), this will save some computations, but will probabably not give the most efficent mesh to render.

Parameters
segmentLimitsThe minimum and maximum segment length to deliver. The last segment returned might be shorter, to go to the track's end.
eDistance failure that is assumed not to matter visibly.
Exceptions
std::invalid_argument
See also
Segment, Segment_Checked
dclspc TrackPainter (int mode, common::Interval< Length > segmentLimits={epsilon__length, plausible_maximum_length}, Length e=epsilon__length)
dclspc TrackPainter (const TrackPainter &)=default
dclspc TrackPainter (TrackPainter &&)=default
dclspc Length Paint (const TrackBuilder &track, const Section &section, Length offset=0_m)
 Paints the track.

Protected Member Functions

virtual void StartPaint (const spat::Frame< Length, One > &, Length, const Section &)
 Gets called once on rendering startup before all PaintSegment() calls.
virtual void PaintSegment (const spat::Frame< Length, One > &rFrame, Length segmentLength, const Section &)=0
 This gets called once per segment to paint a segment of the track.
virtual void EndPaint (const spat::Frame< Length, One > &)
 Gets called once on rendering end after all PaintSegment() calls.

Detailed Description

Base class for painting tracks as a series of short straight pieces.

Member Enumeration Documentation

◆ Mode

Enumerator
mode_leftHandedFaces 

Produces triangles according to the left hand rule. Default it is the right hand rule.

mode_constantSegmentLength 

Uses segmentLimits.Far() as segment length.

mode_SegmentLength 

Checks each segment at its starting point. The default.

mode_checkedSegmentLength 

Checks the end point of the segment, shrinks if necessary. Use it if the curvature changes much inside the segmentLimits.Far() distance.

mode_totallycheckedSegmentLength 

Checks every point of the segment with respect to the segmentLimits.Near() grid. Use it if sudden curves might occure inside the segmentLimits.Far() distance.

mode_ignoreCuvesTorsion 

Ignores the curves torsion (but not the track's twist) for segment calculations.

mode_localFrame 

Paints the track in it's local frame of reference. To get global coordinates, the tracks's transformations have to be applied to the geometric data.

mode_startFrame 

Paints the track around it's start frame. The first segment will start at {0,0,0} with it's tangent heading towards {1,0,0}.

Member Function Documentation

◆ GetCountSegments()

int trax::TrackPainter::GetCountSegments ( ) const
inlinenoexcept
Returns
The number of segments from the track last painted.

◆ GetMode()

int trax::TrackPainter::GetMode ( ) const
inlinenoexcept
Returns
The mode setting adjusted on constructor call.

◆ Paint()

dclspc Length trax::TrackPainter::Paint ( const TrackBuilder & track,
const Section & section,
Length offset = 0_m )

Paints the track.

For reaching the track's end, the last segment might be shorter than what would serve the limits given.

Parameters
trackThe track to paint.
sectionThe section to be used for painting.
offsetIf connected tracks are painted, it can be usefull to supply the return value of a connected track's painting call here. This can be used to adjust texture coordinates for example.
Returns
track.GetLength() + offset

◆ PaintSegment()

virtual void trax::TrackPainter::PaintSegment ( const spat::Frame< Length, One > & rFrame,
Length segmentLength,
const Section &  )
protectedpure virtual

This gets called once per segment to paint a segment of the track.

Parameters
rFramePosition and orientation at the end of the segment to paint.
segmentLengthLength of the segment. This value migh vary from call to call.

Implemented in trax::SectionPainter.

◆ StartPaint()


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