Unigine::SplineSegment Class
Header: | #include <UnigineWorlds.h> |
This class is used to manage individual segments of the world spline graph.
SplineSegment Class
Members
void setStartPoint( const Ptr<SplinePoint> & point )
Sets the specified spline point as a start point of the segment.Arguments
- const Ptr<SplinePoint> & point - Spline point to be set as a start point of the segment.
Ptr<SplinePoint> getStartPoint( )
Returns the current start point of the segment.Return value
Start point of the segment.void setEndPoint( const Ptr<SplinePoint> & point )
Sets the specified spline point as an end point of the segment.Arguments
- const Ptr<SplinePoint> & point - Spline point to be set as an end point of the segment.
Ptr<SplinePoint> getEndPoint( )
Returns the current end point of the segment.Return value
End point of the segment.void setStartTangent( const Math::vec3 & tangent )
Sets the tangent coordinates for the start point of the spline segment.Arguments
- const Math::vec3 & tangent - Start point tangent coordinates to be set.
Math::vec3 getStartTangent( )
Returns the current tangent coordinates for the start point of the spline segment.Return value
Start point tangent coordinates.void setStartUp( const Math::vec3 & up )
Sets the "up" vector coordinates for the start point of the segment.Arguments
- const Math::vec3 & up - Start point "up" vector coordinates to be set.
Math::vec3 getStartUp( )
Returns the current "up" vector coordinates for the start point of the spline segment.Return value
Start point "up" vector coordinates.void setEndTangent( const Math::vec3 & tangent )
Sets the tangent coordinates for the end point of the spline segment.Arguments
- const Math::vec3 & tangent - End point tangent coordinates to be set.
Math::vec3 getEndTangent( )
Returns the current tangent coordinates for the end point of the spline segment.Return value
End point tangent coordinates.void setEndUp( const Math::vec3 & up )
Sets the "up" vector coordinates for the end point of the segment.Arguments
- const Math::vec3 & up - End point "up" vector coordinates.
Math::vec3 getEndUp( )
Returns the current "up" vector coordinates for the end point of the spline segment.Return value
End point "up" vector coordinates to be set.void setEnabled( int enable, int with_points = 1 )
Sets a value indicating whether the spline segment is enabled.Arguments
- int enable - 1 to enable the spline segment, 0 to disable.
- int with_points - Use 1 to enable all points that belong to it as well, 0 to enable the spline point only.
int isEnabled( )
Returns a value indicating whether the spline segment is enabled.Return value
1 if the spline segment is enabled; otherwise, 0.Math::Vec3 calcPoint( float t )
Returns the coordinates of the point at the specified position on the segment.Arguments
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Coordinates of the point.Math::vec3 calcTangent( float t )
Returns the tangent coordinates for the point at the specified position on the segment.Arguments
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Tangent coordinates for the point at the specified position on the segment.Math::vec3 calcUpVector( float t )
Returns the "up" vector coordinates for the point at the specified position on the segment.Arguments
- float t - Position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Coordinates of the "up" vector for the point at the specified position on the segment.float parametricToLinear( float t )
Performs conversion of parametric position to linear position in accordance with the spline segment's length.Arguments
- float t - Parametric position of the point on the segment, in increments of the segment's length normalized to 1.
Return value
Linear position on the spline segment in the range [0.0f, 1.0f].float linearToParametric( float l )
Performs conversion of linear position in accordance with the spline segment's length to parametric position.Arguments
- float l - Linear position on the spline segment in the range [0.0f, 1.0f].
Return value
Parametric position of the point on the segment, in increments of the segment's length normalized to 1.float getLength( )
Returns the length of the spline segment.Return value
Length of the spline segment, in units.void clearSources( )
Clears the list of source nodes for the spline segment.void assignSource( const char * name, int forward_axis = 0 )
Assigns a source node with the given name to the spline segment and sets the specified forward axis for it.Arguments
- const char * name - Source node name.
- int forward_axis - Forward axis to be set for the source node. One of the FORWARD_ variables. The X axis is used by default.
void removeSource( const char * name, int forward_axis = FORWARD_Y )
Removes the source node with the given name.Arguments
- const char * name - Name of the source node to be removed.
- int forward_axis - Forward axis for the source node. One of the FORWARD_ variables. The Y axis is used by default.
void getSources( Vector< String > & sources )
Returns a list of source nodes assigned to the spline segment and puts it to the specified vector.Arguments
- Vector< String > & sources - List of source nodes assigned to the spline segment.
void setSegmentMode( const char * name, int segment_mode = SEGMENT_STRETCH )
Sets the segment mode for the source node with the given name.Arguments
- const char * name - Source node name.
- int segment_mode - Mode for the source node with the given name. One of the SEGMENT_* variables. SEGMENT_STRETCH is used by default.
int getSegmentMode( const char * name )
Returns the current segment mode for the source node with the given name.Arguments
- const char * name - Source node name.
Return value
Mode for the source node with the given name. One of the SEGMENT_* variables. SEGMENT_STRETCH is used by default.void setUVTiling( const char * name, int enable_uv_tiling = 0 )
Sets a value indicating whether UV tiling for the material textures of the source node with the given name is enabled.Arguments
- const char * name - Source node name.
- int enable_uv_tiling - 1 to enable UV tiling for the material textures of the source node, 0 - to stretch textures. The default value is 0.
int getUVTiling( const char * name )
Returns a value indicating whether UV tiling for the material textures of the source node with the given name is enabled.Arguments
- const char * name - Source node name.
Return value
1 if UV tiling for the material textures of the source node is enabled; otherwise (textures are stretched), 0.void setDeltaAngleThreshold( const char * name, float delta_angle_threshold = 1.0f )
Sets the angle threshold value for splitting source node with the given name. If an angle between the tangents for the two subsequent parts of the spline segment exceeds this value, the node will be split.This parameter is used only for the SEGMENT_ADAPTIVE mode.
Arguments
- const char * name - Source node name.
- float delta_angle_threshold - Angle threshold value for the source node with the given name, in degrees. The default value is 1.0f.
float getDeltaAngleThreshold( const char * name )
Returns the current angle threshold value for splitting source node with the given name. If an angle between the tangents for the two subsequent parts of the spline segment exceeds this value, the node will be split.This parameter is used only for the SEGMENT_ADAPTIVE mode.
Arguments
- const char * name - Source node name.
Return value
Angle threshold value for the source node with the given name, in degrees. The default value is 1.0f.void setGap( const char * name, float gap = 0.0f )
Sets the size of the gap between the adjacent copies of the source node with the given name tiled along the spline segment.This parameter is used only for the SEGMENT_TILING mode.
Arguments
- const char * name - Source node name.
- float gap - Gap size to be set, in units.
float getGap( const char * name )
Returns the current size of the gap between the adjacent copies of the source node with the given name tiled along the spline segment.This parameter is used only for the SEGMENT_TILING mode.
Arguments
- const char * name - Source node name.
Return value
Current gap size, in units.void copy( const Ptr<SplineSegment> & src, int copy_endpoints_data = 1 )
Copies all parameters from the specified source spline segment.Arguments
- const Ptr<SplineSegment> & src - Source spline segment.
- int copy_endpoints_data - Use 1 to copy all parameters of segment's endpoints as well, 0 to use default ones. The default value is 0.
Ptr<SplineSegment> clone( int clone_points = 0 )
Returns a clone of the spline segment.Arguments
- int clone_points - Use 1 to copy all parameters of segment's endpoints as well, 0 to use default ones. The default value is 0.
Return value
Clone of the spline segment.Ptr<WorldSplineGraph> getParent( )
Returns the WorldSplineGraph node to which the spline segment belongs.Return value
WorldSplineGraph node to which the spline segment belongs.int getNumSources( )
Returns the total number of source nodes assigned to this spline segment.Return value
Total number of source nodes assigned to this spline segment.int getForwardAxis( const char * name )
Returns the forward axis used for the source node with the specified name.Arguments
- const char * name - Source node name.
Return value
Forward axis for the source node. One of the FORWARD_ variables.Last update:
2020-01-14
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)