This page has been translated automatically.
编程
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
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::WorldExpression Class

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

This class is used to create a world expression, that executes an arbitrary expression. An expression can be executed for the other nodes if they are assigned as child nodes of WorldExpression. The child nodes will inherit transformations (if any) of the world expression and will be transformed relative to the pivot point of WorldExpression.

WorldExpression Class

Members


static WorldExpressionPtr create(const Math::vec3 & size)

Constructor. Creates an arbitrary expression to be executed.
Notice
An expression is executed only when its bounding box is in the viewing frustum or when the camera is positioned within this bounding box, so the size is important.

Arguments

  • const Math::vec3 & size - Size of the bounding box. This is an optional argument.

Ptr<WorldExpression> cast(const Ptr<Node> & node)

Casts a WorldExpression out of the Node instance.

Arguments

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

Return value

Pointer to WorldExpression.

int isCompiled()

Returns a value indicating if the given expression has been compiled. It is automatically called on world load or after setExpression()is used.

Return value

1 if the expression has been compiled; otherwise, 0.

void setDistance(float distance)

Sets the distance at which the expression is not executed.

Arguments

  • float distance - The distance value. If a negative value is specified, 0 will be used instead.

float getDistance()

Returns the distance at which the expression is not executed.

Return value

The distance value.

int setExpression(const char * src)

Sets the arbitrary expression to be executed.
Notice
The expression passed as an argument must be wrapped with curly braces {} as they define the world expression scope.

Arguments

  • const char * src - An executable expression.

Return value

The expression number.

const char * getExpression()

Returns the executable expression.

Return value

The executable expression.

int isFunction(const char * name, int num_args)

Returns a value indicating if the given world expression has the function with specified name and number of arguments.

Arguments

  • const char * name - The name of the function.
  • int num_args - The number of arguments.

Return value

1 if the expression exists; otherwise, 0.

void setIFps(float ifps)

Sets a constant frame duration used to execute the expression. It can be used to decrease the frame rate to get higher performance. 0 means that the expression is executed at the same frame rate as the main application window.

Arguments

  • float ifps - Frame duration (inverse FPS) in seconds (1/FPS). If a too small value is provided, 1E-6 will be used instead.

float getIFps()

Returns the current constant frame duration used to execute the expression. 0 means that the expression is executed at the same frame rate as the main application window.

Return value

Frame duration (inverse FPS) in seconds (1/FPS).

void setOffset(const Math::vec3 & offset)

Sets an offset of the center of the world expression's bounding box along the X, Y and Z axes.

Arguments

  • const Math::vec3 & offset - An offset of the expression box center.

Math::vec3 getOffset()

Returns the offset of the center of the world expression's bounding box along the X, Y and Z axes.

Return value

The offset of the expression box center.

void setSize(const Math::vec3 & size)

Sets the size of the WorldExpression bounding box. The size of the bounding box is important as if the bounding box gets outside the viewing frustum, the expression is not executed.
Notice
If the child object transformed according to the expression gets outside the view frustum, but the bounding box is still in the viewing frustum, the playback of the transformation sequence will not stop.

Arguments

  • const Math::vec3 & size - Size of the bounding box in units.

Math::vec3 getSize()

Returns the current size of the WorldExpression bounding box. The size of the bounding box is important as if the bounding box gets outside the viewing frustum, the expression is not executed.
Notice
If the child object transformed according to the expression gets outside the view frustum, but the bounding box is still in the viewing frustum, the playback of the transformation sequence will not stop.

Return value

Size of the bounding box in units.

int type()

Last update: 2017-07-03
Build: ()