This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

SplineGraph Class

This class is used to create spline graphs. Spline graphs are used for procedural generation of rivers, roads, pipelines etc.

SplineGraph Class

Members


static SplineGraph()

Default constructor. Creates an empty spline graph.

static SplineGraph(string name)

Constructor. Creates an empty spline graph with a given name.

Arguments

  • string name - Spline graph name.

float getLength(int index)

Retuns the length of the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Segment length.

int getNumPoints()

Returns the total number of points in the spline graph.

Return value

Number of points.

int getNumSegments()

Returns the total number of segments in the spline graph.

Return value

Number of segments.

void setPoint(int index, vec3 point)

Sets new coordinates for the point with a given index.

Arguments

  • int index - Point index.
  • vec3 point - New point coordinates.

vec3 getPoint(int index)

Returns the coordinates of the point with a given index.

Arguments

  • int index - Point index.

Return value

Point coordinates.

vec3 getSegmentEndPoint(int index)

Returns the coordinates of the end point for the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Segment end point coordinates.

int getSegmentEndPointIndex(int index)

Returns the index of the end point for the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Segment end point index.

void setSegmentEndTangent(int index, vec3 tangent)

Sets the tangent coordinates for the end point of the segment with a given index.

Arguments

  • int index - Segment index.
  • vec3 tangent - End point tangent coordinates.

vec3 getSegmentEndTangent(int index)

Returns the tangent coordinates for the end point of the segment with a given index.

Arguments

  • int index - Segment index.

Return value

End point tangent coordinates.

void setSegmentEndUpVector(int index, vec3 up)

Sets the up-vector coordinates for the end point of the segment with a given index.

Arguments

  • int index - Segment index.
  • vec3 up - End point up-vector coordinates.

vec3 getSegmentEndUpVector(int index)

Returns the up-vector coordinates for the end point of the segment with a given index.

Arguments

  • int index - Segment index.

Return value

End point up-vector coordinates.

vec3 getSegmentStartPoint(int index)

Returns the coordinates of the start point for the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Segment start point coordinates.

int getSegmentStartPointIndex(int index)

Returns the index of the end point for the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Segment start point index.

void setSegmentStartTangent(int index, vec3 tangent)

Sets the tangent coordinates for the start point of the segment with a given index.

Arguments

  • int index - Segment index.
  • vec3 tangent - Start point tangent coordinates.

vec3 getSegmentStartTangent(int index)

Returns the tangent coordinates for the start point of the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Start point tangent coordinates.

void setSegmentStartUpVector(int index, vec3 up)

Sets the up-vector coordinates for the start point of the segment with a given index.

Arguments

  • int index - Segment index.
  • vec3 up - Start point up-vector coordinates.

vec3 getSegmentStartUpVector(int index)

Returns the up-vector coordinates for the start point of the segment with a given index.

Arguments

  • int index - Segment index.

Return value

Start point up-vector coordinates.

int addPoint(vec3 point)

Adds a point with specified coordinates to the spline graph.

Arguments

  • vec3 point - Point coordinates.

Return value

Current number of points in the spline graph.

int addSegment(int start_index, vec3 start_tangent, vec3 start_up, int end_index, vec3 end_tangent, vec3 end_up)

Adds a segment to the spline graph.

Arguments

  • int start_index - Start point index.
  • vec3 start_tangent - Start point tangent coordinates.
  • vec3 start_up - Start point up-vector coordinates.
  • int end_index - End point index.
  • vec3 end_tangent - End point tangent coordinates.
  • vec3 end_up - End point up-vector coordinates.

Return value

Number of segments in the spline graph if a segment was addes successfully; otherwise, -1

vec3 calcSegmentPoint(int index, float t)

Returns the coordinates of the point on the given segment.

Arguments

  • int index - Segment index.
  • 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 on the given segment.

vec3 calcSegmentTangent(int index, float t)

Returns the tangent coordinates for the point on the given segment.

Arguments

  • int index - Segment index.
  • 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 on the given segment.

vec3 calcSegmentUpVector(int index, float t)

Returns the up-vector coordinates for the point on the given segment.

Arguments

  • int index - Segment index.
  • float t - Position of the point on the segment, in increments of the segment's length normalized to 1.

Return value

Up-vector coordinates for the point on the given segment.

void clear()

Clears the spline graph.

int load(string name)

Loads the spline graph from the specified XML-file.

Arguments

  • string name - Name of the XML-file to load the spline graph from.

Return value

1 if the spline graph was successfully loaded; otherwise, 0.

void removePoint(int index)

Removes a point with a given index from the spline graph.
Notice
The segments having this point as a starting or ending one will also be removed from the spline graph.

Arguments

  • int index - Point index.

void removeSegment(int index)

Removes the segment with a given index.

Arguments

  • int index - Segment index.

int save(string name)

Saves the spline graph to the specified XML-file.

Arguments

  • string name - Name of the XML-file to save the spline graph to.

Return value

1 if the spline graph was successfully saved; otherwise, 0.
Last update: 2017-07-03
Build: ()