This page has been translated automatically.
Программирование
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
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Unigine::WorldSplineGraph Class

Header:#include <UnigineWorlds.h>
Inherits:Node

This class is used to place prefab nodes along a spline graph.

A world spline graph consists of segments and has a list of prefab nodes (currently ObjectMeshStatic only) that can be stretched or tiled along the segments.

WorldSplineGraph has the following features:

  • Vertices and segments of the spline graph are managed via the SplineGraph class.
  • 2 modes are supported:
    • stretching: prefab nodes are stretched along the spline segment.
    • tiling: prefab nodes are duplicated along the spline segment.
  • Forward axis selection for stretching/tiling prefab nodes.

WorldSplineGraph Class

Members


static WorldSplineGraphPtr create()

Default constructor. Creates an empty world spline graph.

static WorldSplineGraphPtr create(const char * name)

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

Arguments

  • const char * name - World spline graph name.

static Ptr<WorldSplineGraph> cast(const Ptr<Node> & node)

Casts a WorldSplineGraph out of the Node instance.

Arguments

  • const Ptr<Node> & node - Pointer to Node.

Return value

Pointer to WorldSplineGraph.

int isCurved()

Returns a value indicating if the world spline graph is curved.

Return value

1 if the world spline graph is curved; otherwise, 0.

void makeCurved()

Curves the world spline graph using its geodetic pivot. The spline file is saved upon completion of the curving operation.
Notice
The world spline graph must be a child of a Geodetic Pivot node.

void makeFlat()

Flattens the world spline graph using its geodetic pivot. The spline file is saved upon completion of the flattening operation.
Notice
The world spline graph must be a child of a Geodetic Pivot node.

void setMaxVisibleDistance(float distance)

Updates the maximum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes invisible.

Arguments

  • float distance - Distance, in units. The default value is inf.

float getMaxVisibleDistance()

Returns the maximum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes invisible.

Return value

Distance, in units.

void setMinVisibleDistance(float distance)

Updates the minimum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes visible.

Arguments

  • float distance - Distance, in units. The default value is -inf.

float getMinVisibleDistance()

Returns the minimum visibility distance of the world spline graph. It is the distance, starting from which the world spline graph becomes visible.

Return value

Distance, in units.

int getNumPoints()

Returns the total number of points in the world spline graph.

Return value

Number of points.

int getNumPrefabNodes()

Returns the total number of prefab nodes in the list.

Return value

Number of prefab nodes.

int getNumSegments()

Returns the total number of segments in the world spline graph.

Return value

Number of segments.

void setPoint(int index, const Math::vec3 & point)

Sets the coordinates of the point with a given index.

Arguments

  • int index - Point index.
  • const Math::vec3 & point - Point coordinates.

Math::vec3 getPoint(int index)

Returns the coordinates of the point with a given index.

Arguments

  • int index - Point index.

Return value

Point coordinates.

int setPrefabForwardAxis(int num, int forward_axis)

Sets the forward axis for a given prefab node.

Arguments

  • int num - Prefab node index.
  • int forward_axis - Forward axis. One of the FORWARD_* variables.

Return value

1 if the forward axis for the prefab node was set successfully; otherwise, 0.

int getPrefabForwardAxis(int num)

Returns the forward axis for a given prefab node.

Arguments

  • int num - Prefab node index.

Return value

Forward axis. One of the FORWARD_* variables.

const char * getPrefabNodeName(int num)

Returns the name of the prefab node with a given index.

Arguments

  • int num - Prefab node index.

Return value

Prefab node name.

int getSegmentMode(int segment_index)

Returns the current mode for the secment with a given index.

Arguments

  • int segment_index - Segment index.

Return value

Mode. One of the SEGMENT_* variables.

void getSegmentNodes(Vector< Ptr<Node> > & nodes)

Retrieves the list of nodes assigned to all segments of the world spline graph and puts it to the buffer.

Arguments

  • Vector< Ptr<Node> > & nodes - Buffer to store the nodes assigned to the segments of the world spline graph.

int getSegmentPrefabIndex(int segment_index)

Returns the index of the prefab node currently assigned to the segment with a given index.

Arguments

  • int segment_index - Segment index.

Return value

Prefab node index or -1 if no prefab node is assigned to the segment with a given index.

int getSegmentStartPointIndex(int index)

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

Arguments

  • int index - Segment index.

Return value

Segment start point index.

int getSegmentEndPointIndex(int index)

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

Arguments

  • int index - Segment index.

Return value

Segment end point index.

Math::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.

Math::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.

Math::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.

Math::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.

Math::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.

Math::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.

Math::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.

Math::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.

Math::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 setSplineGraph(const Ptr<SplineGraph> & splinegraph)

Sets the specified source spline graph as the current one.

Arguments

void getSplineGraph(const Ptr<SplineGraph> & splinegraph)

Copies current spline graph to the destination spline graph.

Arguments

  • const Ptr<SplineGraph> & splinegraph - Destination spline graph.

void setSplineGraphName(const char * name, int force_load = 0)

Sets the name of the world spline graph.

Arguments

  • const char * name - World spline graph name.
  • int force_load - Force flag.
    • If 1 is specified, the world spline graph will immediately loaded from a file.
    • If 0 is specified, only the world spline graph name will be updated.

const char * getSplineGraphName()

Returns the name of the world spline graph.

Return value

World spline graph name.

int addPrefabNode(const char * name, int forward_axis = 0)

Adds a prefab node to the list.

Arguments

  • const char * name - Prefab node name.
  • int forward_axis - Forward axis. One of the FORWARD_* variables. The default value is FORWARD_X.

Return value

1 if the prefab node was added successfully; otherwise, 0.

int assignSegmentPrefab(int segment_index, int prefab_num, int mode = 0)

Assigns the specified prefab node to the given segment of the spline graph.

Arguments

  • int segment_index - Segment index.
  • int prefab_num - Prefab node index.
  • int mode - Mode. One of the SEGMENT_* variables.

Return value

1 if the prefab node was successfully assigned to the segment; otherwise, 0.

void clear()

Clears the world spline graph.

void clearSegmentPrefab(int segment_index = -1)

Removes the assigned prefab node from the segment with a given index.

Arguments

  • int segment_index - Segment index. If no segment index is specified, the method removes assigned prefab nodes from all segments.

int load(const char * name)

Loads a spline graph from the specified XML-file.

Arguments

  • const char * 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 removePrefabNode(int num)

Removes the prefab with a given index from the list. This method also removes all nodes of all segments linked to this prefab node and performs correction of prefab node indices for all segments.

Arguments

  • int num - Prefab node index.

static int type()

Returns the type of the node.

Return value

WorldSplineGraph type identifier.

int FORWARD_X

Description

X is a forward axis for stretching.

int FORWARD_Y

Description

Y is a forward axis for stretching.

int FORWARD_Z

Description

Z is a forward axis for stretching.

int SEGMENT_STRETCH

Description

The prefab node is stretched along the segment.

int SEGMENT_TILING

Description

The prefab node is duplicated along the segment.
Last update: 03.07.2017
Build: ()